Closed FlorianSW closed 3 months ago
I have an ESM project using the gamedig types and it builds fine atm (node 20 / TS 5) :shipit:
The tsconfig:
{
"compilerOptions": {
"baseUrl": ".",
"rootDir": "./src",
"outDir": "./dist",
"lib": [
"es2020"
],
"module": "esnext",
"target": "es2019",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"moduleResolution": "node"
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules"
]
}
Here is the source for the package.json file the error refers to:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/gamedig/package.json
but you should check the referenced _'<...>/workspace/discord-player-count-bot/nodemodules/@types/gamedig/index.d.ts' file maybe. Other then trying to delete the node_modules + package-lock and reinstalling. 🤷♂️
Update:
according to this issue: https://github.com/microsoft/TypeScript/issues/52363
moduleResolution: node16
is the problem and the types need some fixing: https://arethetypeswrong.github.io/?p=gamedig%405.0.0
will take a look at this over the weekend.
The fix is editing the imported modules package json to show:
"exports": {
".": {
"import": {
"types": "./index.d.ts",
"default": "./index.js"
},
"require": {
"types": "./index.d.cts",
"default": "./index.cjs"
}
}
},
After that it lets me build with "moduleResolution": "node16"
, while whithout it i get the same error.
@FlorianSW i submitted a PR to definetly typed, hopefully this gets added soon, then you should be good to go. https://github.com/DefinitelyTyped/DefinitelyTyped/pull/69767
Updates are merged upstream, so this should be fixed now :shipit:
Updates are merged upstream, so this should be fixed now :shipit:
Awesome :) I just tested it and now the types are recognized and uses, just as one would expect. Big thanks for your fast update :)
Kudos for @a-sync for maintaining the type bindings (:
Describe the bug Using the latest
gamedig
and@types/gamedig
packages in my project, I get the following TypeScript compile error:This is my package.json
And my tsconfig.json:
When switching to
commonjs
, typings work fine, however, this is not really an option for me here. Tbh, I don't have a direct clue on what is wrong here, is it a configuration error on my side? Or are the types not working with modules?