示例工程 16-js-to-ts-migration
16-js-to-ts-migration/04-strict-migration/README.md
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
# 04 · strict-migration
**演示**:同一份迁移前代码在非严格配置下通过、在 `strict` 下报 `TS7006`;逐级收紧是可行的迁移路径。
**运行**:在 `tutorials/typescript` 下执行 `npm run build`,再执行 `npm run serve`,打开
`http://localhost:8080/examples/16-js-to-ts-migration/04-strict-migration/`;开 Console。
**预期控制台输出**:
```text
6
```
**类型检查**:`node node_modules/typescript/bin/tsc -p examples/16-js-to-ts-migration/04-strict-migration/tsconfig.types.json`
**预期类型错误**(`demo/legacy.ts`,由 `tsconfig.fail-strict.json` 触发):
```text
demo/legacy.ts(2,27): error TS7006: Parameter 'values' implicitly has an 'any' type.
```
**注意**:`tsconfig.legacy.json` 故意关掉 `strict`,用来演示「先让它编过,再逐目录收紧」。