Repository navigation
Migrate source to TypeScript (/typescript eslint config) - #71
Merged
Merged
Conversation
…escript - Rename all src files .js -> .ts, convert JSDoc types to explicit TS annotations - Convert test/utils.js -> utils.ts; tests run on native node type stripping (no new loaders) - Swap eslint config to the /typescript export; drop redundant prettier/jsdoc overrides - Add InternalNode/LiteralValue/AttributeData types; no explicit any anywhere - Bump typescript lockfile to 5.9.3 (matches what ^5.5.3 resolves for consumers) - Guard rollup libs.d.ts generation against lib files removed in newer TS - Raise engines to node >=22
- dist/** ignore ships in the config's default ignores - globals block was dead weight: node globals come from the config, and test files import describe/it from mocha explicitly (no-undef verified active) - drop the now-unused globals devDependency
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.
What
Migrates the codebase from JSDoc-typed JavaScript to TypeScript and switches ESLint to the
@playcanvas/eslint-config/typescriptexport.src/files renamed.js→.ts(viagit mv, history preserved) with JSDoc types converted to explicit TS annotations and TSDoc comments (no type braces, no typedefs)test/utils.js→test/utils.ts; the 27 mocha spec files stay JS and run the TS source directly via native node type stripping — zero new runtime/loader dependencies (guarded byerasableSyntaxOnly)eslint.config.mjsswapped to the/typescriptexport, which bundles prettier and the import resolver — config shrank to ignores + globals + one chai overrideanyanywhere: internal TS compiler APIs (jsDoc,getElementTypeOfArrayType, …) are typed via anInternalNodeshape; the literal-extraction path uses a recursiveLiteralValueunion; parsed attributes use a typedAttributeData; two internal APIs replaced with public equivalents (isPrefixUnaryExpression, boolean-literal kind checks)src/index.tsthrough the existing swc plugin;tsc -p tsconfig.build.jsonemits declarations as before (now with more accurate signatures, e.g.updateProgram(): ValidationError[])Notable side changes
typescriptlockfile bumped 5.5.4 → 5.9.3 (package.json range^5.5.3unchanged — fresh installs already resolve 5.9). Needed forerasableSyntaxOnly; also surfaced a latent bug whererollup.config.mjsreadlib.es2022.sharedmemory.d.ts, removed in TS 5.9 — libs.d.ts generation now skips missing lib filespackage.jsonfilestrimmed per the newpackage-jsonlint rules (dist/index.jsships viamain; README/LICENSE auto-included) — verified withnpm pack --dry-run+ publintengines.noderaised to>=22.0.0; CI already runs node 24eslint-config-prettierdevDep removed (ships inside the eslint config);@types/nodeaddedVerification
tsc --noEmit, build, publint all green; 184 mocha tests passtypes/keep.tsspecifiers; verified resolvable by a consumer project under bothbundlerandnodenextresolution, with and withoutskipLibCheckmain: built both branches and ranparseAttributes+getAttributesover all 32 test fixtures through eachdist/index.node.mjs— JSON outputs are byte-identical (even across the TS 5.5.4/5.9.3 runtime difference). A line-level diff of the compiled node bundles was audited; every hunk is a rename, hoisted local, or a proven-equivalent API swapNot included:
strict: true— deferred to a follow-up so type-tightening can't hide migration regressions.