Generate types from TypeScript dialect JSDoc#556
Merged
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
f433db3 to
fe3ea68
Compare
The means all generated types will be in sync with the source code, always. Named callbacks are used instead of inline function types because the current version of tsgo (TypeScript 7 native preview) often generates invalid syntax like (: function) when encountering anonymous function types in JSDoc. closes #520 docs: prepare fake-timers JSDoc types for generation feat: generate fake-timers declarations from JSDoc chore: add tsgo preview validation for types chore: ship bundled fake-timers types chore: update types and lockfile docs: finalize JSDoc types migration plan chore: update types with Date instead of DateConstructor docs: finalize JSDoc types migration plan chore: refine JSDoc to match DefinitelyTyped precision feat: use tsgo exclusively for type generation and validation refactor: ts-typed lambdas instead of named types chore: use named @callback for robust tsgo declaration generation Named callbacks are used instead of inline function types because the current version of tsgo (TypeScript 7 native preview) often generates invalid syntax like (: function) when encountering anonymous function types in JSDoc. This approach ensures syntactically correct .d.ts files while maintaining direct source-to-type linkage. fix: enabled type checks and fixed all 147 type errors test: test timers.queueMicrotask in consumer
fe3ea68 to
93d150e
Compare
| return 0; | ||
| } | ||
| if (typeof epoch.getTime === "function") { | ||
| if (epoch instanceof Date) { |
There was a problem hiding this comment.
This was referenced Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #520
Purpose (TL;DR) - mandatory
Background (Problem in detail) - optional
See explanation in #520
@mantoni suggested in #520 to use JSDoc with TS flavor to avoid having to write TS, while having the benefits
Solution - optional
Use native build of TS transpiler for speed.
The code will be type checked, even if still written in js.
Named callbacks are used instead of inline function types because the current version of tsgo (TypeScript 7 native preview) often generates invalid syntax like (: function) when encountering anonymous function types in JSDoc.