Skip to content

chore(argv): create typings #15

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

Merged
merged 1 commit into from
Sep 11, 2019
Merged

chore(argv): create typings #15

merged 1 commit into from
Sep 11, 2019

Conversation

G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Sep 10, 2019

This PR contains:

  • bugfix
  • feature
  • refactor
  • tests
  • documentation
  • metadata

Breaking Changes?

  • yes
  • no

If yes, please describe the breakage.

Please Describe Your Changes

Adds typings for argv.js so that it can be imported in TypeScript.

Closes #14

@matheus1lva
Copy link
Collaborator

Add this file as well on the lib and types properties on package.json

@G-Rath
Copy link
Contributor Author

G-Rath commented Sep 11, 2019

@playma256 This shouldn't be set for the types property on package.json, as that should point to the same thing as main i.e index.d.ts.

That's used for the importing of the package, i.e import x from 'webpack-nano'.

Otherwises, cheers for reminding me about the lib!

@matheus1lva
Copy link
Collaborator

@playma256 This shouldn't be set for the type property on package.json, as that should point to the same thing as main i.e index.d.ts.

That's used for the importing of the package, i.e import x from 'webpack-nano'.

Otherwises, cheers for reminding me about the lib!

Oh really? So tscompiler will also find that file as well? I thought it would need to be added into types as well! Thank you for explaining me this!!! \o/

@G-Rath
Copy link
Contributor Author

G-Rath commented Sep 11, 2019

So tscompiler will also find that file as well?

Yeah, it looks based on the file name. Technically you don't need it if it's called index.d.ts either:

Also note that if your main declaration file is named index.d.ts and lives at the root of the package (next to index.js) you do not need to mark the "types" property, though it is advisable to do so.

But it's good practice :)


I've tested these typings by literally dropping them into the package in node_modules 😄

@shellscape shellscape merged commit 7233fba into shellscape:master Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript types
4 participants