0

I used meteor-typescript-compiler (https://github.com/meteor-typescript/meteor-typescript-compiler) for my new project. For testing purpose, I created fresh Meteor project and put only one file main.ts to it

/// <reference path="./typings/definitions/meteor.d.ts" />
console.log ('added to stack');
Meteor.methods({
  'test': function() {
     console.log('from main');
  }
});

Then, I added 2 packages

meteor add meteortypescript:compiler
meteor add systemjs:systemjs

And download the definition files from https://github.com/meteor-typescript/meteor-typescript-libs and put into the typings folder

When triggering meteor run, I got the exception

main.ts (3, 1): Cannot compile namespaces when the '--isolatedModules' flag is provided.
main.ts (3, 1): Cannot compile namespaces when the '--isolatedModules' flag is provided.
=> Errors prevented startup:                  

   While processing files with meteortypescript:compiler (for target web.browser):
   <anonymous>: Unknown absolute import path /typings/definitions/meteor.d.ts

My Visual Studio Code can see the reference path and does not complain anything about that. What can I do to make this simple configuration work?

1 Answer 1

1

Cannot compile namespaces when the '--isolatedModules' flag is provided

Since the meteor.d.ts file uses namespaces you should not have --isolatedModules compiler flag set. Add a tsconfig.json if there isn't one already and have this option set to false.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @basarat. I can compile the project now, but now I have another issue regarding to generated javascript file stackoverflow.com/questions/33991506/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.