signalwire-js
signalwire-js copied to clipboard
typescript types for ESM
I'm getting this error when adding the realtime sdk
Could not find a declaration file for module '@signalwire/realtime-api'. '/code/speedrun-demo/node_modules/@signalwire/realtime-api/dist/index.node.mjs' implicitly has an 'any' type.
There are types at '/code/speedrun-demo/node_modules/@signalwire/realtime-api/dist/realtime-api/src/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@signalwire/realtime-api' library may need to update its package.json or typings.ts(7016)
Please write the steps to reproduce this error.
It’s literally just “use esm” https://github.com/tobowers/demo-broken-signal-wire
This issue originated due to the TS upgrade and it will be fixed in the next release of our realtime-api SDK.
In the meantime, if you are blocked, there are two ways to fix it temporarily;
- Use the ESNext module which is compatible with NodeJS environments.
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"esModuleInterop": true,
"moduleResolution": "Node",
...
},
...
}
- Explicitly specify the types path in the tsconfig;
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"esModuleInterop": true,
"moduleResolution": "NodeNext",
"paths": {
"@signalwire/realtime-api": [
"path_to_your_node_modules/@signalwire/realtime-api/dist/realtime-api/src/index.d.ts"
]
},
...
},
...
}
Closing this one, the fixed should be there in the latest version of the Realtime SDK.