TypeScriptでよく出てくるエラーで以下のようなものがあります。
色々と設定を変えてみたのですがダメでした
どうしてESLintはこのエラーを吐き出すのでしょうか?
エラーとなるコード例
TypeScript
1type myReturnType<T> = T extends (...args: any[]) => infer R ? R : any 2type T12 = myReturnType<<T>(arr:T[]) => T>
#エラー対象
2行目右辺の myReturnType
#エラーメッセージ
ESLint
1Parsing error: ';' expected.eslint
#.eslintrc.js
module.exports = { "ecmaFeatures": { "modules": true }, "env": { "browser": true, "node" : true, "es6" : true, "mocha":true, "jquery": true }, "extends": [ "eslint:recommended" ], "plugins": [ "@typescript-eslint", "prettier" ], "globals": { }, "parser": ["@typescript-eslint/parser", "babel-eslint"], "parserOptions": { "sourceType": "module", "project": "./tsconfig.json" }, "settings":{ 'import/extensions': ['.js','jsx','.ts','tsx'], 'import/resolver':{'node':['.js','jsx','.ts','tsx']} }, "rules": { "no-console": "warn", "no-irregular-whitespace":'off', "no-extra-semi": "warn", "no-undef": "warn", "quotes": ["warn", "single"], "space-before-blocks": ["warn", { "functions": "always" }], "@typescript-eslint/adjacent-overload-signatures": "error", "no-unused-vars":"off", - 略 - "prettier/prettier": [ "error", { "singleQuote": true, "trailingComma": "es5", "semi": false, }, ], }, }
#環境
MacOS Mojave
VSCode 1.40
typescript 3.2.4
ts-loader 4.4.2
WebPack 4.16.3
あなたの回答
tips
プレビュー