Open mabasic opened 5 months ago
Yes it seems so
I'm not entirely sure why (I'm a bit rusted on node + TS ecosystem since I mainly use TS runtimes now) but after generating types declarations with tsc mod.ts --declaration --emitDeclarationOnly --target esnext --allowImportingTsExtensions --moduleResolution bundler
to create mod.d.ts
and referencing the "types": "mod.d.ts"
field in package.json
, it is still unable to refer back to types
However I noticed that sometimes deleting the node_modules
and reinstalling deps seems to prevent the error you mentionned from occured, but I'm not sure exactly why
If you bundle the .d.ts
files and point to the types from the package.json it should work.
E.g.
"exports": {
"import": {
"types": "./src/core/main.d.mts",
"default": "./src/core/main.mjs"
},
},
As a workaround you can use JSR @mabasic:
First add @jsr:registry=https://npm.jsr.io
to .npmrc
and then install with npm install @jsr/libs__xml
.
The workaround does not work for me. I still get the same error:
> npm install @jsr/libs__xml
npm error Cannot read properties of null (reading 'matches')
@mabasic did you edit .npmrc?
@mabasic did you edit .npmrc?
Yes
Got it now to work, forgot to use pnpm since that is what I use xd.
pnpx jsr add @lib/xml
- this will add the missing line about jsr to the .npmrc
file and failpnpm install @jsr/libs__xml
But still, I should be able to use @lowlighter/xml
package from npm with types.
This whole process feels very hacky atm.
I am using the library in Node with Typescript, but don't see types.
I have tried using
but the command fails: