microsoft / TypeScript-React-Starter

A starter template for TypeScript and React with a detailed README describing how to use the two together.
MIT License
11.08k stars 1.21k forks source link

Cannot find name Asynciterator #142

Open BenjaminWatts opened 6 years ago

BenjaminWatts commented 6 years ago

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?

mateus commented 6 years ago

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'.
watahani commented 6 years ago

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

    "lib": ["es6", "dom", "esnext.asynciterable"],
watahani commented 6 years ago

more info https://github.com/apollographql/graphql-subscriptions/issues/77

sibelius commented 6 years ago

lib: ["esnext"]

solves the problem

we can close this

alamothe commented 5 years ago

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.

xamantra commented 5 years ago

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

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

oh, thanks!