Skip to content

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 <[email protected]>
Signed-off-by: Matteo Collina <[email protected]>
@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
@sindresorhus
Copy link
Collaborator

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