今天TS群里的小伙伴使用ES2017的 特性padEnd
ES2017 中新的字符串方法:padStart 和 padEnd
发现vscode会报错 虽然不影响编译 但是一条红线还是让人很不舒服
后来群里的大佬发现他的tsconfig.json有问题
参照以下内容可解决问题
{
"compilerOptions": {
"baseUrl": ".",
"outDir": "build",
"module": "esnext",
"target": "es5",
"lib": ["esnext", "dom"],
"sourceMap": true,
"allowJs": true,
"jsx": "react",
"moduleResolution": "node",
"rootDir": ".",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"importHelpers": true,
"suppressImplicitAnyIndexErrors": true,
"experimentalDecorators": true,
"downlevelIteration": true,
"allowSyntheticDefaultImports": true,
"paths": {
"@/*": ["src/*"]
}
},
"exclude": ["node_modules", "dist", "build", "mock"]
}
相关资源及拓展
http://json.schemastore.org/tsconfig