You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ 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
The text was updated successfully, but these errors were encountered:
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)
**System Information**
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 runningtsc src/index.ts
:Steps to Reproduce:
To have
index.ts
compiled as in the videoThe text was updated successfully, but these errors were encountered: