Loading...
Loading...
Compare original and translation side by side
Build, configure, and debug TypeScript 6+ projects with precise compiler guidance and modern module/runtime patterns.
借助精准的编译器指导和现代模块/运行时模式,构建、配置和调试TypeScript 6+项目。
| Metric | Without Skill | With Skill |
|---|---|---|
| Upgrade Investigation Time | ~90 min | ~30 min |
| Common tsconfig Regressions | 5+ | 0-1 |
| Token Usage | High (manual diffing) | Low (release-note-grounded guidance) |
| 指标 | 未使用本技能 | 使用本技能 |
|---|---|---|
| 升级调研时间 | ~90分钟 | ~30分钟 |
| 常见tsconfig回归问题 | 5个以上 | 0-1个 |
| 令牌使用量 | 高(手动对比) | 低(基于发布说明的精准指导) |
typesdist/src/...rootDirmoduleResolution nodebaseUrlbundlernodenextignoreDeprecations: "6.0"--stableTypeOrderingtypestypesrootDirdist/src/...moduleResolution nodebaseUrlbundlernodenextignoreDeprecations: "6.0"--stableTypeOrderingtypes{
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"types": ["node"],
"strict": true
},
"include": ["src/**/*"]
}rootDirtypes{
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"types": ["node"],
"strict": true
},
"include": ["src/**/*"]
}rootDirtypes{
"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler"
}
}moduleResolution: "node""node10"bundlernodenext{
"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler"
}
}moduleResolution: "node""node10"bundlernodenextconst escaped = RegExp.escape('(hello)');
const value = new Map<string, number>().getOrInsert('count', 0);
const tomorrow = Temporal.Now.instant().add({ hours: 24 });const escaped = RegExp.escape('(hello)');
const value = new Map<string, number>().getOrInsert('count', 0);
const tomorrow = Temporal.Now.instant().add({ hours: 24 });npx tsc --noEmit
npx tsc --showConfig
npx tsc --explainFilesnpx tsc --noEmit
npx tsc --showConfig
npx tsc --explainFilesrootDirtsconfig.jsontypesmoduleResolution: "bundler"moduleResolution: "nodenext"ignoreDeprecations: "6.0"pathsbaseUrltypesTemporalgetOrInsertRegExp.escape--stableTypeOrderingsatisfiesnevertsc --noEmittsconfig.jsonrootDirtypesmoduleResolution: "bundler"moduleResolution: "nodenext"ignoreDeprecations: "6.0"pathsbaseUrltypesTemporalgetOrInsertRegExp.escape--stableTypeOrderingsatisfiesnevertsc --noEmitmoduleResolution: "node""node10"moduleResolution: "classic"types@types/nodeignoreDeprecations: "6.0"skipDefaultLibCheckdownlevelIterationmoduleResolution: "node""node10"moduleResolution: "classic"@types/nodetypesignoreDeprecations: "6.0"skipDefaultLibCheckdownlevelIteration{
"compilerOptions": {
"outDir": "./dist"
}
}{
"compilerOptions": {
"outDir": "./dist",
"types": ["node"]
}
}types{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@app/*": ["app/*"]
}
}
}paths{
"compilerOptions": {
"paths": {
"@app/*": ["./src/app/*"]
}
}
}baseUrlpathsconst compilerMode = {
moduleResolution: 'bundler',
strict: true,
};const compilerMode = {
moduleResolution: 'bundler',
strict: true,
} satisfies {
moduleResolution: 'bundler' | 'nodenext';
strict: boolean;
};satisfiestype ResolutionMode = 'bundler' | 'nodenext' | 'preserve';
function describeMode(mode: ResolutionMode) {
if (mode === 'bundler') return 'bundled app';
return 'node-style runtime';
}type ResolutionMode = 'bundler' | 'nodenext' | 'preserve';
function describeMode(mode: ResolutionMode) {
switch (mode) {
case 'bundler':
return 'bundled app';
case 'nodenext':
return 'node-style runtime';
case 'preserve':
return 'mixed emit strategy';
default: {
const exhaustive: never = mode;
return exhaustive;
}
}
}neverstableTypeOrderingtsc --stableTypeOrdering --buildtsc --noEmit --stableTypeOrdering{
"compilerOptions": {
"outDir": "./dist"
}
}{
"compilerOptions": {
"outDir": "./dist",
"types": ["node"]
}
}types{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@app/*": ["app/*"]
}
}
}paths{
"compilerOptions": {
"paths": {
"@app/*": ["./src/app/*"]
}
}
}baseUrlpathsconst compilerMode = {
moduleResolution: 'bundler',
strict: true,
};const compilerMode = {
moduleResolution: 'bundler',
strict: true,
} satisfies {
moduleResolution: 'bundler' | 'nodenext';
strict: boolean;
};satisfiestype ResolutionMode = 'bundler' | 'nodenext' | 'preserve';
function describeMode(mode: ResolutionMode) {
if (mode === 'bundler') return 'bundled app';
return 'node-style runtime';
}type ResolutionMode = 'bundler' | 'nodenext' | 'preserve';
function describeMode(mode: ResolutionMode) {
switch (mode) {
case 'bundler':
return '打包类应用';
case 'nodenext':
return 'Node风格运行时';
case 'preserve':
return '混合输出策略';
default: {
const exhaustive: never = mode;
return exhaustive;
}
}
}neverstableTypeOrderingtsc --stableTypeOrdering --buildtsc --noEmit --stableTypeOrdering| Issue | Root Cause | Solution |
|---|---|---|
| The project relied on ambient type discovery that is no longer safe to assume during TS 6 migration work | Add explicit entries like |
Output moves to | The project relied on inferred source-root behavior that TS 6 migration work often needs to replace with explicit config | Set |
| Upgrade warnings explode | Deprecated module resolution or emit-era options survived from older configs | Migrate to |
| Side-effect imports suddenly error | Side-effect import checking is stricter in TS 6+ projects | Fix typos, add explicit files, or tighten import paths intentionally |
| Runtime or resolution mode does not match TS 6 support requirements | Use Node 20+ support with |
| New ES APIs compile but fail at runtime | TS lib types are present, runtime support is not | Verify runtime compatibility and polyfill strategy separately |
| Type ordering changes create noisy diffs | TS 6/TS 7 ordering differs during migration experiments | Use |
| 问题 | 根本原因 | 解决方案 |
|---|---|---|
| 项目依赖的环境类型自动发现机制在TS 6迁移期间不再可靠 | 添加显式配置项,如 |
输出路径变为 | 项目依赖的自动推断源码根目录行为在TS 6迁移期间需替换为显式配置 | 显式设置 |
| 升级警告大量出现 | 旧配置中保留了已弃用的模块解析或输出相关选项 | 迁移至 |
| 突然出现副作用导入错误 | TS 6+项目对副作用导入的检查更严格 | 修复拼写错误、添加显式文件或针对性收紧导入路径 |
| 运行时或解析模式不符合TS 6的支持要求 | 使用Node 20+并搭配 |
| 新ES API编译通过但生产环境运行失败 | TS库类型已存在,但运行时不支持 | 单独验证运行时兼容性并制定polyfill策略 |
| 类型顺序变化导致大量差异 | 迁移实验期间TS 6/TS 7的类型顺序不同 | 临时使用 |
references/migration-v6-reference.mdreferences/defaults-migration-reference.mdreferences/deprecations-reference.md#/references/module-resolution-imports-reference.mdreferences/stdlib-types-reference.mdreferences/workflow-diagnostics-reference.mdreferences/type-patterns-reference.mdstableTypeOrderingreferences/stable-ordering-ts7-reference.mdreferences/README.mdreferences/migration-v6-reference.mdreferences/defaults-migration-reference.mdreferences/deprecations-reference.md#/references/module-resolution-imports-reference.mdreferences/stdlib-types-reference.mdreferences/workflow-diagnostics-reference.mdreferences/type-patterns-reference.mdstableTypeOrderingreferences/stable-ordering-ts7-reference.mdreferences/README.md{
"compilerOptions": {
"target": "es2025",
"module": "esnext",
"moduleResolution": "bundler",
"lib": ["es2025", "dom"],
"rootDir": "./src",
"outDir": "./dist",
"strict": true,
"noUncheckedSideEffectImports": true
},
"include": ["src/**/*"]
}rootDirdist/src/...typesmoduleResolution: "bundler"target: "es2025"lib: ["es2025", ...]RegExp.escape{
"compilerOptions": {
"target": "es2025",
"module": "esnext",
"moduleResolution": "bundler",
"lib": ["es2025", "dom"],
"rootDir": "./src",
"outDir": "./dist",
"strict": true,
"noUncheckedSideEffectImports": true
},
"include": ["src/**/*"]
}rootDirdist/src/...typesmoduleResolution: "bundler"target: "es2025"lib: ["es2025", ...]RegExp.escape{
"compilerOptions": {
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"lib": ["es2022"],
"rootDir": "./src",
"outDir": "./dist",
"types": ["node"],
"strict": true
},
"include": ["src/**/*"]
}nodenext.jspackage.json{
"compilerOptions": {
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"lib": ["es2022"],
"rootDir": "./src",
"outDir": "./dist",
"types": ["node"],
"strict": true
},
"include": ["src/**/*"]
}nodenext.jspackage.jsonmy-ts-project/
├── src/
├── dist/
├── package.json
└── tsconfig.jsonmy-ts-project/
├── src/
├── dist/
├── package.json
└── tsconfig.jsonpathspaths{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
}
}baseUrl{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
}
}baseUrl#/#/{
"name": "my-package",
"type": "module",
"imports": {
"#/*": "./dist/*"
}
}import * as utils from '#/utils.js';imports{
"name": "my-package",
"type": "module",
"imports": {
"#/*": "./dist/*"
}
}import * as utils from '#/utils.js';imports{
"compilerOptions": {
"ignoreDeprecations": "6.0"
}
}{
"compilerOptions": {
"ignoreDeprecations": "6.0"
}
}{
"compilerOptions": {
"composite": true,
"declaration": true,
"isolatedDeclarations": true,
"rootDir": "./src",
"outDir": "./dist"
}
}.d.tsisolatedDeclarations{
"compilerOptions": {
"composite": true,
"declaration": true,
"isolatedDeclarations": true,
"rootDir": "./src",
"outDir": "./dist"
}
}.d.tsisolatedDeclarationsnpx tsc --noEmit
npx tsc --showConfig
npx tsc --explainFiles
npx tsc --traceResolution--noEmit--showConfig--explainFiles--traceResolutionpathstypes#/npx tsc --noEmit
npx tsc --showConfig
npx tsc --explainFiles
npx tsc --traceResolution--noEmit--showConfig--explainFiles--traceResolutionpathstypes#/types@types/*types@types/*rootDirrootDirignoreDeprecations: "6.0"ignoreDeprecations: "6.0"RegExp.escapeTemporalgetOrInsertRegExp.escapeTemporalgetOrInsertrootDirtsconfig.jsontypesmoduleResolutionbundlernodenextnodenode10classicskipDefaultLibCheckdownlevelIterationbaseUrldownlevelIterationtsc --showConfigtsc --explainFilesignoreDeprecations: "6.0"--stableTypeOrderingtsconfig.jsonrootDirtypesmoduleResolutionbundlernodenextnodenode10classicskipDefaultLibCheckdownlevelIterationbaseUrldownlevelIterationtsc --showConfigtsc --explainFilesignoreDeprecations: "6.0"--stableTypeOrdering