Skip to content

Commit 293ff33

Browse files
mrazauskasBendingBender
authored andcommittedOct 12, 2021
fix: ignore Expected at least arguments error
1 parent 208b2d2 commit 293ff33

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed
 

‎source/lib/compiler.ts

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const expectErrordiagnosticCodesToIgnore = new Set<DiagnosticCode>([
2323
DiagnosticCode.TypeDoesNotSatisfyTheConstraint,
2424
DiagnosticCode.GenericTypeRequiresTypeArguments,
2525
DiagnosticCode.ExpectedArgumentsButGotOther,
26+
DiagnosticCode.ExpectedAtLeastArgumentsButGotOther,
2627
DiagnosticCode.NoOverloadExpectsCountOfArguments,
2728
DiagnosticCode.NoOverloadExpectsCountOfTypeArguments,
2829
DiagnosticCode.NoOverloadMatches,

‎source/lib/interfaces.ts

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export enum DiagnosticCode {
3232
ArgumentTypeIsNotAssignableToParameterType = 2345,
3333
CannotAssignToReadOnlyProperty = 2540,
3434
ExpectedArgumentsButGotOther = 2554,
35+
ExpectedAtLeastArgumentsButGotOther = 2555,
3536
TypeHasNoPropertiesInCommonWith = 2559,
3637
ValueOfTypeNotCallable = 2348,
3738
ExpressionNotCallable = 2349,

‎source/test/fixtures/expect-error/values/index.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export type HasKey<K extends string, V = unknown> = {[P in K]?: V};
1313

1414
export function getFoo<T extends HasKey<'foo'>>(obj: T): T['foo'];
1515

16+
export function atLeastOne(...expected: [unknown, ...Array<unknown>]): void;
17+
1618
export interface Options<T> {}
1719

1820
export class MyClass {}

‎source/test/fixtures/expect-error/values/index.test-d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {expectError} from '../../../..';
2-
import {default as one, foo, getFoo, HasKey, hasProperty, MyClass, Options} from '.';
2+
import {default as one, atLeastOne, foo, getFoo, HasKey, hasProperty, MyClass, Options} from '.';
33

44
expectError<string>(1);
55
expectError<string>('fo');
@@ -21,6 +21,8 @@ expectError(one(1));
2121
expectError(one(1, 2, 3));
2222
expectError({} as Options);
2323

24+
expectError(atLeastOne())
25+
2426
expectError(getFoo({bar: 1} as HasKey<'bar'>));
2527

2628
const bar = 1;

0 commit comments

Comments
 (0)
Please sign in to comment.