什么是 tsconfig.json
概述
目录中存在 tsconfig.json
文件表明该目录是 TypeScript 项目的根目录。tsconfig.json
文件指定编译项目所需的根文件和编译器选项。
JavaScript 项目可以改用 jsconfig.json
文件,它的作用几乎相同,但默认启用了一些与 JavaScript 相关的编译器标志。
项目通过以下方式之一编译:
使用 tsconfig.json 或 jsconfig.json
- 通过在没有输入文件的情况下调用 tsc,在这种情况下,编译器会从当前目录开始搜索
tsconfig.json
文件,并继续沿父目录链向上。 - 通过在没有输入文件和
--project
(或只是-p
)命令行选项的情况下调用 tsc,该选项指定包含tsconfig.json
文件的目录的路径,或包含配置的有效.json
文件的路径。
在命令行上指定输入文件时,tsconfig.json
文件将被忽略。
示例
TwoCwMqsEEx3yqnEMOPIMWqK3t9oYTV8WORW3kZvZzmlnT5PoNtrsymUKONpaOKp
- LFfpf39zkc+sfpl4pEDE9OLDDzXtST9LqeKeslanKKCGuifnaDEi9j+nLHcYu5ky+AmwDcL6ojB518Xzoi3T4dg/jQl9Hactv5FP9NBXUqLS/nkbmMPRkONxQ0v7WgxKGiYqCiC39c0OlWLYSqFQvmv5K9BMPYRTNEVAJZxIJRW6ZK92IeeS/Aiu2dXdBQO+8wP5DTeaipmug5fwSQMXPZ+FNfJmyhkVwUTl24G500/hF08KE04HlOLpApjNOQfAbOXul34T8YfLHFf46PhHkr+p5ukKFYCntskgkY/ZL5sFJZV5ef32LhGHvvvqpmRdoNQ4c++MShPZRXAibqUoHa5Ct1drebxIvuoYy6OnH81Osy25Kro7Pyv5VYw+rPqrCZAsfvGiBU4+Bxloq5ZMluQIBPNsm2bPMfjOcKtbFuCmIXBlN1XTlLy2hD2euZAHRxXnBLO3NEdpngThbzsKfjTvzTvqCc7nQSNoP0xiY927BJfqAr6kpTgU/UXGjjoMvw/in+Q2+S1ei4OrK+WXet++mfvVI39bgk5vbXLkM6wYc271T/GGjiF3RletBawL4oC0OFgt5SFaaGDTobD3JR6QWnmVRdJAWfZVAySOyxE4tuk3ZrxdooC2QzyGEuem/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FBqwE/eK+S0sOkHXEDGVSf9bHSMJNaGfRMfhYBTca7uQG84UPVzvILdHFIzcVx4a45W196sA44TyiQ/aszsF/OlcgePN9UugC8uyYOwoHQXYfDUM7n82ju3K4RFFk/R2Wn
QOeRkLT0HEnSb+cQrDM8KDvwfOPw4tu2/3Z/uD0W4hoxCeRuWfjIBppOtRt93gzkZyeJmfyNZZSEyt/15imvUB/nhLt0KUXEdsSCL6ZCOWRrtAPtb0H5gvSUMoEqwy0m5xEcbruz9Wnj7jADmFkL0U7/78/gpU33SL4k8JORWZzucsn5fnA6eQC21xnHpNlScN/YaY3q08ep59qGuaXYPhkugc+ezLqNC6oLmeRFBYwHfILPl3WRwBRDMndvQPj977hL//p5365o/Lew0CG4Iw==
{
"extends": "@tsconfig/node12/tsconfig.json",
"compilerOptions": {
"preserveConstEnums": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
MkJ5F+9Nrl9V47k7PrxdnrPLIR+yOY/5Pm617c2wJx3cpASdbUMH0calYifEMWJaCfXBIR4bYZMb/z6TOZD/RRA29E1qflT1GhpQ9Rbd6+D1E3rdJddWCtTNCSFM9aHnrqOMSoH9vasdngRkTaYoXtPY+YKHbr36XDgz+83P/rqs+yvg+JGNo92/XGFNJZEAzNUrsrtMYJ6fFmDtki3SXGqLeEl8aM/6Y+cY7HtXi/7kpLEWcIBpfqbU4ZLZ6hLlkB7XengBBQz86BmWLncgMw==
- 7+r2nTnH1dY7vPrn8d8GPWmxDGESsjO+r2apXrX9evo01KRgJP1pbYA42qx0giidJvg0CWT79t6vZ89loPk2+/jXBUgQQn42wKsNxWkRbbKkkxNTijgiwbrQvk+jAVXEXMvXAqj1DEpk+7VQRXv79Jiqa1Ag20V4qxWAJUQjaqq+AIoM90l+b8TV9BSVn4/T7bBBx5kdVud55rKNCg8HQ9/Oi5DFwkfuGMRa4pII2UtLfXmTxf5ZxyObaUHhDO6PtWrorsvrtFS9MFh+wigetLc9ydTe19EsLkKHbZPN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