re: Writing a Node.js module in TypeScript VIEW POST


Watch out – prepublish is deprecated: docs.npmjs.com/misc/scripts#deprec...

Should @types/emojione be dev dependency?


prepublish itself is not deprecated. The old behavior is deprecated. But it's not the behavior that I'm intending here.

No the @types/emojione should be a normal dependency because it's a dependency of the generated .d.ts file. Basically the @types of any regular dependency should also be a regular dependency.


prepublish: right. npm’s deprecation warning gave me the wrong impression. I’m using prepublishOnly to avoid that warning, but it looks like that will be deprecated in the long run, while prepublish will stay (with prepublishOnly behavior): github.com/npm/npm/issues/10074

@types/emojione: make sense, didn’t know about dependencies between type definition files.

In this case it doesn't make a difference whether @types/emojione is a dev dependency or not because the .d.ts will only expose one signature that has only built-in types. But if we would have a function that for example exposes a Buffer as part of one signature and we would need @types/node as a normal dependency since the generated .d.ts file has a connection to it. So the best practice would be to just do it for all dependencies that you actually use during runtime.

Code of Conduct Report abuse