Skip to content

Commit

Permalink
Add diagnostic for TS error 2707 (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy-mitchell committed Mar 6, 2023
1 parent 2519573 commit 114db77
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
Expand Up @@ -22,6 +22,7 @@ const expectErrordiagnosticCodesToIgnore = new Set<DiagnosticCode>([
DiagnosticCode.TypeIsNotAssignableToOtherType,
DiagnosticCode.TypeDoesNotSatisfyTheConstraint,
DiagnosticCode.GenericTypeRequiresTypeArguments,
DiagnosticCode.GenericTypeRequiresBetweenXAndYTypeArugments,
DiagnosticCode.ExpectedArgumentsButGotOther,
DiagnosticCode.ExpectedAtLeastArgumentsButGotOther,
DiagnosticCode.NoOverloadExpectsCountOfArguments,
Expand Down
1 change: 1 addition & 0 deletions source/lib/interfaces.ts
Expand Up @@ -26,6 +26,7 @@ export enum DiagnosticCode {
AwaitExpressionOnlyAllowedWithinAsyncFunction = 1308,
TopLevelAwaitOnlyAllowedWhenModuleESNextOrSystem = 1378,
GenericTypeRequiresTypeArguments = 2314,
GenericTypeRequiresBetweenXAndYTypeArugments = 2707,
TypeIsNotAssignableToOtherType = 2322,
TypeDoesNotSatisfyTheConstraint = 2344,
PropertyDoesNotExistOnType = 2339,
Expand Down
2 changes: 2 additions & 0 deletions source/test/fixtures/expect-error/generics/index.d.ts
Expand Up @@ -6,3 +6,5 @@ export default one;

export function two<T1>(foo: T1): T1;
export function two<T1, T2, T3 extends T2>(foo: T1, bar: T2): T3;

export type Three<T1, T2 = 2, T3 = 3> = [T1, T2, T3];
4 changes: 3 additions & 1 deletion source/test/fixtures/expect-error/generics/index.test-d.ts
@@ -1,8 +1,10 @@
import {expectError} from '../../../..';
import one, {two} from '.';
import one, {two, type Three} from '.';

expectError(one(true, true));

expectError(one<number>(1, 2));

expectError(two<number, string>(1, 'bar'));

expectError<Three>('');

0 comments on commit 114db77

Please sign in to comment.