types icon indicating copy to clipboard operation
types copied to clipboard

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

Open mattsoulanille opened this issue 3 years ago • 0 comments

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.

mattsoulanille avatar Oct 18 '22 21:10 mattsoulanille