tsconfig.json配置问题

来源:4-2 将项目列表页面JS改造成TS,增强类型,减少Bug

卷狗

2021-09-11

请老师或同学帮我看看这是怎么回事…只要我配置了"path"属性,这个tsconfig.json的配置文件在运行开始时就会被重置…我不想重置它,就想使用@开头为src,不知道为什么就是不行…

{
“compilerOptions”: {
“baseUrl”: “.”,
“target”: “es5”,
“lib”: [“dom”, “dom.iterable”, “esnext”],
“allowJs”: true,
“skipLibCheck”: true,
“esModuleInterop”: true,
“allowSyntheticDefaultImports”: true,
“strict”: true,
“forceConsistentCasingInFileNames”: true,
“noFallthroughCasesInSwitch”: true,
“module”: “esnext”,
“moduleResolution”: “node”,
“resolveJsonModule”: true,
“isolatedModules”: true,
“noEmit”: true,
“jsx”: “react-jsx”,
// 在不启用的情况下null和undefined可以作为任意类型的子类,数字也可以使用null表示没有,如果不启用,数字就必须写个0,这就很头大了.
“strictNullChecks”: false,
// 在表达式和声明上有隐含的any类型时报错
"noImplicitAny": false,

//----------------------------------------------------------关键点在这里----------------------------------------------------------
“paths”: {
"@/": [
"src/
"
]
},
//----------------------------------------------------------这里只要配置了Path,ts.config文件 就会被重置----------------------------------

},
“include”: [“src”]
}

写回答

1回答

Nolan

2021-09-15

create react app 生成的工程,tsconfig是不可以改的

0
3
卷狗
回复
Nolan
谢谢老师.
2021-09-17
共3条回复

React17+Hook+TS4 优质实践,仿 Jira 企业级项目

解锁 React17 高阶用法,轻松应对大型复杂长周期项目

2691 学习 · 1236 问题

查看课程