Búsqueda de sitios web

graphql - typescript error TS2304: No se puede encontrar el nombre AsyncIterator incluso con esnext


Recibo el siguiente error:

node_modules/@types/graphql/subscription/subscribe.d.ts(36,13): error TS2304: Cannot find name 'AsyncIterator'.
node_modules/@types/graphql/subscription/subscribe.d.ts(47,12): error TS2304: Cannot find name 'AsyncIterator'.
node_modules/@types/graphql/subscription/subscribe.d.ts(75,12): error TS2304: Cannot find name 'AsyncIterable'.
3:01:18 PM - Compilation complete. Watching for file changes.

Incluso al agregar esnext al archivo tsconfig:

{
    "compilerOptions": {
        "outDir": "./dist/",
        "lib": [
            "esnext",
            "esnext.asynciterable"
        ]
    },
    "include": [
        "./src/**/*"
    ]
}

¿Alguna idea para resolver esto?

Respuesta #1

Estaba obteniendo el mismo error. Lo he solucionado actualizando las dependencias del proyecto a la última versión:

npm install -g npm-check-updates
ncu -u

Las versiones anteriores eran estas:

 body-parser        ^1.18.1  →   ^1.19.0 
 express            ^4.15.4  →   ^4.17.1 
 reflect-metadata   ^0.1.10  →   ^0.1.13 
 @types/node       ^8.10.61  →  ^14.0.23 
 ts-node              3.3.0  →    8.10.2 
 typescript        3.3.3333  →     3.9.6