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

error TS2510: Base constructors must all have the same return type. #437

Closed
1 of 5 tasks
devfacet opened this issue Dec 6, 2023 · 3 comments · Fixed by #451
Closed
1 of 5 tasks

error TS2510: Base constructors must all have the same return type. #437

devfacet opened this issue Dec 6, 2023 · 3 comments · Fixed by #451
Labels
bug Something isn't working

Comments

@devfacet
Copy link

devfacet commented Dec 6, 2023

System Info

Node: v20.9.0
tsc: The TypeScript Compiler - Version 5.2.2

Environment/Platform

  • Website/web-app
  • Browser extension
  • Server-side (e.g., Node.js, Deno, Bun)
  • Desktop app (e.g., Electron)
  • Other (e.g., VSCode extension)

Description

I've been building my app with tsc for quite a while. Today, I tried to upgrade @xenova/transformers from 2.7.0 to 2.10.1 but if tailed due to the error below. 2.8.0 works fine, but it doesn't work 2.9.0 and afterward.

Reproduction

npm install @xenova/[email protected]
echo "import { pipeline, Pipeline } from '@xenova/transformers'" > index.ts
tsc index.ts
node_modules/@xenova/transformers/types/utils/tensor.d.ts:75:29 - error TS2510: Base constructors must all have the same return type.

75 export class Tensor extends Tensor_base {
                               ~~~~~~~~~~~
Found 1 error in node_modules/@xenova/transformers/types/utils/tensor.d.ts:75
@devfacet devfacet added the bug Something isn't working label Dec 6, 2023
@kungfooman
Copy link
Contributor

Hey @devfacet, thank you for the issue!

I have a feeling this is because ONNXRuntime is exporting Tensor twice:

node_modules/onnxruntime-common/dist/lib/tensor.d.ts

/**
 * Represent multi-dimensional arrays to feed to or fetch from model inferencing.
 */
export interface Tensor extends TypedTensorBase<Tensor.Type>, TypedTensorUtils<Tensor.Type> {
}

And:

export declare const Tensor: TensorConstructor;

As long as there is no fix, you can always use: tsc index.ts --skipLibCheck

@parhammmm
Copy link

just a note it's happening inside https://github.com/run-llama/LlamaIndexTS as well, ran into it today

xenova added a commit that referenced this issue Dec 12, 2023
* Do not extend from ONNX tensor (fix #437)

* Fix typing issues

* Typing improvements

* Apply suggestions

* Update tensor import type
@devfacet
Copy link
Author

🎉 Thank you, I can't wait for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants