Add Typescript typechecking, generate types with tsc#153
Merged
Conversation
Collaborator
|
Can this be merged after v4.0.0 is released in both core library & JS? |
Collaborator
Author
Technically changing types could be considered breaking for TS users, so I'd prefer to land this pre-release. |
added 2 commits
August 22, 2022 09:43
Pull Request Test Coverage Report for Build 2907065074
💛 - Coveralls |
isaacbrodsky
approved these changes
Aug 22, 2022
| "build-docs": "jsdoc2md --no-cache --global-index-format grouped --partial doc-files/scope.hbs --helper ./doc-files/insert-version.js --separators --template doc-files/README.tmpl.md lib/h3core.js lib/errors.js > README.md", | ||
| "build-tsd-core": "jsdoc -t node_modules/tsd-jsdoc/dist -d console lib/h3core.js | sed 's/\"h3\"/\"h3-js\"/g' > dist/types.d.ts", | ||
| "build-tsd-core": "tsc lib/h3core.js --noResolve --skipLibCheck --allowJs --declaration --emitDeclarationOnly --outFile dist/types.d.ts && yarn build-tsd-core-postprocess", | ||
| "build-tsd-core-postprocess": "sed 's/module \"h3core\"/module \"h3-js\"/g' dist/types.d.ts > types.d.ts.tmp && sed -E -e 's/(CoordPair|SplitLong) = number\\[\\]/\\1 = [number,number]/g' types.d.ts.tmp > dist/types.d.ts && rm types.d.ts.tmp", |
Collaborator
There was a problem hiding this comment.
Maybe this logic should be in a script file so that comments can be added to it? This is a little 'magical'
Collaborator
Author
There was a problem hiding this comment.
Agree, I can take a look at moving this into a script
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.
tsc --noEmittsd-jsdocin favor of generating the library types withtsc --declarationCoordPairandSplitLong, post-processing the libdef to use[number, number]instead ofnumber[](this is a workaround for Support Tuples jsdoc/jsdoc#1703, which kills doc generation if we use[number, number]directly in JSDoc comments)Fixes #152