Skip to content

Commit

Permalink
fix: ignore Expected at least arguments error
Browse files Browse the repository at this point in the history
  • Loading branch information
mrazauskas authored and BendingBender committed Oct 12, 2021
1 parent 208b2d2 commit 293ff33
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions source/lib/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const expectErrordiagnosticCodesToIgnore = new Set<DiagnosticCode>([
DiagnosticCode.TypeDoesNotSatisfyTheConstraint,
DiagnosticCode.GenericTypeRequiresTypeArguments,
DiagnosticCode.ExpectedArgumentsButGotOther,
DiagnosticCode.ExpectedAtLeastArgumentsButGotOther,
DiagnosticCode.NoOverloadExpectsCountOfArguments,
DiagnosticCode.NoOverloadExpectsCountOfTypeArguments,
DiagnosticCode.NoOverloadMatches,
Expand Down
1 change: 1 addition & 0 deletions source/lib/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export enum DiagnosticCode {
ArgumentTypeIsNotAssignableToParameterType = 2345,
CannotAssignToReadOnlyProperty = 2540,
ExpectedArgumentsButGotOther = 2554,
ExpectedAtLeastArgumentsButGotOther = 2555,
TypeHasNoPropertiesInCommonWith = 2559,
ValueOfTypeNotCallable = 2348,
ExpressionNotCallable = 2349,
Expand Down
2 changes: 2 additions & 0 deletions source/test/fixtures/expect-error/values/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export type HasKey<K extends string, V = unknown> = {[P in K]?: V};

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

export function atLeastOne(...expected: [unknown, ...Array<unknown>]): void;

export interface Options<T> {}

export class MyClass {}
4 changes: 3 additions & 1 deletion source/test/fixtures/expect-error/values/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -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<string>(1);
expectError<string>('fo');
Expand All @@ -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;
Expand Down

0 comments on commit 293ff33

Please sign in to comment.