Skip to content

Commit

Permalink
added in final test case
Browse files Browse the repository at this point in the history
  • Loading branch information
aditi-khare-mongoDB committed Mar 20, 2024
1 parent 366eee9 commit 1fb2009
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/types/helper_types.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ expectAssignable<OnlyFieldsOfType<{ a: number; b: string }, number>>({ a: 2 });
expectAssignable<OnlyFieldsOfType<{ a: number; b: string }, string>>({ b: 'hello' });
expectAssignable<OnlyFieldsOfType<{ a: number; b: string }, string, boolean>>({ b: true });

// test the case in which AssignableType does not inherit from FieldType, and AssignableType is provided
expectAssignable<OnlyFieldsOfType<any, string, boolean>>({ b: false });

// test generic schema, essentially we expect nearly no safety here
expectAssignable<OnlyFieldsOfType<Document, NumericType | undefined>>({ someKey: 2 });
// We can still at least enforce the type that the keys map to
Expand Down

0 comments on commit 1fb2009

Please sign in to comment.