-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript declarations #188
Open
spetrac
wants to merge
8
commits into
digitalbazaar:main
Choose a base branch
from
spetrac:typescript-declarations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
98dd2b8
added automatic typescript declarations
251d772
bugfix tsconfig path
74123b3
move build-types from prepare to prepack
8196c9b
added types for testing
0c15cc8
change exports to main
022e817
add rimraf and remove temporary types
33fc7ac
add types back to gitignore
9e55f64
Merge branch 'main' into typescript-declarations
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ npm-debug.log | |
package-lock.json | ||
.nyc_output | ||
dist | ||
/types/ |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"outDir": "types", | ||
"declarationMap": true | ||
}, | ||
"include": [ | ||
"lib/**/*.js" | ||
] | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is rimraf really a main dependency? https://www.npmjs.com/package/rimraf
This seems like an entry in
devDepencies
also do@types/node
andtypescript
have to be in the dependencies for all users? It seems like that introduces a lot of bloat in this library. Are you sure those aren'tdevDependencies
also?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those definitively belong in the
devDependencies
and they are already.You are also right that
rimraf
is not a necessary dependency and only used during development to clear up between builds. You could also use the usualrm
command on linux, but then it would not be cross-plattform compatible. You can also discard the clear-up completely, because the build step is meant to be used automatically when publishing a package, but then it could be irritating during development.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rimraf
dependency is only for the convenience of the developer, so that previous builds must not be cleared manually during development. You can see it's usage in the package.json-build-types
-script.typescript
dependency is obviously necessary to build the types. You can see usage oftsc
in thebuild-types
-script.@types/node
dependency is used to give typescript the necessary types in the NodeJS environment, so that it will not warn of missing types and validate the usage of internal classes and API.These are just the basics of typescript development and should not really be a surprise. If you install the package in production those dependencies will not even be downloaded. The published types should then already be included in the package. Alternatively you can publish proper types in the DefinitelyTyped repository, but then you should not just use automatically generated types.