question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Publish TypeScript types with package

See original GitHub issue

Congratulations on releasing the big ES modules rewrite! I gave it a try in a simple toy app, and it works wonderfully. It was great to see tree-shaking working correctly!

The only feedback I have is that it’d be really nice to have the TypeScript definitions published as part of the package instead of a separate @types package. This would ensure that all consumers of v7 and up are able to use the package with TypeScript without installing another package that is potentially out of date. As an example, I’m unable to test the new v7 beta in my TypeScript projects since the published types are only for v3. In order to use the beta, I’d need to write my own declaration file, and if I’m doing that I figured I might as well offer to do it officially.

If you’re interested, I’m willing to write new type declarations and send a PR adding them.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ctavancommented, Feb 25, 2020

@types/uuid@7.0.0 has finally been released and should fix this issue.

As mentioned above I’m happy to update the TypeScript definitions over at DefinitelyTyped if the API surface of this module changes, but I will follow the official recommendation of not bundling the type definitions into this module as long as it is not written in TypeScript.

1reaction
ibccommented, Feb 24, 2020

Right now I cannot upgrade to uuid v7 because my app/lib is written in TypeScript so it also needs @types/uuid which, right now, is still 3.4.7.

Please, consider adding TypeScript into uuid itself. If you don’t want, you don’t need to rewrite the whole code to TS but just add a "types": "index.d.ts" in package.json and create a index.d.ts that exposes the public library API in TypeScript. Something like this:

https://github.com/ibc/h264-profile-level-id

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Publishing - TypeScript
Packages under the @types organization are published automatically from DefinitelyTyped using the types-publisher tool. To get your declarations published as an ...
Read more >
The 30-second guide to publishing a TypeScript package to ...
The 30-second guide to publishing a TypeScript package to NPM · 1. Add "declaration": true to the compilerOptions of your tsconfig.json · 2....
Read more >
Build and publish an NPM Typescript package | Codementor
Typescript installation and quick test. Globally Installing TypeScript: You can use npm to install TypeScript globally, this means you can ...
Read more >
How to publish TypeScript package to NPM
How to publish TypeScript package to NPM · Write some code · tsconfig.json · Set up Rollup · Build code and publish package...
Read more >
How to link a npm package with its types - Digital Fortress
You just created a package / library written in TypeScript or Javascript and now you wanna publish it to NPM along with its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found