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

Add ts2719 to known errors #220

Merged
merged 3 commits into from
Sep 4, 2024

Conversation

mcollina
Copy link
Contributor

@mcollina mcollina commented Sep 4, 2024

I had found something like:

interface T { }
declare const a: T;
expectError(class Foo<T> {
  x: T;
  constructor(a: T) {
    this.x = a;
  }
  fn() {
    this.x = a;
  }
})

Would generate:

  index.test-d.ts:11:4
  ✖   5:0  Found an error that tsd does not currently support (ts2719), consider creating an issue on GitHub.                                                                       
  ✖  11:4  Type T is not assignable to type T. Two different types with this name exist, but they are unrelated.
  T could be instantiated with an arbitrary type which could be unrelated to T.

  2 errors

Originally found at https://github.com/fastify/fastify/actions/runs/10696978690/job/29653469150?pr=5660#step:5:12 as

 test/types/instance.test-d.ts:374:2
  ✖  373:0  Found an error that tsd does not currently support (ts2719), consider creating an issue on GitHub.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
  ✖  374:2  Type (this: import("/home/runner/work/fastify/fastify/types/instance").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, { new (req: import("http").IncomingMessage): import("http").ServerResponse<import("http").IncomingMessage>; prototype: import("http").ServerResponse<any>; ... 29 more ...; Ev... is not assignable to type (this: import("/home/runner/work/fastify/fastify/types/instance").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, { new (req: import("http").IncomingMessage): import("http").ServerResponse<import("http").IncomingMessage>; prototype: import("http").ServerResponse<any>; ... 29 more ...; Ev.... Two different types with this name exist, but they are unrelated.
  Type boolean is not assignable to type string.  
  ✖  421:0  Found an error that tsd does not currently support (ts2719), consider creating an issue on GitHub.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
  ✖  422:2  Type (this: import("/home/runner/work/fastify/fastify/types/instance").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, { new (req: import("http").IncomingMessage): import("http").ServerResponse<import("http").IncomingMessage>; prototype: import("http").ServerResponse<any>; ... 29 more ...; Ev... is not assignable to type (this: import("/home/runner/work/fastify/fastify/types/instance").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, { new (req: import("http").IncomingMessage): import("http").ServerResponse<import("http").IncomingMessage>; prototype: import("http").ServerResponse<any>; ... 29 more ...; Ev.... Two different types with this name exist, but they are unrelated.
  Type string is not assignable to type boolean.  

This adds it to the diagnostics codes.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
@sindresorhus sindresorhus changed the title Handle ts2719 Add ts2719 to known errors (#216) Sep 4, 2024
@sindresorhus sindresorhus changed the title Add ts2719 to known errors (#216) Add ts2719 to known errors Sep 4, 2024
@sindresorhus sindresorhus merged commit 0660059 into tsdjs:main Sep 4, 2024
4 checks passed
@sindresorhus
Copy link
Collaborator

@mcollina mcollina deleted the two-different-types-same-name branch September 4, 2024 17:26
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 this pull request may close these issues.

2 participants