Skip to content


Fixing a couple of TypeScript compilation errors

This is an old draft that I never got to finish but that I don’t want to throw away either. I guess this is where this site is really used as a notepad ^^

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

=> add “esnext.asynciterable” lib to file tsconfig.json
(source: https://stackoverflow.com/questions/45810696/ionic2-apollo-graphql-eror-cannot-find-name-asynciterator#45812540)

Error 2:
node_modules/aws-sdk/lib/config.d.ts(39,37): error TS2693: 'Promise' only refers to a type, but is being used as a value here.

=> add “es2015.promise” lib to file tsconfig.json

Bonus:
My tsconfig.json file as it was when I started writing this (should be still good, I just added more stuff since then)

{
  "compileOnSave": true,
  "compilerOptions": {
    "target": "es5",
    "noImplicitAny" : true,
    "lib": [
      "es5",
      "es2015.promise",
      "esnext.asynciterable"
    ],
    "skipLibCheck": false,
    "alwaysStrict": true,
    "removeComments": true
  },
  "exclude": [
    "node_modules"
  ],
  "typeRoots": [ "node_modules/@types" ]
}

Posted in JavaScript / TypeScript / Node.js, published drafts.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.

Sorry about the CAPTCHA that requires JS. If you really don't want to enable JS and still want to comment, you can send me your comment via e-mail and I'll post it for you.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA