I’ve converted one of my atmosphere packages to typescript, but I still get this warning:
I’ve put an index.d.ts
file in my package folder. Is there a way to get added to node_modules/@types/meteor
automatically, or any other way to get it picked up by VS Code automatically so users of the package don’t have to manually install the type definitions?
Thanks!
1 Like
would also like to hear a solution. @wildhart did you find anything?
Sadly, atmosphere packages don’t support TS type defs yet (not even for built in TS packages like react-meteor-data
). You’ll need to add a separate NPM package, maybe in definitely typed, or another npm package.
No, I couldn’t find any solution. I ended up manually copying the definition file into my own @types folder.
Worth raising an issue on Meteor? I found this stale issue: How to declare "meteor.d.ts or index.d.ts" in meteor package? · Issue #10828 · meteor/meteor · GitHub
And this closed issue, but I haven’t had time to digest it yet: [1.3] - How to prevent TypeScript from marking the `meteor/PACKAGE_NAME` imports as error? · Issue #6177 · meteor/meteor · GitHub
would be cool in a meteor-style that if you would add api.use("typescript")
(and some tsconfig maybe), it would automatically create a definition file for all exported properties.
2 Likes
I’m having the same annoying problem with mdg:validated-method on Mac. The line:
import { ValidatedMethod } from ‘meteor/mdg:validated-method’;
gets highlighted with an error “Cannot find module ‘meteor/mdg:validated-method’ or its corresponding type declarations.” even though I installed type definitions in the @types/meteor-mdg-validated-method.
This problem persists only with the packages that have a semicolon in their name. What’s worse, copying type definitions to other files with the correct module name “mdg:validated-method” doesn’t work either.
Are there any solutions out there? Thanks a lot!
1 Like
I had the same problem with percolate:migrations. I have in my project a main meteorDef.d.ts file. Adding the definitions there didn’t help. To solve this, I had to create a file inside my @types/meteor/percolate:migrations.d.ts and everything worked just fine.
1 Like