Skip to content

Commit 1fb2009

Browse files
added in final test case
1 parent 366eee9 commit 1fb2009

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/types/helper_types.test-d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ expectAssignable<OnlyFieldsOfType<{ a: number; b: string }, number>>({ a: 2 });
6969
expectAssignable<OnlyFieldsOfType<{ a: number; b: string }, string>>({ b: 'hello' });
7070
expectAssignable<OnlyFieldsOfType<{ a: number; b: string }, string, boolean>>({ b: true });
7171

72+
// test the case in which AssignableType does not inherit from FieldType, and AssignableType is provided
73+
expectAssignable<OnlyFieldsOfType<any, string, boolean>>({ b: false });
74+
7275
// test generic schema, essentially we expect nearly no safety here
7376
expectAssignable<OnlyFieldsOfType<Document, NumericType | undefined>>({ someKey: 2 });
7477
// We can still at least enforce the type that the keys map to

0 commit comments

Comments
 (0)