Convert to TypeScript - #51
Merged
Merged
Conversation
bplistParser.js/test/parse.test.js become .ts, with the hand-written bplistParser.d.ts replaced by declarations generated by tsc (build.js now runs tsc -p tsconfig.build.json after the esbuild bundling step and copies the emitted .d.ts to both dist/index.d.ts and dist/index.d.cts, same as before). Hand-maintained .d.ts files drift from the implementation over time; generating them from the source makes the types the actual source of truth. strict: true, with the parser's genuinely dynamic parts (parsed plist values are arbitrary nested data) typed as `any` to match, same as the public API's existing `T = any` generics. Internals get real types (bigint-aware integer helpers, a proper UID class). Added a typecheck script (tsc --noEmit) and CI step so a future type regression fails CI the same way a broken test does. typescript-eslint pinned to typescript 6.0.x rather than the new 7.x line, since typescript-eslint@8.69's peer range doesn't support it yet.
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.
Summary
bplistParser.js/test/parse.test.js→.ts. Hand-writtenbplistParser.d.tsis replaced by declarations generated bytsc(build.jsnow runstsc -p tsconfig.build.jsonafter the esbuild bundling step and copies the emitted.d.tsto bothdist/index.d.ts/dist/index.d.cts, same as before).strict: true. Parsed plist values stayany(matches the existing publicT = anygenerics — parsing arbitrary plist data is inherently dynamic), but internals get real types: a properUIDclass, bigint-aware integer helpers.typecheckscript (tsc --noEmit) and CI step.Test plan
npm run typechecknpm run build(inspecteddist/index.d.ts/dist/index.d.cts, match the previous hand-written shape)npm test(11/11 pass)npm run lint(only pre-existingeqeqeqwarnings remain)npm run smoke