Repo guidance: Recommended tsconfig settings
These settings help Cloudpack transpile packages in isolation and keep source consistent.
| Setting | Required | Why |
|---|---|---|
isolatedModules | Yes | Ensures code can be transpiled file-by-file; bans patterns requiring cross-file analysis. Alternatively, use lint rules for gradual migration. |
forceConsistentCasingInFileNames | Yes | Prevents case-related resolution bugs across OSes. |
esModuleInterop | Yes | Enforce CJS ↔ ESM interop syntax which is consistent with the ES module spec--see ES module info for context. (allowSyntheticDefaultImports is automatically enabled by this setting.) |
moduleResolution = bundler | Recommended | Enforces respect for exports maps and discourages deep imports. |
target >= ES2022 | Recommended | Smaller output; avoids downleveling newer syntax. |
module = NodeNext | Recommended | Aligns the TypeScript compiler's behavior with Node.js's native ESM support. |
verbatimModuleSyntax | Recommended | Preserve non-type imports even if they're only used as types, to ensure consistent output between TS and Cloudpack bundlers. |
Example snippet:
jsonc
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "bundler",
"isolatedModules": true,
"verbatimModuleSyntax": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"verbatimModuleSyntax": true,
},
}