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

"new GPUInternalError(...)" should return type GPUInternalError #108

Closed
mattsoulanille opened this issue Oct 18, 2022 · 2 comments · Fixed by #110
Closed

"new GPUInternalError(...)" should return type GPUInternalError #108

mattsoulanille opened this issue Oct 18, 2022 · 2 comments · Fixed by #110

Comments

@mattsoulanille
Copy link

GPUInternalError's new function / constructor is defined without a return type, so it defaults to any. Should this return type be the GPUInternalError interface instead?

interface GPUInternalError
  extends GPUError {
  /**
   * Nominal type branding.
   * https://github.com/microsoft/TypeScript/pull/33038
   * @internal
   */
  readonly __brand: "GPUInternalError";
}

declare var GPUInternalError: {
  prototype: GPUInternalError;
  new (
    message: string
  );
};

Proposed change:

...
declare var GPUInternalError: {
  prototype: GPUInternalError;
  new (
    message: string
  ): GPUInternalError; // <--- This right here.
};

I'd send a PR, but if I understand correctly, this file is generated.

@kainino0x
Copy link
Collaborator

Thanks for the report!

There's an upstream bug here:
darionco/bikeshed-to-ts#11

But we can also maintain this as a manual diff in the types. They're partially generated, but not fully. I think we already have this manual edit for several other constructors. I can go ahead and add it.

@kainino0x
Copy link
Collaborator

published 0.1.23

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