I have published an npm package (meteor-model) that has a dependency on @types/meteor. The project itself works fine and
import Meteor from 'meteor/meteor'
correctly resolves to
node_modules/@types/meteor
However, it does not work when I install this package in another project:
Cannot find module 'meteor/meteor'
thrown in
node_modules\meteor-model\dist\MeteorModelDecorators.js:38:16
The repo is here: https://github.com/navio-xyz/meteor-model
Now you can just use the following command to install meteor types:
meteor npm install @types/meteor --save
You simply cannot use 'meteor/*' package to import any module, because there is no meteor package system. If you want to use Meteor or Mongo etc., you can just use it as global variable directly. To enable the type check for such global variables, here is what to do:
npm install --save-dev @types/meteor
{
"compilerOptions": {
...
"types": [
"meteor"
]
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With