Apply tsgo PR 1987 to tsgo-port (#62696)

This commit is contained in:
Jake Bailey
2025-10-30 15:27:14 -07:00
committed by GitHub
parent 763d8821ca
commit f7f95f87bb
39 changed files with 680 additions and 640 deletions
+53 -13
View File
@@ -5552,23 +5552,63 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
(name as string).charCodeAt(2) !== CharacterCodes.hash;
}
function getNamedMembers(members: SymbolTable): Symbol[] {
let result: Symbol[] | undefined;
function getNamedMembers(members: SymbolTable, container: Symbol | undefined): Symbol[] {
if (!TSGO_COMPAT) {
let result: Symbol[] | undefined;
members.forEach((symbol, id) => {
if (isNamedMember(symbol, id)) {
(result || (result = [])).push(symbol);
}
});
return result || emptyArray;
}
if (members.size === 0) {
return emptyArray;
}
// For classes and interfaces, we store explicitly declared members ahead of inherited members. This ensures we process
// explicitly declared members first in type relations, which is beneficial because explicitly declared members are more
// likely to contain discriminating differences. See for example https://github.com/microsoft/typescript-go/issues/1968.
let contained: Symbol[] | undefined;
if (container && container.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
members.forEach((symbol, id) => {
if (isNamedMember(symbol, id) && isDeclarationContainedBy(symbol, container)) {
contained = append(contained, symbol);
}
});
}
let nonContained: Symbol[] | undefined;
members.forEach((symbol, id) => {
if (isNamedMember(symbol, id)) {
(result || (result = [])).push(symbol);
if (isNamedMember(symbol, id) && (!container || !(container.flags & (SymbolFlags.Class | SymbolFlags.Interface)) || !isDeclarationContainedBy(symbol, container))) {
nonContained = append(nonContained, symbol);
}
});
sortSymbolsIfTSGoCompat(result);
return result || emptyArray;
contained?.sort(compareSymbols);
nonContained?.sort(compareSymbols);
return concatenate(contained, nonContained) || emptyArray;
function isDeclarationContainedBy(symbol: Symbol, container: Symbol): boolean {
const declaration = symbol.valueDeclaration;
if (declaration) {
return some(container.declarations, d => containedBy(declaration, d));
}
return false;
function containedBy(a: Node, b: Node): boolean {
return b.pos <= a.pos && b.end >= a.end;
}
}
}
function isNamedMember(member: Symbol, escapedName: __String) {
return !isReservedMemberName(escapedName) && symbolIsValue(member);
}
function getNamedOrIndexSignatureMembers(members: SymbolTable): Symbol[] {
const result = getNamedMembers(members);
function getNamedOrIndexSignatureMembers(members: SymbolTable, symbol: Symbol): Symbol[] {
const result = getNamedMembers(members, symbol);
const index = getIndexSymbolFromSymbolTable(members);
return index ? concatenate(result, [index]) : result;
}
@@ -5581,7 +5621,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
resolved.constructSignatures = constructSignatures;
resolved.indexInfos = indexInfos;
// This can loop back to getPropertyOfType() which would crash if `callSignatures` & `constructSignatures` are not initialized.
if (members !== emptySymbols) resolved.properties = getNamedMembers(members);
if (members !== emptySymbols) resolved.properties = getNamedMembers(members, type.symbol);
return resolved;
}
@@ -13689,7 +13729,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (!(type as InterfaceTypeWithDeclaredMembers).declaredProperties) {
const symbol = type.symbol;
const members = getMembersOfSymbol(symbol);
(type as InterfaceTypeWithDeclaredMembers).declaredProperties = getNamedMembers(members);
(type as InterfaceTypeWithDeclaredMembers).declaredProperties = getNamedMembers(members, symbol);
// Start with signatures at empty array in case of recursive types
(type as InterfaceTypeWithDeclaredMembers).declaredCallSignatures = emptyArray;
(type as InterfaceTypeWithDeclaredMembers).declaredConstructSignatures = emptyArray;
@@ -14565,7 +14605,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const classType = getDeclaredTypeOfClassOrInterface(symbol);
const baseConstructorType = getBaseConstructorTypeOfClass(classType);
if (baseConstructorType.flags & (TypeFlags.Object | TypeFlags.Intersection | TypeFlags.TypeVariable)) {
members = createSymbolTable(getNamedOrIndexSignatureMembers(members));
members = createSymbolTable(getNamedOrIndexSignatureMembers(members, symbol));
addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
}
else if (baseConstructorType === anyType) {
@@ -15028,7 +15068,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
break;
}
}
type.resolvedProperties = getNamedMembers(members);
type.resolvedProperties = getNamedMembers(members, type.symbol);
}
return type.resolvedProperties;
}
@@ -50033,7 +50073,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
});
}
return getNamedMembers(propsByName);
return getNamedMembers(propsByName, /*container*/ undefined);
}
function typeHasCallOrConstructSignatures(type: Type): boolean {
@@ -1,6 +1,6 @@
arrayAssignmentTest1.ts(46,5): error TS2741: Property 'IM1' is missing in type 'undefined[]' but required in type 'I1'.
arrayAssignmentTest1.ts(47,5): error TS2739: Type 'undefined[]' is missing the following properties from type 'C1': IM1, C1M1
arrayAssignmentTest1.ts(48,5): error TS2739: Type 'undefined[]' is missing the following properties from type 'C2': IM1, C1M1, C2M1
arrayAssignmentTest1.ts(48,5): error TS2739: Type 'undefined[]' is missing the following properties from type 'C2': C2M1, IM1, C1M1
arrayAssignmentTest1.ts(49,5): error TS2741: Property 'CM3M1' is missing in type 'undefined[]' but required in type 'C3'.
arrayAssignmentTest1.ts(60,1): error TS2322: Type 'C3[]' is not assignable to type 'I1[]'.
Property 'IM1' is missing in type 'C3' but required in type 'I1'.
@@ -11,9 +11,9 @@ arrayAssignmentTest1.ts(65,1): error TS2322: Type 'C3[]' is not assignable to ty
arrayAssignmentTest1.ts(68,1): error TS2322: Type 'C1[]' is not assignable to type 'C2[]'.
Property 'C2M1' is missing in type 'C1' but required in type 'C2'.
arrayAssignmentTest1.ts(69,1): error TS2322: Type 'I1[]' is not assignable to type 'C2[]'.
Type 'I1' is missing the following properties from type 'C2': C1M1, C2M1
Type 'I1' is missing the following properties from type 'C2': C2M1, C1M1
arrayAssignmentTest1.ts(70,1): error TS2322: Type 'C3[]' is not assignable to type 'C2[]'.
Type 'C3' is missing the following properties from type 'C2': IM1, C1M1, C2M1
Type 'C3' is missing the following properties from type 'C2': C2M1, IM1, C1M1
arrayAssignmentTest1.ts(75,1): error TS2322: Type 'C2[]' is not assignable to type 'C3[]'.
Property 'CM3M1' is missing in type 'C2' but required in type 'C3'.
arrayAssignmentTest1.ts(76,1): error TS2322: Type 'C1[]' is not assignable to type 'C3[]'.
@@ -83,7 +83,7 @@ arrayAssignmentTest1.ts(85,1): error TS2740: Type 'I1' is missing the following
!!! error TS2739: Type 'undefined[]' is missing the following properties from type 'C1': IM1, C1M1
var c2_error: C2 = []; // should be an error - is
~~~~~~~~
!!! error TS2739: Type 'undefined[]' is missing the following properties from type 'C2': IM1, C1M1, C2M1
!!! error TS2739: Type 'undefined[]' is missing the following properties from type 'C2': C2M1, IM1, C1M1
var c3_error: C3 = []; // should be an error - is
~~~~~~~~
!!! error TS2741: Property 'CM3M1' is missing in type 'undefined[]' but required in type 'C3'.
@@ -125,11 +125,11 @@ arrayAssignmentTest1.ts(85,1): error TS2740: Type 'I1' is missing the following
arr_c2 = arr_i1; // should be an error - subtype relationship - is
~~~~~~
!!! error TS2322: Type 'I1[]' is not assignable to type 'C2[]'.
!!! error TS2322: Type 'I1' is missing the following properties from type 'C2': C1M1, C2M1
!!! error TS2322: Type 'I1' is missing the following properties from type 'C2': C2M1, C1M1
arr_c2 = arr_c3; // should be an error - is
~~~~~~
!!! error TS2322: Type 'C3[]' is not assignable to type 'C2[]'.
!!! error TS2322: Type 'C3' is missing the following properties from type 'C2': IM1, C1M1, C2M1
!!! error TS2322: Type 'C3' is missing the following properties from type 'C2': C2M1, IM1, C1M1
// "clean up bug" occurs at this point
// if you move these three expressions to another file, they raise an error
@@ -46,7 +46,7 @@ assignmentCompatWithCallSignatures3.ts(80,1): error TS2322: Type '(x: Base[], y:
Types of parameters 'y' and 'y' are incompatible.
Type 'T' is not assignable to type 'Derived2[]'.
Type 'Base[]' is not assignable to type 'Derived2[]'.
Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
assignmentCompatWithCallSignatures3.ts(83,1): error TS2322: Type '(x: Base[], y: Derived[]) => Derived[]' is not assignable to type '<T extends Array<Derived>>(x: Base[], y: T) => T'.
Type 'Derived[]' is not assignable to type 'T'.
'Derived[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'.
@@ -208,7 +208,7 @@ assignmentCompatWithCallSignatures3.ts(86,1): error TS2322: Type '(x: { a: strin
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
!!! error TS2322: Type 'T' is not assignable to type 'Derived2[]'.
!!! error TS2322: Type 'Base[]' is not assignable to type 'Derived2[]'.
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
var b13: <T extends Array<Derived>>(x: Array<Base>, y: T) => T;
a13 = b13; // ok
b13 = a13; // ok
@@ -46,7 +46,7 @@ assignmentCompatWithConstructSignatures3.ts(80,1): error TS2322: Type 'new (x: B
Types of parameters 'y' and 'y' are incompatible.
Type 'T' is not assignable to type 'Derived2[]'.
Type 'Base[]' is not assignable to type 'Derived2[]'.
Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
assignmentCompatWithConstructSignatures3.ts(83,1): error TS2322: Type 'new (x: Base[], y: Derived[]) => Derived[]' is not assignable to type 'new <T extends Array<Derived>>(x: Base[], y: T) => T'.
Type 'Derived[]' is not assignable to type 'T'.
'Derived[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'.
@@ -208,7 +208,7 @@ assignmentCompatWithConstructSignatures3.ts(86,1): error TS2322: Type 'new (x: {
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
!!! error TS2322: Type 'T' is not assignable to type 'Derived2[]'.
!!! error TS2322: Type 'Base[]' is not assignable to type 'Derived2[]'.
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
var b13: new <T extends Array<Derived>>(x: Array<Base>, y: T) => T;
a13 = b13; // ok
b13 = a13; // ok
@@ -3,7 +3,7 @@ assignmentCompatWithNumericIndexer.ts(14,1): error TS2322: Type 'A' is not assig
Property 'bar' is missing in type 'Base' but required in type 'Derived'.
assignmentCompatWithNumericIndexer.ts(18,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'.
'number' index signatures are incompatible.
Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
assignmentCompatWithNumericIndexer.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A<T>'.
'number' index signatures are incompatible.
Type 'Derived' is not assignable to type 'T'.
@@ -19,7 +19,7 @@ assignmentCompatWithNumericIndexer.ts(36,9): error TS2322: Type '{ [x: number]:
assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A<T>' is not assignable to type '{ [x: number]: Derived2; }'.
'number' index signatures are incompatible.
Type 'T' is not assignable to type 'Derived2'.
Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
==== assignmentCompatWithNumericIndexer.ts (6 errors) ====
@@ -49,7 +49,7 @@ assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A<T>' is not as
~~
!!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'.
!!! error TS2322: 'number' index signatures are incompatible.
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
module Generics {
class A<T extends Base> {
@@ -89,7 +89,7 @@ assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A<T>' is not as
!!! error TS2322: Type 'A<T>' is not assignable to type '{ [x: number]: Derived2; }'.
!!! error TS2322: 'number' index signatures are incompatible.
!!! error TS2322: Type 'T' is not assignable to type 'Derived2'.
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
var b3: { [x: number]: T; }
a = b3; // ok
@@ -3,7 +3,7 @@ assignmentCompatWithNumericIndexer2.ts(14,1): error TS2322: Type 'A' is not assi
Property 'bar' is missing in type 'Base' but required in type 'Derived'.
assignmentCompatWithNumericIndexer2.ts(18,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'.
'number' index signatures are incompatible.
Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
assignmentCompatWithNumericIndexer2.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A<T>'.
'number' index signatures are incompatible.
Type 'Derived' is not assignable to type 'T'.
@@ -19,7 +19,7 @@ assignmentCompatWithNumericIndexer2.ts(36,9): error TS2322: Type '{ [x: number]:
assignmentCompatWithNumericIndexer2.ts(37,9): error TS2322: Type 'A<T>' is not assignable to type '{ [x: number]: Derived2; }'.
'number' index signatures are incompatible.
Type 'T' is not assignable to type 'Derived2'.
Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
==== assignmentCompatWithNumericIndexer2.ts (6 errors) ====
@@ -49,7 +49,7 @@ assignmentCompatWithNumericIndexer2.ts(37,9): error TS2322: Type 'A<T>' is not a
~~
!!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'.
!!! error TS2322: 'number' index signatures are incompatible.
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
module Generics {
interface A<T extends Base> {
@@ -89,7 +89,7 @@ assignmentCompatWithNumericIndexer2.ts(37,9): error TS2322: Type 'A<T>' is not a
!!! error TS2322: Type 'A<T>' is not assignable to type '{ [x: number]: Derived2; }'.
!!! error TS2322: 'number' index signatures are incompatible.
!!! error TS2322: Type 'T' is not assignable to type 'Derived2'.
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
var b3: { [x: number]: T; }
a = b3; // ok
@@ -3,13 +3,13 @@ assignmentCompatWithStringIndexer.ts(15,1): error TS2322: Type 'A' is not assign
Property 'bar' is missing in type 'Base' but required in type 'Derived'.
assignmentCompatWithStringIndexer.ts(19,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'.
'string' index signatures are incompatible.
Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
assignmentCompatWithStringIndexer.ts(33,5): error TS2322: Type 'A<Base>' is not assignable to type '{ [x: string]: Derived; }'.
'string' index signatures are incompatible.
Property 'bar' is missing in type 'Base' but required in type 'Derived'.
assignmentCompatWithStringIndexer.ts(41,5): error TS2322: Type 'A<Base>' is not assignable to type '{ [x: string]: Derived2; }'.
'string' index signatures are incompatible.
Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
assignmentCompatWithStringIndexer.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A<T>'.
'string' index signatures are incompatible.
Type 'Derived' is not assignable to type 'T'.
@@ -25,7 +25,7 @@ assignmentCompatWithStringIndexer.ts(50,9): error TS2322: Type '{ [x: string]: D
assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A<T>' is not assignable to type '{ [x: string]: Derived2; }'.
'string' index signatures are incompatible.
Type 'T' is not assignable to type 'Derived2'.
Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
==== assignmentCompatWithStringIndexer.ts (8 errors) ====
@@ -56,7 +56,7 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A<T>' is not ass
~~
!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'.
!!! error TS2322: 'string' index signatures are incompatible.
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
module Generics {
class A<T extends Base> {
@@ -87,7 +87,7 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A<T>' is not ass
~~
!!! error TS2322: Type 'A<Base>' is not assignable to type '{ [x: string]: Derived2; }'.
!!! error TS2322: 'string' index signatures are incompatible.
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
function foo<T extends Base>() {
var b3: { [x: string]: Derived; };
@@ -118,6 +118,6 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A<T>' is not ass
!!! error TS2322: Type 'A<T>' is not assignable to type '{ [x: string]: Derived2; }'.
!!! error TS2322: 'string' index signatures are incompatible.
!!! error TS2322: Type 'T' is not assignable to type 'Derived2'.
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
}
}
@@ -3,13 +3,13 @@ assignmentCompatWithStringIndexer2.ts(15,1): error TS2322: Type 'A' is not assig
Property 'bar' is missing in type 'Base' but required in type 'Derived'.
assignmentCompatWithStringIndexer2.ts(19,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'.
'string' index signatures are incompatible.
Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
assignmentCompatWithStringIndexer2.ts(33,5): error TS2322: Type 'A<Base>' is not assignable to type '{ [x: string]: Derived; }'.
'string' index signatures are incompatible.
Property 'bar' is missing in type 'Base' but required in type 'Derived'.
assignmentCompatWithStringIndexer2.ts(41,5): error TS2322: Type 'A<Base>' is not assignable to type '{ [x: string]: Derived2; }'.
'string' index signatures are incompatible.
Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
assignmentCompatWithStringIndexer2.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A<T>'.
'string' index signatures are incompatible.
Type 'Derived' is not assignable to type 'T'.
@@ -25,7 +25,7 @@ assignmentCompatWithStringIndexer2.ts(50,9): error TS2322: Type '{ [x: string]:
assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A<T>' is not assignable to type '{ [x: string]: Derived2; }'.
'string' index signatures are incompatible.
Type 'T' is not assignable to type 'Derived2'.
Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
==== assignmentCompatWithStringIndexer2.ts (8 errors) ====
@@ -56,7 +56,7 @@ assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A<T>' is not as
~~
!!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'.
!!! error TS2322: 'string' index signatures are incompatible.
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
module Generics {
interface A<T extends Base> {
@@ -87,7 +87,7 @@ assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A<T>' is not as
~~
!!! error TS2322: Type 'A<Base>' is not assignable to type '{ [x: string]: Derived2; }'.
!!! error TS2322: 'string' index signatures are incompatible.
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
function foo<T extends Base>() {
var b3: { [x: string]: Derived; };
@@ -118,6 +118,6 @@ assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A<T>' is not as
!!! error TS2322: Type 'A<T>' is not assignable to type '{ [x: string]: Derived2; }'.
!!! error TS2322: 'string' index signatures are incompatible.
!!! error TS2322: Type 'T' is not assignable to type 'Derived2'.
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
}
}
@@ -1,5 +1,5 @@
chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,64): error TS2741: Property 'z' is missing in type 'B' but required in type 'C'.
chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,81): error TS2739: Type 'A' is missing the following properties from type 'C': y, z
chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,81): error TS2739: Type 'A' is missing the following properties from type 'C': z, y
==== chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (2 errors) ====
@@ -27,5 +27,5 @@ chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,81): error TS
!!! related TS2728 chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:15:5: 'z' is declared here.
!!! related TS6502 chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:3:27: The expected type comes from the return type of this signature.
~~~~~
!!! error TS2739: Type 'A' is missing the following properties from type 'C': y, z
!!! error TS2739: Type 'A' is missing the following properties from type 'C': z, y
!!! related TS6502 chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:3:27: The expected type comes from the return type of this signature.
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -90,17 +90,17 @@ export declare class FooItem {
export type Constructor<T> = new (...args: any[]) => T;
export declare function WithTags<T extends Constructor<FooItem>>(Base: T): {
new (...args: any[]): {
tags(): void;
foo(): void;
name?: string;
tags(): void;
};
getTags(): void;
} & T;
declare const Test_base: {
new (...args: any[]): {
tags(): void;
foo(): void;
name?: string;
tags(): void;
};
getTags(): void;
} & typeof FooItem;
@@ -1,5 +1,5 @@
implementingAnInterfaceExtendingClassWithPrivates.ts(9,7): error TS2420: Class 'Bar' incorrectly implements interface 'I'.
Type 'Bar' is missing the following properties from type 'I': x, y
Type 'Bar' is missing the following properties from type 'I': y, x
implementingAnInterfaceExtendingClassWithPrivates.ts(12,7): error TS2420: Class 'Bar2' incorrectly implements interface 'I'.
Property 'x' is missing in type 'Bar2' but required in type 'I'.
implementingAnInterfaceExtendingClassWithPrivates.ts(16,7): error TS2420: Class 'Bar3' incorrectly implements interface 'I'.
@@ -20,7 +20,7 @@ implementingAnInterfaceExtendingClassWithPrivates.ts(21,7): error TS2420: Class
class Bar implements I { // error
~~~
!!! error TS2420: Class 'Bar' incorrectly implements interface 'I'.
!!! error TS2420: Type 'Bar' is missing the following properties from type 'I': x, y
!!! error TS2420: Type 'Bar' is missing the following properties from type 'I': y, x
}
class Bar2 implements I { // error
@@ -1,5 +1,5 @@
implementingAnInterfaceExtendingClassWithProtecteds.ts(9,7): error TS2420: Class 'Bar' incorrectly implements interface 'I'.
Type 'Bar' is missing the following properties from type 'I': x, y
Type 'Bar' is missing the following properties from type 'I': y, x
implementingAnInterfaceExtendingClassWithProtecteds.ts(12,7): error TS2420: Class 'Bar2' incorrectly implements interface 'I'.
Property 'x' is missing in type 'Bar2' but required in type 'I'.
implementingAnInterfaceExtendingClassWithProtecteds.ts(16,7): error TS2420: Class 'Bar3' incorrectly implements interface 'I'.
@@ -24,7 +24,7 @@ implementingAnInterfaceExtendingClassWithProtecteds.ts(29,7): error TS2420: Clas
class Bar implements I { // error
~~~
!!! error TS2420: Class 'Bar' incorrectly implements interface 'I'.
!!! error TS2420: Type 'Bar' is missing the following properties from type 'I': x, y
!!! error TS2420: Type 'Bar' is missing the following properties from type 'I': y, x
}
class Bar2 implements I { // error
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@ invalidReturnStatements.ts(2,17): error TS2355: A function whose declared type i
invalidReturnStatements.ts(3,17): error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.
invalidReturnStatements.ts(4,17): error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.
invalidReturnStatements.ts(5,17): error TS2355: A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.
invalidReturnStatements.ts(16,22): error TS2739: Type '{ id: number; }' is missing the following properties from type 'D': dispose, name
invalidReturnStatements.ts(16,22): error TS2739: Type '{ id: number; }' is missing the following properties from type 'D': name, dispose
invalidReturnStatements.ts(18,22): error TS2741: Property 'name' is missing in type 'C' but required in type 'D'.
@@ -32,7 +32,7 @@ invalidReturnStatements.ts(18,22): error TS2741: Property 'name' is missing in t
}
function fn10(): D { return { id: 12 }; }
~~~~~~
!!! error TS2739: Type '{ id: number; }' is missing the following properties from type 'D': dispose, name
!!! error TS2739: Type '{ id: number; }' is missing the following properties from type 'D': name, dispose
function fn11(): D { return new C(); }
~~~~~~
@@ -2,7 +2,7 @@ b.js(4,20): error TS2352: Conversion of type 'number' to type 'string' may be a
b.js(45,23): error TS2352: Conversion of type 'SomeOther' to type 'SomeBase' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Property 'p' is missing in type 'SomeOther' but required in type 'SomeBase'.
b.js(49,26): error TS2352: Conversion of type 'SomeOther' to type 'SomeDerived' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Type 'SomeOther' is missing the following properties from type 'SomeDerived': p, x
Type 'SomeOther' is missing the following properties from type 'SomeDerived': x, p
b.js(51,24): error TS2352: Conversion of type 'SomeDerived' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Property 'q' is missing in type 'SomeDerived' but required in type 'SomeOther'.
b.js(52,24): error TS2352: Conversion of type 'SomeBase' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
@@ -79,7 +79,7 @@ b.js(67,8): error TS2454: Variable 'numOrStr' is used before being assigned.
someDerived = /** @type {SomeDerived} */(someOther); // Error
~~~~~~~~~~~
!!! error TS2352: Conversion of type 'SomeOther' to type 'SomeDerived' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
!!! error TS2352: Type 'SomeOther' is missing the following properties from type 'SomeDerived': p, x
!!! error TS2352: Type 'SomeOther' is missing the following properties from type 'SomeDerived': x, p
someOther = /** @type {SomeOther} */(someDerived); // Error
~~~~~~~~~
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Type Count: 1,000
Instantiation count: 2,500
Instantiation count: 1,000 -> 2,500
=== jsxComplexSignatureHasApplicabilityError.tsx ===
/// <reference path="react16.d.ts" />
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 100,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Type Count: 1,000
Instantiation count: 1,000
Instantiation count: 2,500
=== index.js ===
/** @type {Map<string, string | Set<string>>} */
@@ -77,10 +77,10 @@
// ^
// | ----------------------------------------------------------------------
// | const f: {
// | a: string;
// | bar(): void;
// | b: boolean;
// | baz(param: string | number): void;
// | a: string;
// | bar(): void;
// | }
// | (verbosity level: 1)
// | ----------------------------------------------------------------------
@@ -116,9 +116,9 @@
// ^
// | ----------------------------------------------------------------------
// | const f: {
// | foo(): Foo;
// | bar(param: "foo"): void;
// | baz(): Foo;
// | foo(): Foo;
// | }
// | (verbosity level: 1)
// | ----------------------------------------------------------------------
@@ -137,9 +137,9 @@
// ^^^^^^
// | ----------------------------------------------------------------------
// | const noname: {
// | foo(): (Anonymous class);
// | bar(param: "foo"): void;
// | baz(): (Anonymous class);
// | foo(): (Anonymous class);
// | }
// | (verbosity level: 1)
// | ----------------------------------------------------------------------
@@ -157,9 +157,9 @@
// ^
// | ----------------------------------------------------------------------
// | const k: {
// | foo(): klass;
// | bar(param: "foo"): void;
// | baz(): klass;
// | foo(): klass;
// | }
// | (verbosity level: 1)
// | ----------------------------------------------------------------------
@@ -921,70 +921,6 @@
"text": " ",
"kind": "space"
},
{
"text": "a",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "void",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "b",
"kind": "propertyName"
@@ -1077,6 +1013,70 @@
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "a",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "void",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "}",
"kind": "punctuation"
@@ -1385,6 +1385,42 @@
"text": " ",
"kind": "space"
},
{
"text": "foo",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "Foo",
"kind": "className"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
@@ -1469,42 +1505,6 @@
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "foo",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "Foo",
"kind": "className"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "}",
"kind": "punctuation"
@@ -1605,6 +1605,42 @@
"text": " ",
"kind": "space"
},
{
"text": "foo",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "(Anonymous class)",
"kind": "className"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
@@ -1689,42 +1725,6 @@
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "foo",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "(Anonymous class)",
"kind": "className"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "}",
"kind": "punctuation"
@@ -1825,6 +1825,42 @@
"text": " ",
"kind": "space"
},
{
"text": "foo",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "klass",
"kind": "className"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
@@ -1909,42 +1945,6 @@
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "foo",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "klass",
"kind": "className"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "}",
"kind": "punctuation"
@@ -29,8 +29,8 @@
// ^
// | ----------------------------------------------------------------------
// | const f: {
// | b: "b" | "d";
// | a: "a" | "c";
// | b: "b" | "d";
// | }
// | (verbosity level: 1)
// | ----------------------------------------------------------------------
@@ -57,31 +57,31 @@
// ^
// | ----------------------------------------------------------------------
// | const f: {
// | bar(b: "b" | "d"): string;
// | a: "a" | "c";
// | foo: (a: {
// | param: "a" | "c";
// | }) => number;
// | bar(b: "b" | "d"): string;
// | }
// | (verbosity level: 3)
// | ----------------------------------------------------------------------
// ^
// | ----------------------------------------------------------------------
// | const f: {
// | bar(b: "b" | "d"): string;
// | a: "a" | "c";
// | foo: (a: {
// | param: FooType;
// | }) => number;
// | bar(b: "b" | "d"): string;
// | }
// | (verbosity level: 2)
// | ----------------------------------------------------------------------
// ^
// | ----------------------------------------------------------------------
// | const f: {
// | bar(b: BarParam): string;
// | a: FooType;
// | foo: (a: FooParam) => number;
// | bar(b: BarParam): string;
// | }
// | (verbosity level: 1)
// | ----------------------------------------------------------------------
@@ -106,22 +106,22 @@
// ^
// | ----------------------------------------------------------------------
// | const f: {
// | bar(b: {
// | param: "a" | "c";
// | }): string;
// | a: "a" | "c";
// | foo: (a: {
// | param: "a" | "c";
// | }) => number;
// | bar(b: {
// | param: "a" | "c";
// | }): string;
// | }
// | (verbosity level: 2)
// | ----------------------------------------------------------------------
// ^
// | ----------------------------------------------------------------------
// | const f: {
// | bar(b: FooParam): string;
// | a: "a" | "c";
// | foo: (a: FooParam) => number;
// | bar(b: FooParam): string;
// | }
// | (verbosity level: 1)
// | ----------------------------------------------------------------------
@@ -422,50 +422,6 @@
"text": " ",
"kind": "space"
},
{
"text": "b",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "\"b\"",
"kind": "stringLiteral"
},
{
"text": " ",
"kind": "space"
},
{
"text": "|",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "\"d\"",
"kind": "stringLiteral"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "a",
"kind": "propertyName"
@@ -506,6 +462,50 @@
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "b",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "\"b\"",
"kind": "stringLiteral"
},
{
"text": " ",
"kind": "space"
},
{
"text": "|",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "\"d\"",
"kind": "stringLiteral"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "}",
"kind": "punctuation"
@@ -606,58 +606,6 @@
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "b",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "BarParam",
"kind": "aliasName"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "a",
"kind": "propertyName"
@@ -746,6 +694,58 @@
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "b",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "BarParam",
"kind": "aliasName"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "}",
"kind": "punctuation"
@@ -802,74 +802,6 @@
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "b",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "\"b\"",
"kind": "stringLiteral"
},
{
"text": " ",
"kind": "space"
},
{
"text": "|",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "\"d\"",
"kind": "stringLiteral"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "a",
"kind": "propertyName"
@@ -1014,58 +946,6 @@
"text": "\n",
"kind": "lineBreak"
},
{
"text": "}",
"kind": "punctuation"
}
],
"documentation": [],
"canIncreaseVerbosityLevel": true,
"verbosityLevel": 2
}
},
{
"marker": {
"fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts",
"position": 519,
"name": "f3"
},
"item": {
"kind": "const",
"kindModifiers": "",
"textSpan": {
"start": 518,
"length": 1
},
"displayParts": [
{
"text": "const",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "f",
"kind": "localName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "{",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
@@ -1134,6 +1014,58 @@
"text": "\n",
"kind": "lineBreak"
},
{
"text": "}",
"kind": "punctuation"
}
],
"documentation": [],
"canIncreaseVerbosityLevel": true,
"verbosityLevel": 2
}
},
{
"marker": {
"fileName": "/tests/cases/fourslash/quickinfoVerbosityInterface1.ts",
"position": 519,
"name": "f3"
},
"item": {
"kind": "const",
"kindModifiers": "",
"textSpan": {
"start": 518,
"length": 1
},
"displayParts": [
{
"text": "const",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "f",
"kind": "localName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "{",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
@@ -1298,6 +1230,74 @@
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "b",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "\"b\"",
"kind": "stringLiteral"
},
{
"text": " ",
"kind": "space"
},
{
"text": "|",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "\"d\"",
"kind": "stringLiteral"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "}",
"kind": "punctuation"
@@ -1398,58 +1398,6 @@
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "b",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "FooParam",
"kind": "interfaceName"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "a",
"kind": "propertyName"
@@ -1554,6 +1502,58 @@
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "b",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "FooParam",
"kind": "interfaceName"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "}",
"kind": "punctuation"
@@ -1610,114 +1610,6 @@
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "b",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "{",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "param",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "\"a\"",
"kind": "stringLiteral"
},
{
"text": " ",
"kind": "space"
},
{
"text": "|",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "\"c\"",
"kind": "stringLiteral"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "}",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "a",
"kind": "propertyName"
@@ -1878,6 +1770,114 @@
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "bar",
"kind": "text"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": "b",
"kind": "parameterName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "{",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "param",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "\"a\"",
"kind": "stringLiteral"
},
{
"text": " ",
"kind": "space"
},
{
"text": "|",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "\"c\"",
"kind": "stringLiteral"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": " ",
"kind": "space"
},
{
"text": "}",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
},
{
"text": ";",
"kind": "punctuation"
},
{
"text": "\n",
"kind": "lineBreak"
},
{
"text": "}",
"kind": "punctuation"
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Type Count: 1,000
Instantiation count: 1,000
Instantiation count: 2,500
=== file.js ===
// Don't peek into conditional return expression if it's wrapped in a cast
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -2,7 +2,7 @@ typeAssertions.ts(5,9): error TS2558: Expected 0 type arguments, but got 1.
typeAssertions.ts(31,12): error TS2352: Conversion of type 'SomeOther' to type 'SomeBase' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Property 'p' is missing in type 'SomeOther' but required in type 'SomeBase'.
typeAssertions.ts(35,15): error TS2352: Conversion of type 'SomeOther' to type 'SomeDerived' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Type 'SomeOther' is missing the following properties from type 'SomeDerived': p, x
Type 'SomeOther' is missing the following properties from type 'SomeDerived': x, p
typeAssertions.ts(37,13): error TS2352: Conversion of type 'SomeDerived' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Property 'q' is missing in type 'SomeDerived' but required in type 'SomeOther'.
typeAssertions.ts(38,13): error TS2352: Conversion of type 'SomeBase' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
@@ -67,7 +67,7 @@ typeAssertions.ts(48,50): error TS1128: Declaration or statement expected.
someDerived = <SomeDerived>someOther; // Error
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2352: Conversion of type 'SomeOther' to type 'SomeDerived' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
!!! error TS2352: Type 'SomeOther' is missing the following properties from type 'SomeDerived': p, x
!!! error TS2352: Type 'SomeOther' is missing the following properties from type 'SomeDerived': x, p
someOther = <SomeOther>someDerived; // Error
~~~~~~~~~~~~~~~~~~~~~~
@@ -2,7 +2,7 @@
=== Performance Stats ===
Assignability cache: 2,500
Type Count: 5,000
Type Count: 10,000
Instantiation count: 50,000
Symbol count: 50,000
@@ -24,7 +24,7 @@ interface Two extends Omit<One, "a"> {
}
class TwoStore implements Two {
b: string;
c: boolean;
b: string;
}`,
});