Manuel Rivera
Manuel Rivera

Reputation: 523

typescript and meteor: Cannot find name 'Meteor'

I'm just beginning to use Typescript in my meteor project. Everything has going well but there are some details that I can not easily correct. One of them is this: whenever I use the word Meteor (Meteor.call, Meteor.subscribe, ...) in my code the compiler complains by saying:

typescript Cannot find name 'Meteor'.

I'm using Atom, with typescript package, and it seems to accept Meteor perfectly.

Of course the message seems to be a warning because the compilation does not stop there and the building process completes, but the message is very annoying.

I installed the Meteor type definitions and can see there is a file in node_modules:

@types/meteor/meteor.d.ts

shouldn't the symbol Meteor be defined there?

It seems I'm missing something here, but can't figure out what.

Many thanks for your help and bye ...

Upvotes: 2

Views: 622

Answers (2)

Guido T.
Guido T.

Reputation: 321

Try to install into Package.json

meteor npm install @types/meteor --save

Upvotes: 0

Matteo Demicheli
Matteo Demicheli

Reputation: 184

Adding an import statement fixes the error:

import { Meteor } from 'meteor/meteor'

// ...

But that introduces another error. Cannot find module 'meteor/meteor'., which according to https://github.com/TypeStrong/atom-typescript/issues/1307 is not fixed yet.

Upvotes: 2

Related Questions