Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typescript types for ESM #964

Closed
tobowers opened this issue Feb 13, 2024 · 4 comments
Closed

typescript types for ESM #964

tobowers opened this issue Feb 13, 2024 · 4 comments

Comments

@tobowers
Copy link

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)
@iAmmar7
Copy link
Collaborator

iAmmar7 commented Feb 13, 2024

Please write the steps to reproduce this error.

@tobowers
Copy link
Author

It’s literally just “use esm” https://github.com/tobowers/demo-broken-signal-wire

@iAmmar7
Copy link
Collaborator

iAmmar7 commented Apr 16, 2024

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;

  1. Use the ESNext module which is compatible with NodeJS environments.
{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "esModuleInterop": true,
    "moduleResolution": "Node",
    ...
  },
  ...
}
  1. 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"
      ]
    },
    ...
  },
  ...
}

@iAmmar7
Copy link
Collaborator

iAmmar7 commented Oct 31, 2024

Closing this one, the fixed should be there in the latest version of the Realtime SDK.

@iAmmar7 iAmmar7 closed this as completed Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants