nickbabcock / jomini

Parses Paradox files into javascript objects
MIT License
78 stars 9 forks source link

Incorrect types for slim package export #91

Closed nickbabcock closed 1 year ago

nickbabcock commented 1 year ago

Importing from jomini/slim results in type errors or resolves to the any type (it's not clear why there's a different in resolved type).

Updating module and moduleResolution to Node16, and updating imports to include js file extension seems to fix the problem by having jomini create type declaration files that also have imports with file extensions. But this seems highly specific to esm, and I still want to support commonjs and other environments that don't use Node16 module resolution.

And I tried something like:

"typesVersions": {
  "*": {
    "slim": [
      "./dist/cjs-slim/index-slim.d.ts"
    ]
  }
},

But that didn't solve the issue and I don't know why 🤷

The temporary solution is to create a declaration file like custom.d.ts with the following in downstream projects:

declare module "jomini/slim" {
  export * from "jomini";
}