Skip to content

Commit

Permalink
disallow .not and .branded together
Browse files Browse the repository at this point in the history
  • Loading branch information
mmkal committed Oct 3, 2023
1 parent cdeac9c commit cf38918
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,6 @@ export interface NegativeExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
key: K,
...MISMATCH: MismatchArgs<Extends<K, keyof Actual>, false>
) => true

branded: {
toEqualTypeOf: <Expected>(
...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>
) => true
}
}

export type ExpectTypeOf<Actual, Options extends {positive: boolean}> = Options['positive'] extends true
Expand Down
6 changes: 6 additions & 0 deletions test/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ test('Distinguish between functions whose return types differ by readonly prop',
expectTypeOf<typeof original>().toEqualTypeOf<typeof different>()
// @ts-expect-error
expectTypeOf(original).toEqualTypeOf(different)

// not and branded can't be combined
// @ts-expect-error
expectTypeOf<{}>().not.branded
// @ts-expect-error
expectTypeOf<{}>().branded.not
})

test('Distinguish between classes with only private properties', () => {
Expand Down

0 comments on commit cf38918

Please # to comment.