Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with tsc command when following FEM video on Windows 10 (v2) #297

Closed
1 task
Magneticmagnum opened this issue Apr 1, 2019 · 1 comment
Closed
1 task

Comments

@Magneticmagnum
Copy link

Magneticmagnum commented Apr 1, 2019

**System Information**

Terminal: git-bash
NodeJS version: 10.15.1```
Editor: Visual Studio Code

I was following the commands as described in the FEM video flags (https://frontendmasters.com/courses/typescript-v2/flags/) and ran into the following error when running tsc src/index.ts:

$ tsc src/index.ts
error TS2468: Cannot find global value 'Promise'.

src/index.ts:6:14 - error TS2585: '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.

6   return new Promise(res => setTimeout(res, n));
               ~~~~~~~

src/index.ts:20:2 - error TS2705: 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.

20 (async () => {
    ~~~~~~~~~~~~~


Found 3 errors.

Steps to Reproduce:

$ git clone https://github.com/mike-works/typescript-fundamentals.git
$ cd tscript
$ cd examples/hello-ts
$ tsc src/index.ts
  • Expected behavior
    To have index.ts compiled as in the video
@mike-north
Copy link
Member

This looks like you may not have been using the vscode workspace. What you're seeing is that the source is being treated as something older than ES2017 code (the first version of JS that officially included async and await)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants