Skip to content

Add TypeScript type definitions#298

Merged
danmactough merged 6 commits intomasterfrom
add-types
Mar 21, 2026
Merged

Add TypeScript type definitions#298
danmactough merged 6 commits intomasterfrom
add-types

Conversation

@danmactough
Copy link
Owner

@danmactough danmactough commented Mar 20, 2026

Ships first-party types so npm install feedparser is all TypeScript users need — no separate @types/feedparser install required.

Compared to the DefinitelyTyped version, these types only expose the public API, fix the base class (stream.Transform, not stream.Duplex), make options optional, and add the missing strict option, source property on Item, and index signatures for namespace-prefixed properties.

A typecheck script runs tsc --strict against a type-level test file as part of pretest.

Also adds more extensive types for developers via JSDoc annotations.


Post-Publish Checklist

@danmactough danmactough changed the title Bundle TypeScript type definitions with the package Add TypeScript type definitions Mar 20, 2026
danmactough and others added 6 commits March 20, 2026 21:23
Introduces index.d.ts with clean, public-API-focused types so TypeScript
users get types automatically without needing @types/feedparser. Fixes
several issues in the DefinitelyTyped version: removes private internals,
corrects base class to stream.Transform, makes options optional, adds
missing strict option, source property, and namespace index signatures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds test/types.ts exercising the full public API surface, a typecheck
script running tsc --strict, and wires it into pretest alongside lint.
Also adds .eslintignore to skip .ts files and typescript as a devDep.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without a tsconfig.json VSCode defaulted to ESM module mode, making
import X = require() invalid. Explicit module: commonjs aligns VSCode
with the typecheck script, which is simplified to just tsc.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds typed overloads for `on`, `addListener`, and `once` for the
'readable' event so that `this` is typed as `FeedParser` when using
a regular function callback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@danmactough danmactough merged commit 2a7d443 into master Mar 21, 2026
5 checks passed
@danmactough danmactough deleted the add-types branch March 21, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant