node-serialport
node-serialport copied to clipboard
Feature Request: Bundle Typescript types in published package
💥 Proposal
What feature you'd like to see
Typescript types included in the distributed packages
Motivation
It would be nice to not need to install the @types/serialport
package to use this in TypeScript (or just to get automatic type hinting in modern code editors).
Pitch
Take the types from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/serialport and publishe them in the various packages.
All that is needed is a package.json#types
field that mirrors the package.json#main
field. Looks like creating a types
folder that matches the exported lib
folder should work.
Related issues
https://github.com/serialport/node-serialport/issues/1790 DefinitelyTyped Serialport issues
It would be possible to make @types/serialport
a dependency, like react-testing-library does for their types. That way they could stay synced with those updates.
https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package
If you are the library author and your package is written in TypeScript, bundle the autogenerated declaration files in your package instead of publishing to Definitely Typed.
I recognize that this is talking specifically about packages "written in TypeScript", but, frankly, I don't think that is a hard requirement. DefinitelyTyped is wonderful but we don't need to lean on them if we can just bundle the types directly.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week no further activity occurs. Feel free continue the discussion or ask for a never-stale
label to keep it open. If this is a support issue, consider sharing it on stack overflow to get more eyes on your problem.
Can we get a never-stale
?
Yep!
bundle it directly, we need @serialport/stream and so on, especially when using @serialport/stream only and implement custom bindings
Looking into this a little, it looks like 'serialport'
is using 'plop'
to bundle packages in a consistent way.
Plot claims to support Typescript types automatically.
Maybe this means what's required is converting everything here to .ts
?
We need a build system in place and then to convert everything to typescript (not just the templates for new parsers)
Starting on this with the new bindings for serialport v10 https://github.com/serialport/bindings-cpp/pull/3
No promises but if I can make v10 completely in typescript I will
[email protected]
is using the typscript bindings