tsconfig:
{
"compilerOptions": {
"target": "ES2019",
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"module": "CommonJS",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"outDir": "./../server-build"
},
"include": ["./"]
}
global.d.ts
declare module NodeJS {
interface Process {
pkg: undefined | boolean;
}
}
Error after upgrading to [email protected]:
[ERROR] 12:38:30 ⨯ Unable to compile TypeScript:
server/util.ts:14:15 - error TS2339: Property 'pkg' does not exist on type 'Process'.
14 if (process.pkg) {
~~~
When installing the previous version everything works as expected (npm install -D -E [email protected])
There actually was a bug in ts-node-dev which made it work slower because --files was true by default.
Read the docs of ts-node.
https://github.com/TypeStrong/ts-node#help-my-types-are-missing
global.d.ts should be in typeRoots for ts-node (ts-node-dev) to see it without --files
@whitecolor Thanks for the information!
I solved it the following way: https://github.com/dungeon-revealer/dungeon-revealer/pull/577
More context can be found here: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
A types package is a folder with a file called index.d.ts or a folder with a package.json that has a types field.
This broke our build as well. In our case, since we had a module definition, we had to use
"compilerOptions": {
"baseUrl": ".",
"paths": {
"{module-name}": [
"src/types/{filename}.d.ts"
]
}
}
Maybe it can be pointed out somewhere in the readme? I'd say it belongs to release notes but I cannot find any...
Most helpful comment
@whitecolor Thanks for the information!
I solved it the following way: https://github.com/dungeon-revealer/dungeon-revealer/pull/577
More context can be found here: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html