tsdjs / tsd

Check TypeScript type definitions
MIT License
2.36k stars 68 forks source link

`expectError` finds none, and finds an error... for the same invocation. #170

Closed igalklebanov closed 1 year ago

igalklebanov commented 1 year ago

This one is weird.

expectError is not finding an error & finding an error for the same check.

  test/typings/test-d/update.test-d.ts:42:43
  ✖  42:2   Expected an error, but found none.                                                                                                                                                                                                                                                                                                                                                                                                                                          
  ✖  42:43  Argument of type { readonly first_name: "John"; readonly dinosaurs?: string[]; } is not assignable to parameter of type PickWith<{ readonly first_name: "John"; readonly dinosaurs?: string[]; }, MutationObject<From<Database, "person">, "person", "person">> with exactOptionalPropertyTypes: true. Consider adding undefined to the types of the target's properties.
  Types of property dinosaurs are incompatible.
    Type string[] is not assignable to type never.  

  2 errors

https://github.com/igalklebanov/kysely/blob/tighten-input-objects/test/typings/test-d/update.test-d.ts

also happens after updating tsd to 0.24.1.

removing exactOptionalPropertyTypes: true from test/typings/tsconfig.json makes it pass all tests.

tommy-mitchell commented 1 year ago

This is because tsd doesn't currently support checking for that error (similar to #173). The first error message is because tsd didn't find any errors that it recognizes, and the second is an error reported by the TypeScript compiler that tsd just outputs.

The first error could have a more descriptive message. Related discussion in #177.