shellscape / webpack-nano

A teensy, squeaky 🐤 clean Webpack CLI
Mozilla Public License 2.0
236 stars 5 forks source link

chore(argv): create typings #15

Closed G-Rath closed 5 years ago

G-Rath commented 5 years ago

This PR contains:

Breaking Changes?

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 commented 5 years ago

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

G-Rath commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

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 😄