Jim*_*ahy 6 typescript github-actions
通过actDocker 在本地测试 github-actions 时,我在 github-action 工作流程中遇到了各种 TS 错误(TS2345、TS18046、TS2339 等...)。在本地开发期间不会观察到这些错误,并且tsc -p tsconfig.build.json在本地计算机上运行会导致编译成功。
github-action 正在运行ubuntu-latest,我已确认运行器已配置为使用与本地版本相同的节点、npm、yarn 和 tsc 版本。
v18.13.0v8.19.31.22.19v4.9.4此外,我已经确认 TSC 在 github-action 期间使用的配置与我的本地配置相同(来自 的输出tsc --showConfig,比较本地和 github-action 的差异)。使用 github-action 中的相同 docker 容器,我可以访问终端并运行相同的命令,而不会看到错误。
鉴于节点、npm、yarn 和 tsc 版本在我的本地和 github-action 中是相同的,什么可能导致这种不同的行为?
tsconfig.json
{
"compilerOptions": {
"rootDir": "./src",
"module": "commonjs",
"declaration": false,
"noImplicitAny": false,
"skipLibCheck": true,
"removeComments": true,
"noLib": false,
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"target": "ES2021",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "src",
"incremental": true,
"strictNullChecks": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"],
"paths": {
"@module": ["src/module"]
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1793 次 |
| 最近记录: |