Skip to content

Repo guidance: Recommended tsconfig settings

These settings help Cloudpack transpile packages in isolation and keep source consistent.

SettingRequiredWhy
isolatedModulesYesEnsures code can be transpiled file-by-file; bans patterns requiring cross-file analysis. Alternatively, use lint rules for gradual migration.
forceConsistentCasingInFileNamesYesPrevents case-related resolution bugs across OSes.
esModuleInteropYesEnforce 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 = bundlerRecommendedEnforces respect for exports maps and discourages deep imports.
target >= ES2022RecommendedSmaller output; avoids downleveling newer syntax.
module = NodeNextRecommendedAligns the TypeScript compiler's behavior with Node.js's native ESM support.
verbatimModuleSyntaxRecommendedPreserve 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,
  },
}