Publish Typescript declaration file
See original GitHub issueHi @dumbmatter.
Thanks for such an awesome module! I’m currently using this for some tests in a library of mine that I’m transitioning from JavaScript to Typescript. I was wondering if it would be possible to push a new release out with some Typescript declaration files. It shouldn’t be too hard to do since you’re using Typescript yourself. Just setting declaration: true
and removing allowJs: true
in tsconfig.json
should do the trick.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Documentation - Publishing - TypeScript
There are two main ways you can publish your declaration files to npm: ... Both TypeScript and JavaScript projects can generate types via...
Read more >Including declarations in your npm package - TypeScript
There are two main ways you can publish your declaration files to npm: bundling with your npm package, or; publishing to the @types...
Read more >Why publish the TypeScript declaration file on DefinitelyTyped ...
Type declaration publishing guides seem a bit outdated and sparse in several areas. I'll try to compare both scenarios in detail.
Read more >A quick introduction to “Type Declaration” files and adding ...
These libraries are nothing but the declaration files provided by the TypeScript. We can also explicitly include type declarations in the ...
Read more >The 30-second guide to publishing a TypeScript package to ...
This tells TypeScript to emit an .d.ts definitions file along with your compiled JavaScript, which is what TypeScript will use for type ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Dahaden thanks for the suggestion and the prototype code!
The problem I worry about with this is if you’re passing around IndexedDB variables in your application code, that code shouldn’t have to care that fake-indexeddb exists, so any difference in types between fake-indexeddb and IndexedDB could result in a lot of false positive TypeScript errors. Extension of your example.
Ultimately I think there’s not much to gain by doing anything other than using the built-in TypeScript IndexedDB types. Anything in fake-indexeddb that’s not in real IndexedDB is not part of the public API currently anyway. (For your example, IDBTransaction.commit actually does exist.) If eventually stuff is added to the public API like #50 or #51, then the fake-indexeddb types could just be like
IDBFactory & { myAPI: () => void }
.I’m going to try to do a new release containing TypeScript types and maybe also moving to ES modules if that doesn’t cause too many issues. Working on that now in the v4 branch: https://github.com/dumbmatter/fakeIndexedDB/tree/v4