美文网首页我爱编程
Typescript with Graphql error: c

Typescript with Graphql error: c

作者: kinkyboots | 来源:发表于2017-12-20 18:07 被阅读500次

Problem:

With @types/graphql installed on express server project, Typescript compilation throw error:

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

Cause:

No lib for esnext.AsyncIterator

Solution:

add lib config to tsconfig.json

Notice: conflict between es6 and es2015.core
{
    "compilerOptions": {
        ......
        "lib": [
            "es5",
            "dom",
            "es2015.core",
            "es2015.collection",
            "es2015.generator",
            "es2015.iterable",
            "es2015.proxy",
            "es2015.reflect",
            "es2015.symbol",
            "es2015.symbol.wellknown",
            "esnext.asynciterable"
        ]
    },
}

https://github.com/apollographql/graphql-subscriptions/issues/83

相关文章

网友评论

    本文标题:Typescript with Graphql error: c

    本文链接:https://www.haomeiwen.com/subject/slqnwxtx.html