diff --git a/src/index.ts b/src/index.ts index 2e4532b..f936b4e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -143,7 +143,7 @@ export interface ExpectTypeOf { ? never : ExpectTypeOf : never - not: ExpectTypeOf> + not: Omit>, 'not'> } const fn: any = () => true diff --git a/test/types.test.ts b/test/types.test.ts index 9e69af1..11fbe9b 100644 --- a/test/types.test.ts +++ b/test/types.test.ts @@ -70,6 +70,11 @@ test(`never types don't sneak by`, () => { expectTypeOf().toMatchTypeOf<{foo: string}>() }) +test('not cannot be chained', () => { + // @ts-expect-error + expectTypeOf().not.not.toBeNumber() +}) + test('constructor params', () => { // The built-in ConstructorParameters type helper fails to pick up no-argument overloads. // This test checks that's still the case to avoid unnecessarily maintaining a workaround,