diff --git a/source/lib/compiler.ts b/source/lib/compiler.ts index 102a5a40..e92a7f5d 100644 --- a/source/lib/compiler.ts +++ b/source/lib/compiler.ts @@ -23,6 +23,7 @@ const expectErrordiagnosticCodesToIgnore = new Set([ DiagnosticCode.TypeDoesNotSatisfyTheConstraint, DiagnosticCode.GenericTypeRequiresTypeArguments, DiagnosticCode.ExpectedArgumentsButGotOther, + DiagnosticCode.ExpectedAtLeastArgumentsButGotOther, DiagnosticCode.NoOverloadExpectsCountOfArguments, DiagnosticCode.NoOverloadExpectsCountOfTypeArguments, DiagnosticCode.NoOverloadMatches, diff --git a/source/lib/interfaces.ts b/source/lib/interfaces.ts index a15c0f0d..5897922e 100644 --- a/source/lib/interfaces.ts +++ b/source/lib/interfaces.ts @@ -32,6 +32,7 @@ export enum DiagnosticCode { ArgumentTypeIsNotAssignableToParameterType = 2345, CannotAssignToReadOnlyProperty = 2540, ExpectedArgumentsButGotOther = 2554, + ExpectedAtLeastArgumentsButGotOther = 2555, TypeHasNoPropertiesInCommonWith = 2559, ValueOfTypeNotCallable = 2348, ExpressionNotCallable = 2349, diff --git a/source/test/fixtures/expect-error/values/index.d.ts b/source/test/fixtures/expect-error/values/index.d.ts index 938d95fe..7df40c61 100644 --- a/source/test/fixtures/expect-error/values/index.d.ts +++ b/source/test/fixtures/expect-error/values/index.d.ts @@ -13,6 +13,8 @@ export type HasKey = {[P in K]?: V}; export function getFoo>(obj: T): T['foo']; +export function atLeastOne(...expected: [unknown, ...Array]): void; + export interface Options {} export class MyClass {} diff --git a/source/test/fixtures/expect-error/values/index.test-d.ts b/source/test/fixtures/expect-error/values/index.test-d.ts index 16d6ee62..9c9bbd1b 100644 --- a/source/test/fixtures/expect-error/values/index.test-d.ts +++ b/source/test/fixtures/expect-error/values/index.test-d.ts @@ -1,5 +1,5 @@ import {expectError} from '../../../..'; -import {default as one, foo, getFoo, HasKey, hasProperty, MyClass, Options} from '.'; +import {default as one, atLeastOne, foo, getFoo, HasKey, hasProperty, MyClass, Options} from '.'; expectError(1); expectError('fo'); @@ -21,6 +21,8 @@ expectError(one(1)); expectError(one(1, 2, 3)); expectError({} as Options); +expectError(atLeastOne()) + expectError(getFoo({bar: 1} as HasKey<'bar'>)); const bar = 1;