forked from Legcord/Legcord
-
Notifications
You must be signed in to change notification settings - Fork 2
/
tsconfig.json
34 lines (32 loc) · 3.38 KB
/
tsconfig.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
// Reference: https://www.typescriptlang.org/tsconfig
"include": ["src/**/*"], // This makes it so that the compiler won't compile anything outside of "src".
//"exclude": ["src/**/*.test.ts"], // Exclude .test.ts files since they're for Jest only.
"compilerOptions": {
// Project Structure //
"rootDir": "src", // rootDir only affects the STRUCTURE of the folders, not what gets compiled. For extra measure, make sure the structure conforms to "src".
"outDir": "ts-out", // Likewise, outDir only chooses which folder to compile to. Prevent the compiler from creating JS files right next to source files.
"moduleResolution": "node", // Specify how the compiler resolves modules, like going for node_modules first then searching elsewhere. The official docs just say to use this instead of classic.
// Type Settings //
"strict": true, // Enables all strict checks possible.
"noImplicitReturns": false, // Makes sure you don't accidentally return something + undefined.
"noFallthroughCasesInSwitch": true, // Prevents accidentally forgetting to break every switch case. Of course, if you know what you're doing, feel free to add a @ts-ignore, which also signals that it's not a mistake.
"forceConsistentCasingInFileNames": true, // Make import paths case-sensitive. "./tEst" is no longer the same as "./test".
"resolveJsonModule": true, // Allows you to import JSON files just like how you can require() them. Do note that if you're accessing any JSON files outside of src, it'll mess up dist.
"esModuleInterop": true, // Enables compatibility with Node.js' module system since the entire export can be whatever you want. allowSyntheticDefaultImports doesn't address runtime issues and is made redundant by this setting.
"lib": ["ES2022", "DOM"], // Specifies what common libraries you have access to. If you're working in Node.js, you'll want to leave out the DOM library. But do make sure to include "@types/node" because otherwise, variables like "console" won't be defined.
"noUnusedLocals": true, // Warns you if you have unused variables.
// Output //
"module": "CommonJS", // Compiles ES6 imports to require() syntax.
"removeComments": false,
"sourceMap": true, // Used for displaying the original source when debugging in webpack. Allows you to set breakpoints directly on TypeScript code for VSCode's debugger.
// Library Building //
"declaration": false, // Exports declaration files in addition, used for exporting a module.
"declarationMap": false, // Allows the user to go to the source file when hitting a go-to-implementation key like F12 in VSCode for example.
//"declarationDir": "typings", // declarationDir allows you to separate the compiled code from the declaration files, used in conjunction with package.json's "types" property.
// Web Compatibility //
"target": "ES2022", // ES2017 supports async/await, reducing the amount of compiled code, especially for async-heavy projects. ES2022 is from the Node 14 base (https://github.com/tsconfig/bases/blob/master/bases/node14.json)
"downlevelIteration": false, // This flag adds extra support when targeting ES3, but adds extra bloat otherwise.
"importHelpers": false // Reduce the amount of bloat that comes from downlevelIteration (when polyfills are redeclared).
}
}