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

dist/**/*.d.ts files appear to be incorrect #14

Closed
mflorence99 opened this issue Oct 24, 2023 · 6 comments · Fixed by #16
Closed

dist/**/*.d.ts files appear to be incorrect #14

mflorence99 opened this issue Oct 24, 2023 · 6 comments · Fixed by #16
Assignees

Comments

@mflorence99
Copy link

Version: 3.0.0

Consider line #1 in dist/services/files/index.d.ts:

import { BaseService } from "@/services/base";

Within the assemblyai project itself, paths beginning with @/... are resolved via its tsconfig.json settings. However, when user code imports the library, the following error (and many similar) is generated:

Cannot find module '@/services/base' or its corresponding type declarations.

Usage instructions in the README do not explain how to overcome these errors. What code or config changes are necessary?

@Swimburger
Copy link
Contributor

Can you show me how you're using the module? I'll try to reproduce the issue.

@Swimburger Swimburger self-assigned this Oct 24, 2023
@mflorence99
Copy link
Author

Many thanks. Here's some minimal repro code. You can run it as follows:

npm i
npm run build

You should see a large number of errors like this:

node_modules/assemblyai/dist/services/files/index.d.ts:1:29 - 
  error TS2307: Cannot find module '@/services/base' or its corresponding type declarations.

package.json

{
  "scripts": {
    "build": "tsc -p tsconfig.json"
  },
  "dependencies": {
    "@types/node": "^20.8.8",
    "assemblyai": "^3.0.0",
    "typescript": "^5.2.2"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "lib": ["es2022", "dom"],
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "./build",
    "target": "es2022"
  },
  "include": ["./**/*.ts"]
}

test.ts

import { AssemblyAI } from "assemblyai";

const client = new AssemblyAI({ apiKey: "xxx" });

@Swimburger
Copy link
Contributor

Thanks, I can reproduce the issue. We've been using the module with other build tools, tsx, etc. which didn't reported issues like this.
There are some modules that can help you fix this, and some modules that we could add to our build system that could fix this.
However, it's easy enough for use to remove all the @/ references and replace them with relative references, so I'll stick to the simplest solution here.

@mflorence99
Copy link
Author

Great news, many thanks!

@Swimburger
Copy link
Contributor

@mflorence99 Version 3.0.1 fixed your issue. Let us know if you have any issues!

@mflorence99
Copy link
Author

I can confirm that the fix works. Many thanks!

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

Successfully merging a pull request may close this issue.

2 participants