-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtsconfig.json
More file actions
106 lines (86 loc) · 4.11 KB
/
Copy pathtsconfig.json
File metadata and controls
106 lines (86 loc) · 4.11 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{
"compilerOptions": {
// Allow default imports from CommonJS / non-ESM modules at the type level
// This does NOT change emitted JavaScript
"allowSyntheticDefaultImports": true,
// Do not include or type-check .js/.jsx files in the TypeScript program
// Keeps the project strictly TypeScript-only
"allowJs": false,
// Use the React 17+ automatic JSX runtime
// Eliminates the need to import React in JSX files
"jsx": "react-jsx",
// Skip type-checking of declaration files (*.d.ts)
// Improves build performance in large projects
"skipLibCheck": true,
// // Base directory for resolving non-relative imports
// // Required for path alias configuration via "paths"
// "baseUrl": "./",
// Enforce consistent casing in import paths
// Prevents runtime issues on case-sensitive file systems (Linux, CI)
"forceConsistentCasingInFileNames": true,
// Specify built-in library type definitions
// DOM: Browser APIs (window, document, etc.)
// DOM.Iterable: Enables iteration over DOM collections
// ES2022: Built-in JavaScript APIs available in ES2022
// Note: ES2023 can be enabled when all tooling supports it
"lib": ["DOM", "DOM.Iterable", "ES2022"],
// JavaScript version to emit
// ES2022 supports features such as class fields and top-level await
"target": "ES2022",
// Emit native ES module syntax (import/export)
// Module transformation is handled by the bundler or runtime
"module": "ESNext",
// Module resolution strategy optimized for modern bundlers (Vite, Webpack, Rollup)
// Respects package.json "exports"/"imports" fields
// Does NOT require explicit file extensions in relative imports
"moduleResolution": "Bundler",
// Improve interoperability between CommonJS and ES Modules
// Affects emitted JavaScript and enables natural default imports
"esModuleInterop": true,
// Report errors when variables or parameters implicitly have type 'any'
// Helps catch missing or incomplete typings early
"noImplicitAny": true,
// // Preserve const enum declarations in emitted JavaScript
// // Prevents inlining so enums exist at runtime
// // May increase bundle size and reduce tree-shaking
// "preserveConstEnums": true,
// Remove all comments from emitted JavaScript
// Reduces output size for production builds
"removeComments": true,
// Do not generate source map files
// Disabling source maps reduces build output size
"sourceMap": false,
// Allow importing JSON files as modules
// Example: import config from './config.json'
"resolveJsonModule": true,
"strict": false,
// Explicit directories to search for global type definitions
// NOTE: When specified, TypeScript ONLY searches these directories
"typeRoots": [
"./src/types", // Project-specific global typings
"./node_modules/@types" // Third-party typings from DefinitelyTyped
],
// Path aliases for cleaner, more maintainable imports
// Must be mirrored in bundler and test runner configuration
"paths": {
"@components/*": ["./src/components/*"],
"@constants/*": ["./src/constants/*"],
"@contexts/*": ["./src/contexts/*"],
"@hooks/*": ["./src/hooks/*"],
"@services/*": ["./src/services/*"],
"@store/*": ["./src/store/*"],
"@styles/*": ["./src/style/*"],
"@typings/*": ["./src/types/*"],
"@utils/*": ["./src/utils/*"]
}
},
// Files and directories excluded from compilation
"exclude": [
"node_modules", // Dependency packages (excluded by default, listed explicitly)
"typings" // Legacy or external typings not part of this project
],
// Files included in compilation
"include": [
"./src/**/*" // All TypeScript and TSX files under src
]
}