-
-
Notifications
You must be signed in to change notification settings - Fork 537
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
Add PackageJson
and LiteralUnion
types
#5
Add PackageJson
and LiteralUnion
types
#5
Conversation
npm.d.ts
Outdated
*/ | ||
postrestart?: string; | ||
|
||
[scriptName: string]: string | undefined; |
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.
Why allow undefined
?
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.
In strict
mode, the type of the index signature has to match with the other keys defined in the type. This is the reason I've used the
type Foo = {
key?: string;
} & {
[key: string]: string;
}
below.
npm.d.ts
Outdated
types?: string; | ||
|
||
/** | ||
Location of the bundled TypeScript declaration file. Alias of `types`. |
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.
Should we use @alias
? http://usejsdoc.org/tags-alias.html
npm.d.ts
Outdated
*/ | ||
jspm?: PackageJson; | ||
} & { | ||
[k: string]: unknown; |
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.
[k: string]: unknown; | |
[key: string]: unknown; |
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.
Why is this in a separate intersection type?
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.
Can you move |
I think the filenames for source/test should be |
PackageJson
and LiteralUnion
types
Can you add the types to the readme? |
Which ones? Every single one or only the main |
Only |
Thanks :) |
@BendingBender Was wondering if you would like to join this project as a maintainer? No commitment, just want to show your name in the readme since you have contributed a lot of code here and you might have opinions about future type additions. |
@sindresorhus It would be a pleasure for me! |
Will do the eslint types in a later PR.