HerringtonDarkholme / typescript-repl

An upgraded TypeScript REPL
210 stars 16 forks source link

Cannot find global value 'Promise' #36

Open rhz opened 5 years ago

rhz commented 5 years ago

I'm having a similar issue to #27. I run tsun file.ts and get

Cannot find global value 'Promise'.
file.ts (93,14): 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.
file.ts (280,18): An async function or method in ES5/ES3 requires the 'Promise' constructor.  Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
...

I have a tsconfig.json file in the same folder with the following contents

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es6",
    "sourceMap": true,
    "watch": true,
    "strictNullChecks": true
  },
  "exclude": [
    "node_modules/"
  ]
}

I'm using the following versions

$ npm list -g tsun
/home/rhz/.npm-packages/lib
└── tsun@0.5.0

$ npm list -g typescript
/home/rhz/.npm-packages/lib
└── typescript@3.2.4

How do I tell tsun to use the es6 target?