Skip to content

Commit 114db77

Browse files
Add diagnostic for TS error 2707 (#173)
1 parent 2519573 commit 114db77

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

source/lib/compiler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const expectErrordiagnosticCodesToIgnore = new Set<DiagnosticCode>([
2222
DiagnosticCode.TypeIsNotAssignableToOtherType,
2323
DiagnosticCode.TypeDoesNotSatisfyTheConstraint,
2424
DiagnosticCode.GenericTypeRequiresTypeArguments,
25+
DiagnosticCode.GenericTypeRequiresBetweenXAndYTypeArugments,
2526
DiagnosticCode.ExpectedArgumentsButGotOther,
2627
DiagnosticCode.ExpectedAtLeastArgumentsButGotOther,
2728
DiagnosticCode.NoOverloadExpectsCountOfArguments,

source/lib/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export enum DiagnosticCode {
2626
AwaitExpressionOnlyAllowedWithinAsyncFunction = 1308,
2727
TopLevelAwaitOnlyAllowedWhenModuleESNextOrSystem = 1378,
2828
GenericTypeRequiresTypeArguments = 2314,
29+
GenericTypeRequiresBetweenXAndYTypeArugments = 2707,
2930
TypeIsNotAssignableToOtherType = 2322,
3031
TypeDoesNotSatisfyTheConstraint = 2344,
3132
PropertyDoesNotExistOnType = 2339,

source/test/fixtures/expect-error/generics/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ export default one;
66

77
export function two<T1>(foo: T1): T1;
88
export function two<T1, T2, T3 extends T2>(foo: T1, bar: T2): T3;
9+
10+
export type Three<T1, T2 = 2, T3 = 3> = [T1, T2, T3];
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import {expectError} from '../../../..';
2-
import one, {two} from '.';
2+
import one, {two, type Three} from '.';
33

44
expectError(one(true, true));
55

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

88
expectError(two<number, string>(1, 'bar'));
9+
10+
expectError<Three>('');

0 commit comments

Comments
 (0)