Typescript-react-starter: Cannot find name Asynciterator

Created on 2 May 2018  路  6Comments  路  Source: microsoft/TypeScript-React-Starter

Have followed the starter instructions but cannot start the barebones app:

Failed to compile.

/Users/benjaminwatts/node_modules/@types/graphql/subscription/subscribe.d.ts
(17,12): Cannot find name 'AsyncIterator'.

Any ideas?

Most helpful comment

By adding "esnext.asynciterable" to tsconfig.json, it will work.

    "lib": ["es6", "dom", "esnext.asynciterable"],

All 6 comments

I'm having a similar issue but with an app on Heroku.

Failed to compile

/app/src/foundation/components/App/tests/App.test.tsx
(5,1): Cannot find name 'it'.

By adding "esnext.asynciterable" to tsconfig.json, it will work.

    "lib": ["es6", "dom", "esnext.asynciterable"],

lib: ["esnext"]

solves the problem

we can close this

Isn't adding lib: "esnext" dangerous?

E.g. esnext even includes flatMap...

It only tells TypeScript to assume these APIs will be available in the browser, but doesn't provide polyfills. It will easily break your app in most browsers.

By adding "esnext.asynciterable" to tsconfig.json, it will work.

    "lib": ["es6", "dom", "esnext.asynciterable"],

oh, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wongjiahau picture wongjiahau  路  9Comments

emanuelef picture emanuelef  路  3Comments

StokeMasterJack picture StokeMasterJack  路  4Comments

wuchaoya picture wuchaoya  路  9Comments

masters3d picture masters3d  路  6Comments