mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into add-undefined-to-default-valued-parameters
This commit is contained in:
commit
d62dd291bd
269 files changed
+5267
-2351
No files matched your search
@@ -2,6 +2,7 @@ language: node_js
|
||||
|
||||
node_js:
|
||||
- 'stable'
|
||||
- '6'
|
||||
- '4'
|
||||
|
||||
sudo: false
|
||||
|
||||
@@ -250,6 +250,7 @@ var harnessSources = harnessCoreSources.concat([
|
||||
"convertToBase64.ts",
|
||||
"transpile.ts",
|
||||
"reuseProgramStructure.ts",
|
||||
"textStorage.ts",
|
||||
"cachingInServerLSHost.ts",
|
||||
"moduleResolution.ts",
|
||||
"tsconfigParsing.ts",
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import jobs.generation.Utilities;
|
||||
def project = GithubProject
|
||||
def branch = GithubBranchName
|
||||
|
||||
def nodeVersions = ['stable', '4']
|
||||
def nodeVersions = ['stable', '6', '4']
|
||||
|
||||
nodeVersions.each { nodeVer ->
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
"tsserver": "./bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
"node": ">=4.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/browserify": "latest",
|
||||
|
||||
+191
-89
@@ -1439,9 +1439,8 @@ namespace ts {
|
||||
// May be an untyped module. If so, ignore resolutionDiagnostic.
|
||||
if (!isRelative && resolvedModule && !extensionIsTypeScript(resolvedModule.extension)) {
|
||||
if (isForAugmentation) {
|
||||
Debug.assert(!!moduleNotFoundError);
|
||||
const diag = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
|
||||
error(errorNode, diag, moduleName, resolvedModule.resolvedFileName);
|
||||
error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName);
|
||||
}
|
||||
else if (compilerOptions.noImplicitAny && moduleNotFoundError) {
|
||||
error(errorNode,
|
||||
@@ -1742,7 +1741,19 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, useOnlyExternalAliasing: boolean): Symbol[] {
|
||||
function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable): Symbol[] {
|
||||
function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable) {
|
||||
return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []);
|
||||
}
|
||||
|
||||
function getAccessibleSymbolChainFromSymbolTableWorker(symbols: SymbolTable, visitedSymbolTables: SymbolTable[]): Symbol[] {
|
||||
if (contains(visitedSymbolTables, symbols)) {
|
||||
return undefined;
|
||||
}
|
||||
visitedSymbolTables.push(symbols);
|
||||
const result = trySymbolTable(symbols);
|
||||
visitedSymbolTables.pop();
|
||||
return result;
|
||||
|
||||
function canQualifySymbol(symbolFromSymbolTable: Symbol, meaning: SymbolFlags) {
|
||||
// If the symbol is equivalent and doesn't need further qualification, this symbol is accessible
|
||||
if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) {
|
||||
@@ -1764,34 +1775,36 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
// If symbol is directly available by its name in the symbol table
|
||||
if (isAccessible(symbols[symbol.name])) {
|
||||
return [symbol];
|
||||
}
|
||||
function trySymbolTable(symbols: SymbolTable) {
|
||||
// If symbol is directly available by its name in the symbol table
|
||||
if (isAccessible(symbols[symbol.name])) {
|
||||
return [symbol];
|
||||
}
|
||||
|
||||
// Check if symbol is any of the alias
|
||||
return forEachProperty(symbols, symbolFromSymbolTable => {
|
||||
if (symbolFromSymbolTable.flags & SymbolFlags.Alias
|
||||
&& symbolFromSymbolTable.name !== "export="
|
||||
&& !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) {
|
||||
if (!useOnlyExternalAliasing || // We can use any type of alias to get the name
|
||||
// Is this external alias, then use it to name
|
||||
ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) {
|
||||
// Check if symbol is any of the alias
|
||||
return forEachProperty(symbols, symbolFromSymbolTable => {
|
||||
if (symbolFromSymbolTable.flags & SymbolFlags.Alias
|
||||
&& symbolFromSymbolTable.name !== "export="
|
||||
&& !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) {
|
||||
if (!useOnlyExternalAliasing || // We can use any type of alias to get the name
|
||||
// Is this external alias, then use it to name
|
||||
ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) {
|
||||
|
||||
const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
|
||||
if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) {
|
||||
return [symbolFromSymbolTable];
|
||||
}
|
||||
const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
|
||||
if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) {
|
||||
return [symbolFromSymbolTable];
|
||||
}
|
||||
|
||||
// Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain
|
||||
// but only if the symbolFromSymbolTable can be qualified
|
||||
const accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined;
|
||||
if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {
|
||||
return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
|
||||
// Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain
|
||||
// but only if the symbolFromSymbolTable can be qualified
|
||||
const accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined;
|
||||
if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {
|
||||
return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (symbol) {
|
||||
@@ -3475,20 +3488,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (!popTypeResolution()) {
|
||||
if ((<VariableLikeDeclaration>symbol.valueDeclaration).type) {
|
||||
// Variable has type annotation that circularly references the variable itself
|
||||
type = unknownType;
|
||||
error(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,
|
||||
symbolToString(symbol));
|
||||
}
|
||||
else {
|
||||
// Variable has initializer that circularly references the variable itself
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,
|
||||
symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
type = reportCircularityError(symbol);
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
@@ -3622,11 +3622,33 @@ namespace ts {
|
||||
function getTypeOfInstantiatedSymbol(symbol: Symbol): Type {
|
||||
const links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper);
|
||||
if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) {
|
||||
return unknownType;
|
||||
}
|
||||
let type = instantiateType(getTypeOfSymbol(links.target), links.mapper);
|
||||
if (!popTypeResolution()) {
|
||||
type = reportCircularityError(symbol);
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
|
||||
function reportCircularityError(symbol: Symbol) {
|
||||
// Check if variable has type annotation that circularly references the variable itself
|
||||
if ((<VariableLikeDeclaration>symbol.valueDeclaration).type) {
|
||||
error(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,
|
||||
symbolToString(symbol));
|
||||
return unknownType;
|
||||
}
|
||||
// Otherwise variable has initializer that circularly references the variable itself
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,
|
||||
symbolToString(symbol));
|
||||
}
|
||||
return anyType;
|
||||
}
|
||||
|
||||
function getTypeOfSymbol(symbol: Symbol): Type {
|
||||
if (symbol.flags & SymbolFlags.Instantiated) {
|
||||
return getTypeOfInstantiatedSymbol(symbol);
|
||||
@@ -4515,12 +4537,11 @@ namespace ts {
|
||||
// Resolve upfront such that recursive references see an empty object type.
|
||||
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
// In { [P in K]: T }, we refer to P as the type parameter type, K as the constraint type,
|
||||
// and T as the template type. If K is of the form 'keyof S', the mapped type and S are
|
||||
// homomorphic and we copy property modifiers from corresponding properties in S.
|
||||
// and T as the template type.
|
||||
const typeParameter = getTypeParameterFromMappedType(type);
|
||||
const constraintType = getConstraintTypeFromMappedType(type);
|
||||
const homomorphicType = getHomomorphicTypeFromMappedType(type);
|
||||
const templateType = getTemplateTypeFromMappedType(type);
|
||||
const modifiersType = getModifiersTypeFromMappedType(type);
|
||||
const templateReadonly = !!type.declaration.readonlyToken;
|
||||
const templateOptional = !!type.declaration.questionToken;
|
||||
// First, if the constraint type is a type parameter, obtain the base constraint. Then,
|
||||
@@ -4539,11 +4560,11 @@ namespace ts {
|
||||
// Otherwise, for type string create a string index signature.
|
||||
if (t.flags & TypeFlags.StringLiteral) {
|
||||
const propName = (<LiteralType>t).text;
|
||||
const homomorphicProp = homomorphicType && getPropertyOfType(homomorphicType, propName);
|
||||
const isOptional = templateOptional || !!(homomorphicProp && homomorphicProp.flags & SymbolFlags.Optional);
|
||||
const modifiersProp = getPropertyOfType(modifiersType, propName);
|
||||
const isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & SymbolFlags.Optional);
|
||||
const prop = <TransientSymbol>createSymbol(SymbolFlags.Property | SymbolFlags.Transient | (isOptional ? SymbolFlags.Optional : 0), propName);
|
||||
prop.type = propType;
|
||||
prop.isReadonly = templateReadonly || homomorphicProp && isReadonlySymbol(homomorphicProp);
|
||||
prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp);
|
||||
members[propName] = prop;
|
||||
}
|
||||
else if (t.flags & TypeFlags.String) {
|
||||
@@ -4570,9 +4591,26 @@ namespace ts {
|
||||
unknownType);
|
||||
}
|
||||
|
||||
function getHomomorphicTypeFromMappedType(type: MappedType) {
|
||||
const constraint = getConstraintDeclaration(getTypeParameterFromMappedType(type));
|
||||
return constraint.kind === SyntaxKind.TypeOperator ? instantiateType(getTypeFromTypeNode((<TypeOperatorNode>constraint).type), type.mapper || identityMapper) : undefined;
|
||||
function getModifiersTypeFromMappedType(type: MappedType) {
|
||||
if (!type.modifiersType) {
|
||||
const constraintDeclaration = type.declaration.typeParameter.constraint;
|
||||
if (constraintDeclaration.kind === SyntaxKind.TypeOperator) {
|
||||
// If the constraint declaration is a 'keyof T' node, the modifiers type is T. We check
|
||||
// AST nodes here because, when T is a non-generic type, the logic below eagerly resolves
|
||||
// 'keyof T' to a literal union type and we can't recover T from that type.
|
||||
type.modifiersType = instantiateType(getTypeFromTypeNode((<TypeOperatorNode>constraintDeclaration).type), type.mapper || identityMapper);
|
||||
}
|
||||
else {
|
||||
// Otherwise, get the declared constraint type, and if the constraint type is a type parameter,
|
||||
// get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T',
|
||||
// the modifiers type is T. Otherwise, the modifiers type is {}.
|
||||
const declaredType = <MappedType>getTypeFromMappedTypeNode(type.declaration);
|
||||
const constraint = getConstraintTypeFromMappedType(declaredType);
|
||||
const extendedConstraint = constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(<TypeParameter>constraint) : constraint;
|
||||
type.modifiersType = extendedConstraint.flags & TypeFlags.Index ? instantiateType((<IndexType>extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType;
|
||||
}
|
||||
}
|
||||
return type.modifiersType;
|
||||
}
|
||||
|
||||
function getErasedTemplateTypeFromMappedType(type: MappedType) {
|
||||
@@ -4670,33 +4708,24 @@ namespace ts {
|
||||
* The apparent type of a type parameter is the base constraint instantiated with the type parameter
|
||||
* as the type argument for the 'this' type.
|
||||
*/
|
||||
function getApparentTypeOfTypeParameter(type: TypeParameter) {
|
||||
function getApparentTypeOfTypeVariable(type: TypeVariable) {
|
||||
if (!type.resolvedApparentType) {
|
||||
let constraintType = getConstraintOfTypeParameter(type);
|
||||
let constraintType = getConstraintOfTypeVariable(type);
|
||||
while (constraintType && constraintType.flags & TypeFlags.TypeParameter) {
|
||||
constraintType = getConstraintOfTypeParameter(<TypeParameter>constraintType);
|
||||
constraintType = getConstraintOfTypeVariable(<TypeVariable>constraintType);
|
||||
}
|
||||
type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type);
|
||||
}
|
||||
return type.resolvedApparentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* The apparent type of an indexed access T[K] is the type of T's string index signature, if any.
|
||||
*/
|
||||
function getApparentTypeOfIndexedAccess(type: IndexedAccessType) {
|
||||
return getIndexTypeOfType(getApparentType(type.objectType), IndexKind.String) || type;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a type parameter, return the base constraint of the type parameter. For the string, number,
|
||||
* boolean, and symbol primitive types, return the corresponding object types. Otherwise return the
|
||||
* type itself. Note that the apparent type of a union type is the union type itself.
|
||||
*/
|
||||
function getApparentType(type: Type): Type {
|
||||
const t = type.flags & TypeFlags.TypeParameter ? getApparentTypeOfTypeParameter(<TypeParameter>type) :
|
||||
type.flags & TypeFlags.IndexedAccess ? getApparentTypeOfIndexedAccess(<IndexedAccessType>type) :
|
||||
type;
|
||||
const t = type.flags & TypeFlags.TypeVariable ? getApparentTypeOfTypeVariable(<TypeVariable>type) : type;
|
||||
return t.flags & TypeFlags.StringLike ? globalStringType :
|
||||
t.flags & TypeFlags.NumberLike ? globalNumberType :
|
||||
t.flags & TypeFlags.BooleanLike ? globalBooleanType :
|
||||
@@ -5282,6 +5311,12 @@ namespace ts {
|
||||
return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
|
||||
}
|
||||
|
||||
function getConstraintOfTypeVariable(type: TypeVariable): Type {
|
||||
return type.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(<TypeParameter>type) :
|
||||
type.flags & TypeFlags.IndexedAccess ? (<IndexedAccessType>type).constraint :
|
||||
undefined;
|
||||
}
|
||||
|
||||
function getParentSymbolOfTypeParameter(typeParameter: TypeParameter): Symbol {
|
||||
return getSymbolOfNode(getDeclarationOfKind(typeParameter.symbol, SyntaxKind.TypeParameter).parent);
|
||||
}
|
||||
@@ -5957,6 +5992,24 @@ namespace ts {
|
||||
const type = <IndexedAccessType>createType(TypeFlags.IndexedAccess);
|
||||
type.objectType = objectType;
|
||||
type.indexType = indexType;
|
||||
// We eagerly compute the constraint of the indexed access type such that circularity
|
||||
// errors are immediately caught and reported. For example, class C { x: this["x"] }
|
||||
// becomes an error only when the constraint is eagerly computed.
|
||||
if (type.objectType.flags & TypeFlags.StructuredType) {
|
||||
// The constraint of T[K], where T is an object, union, or intersection type,
|
||||
// is the type of the string index signature of T, if any.
|
||||
type.constraint = getIndexTypeOfType(type.objectType, IndexKind.String);
|
||||
}
|
||||
else if (type.objectType.flags & TypeFlags.TypeVariable) {
|
||||
// The constraint of T[K], where T is a type variable, is A[K], where A is the
|
||||
// apparent type of T.
|
||||
const apparentType = getApparentTypeOfTypeVariable(<TypeVariable>type.objectType);
|
||||
if (apparentType !== emptyObjectType) {
|
||||
type.constraint = isTypeOfKind((<IndexedAccessType>type).indexType, TypeFlags.StringLike) ?
|
||||
getIndexedAccessType(apparentType, (<IndexedAccessType>type).indexType) :
|
||||
getIndexTypeOfType(apparentType, IndexKind.String);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -6035,14 +6088,19 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getIndexedAccessType(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode) {
|
||||
if (maybeTypeOfKind(indexType, TypeFlags.TypeVariable | TypeFlags.Index) || isGenericMappedType(objectType)) {
|
||||
// If the index type is generic, if the object type is generic and doesn't originate in an expression,
|
||||
// or if the object type is a mapped type with a generic constraint, we are performing a higher-order
|
||||
// index access where we cannot meaningfully access the properties of the object type. Note that for a
|
||||
// generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to
|
||||
// preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved
|
||||
// eagerly using the constraint type of 'this' at the given location.
|
||||
if (maybeTypeOfKind(indexType, TypeFlags.TypeVariable | TypeFlags.Index) ||
|
||||
maybeTypeOfKind(objectType, TypeFlags.TypeVariable) && !(accessNode && accessNode.kind === SyntaxKind.ElementAccessExpression) ||
|
||||
isGenericMappedType(objectType)) {
|
||||
if (objectType.flags & TypeFlags.Any) {
|
||||
return objectType;
|
||||
}
|
||||
// If the index type is generic or if the object type is a mapped type with a generic constraint,
|
||||
// we are performing a higher-order index access where we cannot meaningfully access the properties
|
||||
// of the object type. In those cases, we first check that the index type is assignable to 'keyof T'
|
||||
// for the object type.
|
||||
// We first check that the index type is assignable to 'keyof T' for the object type.
|
||||
if (accessNode) {
|
||||
if (!isTypeAssignableTo(indexType, getIndexType(objectType))) {
|
||||
error(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
|
||||
@@ -6059,6 +6117,7 @@ namespace ts {
|
||||
const id = objectType.id + "," + indexType.id;
|
||||
return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType));
|
||||
}
|
||||
// In the following we resolve T[K] to the type of the property in T selected by K.
|
||||
const apparentObjectType = getApparentType(objectType);
|
||||
if (indexType.flags & TypeFlags.Union && !(indexType.flags & TypeFlags.Primitive)) {
|
||||
const propTypes: Type[] = [];
|
||||
@@ -7165,6 +7224,25 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isUnionOrIntersectionTypeWithoutNullableConstituents(type: Type): boolean {
|
||||
if (!(type.flags & TypeFlags.UnionOrIntersection)) {
|
||||
return false;
|
||||
}
|
||||
// at this point we know that this is union or intersection type possibly with nullable constituents.
|
||||
// check if we still will have compound type if we ignore nullable components.
|
||||
let seenNonNullable = false;
|
||||
for (const t of (<UnionOrIntersectionType>type).types) {
|
||||
if (t.flags & TypeFlags.Nullable) {
|
||||
continue;
|
||||
}
|
||||
if (seenNonNullable) {
|
||||
return true;
|
||||
}
|
||||
seenNonNullable = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Compare two types and return
|
||||
// Ternary.True if they are related with no assumptions,
|
||||
// Ternary.Maybe if they are related with assumptions of other relationships, or
|
||||
@@ -7197,7 +7275,7 @@ namespace ts {
|
||||
// and intersection types are further deconstructed on the target side, we don't want to
|
||||
// make the check again (as it might fail for a partial target type). Therefore we obtain
|
||||
// the regular source type and proceed with that.
|
||||
if (target.flags & TypeFlags.UnionOrIntersection) {
|
||||
if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) {
|
||||
source = getRegularTypeOfObjectLiteral(source);
|
||||
}
|
||||
}
|
||||
@@ -7246,8 +7324,7 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (target.flags & TypeFlags.TypeParameter) {
|
||||
else if (target.flags & TypeFlags.TypeParameter) {
|
||||
// A source type { [P in keyof T]: X } is related to a target type T if X is related to T[P].
|
||||
if (getObjectFlags(source) & ObjectFlags.Mapped && getConstraintTypeFromMappedType(<MappedType>source) === getIndexType(target)) {
|
||||
if (!(<MappedType>source).declaration.questionToken) {
|
||||
@@ -7276,10 +7353,10 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// Given a type parameter T with a constraint C, a type S is assignable to
|
||||
// Given a type variable T with a constraint C, a type S is assignable to
|
||||
// keyof T if S is assignable to keyof C.
|
||||
if ((<IndexType>target).type.flags & TypeFlags.TypeParameter) {
|
||||
const constraint = getConstraintOfTypeParameter(<TypeParameter>(<IndexType>target).type);
|
||||
if ((<IndexType>target).type.flags & TypeFlags.TypeVariable) {
|
||||
const constraint = getConstraintOfTypeVariable(<TypeVariable>(<IndexType>target).type);
|
||||
if (constraint) {
|
||||
if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) {
|
||||
return result;
|
||||
@@ -7295,6 +7372,14 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// A type S is related to a type T[K] if S is related to A[K], where K is string-like and
|
||||
// A is the apparent type of S.
|
||||
if ((<IndexedAccessType>target).constraint) {
|
||||
if (result = isRelatedTo(source, (<IndexedAccessType>target).constraint, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (source.flags & TypeFlags.TypeParameter) {
|
||||
@@ -7303,6 +7388,7 @@ namespace ts {
|
||||
const indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(<MappedType>target));
|
||||
const templateType = getTemplateTypeFromMappedType(<MappedType>target);
|
||||
if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -7324,6 +7410,16 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (source.flags & TypeFlags.IndexedAccess) {
|
||||
// A type S[K] is related to a type T if A[K] is related to T, where K is string-like and
|
||||
// A is the apparent type of S.
|
||||
if ((<IndexedAccessType>source).constraint) {
|
||||
if (result = isRelatedTo((<IndexedAccessType>source).constraint, target, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (<TypeReference>source).target === (<TypeReference>target).target) {
|
||||
// We have type references to same target type, see if relationship holds for all type arguments
|
||||
@@ -11255,13 +11351,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkSpreadExpression(node: SpreadElement, contextualMapper?: TypeMapper): Type {
|
||||
// It is usually not safe to call checkExpressionCached if we can be contextually typing.
|
||||
// You can tell that we are contextually typing because of the contextualMapper parameter.
|
||||
// While it is true that a spread element can have a contextual type, it does not do anything
|
||||
// with this type. It is neither affected by it, nor does it propagate it to its operand.
|
||||
// So the fact that contextualMapper is passed is not important, because the operand of a spread
|
||||
// element is not contextually typed.
|
||||
const arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper);
|
||||
const arrayOrIterableType = checkExpression(node.expression, contextualMapper);
|
||||
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false);
|
||||
}
|
||||
|
||||
@@ -13478,13 +13568,14 @@ namespace ts {
|
||||
const containingClass = getContainingClass(node);
|
||||
if (containingClass) {
|
||||
const containingType = getTypeOfNode(containingClass);
|
||||
const baseTypes = getBaseTypes(<InterfaceType>containingType);
|
||||
if (baseTypes.length) {
|
||||
let baseTypes = getBaseTypes(containingType as InterfaceType);
|
||||
while (baseTypes.length) {
|
||||
const baseType = baseTypes[0];
|
||||
if (modifiers & ModifierFlags.Protected &&
|
||||
baseType.symbol === declaration.parent.symbol) {
|
||||
return true;
|
||||
}
|
||||
baseTypes = getBaseTypes(baseType as InterfaceType);
|
||||
}
|
||||
}
|
||||
if (modifiers & ModifierFlags.Private) {
|
||||
@@ -14992,8 +15083,8 @@ namespace ts {
|
||||
|
||||
function isLiteralContextualType(contextualType: Type) {
|
||||
if (contextualType) {
|
||||
if (contextualType.flags & TypeFlags.TypeParameter) {
|
||||
const apparentType = getApparentTypeOfTypeParameter(<TypeParameter>contextualType);
|
||||
if (contextualType.flags & TypeFlags.TypeVariable) {
|
||||
const apparentType = getApparentTypeOfTypeVariable(<TypeVariable>contextualType);
|
||||
// If the type parameter is constrained to the base primitive type we're checking for,
|
||||
// consider this a literal context. For example, given a type parameter 'T extends string',
|
||||
// this causes us to infer string literal types for T.
|
||||
@@ -15828,7 +15919,7 @@ namespace ts {
|
||||
checkSourceElement(node.type);
|
||||
const type = <MappedType>getTypeFromMappedTypeNode(node);
|
||||
const constraintType = getConstraintTypeFromMappedType(type);
|
||||
const keyType = constraintType.flags & TypeFlags.TypeParameter ? getApparentTypeOfTypeParameter(<TypeParameter>constraintType) : constraintType;
|
||||
const keyType = constraintType.flags & TypeFlags.TypeVariable ? getApparentTypeOfTypeVariable(<TypeVariable>constraintType) : constraintType;
|
||||
checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint);
|
||||
}
|
||||
|
||||
@@ -16210,7 +16301,7 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const onfulfilledParameterType = getTypeWithFacts(getUnionType(map(thenSignatures, getTypeOfFirstParameterOfSignature)), TypeFacts.NEUndefined);
|
||||
const onfulfilledParameterType = getTypeWithFacts(getUnionType(map(thenSignatures, getTypeOfFirstParameterOfSignature)), TypeFacts.NEUndefinedOrNull);
|
||||
if (isTypeAny(onfulfilledParameterType)) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -16704,6 +16795,14 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isRemovedPropertyFromObjectSpread(node: Node) {
|
||||
if (isBindingElement(node) && isObjectBindingPattern(node.parent)) {
|
||||
const lastElement = lastOrUndefined(node.parent.elements);
|
||||
return lastElement !== node && !!lastElement.dotDotDotToken;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function errorUnusedLocal(node: Node, name: string) {
|
||||
if (isIdentifierThatStartsWithUnderScore(node)) {
|
||||
const declaration = getRootDeclaration(node.parent);
|
||||
@@ -16713,7 +16812,10 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
}
|
||||
error(node, Diagnostics._0_is_declared_but_never_used, name);
|
||||
|
||||
if (!isRemovedPropertyFromObjectSpread(node.kind === SyntaxKind.Identifier ? node.parent : node)) {
|
||||
error(node, Diagnostics._0_is_declared_but_never_used, name);
|
||||
}
|
||||
}
|
||||
|
||||
function parameterNameStartsWithUnderscore(parameterName: DeclarationName) {
|
||||
@@ -18001,7 +18103,7 @@ namespace ts {
|
||||
|
||||
const baseTypeNode = getClassExtendsHeritageClauseElement(node);
|
||||
if (baseTypeNode) {
|
||||
if (languageVersion < ScriptTarget.ES2015) {
|
||||
if (languageVersion < ScriptTarget.ES2015 && !isInAmbientContext(node)) {
|
||||
checkExternalEmitHelpers(baseTypeNode.parent, ExternalEmitHelpers.Extends);
|
||||
}
|
||||
|
||||
|
||||
@@ -841,7 +841,7 @@ namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string, resolutionStack: Path[] = []): ParsedCommandLine {
|
||||
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string, resolutionStack: Path[] = [], extraFileExtensions: FileExtensionInfo[] = []): ParsedCommandLine {
|
||||
const errors: Diagnostic[] = [];
|
||||
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames);
|
||||
const resolvedPath = toPath(configFileName || "", basePath, getCanonicalFileName);
|
||||
@@ -981,7 +981,7 @@ namespace ts {
|
||||
includeSpecs = ["**/*"];
|
||||
}
|
||||
|
||||
const result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors);
|
||||
const result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions);
|
||||
|
||||
if (result.fileNames.length === 0 && !hasProperty(json, "files") && resolutionStack.length === 0) {
|
||||
errors.push(
|
||||
@@ -1185,7 +1185,7 @@ namespace ts {
|
||||
* @param host The host used to resolve files and directories.
|
||||
* @param errors An array for diagnostic reporting.
|
||||
*/
|
||||
function matchFileNames(fileNames: string[], include: string[], exclude: string[], basePath: string, options: CompilerOptions, host: ParseConfigHost, errors: Diagnostic[]): ExpandResult {
|
||||
function matchFileNames(fileNames: string[], include: string[], exclude: string[], basePath: string, options: CompilerOptions, host: ParseConfigHost, errors: Diagnostic[], extraFileExtensions: FileExtensionInfo[]): ExpandResult {
|
||||
basePath = normalizePath(basePath);
|
||||
|
||||
// The exclude spec list is converted into a regular expression, which allows us to quickly
|
||||
@@ -1219,7 +1219,7 @@ namespace ts {
|
||||
|
||||
// Rather than requery this for each file and filespec, we query the supported extensions
|
||||
// once and store it on the expansion context.
|
||||
const supportedExtensions = getSupportedExtensions(options);
|
||||
const supportedExtensions = getSupportedExtensions(options, extraFileExtensions);
|
||||
|
||||
// Literal files are always included verbatim. An "include" or "exclude" specification cannot
|
||||
// remove a literal file.
|
||||
|
||||
+14
-22
@@ -863,24 +863,6 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduce the properties defined on a map-like (but not from its prototype chain).
|
||||
*
|
||||
* NOTE: This is intended for use with MapLike<T> objects. For Map<T> objects, use
|
||||
* reduceProperties instead as it offers better performance.
|
||||
*
|
||||
* @param map The map-like to reduce
|
||||
* @param callback An aggregation function that is called for each entry in the map
|
||||
* @param initial The initial value for the reduction.
|
||||
*/
|
||||
export function reduceOwnProperties<T, U>(map: MapLike<T>, callback: (aggregate: U, value: T, key: string) => U, initial: U): U {
|
||||
let result = initial;
|
||||
for (const key in map) if (hasOwnProperty.call(map, key)) {
|
||||
result = callback(result, map[key], String(key));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a shallow equality comparison of the contents of two map-likes.
|
||||
*
|
||||
@@ -1942,8 +1924,18 @@ namespace ts {
|
||||
export const supportedJavascriptExtensions = [".js", ".jsx"];
|
||||
const allSupportedExtensions = supportedTypeScriptExtensions.concat(supportedJavascriptExtensions);
|
||||
|
||||
export function getSupportedExtensions(options?: CompilerOptions): string[] {
|
||||
return options && options.allowJs ? allSupportedExtensions : supportedTypeScriptExtensions;
|
||||
export function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]): string[] {
|
||||
const needAllExtensions = options && options.allowJs;
|
||||
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
||||
return needAllExtensions ? allSupportedExtensions : supportedTypeScriptExtensions;
|
||||
}
|
||||
const extensions = (needAllExtensions ? allSupportedExtensions : supportedTypeScriptExtensions).slice(0);
|
||||
for (const extInfo of extraFileExtensions) {
|
||||
if (needAllExtensions || extInfo.scriptKind === ScriptKind.TS) {
|
||||
extensions.push(extInfo.extension);
|
||||
}
|
||||
}
|
||||
return extensions;
|
||||
}
|
||||
|
||||
export function hasJavaScriptFileExtension(fileName: string) {
|
||||
@@ -1954,10 +1946,10 @@ namespace ts {
|
||||
return forEach(supportedTypeScriptExtensions, extension => fileExtensionIs(fileName, extension));
|
||||
}
|
||||
|
||||
export function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions) {
|
||||
export function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]) {
|
||||
if (!fileName) { return false; }
|
||||
|
||||
for (const extension of getSupportedExtensions(compilerOptions)) {
|
||||
for (const extension of getSupportedExtensions(compilerOptions, extraFileExtensions)) {
|
||||
if (fileExtensionIs(fileName, extension)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6337,7 +6337,7 @@ namespace ts {
|
||||
break;
|
||||
case SyntaxKind.AsteriskToken:
|
||||
const asterisk = scanner.getTokenText();
|
||||
if (state === JSDocState.SawAsterisk) {
|
||||
if (state === JSDocState.SawAsterisk || state === JSDocState.SavingComments) {
|
||||
// If we've already seen an asterisk, then we can no longer parse a tag on this line
|
||||
state = JSDocState.SavingComments;
|
||||
pushComment(asterisk);
|
||||
@@ -6358,7 +6358,10 @@ namespace ts {
|
||||
case SyntaxKind.WhitespaceTrivia:
|
||||
// only collect whitespace if we're already saving comments or have just crossed the comment indent margin
|
||||
const whitespace = scanner.getTokenText();
|
||||
if (state === JSDocState.SavingComments || margin !== undefined && indent + whitespace.length > margin) {
|
||||
if (state === JSDocState.SavingComments) {
|
||||
comments.push(whitespace);
|
||||
}
|
||||
else if (margin !== undefined && indent + whitespace.length > margin) {
|
||||
comments.push(whitespace.slice(margin - indent - 1));
|
||||
}
|
||||
indent += whitespace.length;
|
||||
@@ -6366,6 +6369,8 @@ namespace ts {
|
||||
case SyntaxKind.EndOfFileToken:
|
||||
break;
|
||||
default:
|
||||
// anything other than whitespace or asterisk at the beginning of the line starts the comment text
|
||||
state = JSDocState.SavingComments;
|
||||
pushComment(scanner.getTokenText());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ namespace ts {
|
||||
|
||||
encodeLastRecordedSourceMapSpan();
|
||||
|
||||
return stringify({
|
||||
return JSON.stringify({
|
||||
version: 3,
|
||||
file: sourceMapData.sourceMapFile,
|
||||
sourceRoot: sourceMapData.sourceMapSourceRoot,
|
||||
|
||||
@@ -2286,14 +2286,19 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
startLexicalEnvironment();
|
||||
let loopBody = visitNode(node.statement, visitor, isStatement);
|
||||
const lexicalEnvironment = endLexicalEnvironment();
|
||||
|
||||
const currentState = convertedLoopState;
|
||||
convertedLoopState = outerConvertedLoopState;
|
||||
|
||||
if (loopOutParameters.length) {
|
||||
if (loopOutParameters.length || lexicalEnvironment) {
|
||||
const statements = isBlock(loopBody) ? (<Block>loopBody).statements.slice() : [loopBody];
|
||||
copyOutParameters(loopOutParameters, CopyDirection.ToOutParameter, statements);
|
||||
if (loopOutParameters.length) {
|
||||
copyOutParameters(loopOutParameters, CopyDirection.ToOutParameter, statements);
|
||||
}
|
||||
addRange(statements, lexicalEnvironment)
|
||||
loopBody = createBlock(statements, /*location*/ undefined, /*multiline*/ true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1223,11 +1223,12 @@ namespace ts {
|
||||
}
|
||||
|
||||
const { firstAccessor, secondAccessor, setAccessor } = getAllAccessorDeclarations(node.members, accessor);
|
||||
if (accessor !== firstAccessor) {
|
||||
const firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined;
|
||||
if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators);
|
||||
const decorators = firstAccessorWithDecorators.decorators;
|
||||
const parameters = getDecoratorsOfParameters(setAccessor);
|
||||
if (!decorators && !parameters) {
|
||||
return undefined;
|
||||
@@ -1276,7 +1277,7 @@ namespace ts {
|
||||
* @param node The declaration node.
|
||||
* @param allDecorators An object containing all of the decorators for the declaration.
|
||||
*/
|
||||
function transformAllDecoratorsOfDeclaration(node: Declaration, allDecorators: AllDecorators) {
|
||||
function transformAllDecoratorsOfDeclaration(node: Declaration, container: ClassLikeDeclaration, allDecorators: AllDecorators) {
|
||||
if (!allDecorators) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -1284,7 +1285,7 @@ namespace ts {
|
||||
const decoratorExpressions: Expression[] = [];
|
||||
addRange(decoratorExpressions, map(allDecorators.decorators, transformDecorator));
|
||||
addRange(decoratorExpressions, flatMap(allDecorators.parameters, transformDecoratorsOfParameter));
|
||||
addTypeMetadata(node, decoratorExpressions);
|
||||
addTypeMetadata(node, container, decoratorExpressions);
|
||||
return decoratorExpressions;
|
||||
}
|
||||
|
||||
@@ -1333,7 +1334,7 @@ namespace ts {
|
||||
*/
|
||||
function generateClassElementDecorationExpression(node: ClassExpression | ClassDeclaration, member: ClassElement) {
|
||||
const allDecorators = getAllDecoratorsOfClassElement(node, member);
|
||||
const decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators);
|
||||
const decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators);
|
||||
if (!decoratorExpressions) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -1414,7 +1415,7 @@ namespace ts {
|
||||
*/
|
||||
function generateConstructorDecorationExpression(node: ClassExpression | ClassDeclaration) {
|
||||
const allDecorators = getAllDecoratorsOfConstructor(node);
|
||||
const decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators);
|
||||
const decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators);
|
||||
if (!decoratorExpressions) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -1467,22 +1468,22 @@ namespace ts {
|
||||
* @param node The declaration node.
|
||||
* @param decoratorExpressions The destination array to which to add new decorator expressions.
|
||||
*/
|
||||
function addTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) {
|
||||
function addTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) {
|
||||
if (USE_NEW_TYPE_METADATA_FORMAT) {
|
||||
addNewTypeMetadata(node, decoratorExpressions);
|
||||
addNewTypeMetadata(node, container, decoratorExpressions);
|
||||
}
|
||||
else {
|
||||
addOldTypeMetadata(node, decoratorExpressions);
|
||||
addOldTypeMetadata(node, container, decoratorExpressions);
|
||||
}
|
||||
}
|
||||
|
||||
function addOldTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) {
|
||||
function addOldTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) {
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
if (shouldAddTypeMetadata(node)) {
|
||||
decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node)));
|
||||
}
|
||||
if (shouldAddParamTypesMetadata(node)) {
|
||||
decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node)));
|
||||
decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container)));
|
||||
}
|
||||
if (shouldAddReturnTypeMetadata(node)) {
|
||||
decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node)));
|
||||
@@ -1490,14 +1491,14 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function addNewTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) {
|
||||
function addNewTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) {
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
let properties: ObjectLiteralElementLike[];
|
||||
if (shouldAddTypeMetadata(node)) {
|
||||
(properties || (properties = [])).push(createPropertyAssignment("type", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeTypeOfNode(node))));
|
||||
}
|
||||
if (shouldAddParamTypesMetadata(node)) {
|
||||
(properties || (properties = [])).push(createPropertyAssignment("paramTypes", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeParameterTypesOfNode(node))));
|
||||
(properties || (properties = [])).push(createPropertyAssignment("paramTypes", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeParameterTypesOfNode(node, container))));
|
||||
}
|
||||
if (shouldAddReturnTypeMetadata(node)) {
|
||||
(properties || (properties = [])).push(createPropertyAssignment("returnType", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeReturnTypeOfNode(node))));
|
||||
@@ -1542,12 +1543,16 @@ namespace ts {
|
||||
* @param node The node to test.
|
||||
*/
|
||||
function shouldAddParamTypesMetadata(node: Declaration): boolean {
|
||||
const kind = node.kind;
|
||||
return kind === SyntaxKind.ClassDeclaration
|
||||
|| kind === SyntaxKind.ClassExpression
|
||||
|| kind === SyntaxKind.MethodDeclaration
|
||||
|| kind === SyntaxKind.GetAccessor
|
||||
|| kind === SyntaxKind.SetAccessor;
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
return getFirstConstructorWithBody(<ClassLikeDeclaration>node) !== undefined;
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1595,7 +1600,7 @@ namespace ts {
|
||||
*
|
||||
* @param node The node that should have its parameter types serialized.
|
||||
*/
|
||||
function serializeParameterTypesOfNode(node: Node): Expression {
|
||||
function serializeParameterTypesOfNode(node: Node, container: ClassLikeDeclaration): Expression {
|
||||
const valueDeclaration =
|
||||
isClassLike(node)
|
||||
? getFirstConstructorWithBody(node)
|
||||
@@ -1605,7 +1610,7 @@ namespace ts {
|
||||
|
||||
const expressions: Expression[] = [];
|
||||
if (valueDeclaration) {
|
||||
const parameters = valueDeclaration.parameters;
|
||||
const parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container);
|
||||
const numParameters = parameters.length;
|
||||
for (let i = 0; i < numParameters; i++) {
|
||||
const parameter = parameters[i];
|
||||
@@ -1624,6 +1629,16 @@ namespace ts {
|
||||
return createArrayLiteral(expressions);
|
||||
}
|
||||
|
||||
function getParametersOfDecoratedDeclaration(node: FunctionLikeDeclaration, container: ClassLikeDeclaration) {
|
||||
if (container && node.kind === SyntaxKind.GetAccessor) {
|
||||
const { setAccessor } = getAllAccessorDeclarations(container.members, <AccessorDeclaration>node);
|
||||
if (setAccessor) {
|
||||
return setAccessor.parameters;
|
||||
}
|
||||
}
|
||||
return node.parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the return type of a node for use with decorator type metadata.
|
||||
*
|
||||
|
||||
+10
-2
@@ -2933,6 +2933,7 @@ namespace ts {
|
||||
typeParameter?: TypeParameter;
|
||||
constraintType?: Type;
|
||||
templateType?: Type;
|
||||
modifiersType?: Type;
|
||||
mapper?: TypeMapper; // Instantiation mapper
|
||||
}
|
||||
|
||||
@@ -2968,6 +2969,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface TypeVariable extends Type {
|
||||
/* @internal */
|
||||
resolvedApparentType: Type;
|
||||
/* @internal */
|
||||
resolvedIndexType: IndexType;
|
||||
}
|
||||
@@ -2980,8 +2983,6 @@ namespace ts {
|
||||
/* @internal */
|
||||
mapper?: TypeMapper; // Instantiation mapper
|
||||
/* @internal */
|
||||
resolvedApparentType: Type;
|
||||
/* @internal */
|
||||
isThisType?: boolean;
|
||||
}
|
||||
|
||||
@@ -2990,6 +2991,7 @@ namespace ts {
|
||||
export interface IndexedAccessType extends TypeVariable {
|
||||
objectType: Type;
|
||||
indexType: Type;
|
||||
constraint?: Type;
|
||||
}
|
||||
|
||||
// keyof T types (TypeFlags.Index)
|
||||
@@ -3086,6 +3088,12 @@ namespace ts {
|
||||
ThisProperty
|
||||
}
|
||||
|
||||
export interface FileExtensionInfo {
|
||||
extension: string;
|
||||
scriptKind: ScriptKind;
|
||||
isMixedContent: boolean;
|
||||
}
|
||||
|
||||
export interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
|
||||
@@ -3189,55 +3189,6 @@ namespace ts {
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph
|
||||
* as the fallback implementation does not check for circular references by default.
|
||||
*/
|
||||
export const stringify: (value: any) => string = typeof JSON !== "undefined" && JSON.stringify
|
||||
? JSON.stringify
|
||||
: stringifyFallback;
|
||||
|
||||
/**
|
||||
* Serialize an object graph into a JSON string.
|
||||
*/
|
||||
function stringifyFallback(value: any): string {
|
||||
// JSON.stringify returns `undefined` here, instead of the string "undefined".
|
||||
return value === undefined ? undefined : stringifyValue(value);
|
||||
}
|
||||
|
||||
function stringifyValue(value: any): string {
|
||||
return typeof value === "string" ? `"${escapeString(value)}"`
|
||||
: typeof value === "number" ? isFinite(value) ? String(value) : "null"
|
||||
: typeof value === "boolean" ? value ? "true" : "false"
|
||||
: typeof value === "object" && value ? isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value)
|
||||
: /*fallback*/ "null";
|
||||
}
|
||||
|
||||
function cycleCheck(cb: (value: any) => string, value: any) {
|
||||
Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON");
|
||||
value.__cycle = true;
|
||||
const result = cb(value);
|
||||
delete value.__cycle;
|
||||
return result;
|
||||
}
|
||||
|
||||
function stringifyArray(value: any) {
|
||||
return `[${reduceLeft(value, stringifyElement, "")}]`;
|
||||
}
|
||||
|
||||
function stringifyElement(memo: string, value: any) {
|
||||
return (memo ? memo + "," : memo) + stringifyValue(value);
|
||||
}
|
||||
|
||||
function stringifyObject(value: any) {
|
||||
return `{${reduceOwnProperties(value, stringifyProperty, "")}}`;
|
||||
}
|
||||
|
||||
function stringifyProperty(memo: string, value: any, key: string) {
|
||||
return value === undefined || typeof value === "function" || key === "__cycle" ? memo
|
||||
: (memo ? memo + "," : memo) + `"${escapeString(key)}":${stringifyValue(value)}`;
|
||||
}
|
||||
|
||||
const base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
||||
/**
|
||||
|
||||
@@ -607,23 +607,13 @@ namespace FourSlash {
|
||||
});
|
||||
}
|
||||
|
||||
public verifyMemberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
|
||||
const members = this.getMemberListAtCaret();
|
||||
if (members) {
|
||||
this.assertItemInCompletionList(members.entries, symbol, text, documentation, kind);
|
||||
}
|
||||
else {
|
||||
this.raiseError("Expected a member list, but none was provided");
|
||||
}
|
||||
}
|
||||
|
||||
public verifyMemberListCount(expectedCount: number, negative: boolean) {
|
||||
public verifyCompletionListCount(expectedCount: number, negative: boolean) {
|
||||
if (expectedCount === 0 && negative) {
|
||||
this.verifyMemberListIsEmpty(/*negative*/ false);
|
||||
this.verifyCompletionListIsEmpty(/*negative*/ false);
|
||||
return;
|
||||
}
|
||||
|
||||
const members = this.getMemberListAtCaret();
|
||||
const members = this.getCompletionListAtCaret();
|
||||
|
||||
if (members) {
|
||||
const match = members.entries.length === expectedCount;
|
||||
@@ -637,13 +627,6 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyMemberListDoesNotContain(symbol: string) {
|
||||
const members = this.getMemberListAtCaret();
|
||||
if (members && members.entries.filter(e => e.name === symbol).length !== 0) {
|
||||
this.raiseError(`Member list did contain ${symbol}`);
|
||||
}
|
||||
}
|
||||
|
||||
public verifyCompletionListItemsCountIsGreaterThan(count: number, negative: boolean) {
|
||||
const completions = this.getCompletionListAtCaret();
|
||||
const itemsCount = completions.entries.length;
|
||||
@@ -685,16 +668,6 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyMemberListIsEmpty(negative: boolean) {
|
||||
const members = this.getMemberListAtCaret();
|
||||
if ((!members || members.entries.length === 0) && negative) {
|
||||
this.raiseError("Member list is empty at Caret");
|
||||
}
|
||||
else if ((members && members.entries.length !== 0) && !negative) {
|
||||
this.raiseError(`Member list is not empty at Caret:\nMember List contains: ${stringify(members.entries.map(e => e.name))}`);
|
||||
}
|
||||
}
|
||||
|
||||
public verifyCompletionListIsEmpty(negative: boolean) {
|
||||
const completions = this.getCompletionListAtCaret();
|
||||
if ((!completions || completions.entries.length === 0) && negative) {
|
||||
@@ -892,10 +865,6 @@ namespace FourSlash {
|
||||
this.raiseError(`verifyReferencesAtPositionListContains failed - could not find the item: ${stringify(missingItem)} in the returned list: (${stringify(references)})`);
|
||||
}
|
||||
|
||||
private getMemberListAtCaret() {
|
||||
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
}
|
||||
|
||||
private getCompletionListAtCaret() {
|
||||
return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
}
|
||||
@@ -1353,11 +1322,6 @@ namespace FourSlash {
|
||||
Harness.IO.log(stringify(sigHelp));
|
||||
}
|
||||
|
||||
public printMemberListMembers() {
|
||||
const members = this.getMemberListAtCaret();
|
||||
this.printMembersOrCompletions(members);
|
||||
}
|
||||
|
||||
public printCompletionListMembers() {
|
||||
const completions = this.getCompletionListAtCaret();
|
||||
this.printMembersOrCompletions(completions);
|
||||
@@ -3061,19 +3025,8 @@ namespace FourSlashInterface {
|
||||
}
|
||||
}
|
||||
|
||||
// Verifies the member list contains the specified symbol. The
|
||||
// member list is brought up if necessary
|
||||
public memberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
|
||||
if (this.negative) {
|
||||
this.state.verifyMemberListDoesNotContain(symbol);
|
||||
}
|
||||
else {
|
||||
this.state.verifyMemberListContains(symbol, text, documentation, kind);
|
||||
}
|
||||
}
|
||||
|
||||
public memberListCount(expectedCount: number) {
|
||||
this.state.verifyMemberListCount(expectedCount, this.negative);
|
||||
public completionListCount(expectedCount: number) {
|
||||
this.state.verifyCompletionListCount(expectedCount, this.negative);
|
||||
}
|
||||
|
||||
// Verifies the completion list contains the specified symbol. The
|
||||
@@ -3109,10 +3062,6 @@ namespace FourSlashInterface {
|
||||
this.state.verifyCompletionListAllowsNewIdentifier(this.negative);
|
||||
}
|
||||
|
||||
public memberListIsEmpty() {
|
||||
this.state.verifyMemberListIsEmpty(this.negative);
|
||||
}
|
||||
|
||||
public signatureHelpPresent() {
|
||||
this.state.verifySignatureHelpPresent(!this.negative);
|
||||
}
|
||||
@@ -3514,10 +3463,6 @@ namespace FourSlashInterface {
|
||||
this.state.printCurrentSignatureHelp();
|
||||
}
|
||||
|
||||
public printMemberListMembers() {
|
||||
this.state.printMemberListMembers();
|
||||
}
|
||||
|
||||
public printCompletionListMembers() {
|
||||
this.state.printCompletionListMembers();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/// <reference path="../harness.ts" />
|
||||
/// <reference path="../../server/scriptVersionCache.ts"/>
|
||||
/// <reference path="./tsserverProjectSystem.ts" />
|
||||
|
||||
namespace ts.textStorage {
|
||||
describe("Text storage", () => {
|
||||
const f = {
|
||||
path: "/a/app.ts",
|
||||
content: `
|
||||
let x = 1;
|
||||
let y = 2;
|
||||
function bar(a: number) {
|
||||
return a + 1;
|
||||
}`
|
||||
};
|
||||
|
||||
it("text based storage should be have exactly the same as script version cache", () => {
|
||||
|
||||
const host = ts.projectSystem.createServerHost([f]);
|
||||
|
||||
const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path));
|
||||
const ts2 = new server.TextStorage(host, server.asNormalizedPath(f.path));
|
||||
|
||||
ts1.useScriptVersionCache();
|
||||
ts2.useText();
|
||||
|
||||
const lineMap = computeLineStarts(f.content);
|
||||
|
||||
for (let line = 0; line < lineMap.length; line++) {
|
||||
const start = lineMap[line];
|
||||
const end = line === lineMap.length - 1 ? f.path.length : lineMap[line + 1];
|
||||
|
||||
for (let offset = 0; offset < end - start; offset++) {
|
||||
const pos1 = ts1.lineOffsetToPosition(line + 1, offset + 1);
|
||||
const pos2 = ts2.lineOffsetToPosition(line + 1, offset + 1);
|
||||
assert.isTrue(pos1 === pos2, `lineOffsetToPosition ${line + 1}-${offset + 1}: expected ${pos1} to equal ${pos2}`);
|
||||
}
|
||||
|
||||
const {start: start1, length: length1 } = ts1.lineToTextSpan(line);
|
||||
const {start: start2, length: length2 } = ts2.lineToTextSpan(line);
|
||||
assert.isTrue(start1 === start2, `lineToTextSpan ${line}::start:: expected ${start1} to equal ${start2}`);
|
||||
assert.isTrue(length1 === length2, `lineToTextSpan ${line}::length:: expected ${length1} to equal ${length2}`);
|
||||
}
|
||||
|
||||
for (let pos = 0; pos < f.content.length; pos++) {
|
||||
const { line: line1, offset: offset1 } = ts1.positionToLineOffset(pos);
|
||||
const { line: line2, offset: offset2 } = ts2.positionToLineOffset(pos);
|
||||
assert.isTrue(line1 === line2, `positionToLineOffset ${pos}::line:: expected ${line1} to equal ${line2}`);
|
||||
assert.isTrue(offset1 === offset2, `positionToLineOffset ${pos}::offset:: expected ${offset1} to equal ${offset2}`);
|
||||
}
|
||||
});
|
||||
|
||||
it("should switch to script version cache if necessary", () => {
|
||||
const host = ts.projectSystem.createServerHost([f]);
|
||||
const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path));
|
||||
|
||||
ts1.getSnapshot();
|
||||
assert.isTrue(!ts1.hasScriptVersionCache(), "should not have script version cache - 1");
|
||||
|
||||
ts1.edit(0, 5, " ");
|
||||
assert.isTrue(ts1.hasScriptVersionCache(), "have script version cache - 1");
|
||||
|
||||
ts1.useText();
|
||||
assert.isTrue(!ts1.hasScriptVersionCache(), "should not have script version cache - 2");
|
||||
|
||||
ts1.getLineInfo(0);
|
||||
assert.isTrue(ts1.hasScriptVersionCache(), "have script version cache - 2");
|
||||
})
|
||||
});
|
||||
}
|
||||
@@ -140,7 +140,6 @@ namespace ts.projectSystem {
|
||||
export interface TestServerHostCreationParameters {
|
||||
useCaseSensitiveFileNames?: boolean;
|
||||
executingFilePath?: string;
|
||||
libFile?: FileOrFolder;
|
||||
currentDirectory?: string;
|
||||
}
|
||||
|
||||
@@ -1145,6 +1144,69 @@ namespace ts.projectSystem {
|
||||
checkNumberOfProjects(projectService, {});
|
||||
});
|
||||
|
||||
it("reload regular file after closing", () => {
|
||||
const f1 = {
|
||||
path: "/a/b/app.ts",
|
||||
content: "x."
|
||||
};
|
||||
const f2 = {
|
||||
path: "/a/b/lib.ts",
|
||||
content: "let x: number;"
|
||||
};
|
||||
|
||||
const host = createServerHost([f1, f2, libFile]);
|
||||
const service = createProjectService(host);
|
||||
service.openExternalProject({ projectFileName: "/a/b/project", rootFiles: toExternalFiles([f1.path, f2.path]), options: {} })
|
||||
|
||||
service.openClientFile(f1.path);
|
||||
service.openClientFile(f2.path, "let x: string");
|
||||
|
||||
service.checkNumberOfProjects({ externalProjects: 1 });
|
||||
checkProjectActualFiles(service.externalProjects[0], [f1.path, f2.path, libFile.path]);
|
||||
|
||||
const completions1 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 2);
|
||||
// should contain completions for string
|
||||
assert.isTrue(completions1.entries.some(e => e.name === "charAt"), "should contain 'charAt'");
|
||||
assert.isFalse(completions1.entries.some(e => e.name === "toExponential"), "should not contain 'toExponential'");
|
||||
|
||||
service.closeClientFile(f2.path);
|
||||
const completions2 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 2);
|
||||
// should contain completions for string
|
||||
assert.isFalse(completions2.entries.some(e => e.name === "charAt"), "should not contain 'charAt'");
|
||||
assert.isTrue(completions2.entries.some(e => e.name === "toExponential"), "should contain 'toExponential'");
|
||||
});
|
||||
|
||||
it("clear mixed content file after closing", () => {
|
||||
const f1 = {
|
||||
path: "/a/b/app.ts",
|
||||
content: " "
|
||||
};
|
||||
const f2 = {
|
||||
path: "/a/b/lib.html",
|
||||
content: "<html/>"
|
||||
};
|
||||
|
||||
const host = createServerHost([f1, f2, libFile]);
|
||||
const service = createProjectService(host);
|
||||
service.openExternalProject({ projectFileName: "/a/b/project", rootFiles: [{ fileName: f1.path }, { fileName: f2.path, hasMixedContent: true }], options: {} })
|
||||
|
||||
service.openClientFile(f1.path);
|
||||
service.openClientFile(f2.path, "let somelongname: string");
|
||||
|
||||
service.checkNumberOfProjects({ externalProjects: 1 });
|
||||
checkProjectActualFiles(service.externalProjects[0], [f1.path, f2.path, libFile.path]);
|
||||
|
||||
const completions1 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0);
|
||||
assert.isTrue(completions1.entries.some(e => e.name === "somelongname"), "should contain 'somelongname'");
|
||||
|
||||
service.closeClientFile(f2.path);
|
||||
const completions2 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0);
|
||||
assert.isFalse(completions2.entries.some(e => e.name === "somelongname"), "should not contain 'somelongname'");
|
||||
const sf2 = service.externalProjects[0].getLanguageService().getProgram().getSourceFile(f2.path);
|
||||
assert.equal(sf2.text, "");
|
||||
});
|
||||
|
||||
|
||||
it("external project with included config file opened after configured project", () => {
|
||||
const file1 = {
|
||||
path: "/a/b/f1.ts",
|
||||
@@ -1529,6 +1591,67 @@ namespace ts.projectSystem {
|
||||
checkProjectActualFiles(projectService.inferredProjects[1], [file2.path]);
|
||||
});
|
||||
|
||||
it("tsconfig script block support", () => {
|
||||
const file1 = {
|
||||
path: "/a/b/f1.ts",
|
||||
content: ` `
|
||||
};
|
||||
const file2 = {
|
||||
path: "/a/b/f2.html",
|
||||
content: `var hello = "hello";`
|
||||
};
|
||||
const config = {
|
||||
path: "/a/b/tsconfig.json",
|
||||
content: JSON.stringify({ compilerOptions: { allowJs: true } })
|
||||
};
|
||||
const host = createServerHost([file1, file2, config]);
|
||||
const session = createSession(host);
|
||||
openFilesForSession([file1], session);
|
||||
const projectService = session.getProjectService();
|
||||
|
||||
// HTML file will not be included in any projects yet
|
||||
checkNumberOfProjects(projectService, { configuredProjects: 1 });
|
||||
checkProjectActualFiles(projectService.configuredProjects[0], [file1.path]);
|
||||
|
||||
// Specify .html extension as mixed content
|
||||
const extraFileExtensions = [{ extension: ".html", scriptKind: ScriptKind.JS, isMixedContent: true }];
|
||||
const configureHostRequest = makeSessionRequest<protocol.ConfigureRequestArguments>(CommandNames.Configure, { extraFileExtensions });
|
||||
session.executeCommand(configureHostRequest).response;
|
||||
|
||||
// HTML file still not included in the project as it is closed
|
||||
checkNumberOfProjects(projectService, { configuredProjects: 1 });
|
||||
checkProjectActualFiles(projectService.configuredProjects[0], [file1.path]);
|
||||
|
||||
// Open HTML file
|
||||
projectService.applyChangesInOpenFiles(
|
||||
/*openFiles*/[{ fileName: file2.path, hasMixedContent: true, scriptKind: ScriptKind.JS, content: `var hello = "hello";` }],
|
||||
/*changedFiles*/undefined,
|
||||
/*closedFiles*/undefined);
|
||||
|
||||
// Now HTML file is included in the project
|
||||
checkNumberOfProjects(projectService, { configuredProjects: 1 });
|
||||
checkProjectActualFiles(projectService.configuredProjects[0], [file1.path, file2.path]);
|
||||
|
||||
// Check identifiers defined in HTML content are available in .ts file
|
||||
const project = projectService.configuredProjects[0];
|
||||
let completions = project.getLanguageService().getCompletionsAtPosition(file1.path, 1);
|
||||
assert(completions && completions.entries[0].name === "hello", `expected entry hello to be in completion list`);
|
||||
|
||||
// Close HTML file
|
||||
projectService.applyChangesInOpenFiles(
|
||||
/*openFiles*/undefined,
|
||||
/*changedFiles*/undefined,
|
||||
/*closedFiles*/[file2.path]);
|
||||
|
||||
// HTML file is still included in project
|
||||
checkNumberOfProjects(projectService, { configuredProjects: 1 });
|
||||
checkProjectActualFiles(projectService.configuredProjects[0], [file1.path, file2.path]);
|
||||
|
||||
// Check identifiers defined in HTML content are not available in .ts file
|
||||
completions = project.getLanguageService().getCompletionsAtPosition(file1.path, 5);
|
||||
assert(completions && completions.entries[0].name !== "hello", `unexpected hello entry in completion list`);
|
||||
});
|
||||
|
||||
it("project structure update is deferred if files are not added\removed", () => {
|
||||
const file1 = {
|
||||
path: "/a/b/f1.ts",
|
||||
@@ -1574,7 +1697,7 @@ namespace ts.projectSystem {
|
||||
const project = projectService.externalProjects[0];
|
||||
|
||||
const scriptInfo = project.getScriptInfo(file1.path);
|
||||
const snap = scriptInfo.snap();
|
||||
const snap = scriptInfo.getSnapshot();
|
||||
const actualText = snap.getText(0, snap.getLength());
|
||||
assert.equal(actualText, "", `expected content to be empty string, got "${actualText}"`);
|
||||
|
||||
@@ -1587,7 +1710,7 @@ namespace ts.projectSystem {
|
||||
projectService.closeClientFile(file1.path);
|
||||
|
||||
const scriptInfo2 = project.getScriptInfo(file1.path);
|
||||
const snap2 = scriptInfo2.snap();
|
||||
const snap2 = scriptInfo2.getSnapshot();
|
||||
const actualText2 = snap2.getText(0, snap.getLength());
|
||||
assert.equal(actualText2, "", `expected content to be empty string, got "${actualText2}"`);
|
||||
});
|
||||
@@ -2285,13 +2408,13 @@ namespace ts.projectSystem {
|
||||
p.updateGraph();
|
||||
|
||||
const scriptInfo = p.getScriptInfo(f.path);
|
||||
checkSnapLength(scriptInfo.snap(), f.content.length);
|
||||
checkSnapLength(scriptInfo.getSnapshot(), f.content.length);
|
||||
|
||||
// open project and replace its content with empty string
|
||||
projectService.openClientFile(f.path, "");
|
||||
checkSnapLength(scriptInfo.snap(), 0);
|
||||
checkSnapLength(scriptInfo.getSnapshot(), 0);
|
||||
});
|
||||
function checkSnapLength(snap: server.LineIndexSnapshot, expectedLength: number) {
|
||||
function checkSnapLength(snap: IScriptSnapshot, expectedLength: number) {
|
||||
assert.equal(snap.getLength(), expectedLength, "Incorrect snapshot size");
|
||||
}
|
||||
});
|
||||
@@ -2444,7 +2567,6 @@ namespace ts.projectSystem {
|
||||
const cwd = {
|
||||
path: "/a/c"
|
||||
};
|
||||
debugger;
|
||||
const host = createServerHost([f1, config, node, cwd], { currentDirectory: cwd.path });
|
||||
const projectService = createProjectService(host);
|
||||
projectService.openClientFile(f1.path);
|
||||
@@ -2715,7 +2837,7 @@ namespace ts.projectSystem {
|
||||
|
||||
// verify content
|
||||
const projectServiice = session.getProjectService();
|
||||
const snap1 = projectServiice.getScriptInfo(f1.path).snap();
|
||||
const snap1 = projectServiice.getScriptInfo(f1.path).getSnapshot();
|
||||
assert.equal(snap1.getText(0, snap1.getLength()), tmp.content, "content should be equal to the content of temp file");
|
||||
|
||||
// reload from original file file
|
||||
@@ -2727,7 +2849,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
|
||||
// verify content
|
||||
const snap2 = projectServiice.getScriptInfo(f1.path).snap();
|
||||
const snap2 = projectServiice.getScriptInfo(f1.path).getSnapshot();
|
||||
assert.equal(snap2.getText(0, snap2.getLength()), f1.content, "content should be equal to the content of original file");
|
||||
|
||||
});
|
||||
|
||||
@@ -108,6 +108,7 @@ namespace ts.server {
|
||||
export interface HostConfiguration {
|
||||
formatCodeOptions: FormatCodeSettings;
|
||||
hostInfo: string;
|
||||
extraFileExtensions?: FileExtensionInfo[];
|
||||
}
|
||||
|
||||
interface ConfigFileConversionResult {
|
||||
@@ -132,13 +133,16 @@ namespace ts.server {
|
||||
interface FilePropertyReader<T> {
|
||||
getFileName(f: T): string;
|
||||
getScriptKind(f: T): ScriptKind;
|
||||
hasMixedContent(f: T): boolean;
|
||||
hasMixedContent(f: T, extraFileExtensions: FileExtensionInfo[]): boolean;
|
||||
}
|
||||
|
||||
const fileNamePropertyReader: FilePropertyReader<string> = {
|
||||
getFileName: x => x,
|
||||
getScriptKind: _ => undefined,
|
||||
hasMixedContent: _ => false
|
||||
hasMixedContent: (fileName, extraFileExtensions) => {
|
||||
const mixedContentExtensions = ts.map(ts.filter(extraFileExtensions, item => item.isMixedContent), item => item.extension);
|
||||
return forEach(mixedContentExtensions, extension => fileExtensionIs(fileName, extension))
|
||||
}
|
||||
};
|
||||
|
||||
const externalFilePropertyReader: FilePropertyReader<protocol.ExternalFile> = {
|
||||
@@ -282,7 +286,8 @@ namespace ts.server {
|
||||
|
||||
this.hostConfiguration = {
|
||||
formatCodeOptions: getDefaultFormatCodeSettings(this.host),
|
||||
hostInfo: "Unknown host"
|
||||
hostInfo: "Unknown host",
|
||||
extraFileExtensions: []
|
||||
};
|
||||
|
||||
this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory());
|
||||
@@ -424,7 +429,7 @@ namespace ts.server {
|
||||
this.handleDeletedFile(info);
|
||||
}
|
||||
else {
|
||||
if (info && (!info.isOpen)) {
|
||||
if (info && (!info.isScriptOpen())) {
|
||||
// file has been changed which might affect the set of referenced files in projects that include
|
||||
// this file and set of inferred projects
|
||||
info.reloadFromFile();
|
||||
@@ -440,7 +445,7 @@ namespace ts.server {
|
||||
|
||||
// TODO: handle isOpen = true case
|
||||
|
||||
if (!info.isOpen) {
|
||||
if (!info.isScriptOpen()) {
|
||||
this.filenameToScriptInfo.remove(info.path);
|
||||
this.lastDeletedFile = info;
|
||||
|
||||
@@ -486,7 +491,7 @@ namespace ts.server {
|
||||
// If a change was made inside "folder/file", node will trigger the callback twice:
|
||||
// one with the fileName being "folder/file", and the other one with "folder".
|
||||
// We don't respond to the second one.
|
||||
if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions())) {
|
||||
if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions(), this.hostConfiguration.extraFileExtensions)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -634,15 +639,17 @@ namespace ts.server {
|
||||
// Closing file should trigger re-reading the file content from disk. This is
|
||||
// because the user may chose to discard the buffer content before saving
|
||||
// to the disk, and the server's version of the file can be out of sync.
|
||||
info.reloadFromFile();
|
||||
info.close();
|
||||
|
||||
removeItemFromSet(this.openFiles, info);
|
||||
info.isOpen = false;
|
||||
|
||||
// collect all projects that should be removed
|
||||
let projectsToRemove: Project[];
|
||||
for (const p of info.containingProjects) {
|
||||
if (p.projectKind === ProjectKind.Configured) {
|
||||
if (info.hasMixedContent) {
|
||||
info.registerFileUpdate();
|
||||
}
|
||||
// last open file in configured project - close it
|
||||
if ((<ConfiguredProject>p).deleteOpenRef() === 0) {
|
||||
(projectsToRemove || (projectsToRemove = [])).push(p);
|
||||
@@ -811,7 +818,9 @@ namespace ts.server {
|
||||
this.host,
|
||||
getDirectoryPath(configFilename),
|
||||
/*existingOptions*/ {},
|
||||
configFilename);
|
||||
configFilename,
|
||||
/*resolutionStack*/ [],
|
||||
this.hostConfiguration.extraFileExtensions);
|
||||
|
||||
if (parsedCommandLine.errors.length) {
|
||||
errors = concatenate(errors, parsedCommandLine.errors);
|
||||
@@ -915,7 +924,7 @@ namespace ts.server {
|
||||
for (const f of files) {
|
||||
const rootFilename = propertyReader.getFileName(f);
|
||||
const scriptKind = propertyReader.getScriptKind(f);
|
||||
const hasMixedContent = propertyReader.hasMixedContent(f);
|
||||
const hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions);
|
||||
if (this.host.fileExists(rootFilename)) {
|
||||
const info = this.getOrCreateScriptInfoForNormalizedPath(toNormalizedPath(rootFilename), /*openedByClient*/ clientFileName == rootFilename, /*fileContent*/ undefined, scriptKind, hasMixedContent);
|
||||
project.addRoot(info);
|
||||
@@ -961,7 +970,7 @@ namespace ts.server {
|
||||
rootFilesChanged = true;
|
||||
if (!scriptInfo) {
|
||||
const scriptKind = propertyReader.getScriptKind(f);
|
||||
const hasMixedContent = propertyReader.hasMixedContent(f);
|
||||
const hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions);
|
||||
scriptInfo = this.getOrCreateScriptInfoForNormalizedPath(normalizedPath, /*openedByClient*/ false, /*fileContent*/ undefined, scriptKind, hasMixedContent);
|
||||
}
|
||||
}
|
||||
@@ -989,7 +998,7 @@ namespace ts.server {
|
||||
}
|
||||
if (toAdd) {
|
||||
for (const f of toAdd) {
|
||||
if (f.isOpen && isRootFileInInferredProject(f)) {
|
||||
if (f.isScriptOpen() && isRootFileInInferredProject(f)) {
|
||||
// if file is already root in some inferred project
|
||||
// - remove the file from that project and delete the project if necessary
|
||||
const inferredProject = f.containingProjects[0];
|
||||
@@ -1089,32 +1098,34 @@ namespace ts.server {
|
||||
getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean) {
|
||||
let info = this.getScriptInfoForNormalizedPath(fileName);
|
||||
if (!info) {
|
||||
let content: string;
|
||||
if (this.host.fileExists(fileName)) {
|
||||
// by default pick whatever content was supplied as the argument
|
||||
// if argument was not given - then for mixed content files assume that its content is empty string
|
||||
content = fileContent || (hasMixedContent ? "" : this.host.readFile(fileName));
|
||||
}
|
||||
if (!content) {
|
||||
if (openedByClient) {
|
||||
content = "";
|
||||
}
|
||||
}
|
||||
if (content !== undefined) {
|
||||
info = new ScriptInfo(this.host, fileName, content, scriptKind, openedByClient, hasMixedContent);
|
||||
// do not watch files with mixed content - server doesn't know how to interpret it
|
||||
if (openedByClient || this.host.fileExists(fileName)) {
|
||||
info = new ScriptInfo(this.host, fileName, scriptKind, hasMixedContent);
|
||||
|
||||
this.filenameToScriptInfo.set(info.path, info);
|
||||
if (!info.isOpen && !hasMixedContent) {
|
||||
info.setWatcher(this.host.watchFile(fileName, _ => this.onSourceFileChanged(fileName)));
|
||||
|
||||
if (openedByClient) {
|
||||
if (fileContent === undefined) {
|
||||
// if file is opened by client and its content is not specified - use file text
|
||||
fileContent = this.host.readFile(fileName) || "";
|
||||
}
|
||||
}
|
||||
else {
|
||||
// do not watch files with mixed content - server doesn't know how to interpret it
|
||||
if (!hasMixedContent) {
|
||||
info.setWatcher(this.host.watchFile(fileName, _ => this.onSourceFileChanged(fileName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (info) {
|
||||
if (fileContent !== undefined) {
|
||||
info.reload(fileContent);
|
||||
if (openedByClient && !info.isScriptOpen()) {
|
||||
info.open(fileContent);
|
||||
if (hasMixedContent) {
|
||||
info.registerFileUpdate();
|
||||
}
|
||||
}
|
||||
if (openedByClient) {
|
||||
info.isOpen = true;
|
||||
else if (fileContent !== undefined) {
|
||||
info.reload(fileContent);
|
||||
}
|
||||
}
|
||||
return info;
|
||||
@@ -1146,6 +1157,10 @@ namespace ts.server {
|
||||
mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions));
|
||||
this.logger.info("Format host information updated");
|
||||
}
|
||||
if (args.extraFileExtensions) {
|
||||
this.hostConfiguration.extraFileExtensions = args.extraFileExtensions;
|
||||
this.logger.info("Host file extension mappings updated");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1230,7 +1245,6 @@ namespace ts.server {
|
||||
const info = this.getScriptInfoForNormalizedPath(toNormalizedPath(uncheckedFileName));
|
||||
if (info) {
|
||||
this.closeOpenFile(info);
|
||||
info.isOpen = false;
|
||||
}
|
||||
this.printProjects();
|
||||
}
|
||||
@@ -1255,7 +1269,7 @@ namespace ts.server {
|
||||
if (openFiles) {
|
||||
for (const file of openFiles) {
|
||||
const scriptInfo = this.getScriptInfo(file.fileName);
|
||||
Debug.assert(!scriptInfo || !scriptInfo.isOpen);
|
||||
Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen());
|
||||
const normalizedPath = scriptInfo ? scriptInfo.fileName : toNormalizedPath(file.fileName);
|
||||
this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace ts.server {
|
||||
getScriptSnapshot(filename: string): ts.IScriptSnapshot {
|
||||
const scriptInfo = this.project.getScriptInfoLSHost(filename);
|
||||
if (scriptInfo) {
|
||||
return scriptInfo.snap();
|
||||
return scriptInfo.getSnapshot();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-5
@@ -1,4 +1,4 @@
|
||||
/// <reference path="..\services\services.ts" />
|
||||
/// <reference path="..\services\services.ts" />
|
||||
/// <reference path="utilities.ts"/>
|
||||
/// <reference path="scriptInfo.ts"/>
|
||||
/// <reference path="lsHost.ts"/>
|
||||
@@ -187,6 +187,10 @@ namespace ts.server {
|
||||
public languageServiceEnabled = true;
|
||||
|
||||
builder: Builder;
|
||||
/**
|
||||
* Set of files names that were updated since the last call to getChangesSinceVersion.
|
||||
*/
|
||||
private updatedFileNames: Map<string>;
|
||||
/**
|
||||
* Set of files that was returned from the last call to getChangesSinceVersion.
|
||||
*/
|
||||
@@ -448,7 +452,7 @@ namespace ts.server {
|
||||
|
||||
containsFile(filename: NormalizedPath, requireOpen?: boolean) {
|
||||
const info = this.projectService.getScriptInfoForNormalizedPath(filename);
|
||||
if (info && (info.isOpen || !requireOpen)) {
|
||||
if (info && (info.isScriptOpen() || !requireOpen)) {
|
||||
return this.containsScriptInfo(info);
|
||||
}
|
||||
}
|
||||
@@ -480,6 +484,10 @@ namespace ts.server {
|
||||
this.markAsDirty();
|
||||
}
|
||||
|
||||
registerFileUpdate(fileName: string) {
|
||||
(this.updatedFileNames || (this.updatedFileNames = createMap<string>()))[fileName] = fileName;
|
||||
}
|
||||
|
||||
markAsDirty() {
|
||||
this.projectStateVersion++;
|
||||
}
|
||||
@@ -667,10 +675,12 @@ namespace ts.server {
|
||||
isInferred: this.projectKind === ProjectKind.Inferred,
|
||||
options: this.getCompilerOptions()
|
||||
};
|
||||
const updatedFileNames = this.updatedFileNames;
|
||||
this.updatedFileNames = undefined;
|
||||
// check if requested version is the same that we have reported last time
|
||||
if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) {
|
||||
// if current structure version is the same - return info witout any changes
|
||||
if (this.projectStructureVersion == this.lastReportedVersion) {
|
||||
// if current structure version is the same - return info without any changes
|
||||
if (this.projectStructureVersion == this.lastReportedVersion && !updatedFileNames) {
|
||||
return { info, projectErrors: this.projectErrors };
|
||||
}
|
||||
// compute and return the difference
|
||||
@@ -679,6 +689,7 @@ namespace ts.server {
|
||||
|
||||
const added: string[] = [];
|
||||
const removed: string[] = [];
|
||||
const updated: string[] = getOwnKeys(updatedFileNames);
|
||||
for (const id in currentFiles) {
|
||||
if (!hasProperty(lastReportedFileNames, id)) {
|
||||
added.push(id);
|
||||
@@ -691,7 +702,7 @@ namespace ts.server {
|
||||
}
|
||||
this.lastReportedFileNames = currentFiles;
|
||||
this.lastReportedVersion = this.projectStructureVersion;
|
||||
return { info, changes: { added, removed }, projectErrors: this.projectErrors };
|
||||
return { info, changes: { added, removed, updated }, projectErrors: this.projectErrors };
|
||||
}
|
||||
else {
|
||||
// unknown version - return everything
|
||||
|
||||
+10
-1
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* Declaration module describing the TypeScript Server protocol
|
||||
*/
|
||||
namespace ts.server.protocol {
|
||||
@@ -918,6 +918,10 @@ namespace ts.server.protocol {
|
||||
* List of removed files
|
||||
*/
|
||||
removed: string[];
|
||||
/**
|
||||
* List of updated files
|
||||
*/
|
||||
updated: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -990,6 +994,11 @@ namespace ts.server.protocol {
|
||||
* The format options to use during formatting and other code editing features.
|
||||
*/
|
||||
formatOptions?: FormatCodeSettings;
|
||||
|
||||
/**
|
||||
* The host's additional supported file extensions
|
||||
*/
|
||||
extraFileExtensions?: FileExtensionInfo[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+197
-35
@@ -2,6 +2,161 @@
|
||||
|
||||
namespace ts.server {
|
||||
|
||||
/* @internal */
|
||||
export class TextStorage {
|
||||
private svc: ScriptVersionCache | undefined;
|
||||
private svcVersion = 0;
|
||||
|
||||
private text: string;
|
||||
private lineMap: number[];
|
||||
private textVersion = 0;
|
||||
|
||||
constructor(private readonly host: ServerHost, private readonly fileName: NormalizedPath) {
|
||||
}
|
||||
|
||||
public getVersion() {
|
||||
return this.svc
|
||||
? `SVC-${this.svcVersion}-${this.svc.getSnapshot().version}`
|
||||
: `Text-${this.textVersion}`;
|
||||
}
|
||||
|
||||
public hasScriptVersionCache() {
|
||||
return this.svc !== undefined;
|
||||
}
|
||||
|
||||
public useScriptVersionCache(newText?: string) {
|
||||
this.switchToScriptVersionCache(newText);
|
||||
}
|
||||
|
||||
public useText(newText?: string) {
|
||||
this.svc = undefined;
|
||||
this.setText(newText);
|
||||
}
|
||||
|
||||
public edit(start: number, end: number, newText: string) {
|
||||
this.switchToScriptVersionCache().edit(start, end - start, newText);
|
||||
}
|
||||
|
||||
public reload(text: string) {
|
||||
if (this.svc) {
|
||||
this.svc.reload(text);
|
||||
}
|
||||
else {
|
||||
this.setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
public reloadFromFile(tempFileName?: string) {
|
||||
if (this.svc || (tempFileName !== this.fileName)) {
|
||||
this.reload(this.getFileText(tempFileName))
|
||||
}
|
||||
else {
|
||||
this.setText(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
public getSnapshot(): IScriptSnapshot {
|
||||
return this.svc
|
||||
? this.svc.getSnapshot()
|
||||
: ScriptSnapshot.fromString(this.getOrLoadText());
|
||||
}
|
||||
|
||||
public getLineInfo(line: number) {
|
||||
return this.switchToScriptVersionCache().getSnapshot().index.lineNumberToInfo(line);
|
||||
}
|
||||
/**
|
||||
* @param line 0 based index
|
||||
*/
|
||||
lineToTextSpan(line: number) {
|
||||
if (!this.svc) {
|
||||
const lineMap = this.getLineMap();
|
||||
const start = lineMap[line]; // -1 since line is 1-based
|
||||
const end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length;
|
||||
return ts.createTextSpanFromBounds(start, end);
|
||||
}
|
||||
const index = this.svc.getSnapshot().index;
|
||||
const lineInfo = index.lineNumberToInfo(line + 1);
|
||||
let len: number;
|
||||
if (lineInfo.leaf) {
|
||||
len = lineInfo.leaf.text.length;
|
||||
}
|
||||
else {
|
||||
const nextLineInfo = index.lineNumberToInfo(line + 2);
|
||||
len = nextLineInfo.offset - lineInfo.offset;
|
||||
}
|
||||
return ts.createTextSpan(lineInfo.offset, len);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param line 1 based index
|
||||
* @param offset 1 based index
|
||||
*/
|
||||
lineOffsetToPosition(line: number, offset: number): number {
|
||||
if (!this.svc) {
|
||||
return computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1);
|
||||
}
|
||||
const index = this.svc.getSnapshot().index;
|
||||
|
||||
const lineInfo = index.lineNumberToInfo(line);
|
||||
// TODO: assert this offset is actually on the line
|
||||
return (lineInfo.offset + offset - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param line 1-based index
|
||||
* @param offset 1-based index
|
||||
*/
|
||||
positionToLineOffset(position: number): ILineInfo {
|
||||
if (!this.svc) {
|
||||
const { line, character } = computeLineAndCharacterOfPosition(this.getLineMap(), position);
|
||||
return { line: line + 1, offset: character + 1 };
|
||||
}
|
||||
const index = this.svc.getSnapshot().index;
|
||||
const lineOffset = index.charOffsetToLineNumberAndPos(position);
|
||||
return { line: lineOffset.line, offset: lineOffset.offset + 1 };
|
||||
}
|
||||
|
||||
private getFileText(tempFileName?: string) {
|
||||
return this.host.readFile(tempFileName || this.fileName) || "";
|
||||
}
|
||||
|
||||
private ensureNoScriptVersionCache() {
|
||||
Debug.assert(!this.svc, "ScriptVersionCache should not be set");
|
||||
}
|
||||
|
||||
private switchToScriptVersionCache(newText?: string): ScriptVersionCache {
|
||||
if (!this.svc) {
|
||||
this.svc = ScriptVersionCache.fromString(this.host, newText !== undefined ? newText : this.getOrLoadText());
|
||||
this.svcVersion++;
|
||||
this.text = undefined;
|
||||
}
|
||||
return this.svc;
|
||||
}
|
||||
|
||||
private getOrLoadText() {
|
||||
this.ensureNoScriptVersionCache();
|
||||
if (this.text === undefined) {
|
||||
this.setText(this.getFileText());
|
||||
}
|
||||
return this.text;
|
||||
}
|
||||
|
||||
private getLineMap() {
|
||||
this.ensureNoScriptVersionCache();
|
||||
return this.lineMap || (this.lineMap = computeLineStarts(this.getOrLoadText()));
|
||||
}
|
||||
|
||||
private setText(newText: string) {
|
||||
this.ensureNoScriptVersionCache();
|
||||
if (newText === undefined || this.text !== newText) {
|
||||
this.text = newText;
|
||||
this.lineMap = undefined;
|
||||
this.textVersion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class ScriptInfo {
|
||||
/**
|
||||
* All projects that include this file
|
||||
@@ -11,24 +166,46 @@ namespace ts.server {
|
||||
readonly path: Path;
|
||||
|
||||
private fileWatcher: FileWatcher;
|
||||
private svc: ScriptVersionCache;
|
||||
private textStorage: TextStorage;
|
||||
|
||||
private isOpen: boolean;
|
||||
|
||||
// TODO: allow to update hasMixedContent from the outside
|
||||
constructor(
|
||||
private readonly host: ServerHost,
|
||||
readonly fileName: NormalizedPath,
|
||||
content: string,
|
||||
readonly scriptKind: ScriptKind,
|
||||
public isOpen = false,
|
||||
public hasMixedContent = false) {
|
||||
|
||||
this.path = toPath(fileName, host.getCurrentDirectory(), createGetCanonicalFileName(host.useCaseSensitiveFileNames));
|
||||
this.svc = ScriptVersionCache.fromString(host, content);
|
||||
this.textStorage = new TextStorage(host, fileName);
|
||||
if (hasMixedContent) {
|
||||
this.textStorage.reload("");
|
||||
}
|
||||
this.scriptKind = scriptKind
|
||||
? scriptKind
|
||||
: getScriptKindFromFileName(fileName);
|
||||
}
|
||||
|
||||
public isScriptOpen() {
|
||||
return this.isOpen;
|
||||
}
|
||||
|
||||
public open(newText: string) {
|
||||
this.isOpen = true;
|
||||
this.textStorage.useScriptVersionCache(newText);
|
||||
this.markContainingProjectsAsDirty();
|
||||
}
|
||||
|
||||
public close() {
|
||||
this.isOpen = false;
|
||||
this.textStorage.useText(this.hasMixedContent ? "" : undefined);
|
||||
this.markContainingProjectsAsDirty();
|
||||
}
|
||||
|
||||
public getSnapshot() {
|
||||
return this.textStorage.getSnapshot();
|
||||
}
|
||||
|
||||
getFormatCodeSettings() {
|
||||
return this.formatCodeSettings;
|
||||
}
|
||||
@@ -90,6 +267,12 @@ namespace ts.server {
|
||||
return this.containingProjects[0];
|
||||
}
|
||||
|
||||
registerFileUpdate(): void {
|
||||
for (const p of this.containingProjects) {
|
||||
p.registerFileUpdate(this.path);
|
||||
}
|
||||
}
|
||||
|
||||
setFormatOptions(formatSettings: FormatCodeSettings): void {
|
||||
if (formatSettings) {
|
||||
if (!this.formatCodeSettings) {
|
||||
@@ -112,16 +295,16 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
getLatestVersion() {
|
||||
return this.svc.latestVersion().toString();
|
||||
return this.textStorage.getVersion();
|
||||
}
|
||||
|
||||
reload(script: string) {
|
||||
this.svc.reload(script);
|
||||
this.textStorage.reload(script);
|
||||
this.markContainingProjectsAsDirty();
|
||||
}
|
||||
|
||||
saveTo(fileName: string) {
|
||||
const snap = this.snap();
|
||||
const snap = this.textStorage.getSnapshot();
|
||||
this.host.writeFile(fileName, snap.getText(0, snap.getLength()));
|
||||
}
|
||||
|
||||
@@ -130,22 +313,17 @@ namespace ts.server {
|
||||
this.reload("");
|
||||
}
|
||||
else {
|
||||
this.svc.reloadFromFile(tempFileName || this.fileName);
|
||||
this.textStorage.reloadFromFile(tempFileName);
|
||||
this.markContainingProjectsAsDirty();
|
||||
}
|
||||
}
|
||||
|
||||
snap() {
|
||||
return this.svc.getSnapshot();
|
||||
}
|
||||
|
||||
getLineInfo(line: number) {
|
||||
const snap = this.snap();
|
||||
return snap.index.lineNumberToInfo(line);
|
||||
return this.textStorage.getLineInfo(line);
|
||||
}
|
||||
|
||||
editContent(start: number, end: number, newText: string): void {
|
||||
this.svc.edit(start, end - start, newText);
|
||||
this.textStorage.edit(start, end, newText);
|
||||
this.markContainingProjectsAsDirty();
|
||||
}
|
||||
|
||||
@@ -159,17 +337,7 @@ namespace ts.server {
|
||||
* @param line 1 based index
|
||||
*/
|
||||
lineToTextSpan(line: number) {
|
||||
const index = this.snap().index;
|
||||
const lineInfo = index.lineNumberToInfo(line + 1);
|
||||
let len: number;
|
||||
if (lineInfo.leaf) {
|
||||
len = lineInfo.leaf.text.length;
|
||||
}
|
||||
else {
|
||||
const nextLineInfo = index.lineNumberToInfo(line + 2);
|
||||
len = nextLineInfo.offset - lineInfo.offset;
|
||||
}
|
||||
return ts.createTextSpan(lineInfo.offset, len);
|
||||
return this.textStorage.lineToTextSpan(line);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,11 +345,7 @@ namespace ts.server {
|
||||
* @param offset 1 based index
|
||||
*/
|
||||
lineOffsetToPosition(line: number, offset: number): number {
|
||||
const index = this.snap().index;
|
||||
|
||||
const lineInfo = index.lineNumberToInfo(line);
|
||||
// TODO: assert this offset is actually on the line
|
||||
return (lineInfo.offset + offset - 1);
|
||||
return this.textStorage.lineOffsetToPosition(line, offset);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,9 +353,7 @@ namespace ts.server {
|
||||
* @param offset 1-based index
|
||||
*/
|
||||
positionToLineOffset(position: number): ILineInfo {
|
||||
const index = this.snap().index;
|
||||
const lineOffset = index.charOffsetToLineNumberAndPos(position);
|
||||
return { line: lineOffset.line, offset: lineOffset.offset + 1 };
|
||||
return this.textStorage.positionToLineOffset(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -438,8 +438,9 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange {
|
||||
const oldSnap = <LineIndexSnapshot>oldSnapshot;
|
||||
return this.getTextChangeRangeSinceVersion(oldSnap.version);
|
||||
if (oldSnapshot instanceof LineIndexSnapshot) {
|
||||
return this.getTextChangeRangeSinceVersion(oldSnapshot.version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -709,7 +709,7 @@ namespace ts.server {
|
||||
const displayString = ts.displayPartsToString(nameInfo.displayParts);
|
||||
const nameSpan = nameInfo.textSpan;
|
||||
const nameColStart = scriptInfo.positionToLineOffset(nameSpan.start).offset;
|
||||
const nameText = scriptInfo.snap().getText(nameSpan.start, ts.textSpanEnd(nameSpan));
|
||||
const nameText = scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan));
|
||||
const refs = combineProjectOutput<protocol.ReferencesResponseItem>(
|
||||
projects,
|
||||
(project: Project) => {
|
||||
@@ -722,7 +722,7 @@ namespace ts.server {
|
||||
const refScriptInfo = project.getScriptInfo(ref.fileName);
|
||||
const start = refScriptInfo.positionToLineOffset(ref.textSpan.start);
|
||||
const refLineSpan = refScriptInfo.lineToTextSpan(start.line - 1);
|
||||
const lineText = refScriptInfo.snap().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, "");
|
||||
const lineText = refScriptInfo.getSnapshot().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, "");
|
||||
return {
|
||||
file: ref.fileName,
|
||||
start: start,
|
||||
@@ -1326,7 +1326,7 @@ namespace ts.server {
|
||||
highPriorityFiles.push(fileNameInProject);
|
||||
else {
|
||||
const info = this.projectService.getScriptInfo(fileNameInProject);
|
||||
if (!info.isOpen) {
|
||||
if (!info.isScriptOpen()) {
|
||||
if (fileNameInProject.indexOf(".d.ts") > 0)
|
||||
veryLowPriorityFiles.push(fileNameInProject);
|
||||
else
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="types.d.ts" />
|
||||
/// <reference path="types.d.ts" />
|
||||
/// <reference path="shared.ts" />
|
||||
|
||||
namespace ts.server {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* @internal */
|
||||
/* @internal */
|
||||
namespace ts.JsDoc {
|
||||
const jsDocTagNames = [
|
||||
"augments",
|
||||
@@ -166,6 +166,7 @@ namespace ts.JsDoc {
|
||||
const lineStart = sourceFile.getLineStarts()[posLineAndChar.line];
|
||||
|
||||
const indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character);
|
||||
const isJavaScriptFile = hasJavaScriptFileExtension(sourceFile.fileName);
|
||||
|
||||
let docParams = "";
|
||||
for (let i = 0, numParams = parameters.length; i < numParams; i++) {
|
||||
@@ -173,8 +174,12 @@ namespace ts.JsDoc {
|
||||
const paramName = currentName.kind === SyntaxKind.Identifier ?
|
||||
(<Identifier>currentName).text :
|
||||
"param" + i;
|
||||
|
||||
docParams += `${indentationStr} * @param ${paramName}${newLine}`;
|
||||
if (isJavaScriptFile) {
|
||||
docParams += `${indentationStr} * @param {any} ${paramName}${newLine}`;
|
||||
}
|
||||
else {
|
||||
docParams += `${indentationStr} * @param ${paramName}${newLine}`;
|
||||
}
|
||||
}
|
||||
|
||||
// A doc comment consists of the following
|
||||
|
||||
@@ -1725,7 +1725,7 @@ namespace ts {
|
||||
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
|
||||
|
||||
// Check if in a context where we don't want to perform any insertion
|
||||
if (isInString(sourceFile, position) || isInComment(sourceFile, position)) {
|
||||
if (isInString(sourceFile, position)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
public getText(start: number, end: number): string {
|
||||
return this.text.substring(start, end);
|
||||
return start === 0 && end === this.text.length
|
||||
? this.text
|
||||
: this.text.substring(start, end);
|
||||
}
|
||||
|
||||
public getLength(): number {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [awaitInheritedPromise_es2017.ts]
|
||||
interface A extends Promise<string> {}
|
||||
declare var a: A;
|
||||
async function f() {
|
||||
await a;
|
||||
}
|
||||
|
||||
//// [awaitInheritedPromise_es2017.js]
|
||||
async function f() {
|
||||
await a;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts ===
|
||||
interface A extends Promise<string> {}
|
||||
>A : Symbol(A, Decl(awaitInheritedPromise_es2017.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
|
||||
declare var a: A;
|
||||
>a : Symbol(a, Decl(awaitInheritedPromise_es2017.ts, 1, 11))
|
||||
>A : Symbol(A, Decl(awaitInheritedPromise_es2017.ts, 0, 0))
|
||||
|
||||
async function f() {
|
||||
>f : Symbol(f, Decl(awaitInheritedPromise_es2017.ts, 1, 17))
|
||||
|
||||
await a;
|
||||
>a : Symbol(a, Decl(awaitInheritedPromise_es2017.ts, 1, 11))
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
=== tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts ===
|
||||
interface A extends Promise<string> {}
|
||||
>A : A
|
||||
>Promise : Promise<T>
|
||||
|
||||
declare var a: A;
|
||||
>a : A
|
||||
>A : A
|
||||
|
||||
async function f() {
|
||||
>f : () => Promise<void>
|
||||
|
||||
await a;
|
||||
>await a : string
|
||||
>a : A
|
||||
}
|
||||
@@ -208,6 +208,7 @@ function foo() {
|
||||
}
|
||||
(function () { return b; });
|
||||
return { value: 100 };
|
||||
var _a;
|
||||
};
|
||||
for (var _c = 0, _d = []; _c < _d.length; _c++) {
|
||||
var b = _d[_c];
|
||||
@@ -221,6 +222,7 @@ function foo() {
|
||||
}
|
||||
}
|
||||
(function () { return a; });
|
||||
var _b;
|
||||
};
|
||||
var arguments_1 = arguments, x, z, x1, z1;
|
||||
l0: for (var _i = 0, _a = []; _i < _a.length; _i++) {
|
||||
@@ -238,7 +240,6 @@ function foo() {
|
||||
use(z);
|
||||
use(x1);
|
||||
use(z1);
|
||||
var _b, _a;
|
||||
}
|
||||
function foo2() {
|
||||
for (var _i = 0, _a = []; _i < _a.length; _i++) {
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(3,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(7,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(15,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(19,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(23,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(27,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(28,5): error TS2502: 'y' is referenced directly or indirectly in its own type annotation.
|
||||
tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(29,5): error TS2502: 'z' is referenced directly or indirectly in its own type annotation.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts (8 errors) ====
|
||||
|
||||
type T1 = {
|
||||
x: T1["x"]; // Error
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
};
|
||||
|
||||
type T2<K extends "x" | "y"> = {
|
||||
x: T2<K>[K]; // Error
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
y: number;
|
||||
}
|
||||
|
||||
declare let x2: T2<"x">;
|
||||
let x2x = x2.x;
|
||||
|
||||
interface T3<T extends T3<T>> {
|
||||
x: T["x"]; // Error
|
||||
~~~~~~~~~~
|
||||
!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
}
|
||||
|
||||
interface T4<T extends T4<T>> {
|
||||
x: T4<T>["x"]; // Error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
}
|
||||
|
||||
class C1 {
|
||||
x: C1["x"]; // Error
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
}
|
||||
|
||||
class C2 {
|
||||
x: this["y"]; // Error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation.
|
||||
y: this["z"]; // Error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2502: 'y' is referenced directly or indirectly in its own type annotation.
|
||||
z: this["x"]; // Error
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2502: 'z' is referenced directly or indirectly in its own type annotation.
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
//// [circularIndexedAccessErrors.ts]
|
||||
|
||||
type T1 = {
|
||||
x: T1["x"]; // Error
|
||||
};
|
||||
|
||||
type T2<K extends "x" | "y"> = {
|
||||
x: T2<K>[K]; // Error
|
||||
y: number;
|
||||
}
|
||||
|
||||
declare let x2: T2<"x">;
|
||||
let x2x = x2.x;
|
||||
|
||||
interface T3<T extends T3<T>> {
|
||||
x: T["x"]; // Error
|
||||
}
|
||||
|
||||
interface T4<T extends T4<T>> {
|
||||
x: T4<T>["x"]; // Error
|
||||
}
|
||||
|
||||
class C1 {
|
||||
x: C1["x"]; // Error
|
||||
}
|
||||
|
||||
class C2 {
|
||||
x: this["y"]; // Error
|
||||
y: this["z"]; // Error
|
||||
z: this["x"]; // Error
|
||||
}
|
||||
|
||||
//// [circularIndexedAccessErrors.js]
|
||||
var x2x = x2.x;
|
||||
var C1 = (function () {
|
||||
function C1() {
|
||||
}
|
||||
return C1;
|
||||
}());
|
||||
var C2 = (function () {
|
||||
function C2() {
|
||||
}
|
||||
return C2;
|
||||
}());
|
||||
|
||||
|
||||
//// [circularIndexedAccessErrors.d.ts]
|
||||
declare type T1 = {
|
||||
x: T1["x"];
|
||||
};
|
||||
declare type T2<K extends "x" | "y"> = {
|
||||
x: T2<K>[K];
|
||||
y: number;
|
||||
};
|
||||
declare let x2: T2<"x">;
|
||||
declare let x2x: any;
|
||||
interface T3<T extends T3<T>> {
|
||||
x: T["x"];
|
||||
}
|
||||
interface T4<T extends T4<T>> {
|
||||
x: T4<T>["x"];
|
||||
}
|
||||
declare class C1 {
|
||||
x: C1["x"];
|
||||
}
|
||||
declare class C2 {
|
||||
x: this["y"];
|
||||
y: this["z"];
|
||||
z: this["x"];
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [tests/cases/compiler/circularReferenceInImport.ts] ////
|
||||
|
||||
//// [db.d.ts]
|
||||
|
||||
declare namespace Db {
|
||||
export import Types = Db;
|
||||
}
|
||||
|
||||
export = Db;
|
||||
|
||||
//// [app.ts]
|
||||
import * as Db from "./db"
|
||||
|
||||
export function foo() {
|
||||
return new Object()
|
||||
}
|
||||
|
||||
//// [app.js]
|
||||
"use strict";
|
||||
function foo() {
|
||||
return new Object();
|
||||
}
|
||||
exports.foo = foo;
|
||||
|
||||
|
||||
//// [app.d.ts]
|
||||
export declare function foo(): Object;
|
||||
@@ -0,0 +1,23 @@
|
||||
=== tests/cases/compiler/db.d.ts ===
|
||||
|
||||
declare namespace Db {
|
||||
>Db : Symbol(Types, Decl(db.d.ts, 0, 0))
|
||||
|
||||
export import Types = Db;
|
||||
>Types : Symbol(Types, Decl(db.d.ts, 1, 22))
|
||||
>Db : Symbol(Types, Decl(db.d.ts, 0, 0))
|
||||
}
|
||||
|
||||
export = Db;
|
||||
>Db : Symbol(Db, Decl(db.d.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/app.ts ===
|
||||
import * as Db from "./db"
|
||||
>Db : Symbol(Db, Decl(app.ts, 0, 6))
|
||||
|
||||
export function foo() {
|
||||
>foo : Symbol(foo, Decl(app.ts, 0, 26))
|
||||
|
||||
return new Object()
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
=== tests/cases/compiler/db.d.ts ===
|
||||
|
||||
declare namespace Db {
|
||||
>Db : typeof Types
|
||||
|
||||
export import Types = Db;
|
||||
>Types : typeof Types
|
||||
>Db : typeof Types
|
||||
}
|
||||
|
||||
export = Db;
|
||||
>Db : typeof Db
|
||||
|
||||
=== tests/cases/compiler/app.ts ===
|
||||
import * as Db from "./db"
|
||||
>Db : typeof Db
|
||||
|
||||
export function foo() {
|
||||
>foo : () => Object
|
||||
|
||||
return new Object()
|
||||
>new Object() : Object
|
||||
>Object : ObjectConstructor
|
||||
}
|
||||
@@ -14,15 +14,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
let Testing123 = Testing123_1 = class Testing123 {
|
||||
};
|
||||
Testing123.prop1 = Testing123_1.prop0;
|
||||
Testing123 = Testing123_1 = __decorate([
|
||||
Something({ v: () => Testing123_1 }),
|
||||
__metadata("design:paramtypes", [])
|
||||
Something({ v: () => Testing123_1 })
|
||||
], Testing123);
|
||||
exports.Testing123 = Testing123;
|
||||
var Testing123_1;
|
||||
@@ -13,14 +13,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
let Testing123 = Testing123_1 = class Testing123 {
|
||||
};
|
||||
Testing123 = Testing123_1 = __decorate([
|
||||
Something({ v: () => Testing123_1 }),
|
||||
__metadata("design:paramtypes", [])
|
||||
Something({ v: () => Testing123_1 })
|
||||
], Testing123);
|
||||
exports.Testing123 = Testing123;
|
||||
var Testing123_1;
|
||||
@@ -17,9 +17,6 @@ System.register([], function (exports_1, context_1) {
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var Testing123, Testing123_1;
|
||||
return {
|
||||
@@ -29,8 +26,7 @@ System.register([], function (exports_1, context_1) {
|
||||
};
|
||||
Testing123.prop1 = Testing123_1.prop0;
|
||||
Testing123 = Testing123_1 = __decorate([
|
||||
Something({ v: () => Testing123_1 }),
|
||||
__metadata("design:paramtypes", [])
|
||||
Something({ v: () => Testing123_1 })
|
||||
], Testing123);
|
||||
exports_1("Testing123", Testing123);
|
||||
}
|
||||
|
||||
@@ -14,9 +14,6 @@ System.register([], function (exports_1, context_1) {
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var Testing123, Testing123_1;
|
||||
return {
|
||||
@@ -25,8 +22,7 @@ System.register([], function (exports_1, context_1) {
|
||||
Testing123 = Testing123_1 = class Testing123 {
|
||||
};
|
||||
Testing123 = Testing123_1 = __decorate([
|
||||
Something({ v: () => Testing123_1 }),
|
||||
__metadata("design:paramtypes", [])
|
||||
Something({ v: () => Testing123_1 })
|
||||
], Testing123);
|
||||
exports_1("Testing123", Testing123);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts(26,5): error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts(31,5): error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts (2 errors) ====
|
||||
declare function dec1<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
declare function dec2<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class A {
|
||||
@dec1 get x() { return 0; }
|
||||
set x(value: number) { }
|
||||
}
|
||||
|
||||
class B {
|
||||
get x() { return 0; }
|
||||
@dec2 set x(value: number) { }
|
||||
}
|
||||
|
||||
class C {
|
||||
@dec1 set x(value: number) { }
|
||||
get x() { return 0; }
|
||||
}
|
||||
|
||||
class D {
|
||||
set x(value: number) { }
|
||||
@dec2 get x() { return 0; }
|
||||
}
|
||||
|
||||
class E {
|
||||
@dec1 get x() { return 0; }
|
||||
@dec2 set x(value: number) { }
|
||||
~
|
||||
!!! error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name.
|
||||
}
|
||||
|
||||
class F {
|
||||
@dec1 set x(value: number) { }
|
||||
@dec2 get x() { return 0; }
|
||||
~
|
||||
!!! error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name.
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
//// [decoratorOnClassAccessor7.ts]
|
||||
declare function dec1<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
declare function dec2<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class A {
|
||||
@dec1 get x() { return 0; }
|
||||
set x(value: number) { }
|
||||
}
|
||||
|
||||
class B {
|
||||
get x() { return 0; }
|
||||
@dec2 set x(value: number) { }
|
||||
}
|
||||
|
||||
class C {
|
||||
@dec1 set x(value: number) { }
|
||||
get x() { return 0; }
|
||||
}
|
||||
|
||||
class D {
|
||||
set x(value: number) { }
|
||||
@dec2 get x() { return 0; }
|
||||
}
|
||||
|
||||
class E {
|
||||
@dec1 get x() { return 0; }
|
||||
@dec2 set x(value: number) { }
|
||||
}
|
||||
|
||||
class F {
|
||||
@dec1 set x(value: number) { }
|
||||
@dec2 get x() { return 0; }
|
||||
}
|
||||
|
||||
//// [decoratorOnClassAccessor7.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
Object.defineProperty(A.prototype, "x", {
|
||||
get: function () { return 0; },
|
||||
set: function (value) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return A;
|
||||
}());
|
||||
__decorate([
|
||||
dec1
|
||||
], A.prototype, "x", null);
|
||||
var B = (function () {
|
||||
function B() {
|
||||
}
|
||||
Object.defineProperty(B.prototype, "x", {
|
||||
get: function () { return 0; },
|
||||
set: function (value) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return B;
|
||||
}());
|
||||
__decorate([
|
||||
dec2
|
||||
], B.prototype, "x", null);
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "x", {
|
||||
get: function () { return 0; },
|
||||
set: function (value) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
}());
|
||||
__decorate([
|
||||
dec1
|
||||
], C.prototype, "x", null);
|
||||
var D = (function () {
|
||||
function D() {
|
||||
}
|
||||
Object.defineProperty(D.prototype, "x", {
|
||||
get: function () { return 0; },
|
||||
set: function (value) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return D;
|
||||
}());
|
||||
__decorate([
|
||||
dec2
|
||||
], D.prototype, "x", null);
|
||||
var E = (function () {
|
||||
function E() {
|
||||
}
|
||||
Object.defineProperty(E.prototype, "x", {
|
||||
get: function () { return 0; },
|
||||
set: function (value) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return E;
|
||||
}());
|
||||
__decorate([
|
||||
dec1
|
||||
], E.prototype, "x", null);
|
||||
var F = (function () {
|
||||
function F() {
|
||||
}
|
||||
Object.defineProperty(F.prototype, "x", {
|
||||
get: function () { return 0; },
|
||||
set: function (value) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return F;
|
||||
}());
|
||||
__decorate([
|
||||
dec1
|
||||
], F.prototype, "x", null);
|
||||
@@ -0,0 +1,135 @@
|
||||
//// [decoratorOnClassAccessor8.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class A {
|
||||
@dec get x() { return 0; }
|
||||
set x(value: number) { }
|
||||
}
|
||||
|
||||
class B {
|
||||
get x() { return 0; }
|
||||
@dec set x(value: number) { }
|
||||
}
|
||||
|
||||
class C {
|
||||
@dec set x(value: number) { }
|
||||
get x() { return 0; }
|
||||
}
|
||||
|
||||
class D {
|
||||
set x(value: number) { }
|
||||
@dec get x() { return 0; }
|
||||
}
|
||||
|
||||
class E {
|
||||
@dec get x() { return 0; }
|
||||
}
|
||||
|
||||
class F {
|
||||
@dec set x(value: number) { }
|
||||
}
|
||||
|
||||
//// [decoratorOnClassAccessor8.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
Object.defineProperty(A.prototype, "x", {
|
||||
get: function () { return 0; },
|
||||
set: function (value) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return A;
|
||||
}());
|
||||
__decorate([
|
||||
dec,
|
||||
__metadata("design:type", Object),
|
||||
__metadata("design:paramtypes", [Number])
|
||||
], A.prototype, "x", null);
|
||||
var B = (function () {
|
||||
function B() {
|
||||
}
|
||||
Object.defineProperty(B.prototype, "x", {
|
||||
get: function () { return 0; },
|
||||
set: function (value) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return B;
|
||||
}());
|
||||
__decorate([
|
||||
dec,
|
||||
__metadata("design:type", Number),
|
||||
__metadata("design:paramtypes", [Number])
|
||||
], B.prototype, "x", null);
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "x", {
|
||||
get: function () { return 0; },
|
||||
set: function (value) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return C;
|
||||
}());
|
||||
__decorate([
|
||||
dec,
|
||||
__metadata("design:type", Number),
|
||||
__metadata("design:paramtypes", [Number])
|
||||
], C.prototype, "x", null);
|
||||
var D = (function () {
|
||||
function D() {
|
||||
}
|
||||
Object.defineProperty(D.prototype, "x", {
|
||||
get: function () { return 0; },
|
||||
set: function (value) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return D;
|
||||
}());
|
||||
__decorate([
|
||||
dec,
|
||||
__metadata("design:type", Object),
|
||||
__metadata("design:paramtypes", [Number])
|
||||
], D.prototype, "x", null);
|
||||
var E = (function () {
|
||||
function E() {
|
||||
}
|
||||
Object.defineProperty(E.prototype, "x", {
|
||||
get: function () { return 0; },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return E;
|
||||
}());
|
||||
__decorate([
|
||||
dec,
|
||||
__metadata("design:type", Object),
|
||||
__metadata("design:paramtypes", [])
|
||||
], E.prototype, "x", null);
|
||||
var F = (function () {
|
||||
function F() {
|
||||
}
|
||||
Object.defineProperty(F.prototype, "x", {
|
||||
set: function (value) { },
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return F;
|
||||
}());
|
||||
__decorate([
|
||||
dec,
|
||||
__metadata("design:type", Number),
|
||||
__metadata("design:paramtypes", [Number])
|
||||
], F.prototype, "x", null);
|
||||
@@ -0,0 +1,76 @@
|
||||
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(decoratorOnClassAccessor8.ts, 0, 21))
|
||||
>target : Symbol(target, Decl(decoratorOnClassAccessor8.ts, 0, 24))
|
||||
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassAccessor8.ts, 0, 36))
|
||||
>descriptor : Symbol(descriptor, Decl(decoratorOnClassAccessor8.ts, 0, 57))
|
||||
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(decoratorOnClassAccessor8.ts, 0, 21))
|
||||
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(decoratorOnClassAccessor8.ts, 0, 21))
|
||||
|
||||
class A {
|
||||
>A : Symbol(A, Decl(decoratorOnClassAccessor8.ts, 0, 126))
|
||||
|
||||
@dec get x() { return 0; }
|
||||
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(decoratorOnClassAccessor8.ts, 2, 9), Decl(decoratorOnClassAccessor8.ts, 3, 30))
|
||||
|
||||
set x(value: number) { }
|
||||
>x : Symbol(A.x, Decl(decoratorOnClassAccessor8.ts, 2, 9), Decl(decoratorOnClassAccessor8.ts, 3, 30))
|
||||
>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 4, 10))
|
||||
}
|
||||
|
||||
class B {
|
||||
>B : Symbol(B, Decl(decoratorOnClassAccessor8.ts, 5, 1))
|
||||
|
||||
get x() { return 0; }
|
||||
>x : Symbol(B.x, Decl(decoratorOnClassAccessor8.ts, 7, 9), Decl(decoratorOnClassAccessor8.ts, 8, 25))
|
||||
|
||||
@dec set x(value: number) { }
|
||||
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
|
||||
>x : Symbol(B.x, Decl(decoratorOnClassAccessor8.ts, 7, 9), Decl(decoratorOnClassAccessor8.ts, 8, 25))
|
||||
>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 9, 15))
|
||||
}
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(decoratorOnClassAccessor8.ts, 10, 1))
|
||||
|
||||
@dec set x(value: number) { }
|
||||
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
|
||||
>x : Symbol(C.x, Decl(decoratorOnClassAccessor8.ts, 12, 9), Decl(decoratorOnClassAccessor8.ts, 13, 33))
|
||||
>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 13, 15))
|
||||
|
||||
get x() { return 0; }
|
||||
>x : Symbol(C.x, Decl(decoratorOnClassAccessor8.ts, 12, 9), Decl(decoratorOnClassAccessor8.ts, 13, 33))
|
||||
}
|
||||
|
||||
class D {
|
||||
>D : Symbol(D, Decl(decoratorOnClassAccessor8.ts, 15, 1))
|
||||
|
||||
set x(value: number) { }
|
||||
>x : Symbol(D.x, Decl(decoratorOnClassAccessor8.ts, 17, 9), Decl(decoratorOnClassAccessor8.ts, 18, 28))
|
||||
>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 18, 10))
|
||||
|
||||
@dec get x() { return 0; }
|
||||
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
|
||||
>x : Symbol(D.x, Decl(decoratorOnClassAccessor8.ts, 17, 9), Decl(decoratorOnClassAccessor8.ts, 18, 28))
|
||||
}
|
||||
|
||||
class E {
|
||||
>E : Symbol(E, Decl(decoratorOnClassAccessor8.ts, 20, 1))
|
||||
|
||||
@dec get x() { return 0; }
|
||||
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
|
||||
>x : Symbol(E.x, Decl(decoratorOnClassAccessor8.ts, 22, 9))
|
||||
}
|
||||
|
||||
class F {
|
||||
>F : Symbol(F, Decl(decoratorOnClassAccessor8.ts, 24, 1))
|
||||
|
||||
@dec set x(value: number) { }
|
||||
>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0))
|
||||
>x : Symbol(F.x, Decl(decoratorOnClassAccessor8.ts, 26, 9))
|
||||
>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 27, 15))
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
@dec get x() { return 0; }
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>x : number
|
||||
>0 : 0
|
||||
|
||||
set x(value: number) { }
|
||||
>x : number
|
||||
>value : number
|
||||
}
|
||||
|
||||
class B {
|
||||
>B : B
|
||||
|
||||
get x() { return 0; }
|
||||
>x : number
|
||||
>0 : 0
|
||||
|
||||
@dec set x(value: number) { }
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>x : number
|
||||
>value : number
|
||||
}
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec set x(value: number) { }
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>x : number
|
||||
>value : number
|
||||
|
||||
get x() { return 0; }
|
||||
>x : number
|
||||
>0 : 0
|
||||
}
|
||||
|
||||
class D {
|
||||
>D : D
|
||||
|
||||
set x(value: number) { }
|
||||
>x : number
|
||||
>value : number
|
||||
|
||||
@dec get x() { return 0; }
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>x : number
|
||||
>0 : 0
|
||||
}
|
||||
|
||||
class E {
|
||||
>E : E
|
||||
|
||||
@dec get x() { return 0; }
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>x : number
|
||||
>0 : 0
|
||||
}
|
||||
|
||||
class F {
|
||||
>F : F
|
||||
|
||||
@dec set x(value: number) { }
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>x : number
|
||||
>value : number
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//// [decoratorOnClassConstructor4.ts]
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class A {
|
||||
}
|
||||
|
||||
@dec
|
||||
class B {
|
||||
constructor(x: number) {}
|
||||
}
|
||||
|
||||
@dec
|
||||
class C extends A {
|
||||
}
|
||||
|
||||
//// [decoratorOnClassConstructor4.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
A = __decorate([
|
||||
dec
|
||||
], A);
|
||||
var B = (function () {
|
||||
function B(x) {
|
||||
}
|
||||
return B;
|
||||
}());
|
||||
B = __decorate([
|
||||
dec,
|
||||
__metadata("design:paramtypes", [Number])
|
||||
], B);
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
return _super.apply(this, arguments) || this;
|
||||
}
|
||||
return C;
|
||||
}(A));
|
||||
C = __decorate([
|
||||
dec
|
||||
], C);
|
||||
@@ -0,0 +1,28 @@
|
||||
=== tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts ===
|
||||
declare var dec: any;
|
||||
>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11))
|
||||
|
||||
@dec
|
||||
>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11))
|
||||
|
||||
class A {
|
||||
>A : Symbol(A, Decl(decoratorOnClassConstructor4.ts, 0, 21))
|
||||
}
|
||||
|
||||
@dec
|
||||
>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11))
|
||||
|
||||
class B {
|
||||
>B : Symbol(B, Decl(decoratorOnClassConstructor4.ts, 4, 1))
|
||||
|
||||
constructor(x: number) {}
|
||||
>x : Symbol(x, Decl(decoratorOnClassConstructor4.ts, 8, 16))
|
||||
}
|
||||
|
||||
@dec
|
||||
>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11))
|
||||
|
||||
class C extends A {
|
||||
>C : Symbol(C, Decl(decoratorOnClassConstructor4.ts, 9, 1))
|
||||
>A : Symbol(A, Decl(decoratorOnClassConstructor4.ts, 0, 21))
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
=== tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts ===
|
||||
declare var dec: any;
|
||||
>dec : any
|
||||
|
||||
@dec
|
||||
>dec : any
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
}
|
||||
|
||||
@dec
|
||||
>dec : any
|
||||
|
||||
class B {
|
||||
>B : B
|
||||
|
||||
constructor(x: number) {}
|
||||
>x : number
|
||||
}
|
||||
|
||||
@dec
|
||||
>dec : any
|
||||
|
||||
class C extends A {
|
||||
>C : C
|
||||
>A : A
|
||||
}
|
||||
@@ -64,8 +64,7 @@ tslib_1.__decorate([
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = tslib_1.__decorate([
|
||||
dec,
|
||||
tslib_1.__metadata("design:paramtypes", [])
|
||||
dec
|
||||
], C);
|
||||
//// [script.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
@@ -111,6 +110,5 @@ __decorate([
|
||||
__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = __decorate([
|
||||
dec,
|
||||
__metadata("design:paramtypes", [])
|
||||
dec
|
||||
], C);
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/declaration.d.ts ===
|
||||
export declare class D {
|
||||
>D : Symbol(D, Decl(declaration.d.ts, 0, 0))
|
||||
}
|
||||
export declare class E extends D {
|
||||
>E : Symbol(E, Decl(declaration.d.ts, 1, 1))
|
||||
>D : Symbol(D, Decl(declaration.d.ts, 0, 0))
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/declaration.d.ts ===
|
||||
export declare class D {
|
||||
>D : D
|
||||
}
|
||||
export declare class E extends D {
|
||||
>E : E
|
||||
>D : D
|
||||
}
|
||||
@@ -64,8 +64,7 @@ tslib_1.__decorate([
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = tslib_1.__decorate([
|
||||
dec,
|
||||
tslib_1.__metadata("design:paramtypes", [])
|
||||
dec
|
||||
], C);
|
||||
//// [script.js]
|
||||
"use strict";
|
||||
@@ -96,6 +95,5 @@ tslib_1.__decorate([
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = tslib_1.__decorate([
|
||||
dec,
|
||||
tslib_1.__metadata("design:paramtypes", [])
|
||||
dec
|
||||
], C);
|
||||
@@ -63,8 +63,7 @@ tslib_1.__decorate([
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = tslib_1.__decorate([
|
||||
dec,
|
||||
tslib_1.__metadata("design:paramtypes", [])
|
||||
dec
|
||||
], C);
|
||||
var o = { a: 1 };
|
||||
var y = tslib_1.__assign({}, o);
|
||||
@@ -113,6 +112,5 @@ __decorate([
|
||||
__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = __decorate([
|
||||
dec,
|
||||
__metadata("design:paramtypes", [])
|
||||
dec
|
||||
], C);
|
||||
@@ -56,8 +56,7 @@ tslib_1.__decorate([
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = tslib_1.__decorate([
|
||||
dec,
|
||||
tslib_1.__metadata("design:paramtypes", [])
|
||||
dec
|
||||
], C);
|
||||
//// [script.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
@@ -103,6 +102,5 @@ __decorate([
|
||||
__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = __decorate([
|
||||
dec,
|
||||
__metadata("design:paramtypes", [])
|
||||
dec
|
||||
], C);
|
||||
@@ -249,6 +249,53 @@ function f74(func: <T, U, K extends keyof (T | U)>(x: T, y: U, k: K) => (T | U)[
|
||||
let b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean
|
||||
}
|
||||
|
||||
function f80<T extends { a: { x: any } }>(obj: T) {
|
||||
let a1 = obj.a; // { x: any }
|
||||
let a2 = obj['a']; // { x: any }
|
||||
let a3 = obj['a'] as T['a']; // T["a"]
|
||||
let x1 = obj.a.x; // any
|
||||
let x2 = obj['a']['x']; // any
|
||||
let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"]
|
||||
}
|
||||
|
||||
function f81<T extends { a: { x: any } }>(obj: T) {
|
||||
return obj['a']['x'] as T['a']['x'];
|
||||
}
|
||||
|
||||
function f82() {
|
||||
let x1 = f81({ a: { x: "hello" } }); // string
|
||||
let x2 = f81({ a: { x: 42 } }); // number
|
||||
}
|
||||
|
||||
function f83<T extends { [x: string]: { x: any } }, K extends keyof T>(obj: T, key: K) {
|
||||
return obj[key]['x'] as T[K]['x'];
|
||||
}
|
||||
|
||||
function f84() {
|
||||
let x1 = f83({ foo: { x: "hello" } }, "foo"); // string
|
||||
let x2 = f83({ bar: { x: 42 } }, "bar"); // number
|
||||
}
|
||||
|
||||
class C1 {
|
||||
x: number;
|
||||
get<K extends keyof this>(key: K) {
|
||||
return this[key];
|
||||
}
|
||||
set<K extends keyof this>(key: K, value: this[K]) {
|
||||
this[key] = value;
|
||||
}
|
||||
foo() {
|
||||
let x1 = this.x; // number
|
||||
let x2 = this["x"]; // number
|
||||
let x3 = this.get("x"); // this["x"]
|
||||
let x4 = getProperty(this, "x"); // this["x"]
|
||||
this.x = 42;
|
||||
this["x"] = 42;
|
||||
this.set("x", 42);
|
||||
setProperty(this, "x", 42);
|
||||
}
|
||||
}
|
||||
|
||||
// Repros from #12011
|
||||
|
||||
class Base {
|
||||
@@ -364,7 +411,25 @@ interface R {
|
||||
function f<K extends keyof R>(p: K) {
|
||||
let a: any;
|
||||
a[p].add; // any
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #12651
|
||||
|
||||
type MethodDescriptor = {
|
||||
name: string;
|
||||
args: any[];
|
||||
returnValue: any;
|
||||
}
|
||||
|
||||
declare function dispatchMethod<M extends MethodDescriptor>(name: M['name'], args: M['args']): M['returnValue'];
|
||||
|
||||
type SomeMethodDescriptor = {
|
||||
name: "someMethod";
|
||||
args: [string, number];
|
||||
returnValue: string[];
|
||||
}
|
||||
|
||||
let result = dispatchMethod<SomeMethodDescriptor>("someMethod", ["hello", 35]);
|
||||
|
||||
//// [keyofAndIndexedAccess.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
@@ -536,6 +601,49 @@ function f74(func) {
|
||||
var a = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a'); // number
|
||||
var b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean
|
||||
}
|
||||
function f80(obj) {
|
||||
var a1 = obj.a; // { x: any }
|
||||
var a2 = obj['a']; // { x: any }
|
||||
var a3 = obj['a']; // T["a"]
|
||||
var x1 = obj.a.x; // any
|
||||
var x2 = obj['a']['x']; // any
|
||||
var x3 = obj['a']['x']; // T["a"]["x"]
|
||||
}
|
||||
function f81(obj) {
|
||||
return obj['a']['x'];
|
||||
}
|
||||
function f82() {
|
||||
var x1 = f81({ a: { x: "hello" } }); // string
|
||||
var x2 = f81({ a: { x: 42 } }); // number
|
||||
}
|
||||
function f83(obj, key) {
|
||||
return obj[key]['x'];
|
||||
}
|
||||
function f84() {
|
||||
var x1 = f83({ foo: { x: "hello" } }, "foo"); // string
|
||||
var x2 = f83({ bar: { x: 42 } }, "bar"); // number
|
||||
}
|
||||
var C1 = (function () {
|
||||
function C1() {
|
||||
}
|
||||
C1.prototype.get = function (key) {
|
||||
return this[key];
|
||||
};
|
||||
C1.prototype.set = function (key, value) {
|
||||
this[key] = value;
|
||||
};
|
||||
C1.prototype.foo = function () {
|
||||
var x1 = this.x; // number
|
||||
var x2 = this["x"]; // number
|
||||
var x3 = this.get("x"); // this["x"]
|
||||
var x4 = getProperty(this, "x"); // this["x"]
|
||||
this.x = 42;
|
||||
this["x"] = 42;
|
||||
this.set("x", 42);
|
||||
setProperty(this, "x", 42);
|
||||
};
|
||||
return C1;
|
||||
}());
|
||||
// Repros from #12011
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
@@ -604,6 +712,7 @@ function f(p) {
|
||||
var a;
|
||||
a[p].add; // any
|
||||
}
|
||||
var result = dispatchMethod("someMethod", ["hello", 35]);
|
||||
|
||||
|
||||
//// [keyofAndIndexedAccess.d.ts]
|
||||
@@ -716,6 +825,29 @@ declare function f71(func: <T, U>(x: T, y: U) => Partial<T & U>): void;
|
||||
declare function f72(func: <T, U, K extends keyof T | keyof U>(x: T, y: U, k: K) => (T & U)[K]): void;
|
||||
declare function f73(func: <T, U, K extends keyof (T & U)>(x: T, y: U, k: K) => (T & U)[K]): void;
|
||||
declare function f74(func: <T, U, K extends keyof (T | U)>(x: T, y: U, k: K) => (T | U)[K]): void;
|
||||
declare function f80<T extends {
|
||||
a: {
|
||||
x: any;
|
||||
};
|
||||
}>(obj: T): void;
|
||||
declare function f81<T extends {
|
||||
a: {
|
||||
x: any;
|
||||
};
|
||||
}>(obj: T): T["a"]["x"];
|
||||
declare function f82(): void;
|
||||
declare function f83<T extends {
|
||||
[x: string]: {
|
||||
x: any;
|
||||
};
|
||||
}, K extends keyof T>(obj: T, key: K): T[K]["x"];
|
||||
declare function f84(): void;
|
||||
declare class C1 {
|
||||
x: number;
|
||||
get<K extends keyof this>(key: K): this[K];
|
||||
set<K extends keyof this>(key: K, value: this[K]): void;
|
||||
foo(): void;
|
||||
}
|
||||
declare class Base {
|
||||
get<K extends keyof this>(prop: K): this[K];
|
||||
set<K extends keyof this>(prop: K, value: this[K]): void;
|
||||
@@ -723,12 +855,12 @@ declare class Base {
|
||||
declare class Person extends Base {
|
||||
parts: number;
|
||||
constructor(parts: number);
|
||||
getParts(): number;
|
||||
getParts(): this["parts"];
|
||||
}
|
||||
declare class OtherPerson {
|
||||
parts: number;
|
||||
constructor(parts: number);
|
||||
getParts(): number;
|
||||
getParts(): this["parts"];
|
||||
}
|
||||
declare function path<T, K1 extends keyof T>(obj: T, key1: K1): T[K1];
|
||||
declare function path<T, K1 extends keyof T, K2 extends keyof T[K1]>(obj: T, key1: K1, key2: K2): T[K1][K2];
|
||||
@@ -776,3 +908,15 @@ interface R {
|
||||
p: number;
|
||||
}
|
||||
declare function f<K extends keyof R>(p: K): void;
|
||||
declare type MethodDescriptor = {
|
||||
name: string;
|
||||
args: any[];
|
||||
returnValue: any;
|
||||
};
|
||||
declare function dispatchMethod<M extends MethodDescriptor>(name: M['name'], args: M['args']): M['returnValue'];
|
||||
declare type SomeMethodDescriptor = {
|
||||
name: "someMethod";
|
||||
args: [string, number];
|
||||
returnValue: string[];
|
||||
};
|
||||
declare let result: string[];
|
||||
@@ -951,396 +951,628 @@ function f74(func: <T, U, K extends keyof (T | U)>(x: T, y: U, k: K) => (T | U)[
|
||||
>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 247, 46))
|
||||
}
|
||||
|
||||
function f80<T extends { a: { x: any } }>(obj: T) {
|
||||
>f80 : Symbol(f80, Decl(keyofAndIndexedAccess.ts, 248, 1))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 250, 13))
|
||||
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 250, 13))
|
||||
|
||||
let a1 = obj.a; // { x: any }
|
||||
>a1 : Symbol(a1, Decl(keyofAndIndexedAccess.ts, 251, 7))
|
||||
>obj.a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42))
|
||||
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24))
|
||||
|
||||
let a2 = obj['a']; // { x: any }
|
||||
>a2 : Symbol(a2, Decl(keyofAndIndexedAccess.ts, 252, 7))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42))
|
||||
>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24))
|
||||
|
||||
let a3 = obj['a'] as T['a']; // T["a"]
|
||||
>a3 : Symbol(a3, Decl(keyofAndIndexedAccess.ts, 253, 7))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42))
|
||||
>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 250, 13))
|
||||
|
||||
let x1 = obj.a.x; // any
|
||||
>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 254, 7))
|
||||
>obj.a.x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29))
|
||||
>obj.a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42))
|
||||
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29))
|
||||
|
||||
let x2 = obj['a']['x']; // any
|
||||
>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 255, 7))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42))
|
||||
>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24))
|
||||
>'x' : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29))
|
||||
|
||||
let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"]
|
||||
>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 256, 7))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42))
|
||||
>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24))
|
||||
>'x' : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 250, 13))
|
||||
}
|
||||
|
||||
function f81<T extends { a: { x: any } }>(obj: T) {
|
||||
>f81 : Symbol(f81, Decl(keyofAndIndexedAccess.ts, 257, 1))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 259, 13))
|
||||
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 259, 24))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 259, 29))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 259, 42))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 259, 13))
|
||||
|
||||
return obj['a']['x'] as T['a']['x'];
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 259, 42))
|
||||
>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 259, 24))
|
||||
>'x' : Symbol(x, Decl(keyofAndIndexedAccess.ts, 259, 29))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 259, 13))
|
||||
}
|
||||
|
||||
function f82() {
|
||||
>f82 : Symbol(f82, Decl(keyofAndIndexedAccess.ts, 261, 1))
|
||||
|
||||
let x1 = f81({ a: { x: "hello" } }); // string
|
||||
>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 264, 7))
|
||||
>f81 : Symbol(f81, Decl(keyofAndIndexedAccess.ts, 257, 1))
|
||||
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 264, 18))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 264, 23))
|
||||
|
||||
let x2 = f81({ a: { x: 42 } }); // number
|
||||
>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 265, 7))
|
||||
>f81 : Symbol(f81, Decl(keyofAndIndexedAccess.ts, 257, 1))
|
||||
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 265, 18))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 265, 23))
|
||||
}
|
||||
|
||||
function f83<T extends { [x: string]: { x: any } }, K extends keyof T>(obj: T, key: K) {
|
||||
>f83 : Symbol(f83, Decl(keyofAndIndexedAccess.ts, 266, 1))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 268, 13))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 268, 26))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 268, 39))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 268, 51))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 268, 13))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 268, 71))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 268, 13))
|
||||
>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 268, 78))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 268, 51))
|
||||
|
||||
return obj[key]['x'] as T[K]['x'];
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 268, 71))
|
||||
>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 268, 78))
|
||||
>'x' : Symbol(x, Decl(keyofAndIndexedAccess.ts, 268, 39))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 268, 13))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 268, 51))
|
||||
}
|
||||
|
||||
function f84() {
|
||||
>f84 : Symbol(f84, Decl(keyofAndIndexedAccess.ts, 270, 1))
|
||||
|
||||
let x1 = f83({ foo: { x: "hello" } }, "foo"); // string
|
||||
>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 273, 7))
|
||||
>f83 : Symbol(f83, Decl(keyofAndIndexedAccess.ts, 266, 1))
|
||||
>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 273, 18))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 273, 25))
|
||||
|
||||
let x2 = f83({ bar: { x: 42 } }, "bar"); // number
|
||||
>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 274, 7))
|
||||
>f83 : Symbol(f83, Decl(keyofAndIndexedAccess.ts, 266, 1))
|
||||
>bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 274, 18))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 274, 25))
|
||||
}
|
||||
|
||||
class C1 {
|
||||
>C1 : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1))
|
||||
|
||||
x: number;
|
||||
>x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10))
|
||||
|
||||
get<K extends keyof this>(key: K) {
|
||||
>get : Symbol(C1.get, Decl(keyofAndIndexedAccess.ts, 278, 14))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 279, 8))
|
||||
>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 279, 30))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 279, 8))
|
||||
|
||||
return this[key];
|
||||
>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1))
|
||||
>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 279, 30))
|
||||
}
|
||||
set<K extends keyof this>(key: K, value: this[K]) {
|
||||
>set : Symbol(C1.set, Decl(keyofAndIndexedAccess.ts, 281, 5))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 282, 8))
|
||||
>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 282, 30))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 282, 8))
|
||||
>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 282, 37))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 282, 8))
|
||||
|
||||
this[key] = value;
|
||||
>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1))
|
||||
>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 282, 30))
|
||||
>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 282, 37))
|
||||
}
|
||||
foo() {
|
||||
>foo : Symbol(C1.foo, Decl(keyofAndIndexedAccess.ts, 284, 5))
|
||||
|
||||
let x1 = this.x; // number
|
||||
>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 286, 11))
|
||||
>this.x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10))
|
||||
>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1))
|
||||
>x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10))
|
||||
|
||||
let x2 = this["x"]; // number
|
||||
>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 287, 11))
|
||||
>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1))
|
||||
>"x" : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10))
|
||||
|
||||
let x3 = this.get("x"); // this["x"]
|
||||
>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 288, 11))
|
||||
>this.get : Symbol(C1.get, Decl(keyofAndIndexedAccess.ts, 278, 14))
|
||||
>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1))
|
||||
>get : Symbol(C1.get, Decl(keyofAndIndexedAccess.ts, 278, 14))
|
||||
|
||||
let x4 = getProperty(this, "x"); // this["x"]
|
||||
>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 289, 11))
|
||||
>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26))
|
||||
>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1))
|
||||
|
||||
this.x = 42;
|
||||
>this.x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10))
|
||||
>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1))
|
||||
>x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10))
|
||||
|
||||
this["x"] = 42;
|
||||
>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1))
|
||||
>"x" : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10))
|
||||
|
||||
this.set("x", 42);
|
||||
>this.set : Symbol(C1.set, Decl(keyofAndIndexedAccess.ts, 281, 5))
|
||||
>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1))
|
||||
>set : Symbol(C1.set, Decl(keyofAndIndexedAccess.ts, 281, 5))
|
||||
|
||||
setProperty(this, "x", 42);
|
||||
>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1))
|
||||
>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1))
|
||||
}
|
||||
}
|
||||
|
||||
// Repros from #12011
|
||||
|
||||
class Base {
|
||||
>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 248, 1))
|
||||
>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1))
|
||||
|
||||
get<K extends keyof this>(prop: K) {
|
||||
>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 252, 12))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 253, 8))
|
||||
>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 253, 30))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 253, 8))
|
||||
>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 299, 12))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 300, 8))
|
||||
>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 300, 30))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 300, 8))
|
||||
|
||||
return this[prop];
|
||||
>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 248, 1))
|
||||
>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 253, 30))
|
||||
>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1))
|
||||
>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 300, 30))
|
||||
}
|
||||
set<K extends keyof this>(prop: K, value: this[K]) {
|
||||
>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 255, 5))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 256, 8))
|
||||
>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 256, 30))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 256, 8))
|
||||
>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 256, 38))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 256, 8))
|
||||
>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 302, 5))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 303, 8))
|
||||
>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 303, 30))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 303, 8))
|
||||
>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 303, 38))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 303, 8))
|
||||
|
||||
this[prop] = value;
|
||||
>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 248, 1))
|
||||
>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 256, 30))
|
||||
>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 256, 38))
|
||||
>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1))
|
||||
>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 303, 30))
|
||||
>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 303, 38))
|
||||
}
|
||||
}
|
||||
|
||||
class Person extends Base {
|
||||
>Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 259, 1))
|
||||
>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 248, 1))
|
||||
>Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 306, 1))
|
||||
>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1))
|
||||
|
||||
parts: number;
|
||||
>parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 261, 27))
|
||||
>parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 308, 27))
|
||||
|
||||
constructor(parts: number) {
|
||||
>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 263, 16))
|
||||
>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 310, 16))
|
||||
|
||||
super();
|
||||
>super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 248, 1))
|
||||
>super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1))
|
||||
|
||||
this.set("parts", parts);
|
||||
>this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 255, 5))
|
||||
>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 259, 1))
|
||||
>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 255, 5))
|
||||
>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 263, 16))
|
||||
>this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 302, 5))
|
||||
>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 306, 1))
|
||||
>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 302, 5))
|
||||
>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 310, 16))
|
||||
}
|
||||
getParts() {
|
||||
>getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 266, 5))
|
||||
>getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 313, 5))
|
||||
|
||||
return this.get("parts")
|
||||
>this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 252, 12))
|
||||
>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 259, 1))
|
||||
>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 252, 12))
|
||||
>this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 299, 12))
|
||||
>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 306, 1))
|
||||
>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 299, 12))
|
||||
}
|
||||
}
|
||||
|
||||
class OtherPerson {
|
||||
>OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 270, 1))
|
||||
>OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 317, 1))
|
||||
|
||||
parts: number;
|
||||
>parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 272, 19))
|
||||
>parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 319, 19))
|
||||
|
||||
constructor(parts: number) {
|
||||
>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 274, 16))
|
||||
>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 321, 16))
|
||||
|
||||
setProperty(this, "parts", parts);
|
||||
>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1))
|
||||
>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 270, 1))
|
||||
>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 274, 16))
|
||||
>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 317, 1))
|
||||
>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 321, 16))
|
||||
}
|
||||
getParts() {
|
||||
>getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 276, 5))
|
||||
>getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 323, 5))
|
||||
|
||||
return getProperty(this, "parts")
|
||||
>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26))
|
||||
>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 270, 1))
|
||||
>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 317, 1))
|
||||
}
|
||||
}
|
||||
|
||||
// Modified repro from #12544
|
||||
|
||||
function path<T, K1 extends keyof T>(obj: T, key1: K1): T[K1];
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 280, 1), Decl(keyofAndIndexedAccess.ts, 284, 62), Decl(keyofAndIndexedAccess.ts, 285, 100), Decl(keyofAndIndexedAccess.ts, 286, 142), Decl(keyofAndIndexedAccess.ts, 287, 59))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 284, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 284, 16))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 284, 14))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 284, 37))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 284, 14))
|
||||
>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 284, 44))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 284, 16))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 284, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 284, 16))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 331, 16))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 331, 37))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14))
|
||||
>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 331, 44))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 331, 16))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 331, 16))
|
||||
|
||||
function path<T, K1 extends keyof T, K2 extends keyof T[K1]>(obj: T, key1: K1, key2: K2): T[K1][K2];
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 280, 1), Decl(keyofAndIndexedAccess.ts, 284, 62), Decl(keyofAndIndexedAccess.ts, 285, 100), Decl(keyofAndIndexedAccess.ts, 286, 142), Decl(keyofAndIndexedAccess.ts, 287, 59))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 285, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 285, 16))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 285, 14))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 285, 36))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 285, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 285, 16))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 285, 61))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 285, 14))
|
||||
>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 285, 68))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 285, 16))
|
||||
>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 285, 78))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 285, 36))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 285, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 285, 16))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 285, 36))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 332, 36))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 332, 61))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14))
|
||||
>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 332, 68))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16))
|
||||
>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 332, 78))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 332, 36))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 332, 36))
|
||||
|
||||
function path<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3];
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 280, 1), Decl(keyofAndIndexedAccess.ts, 284, 62), Decl(keyofAndIndexedAccess.ts, 285, 100), Decl(keyofAndIndexedAccess.ts, 286, 142), Decl(keyofAndIndexedAccess.ts, 287, 59))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 286, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 286, 16))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 286, 14))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 286, 36))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 286, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 286, 16))
|
||||
>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 286, 60))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 286, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 286, 16))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 286, 36))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 286, 89))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 286, 14))
|
||||
>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 286, 96))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 286, 16))
|
||||
>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 286, 106))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 286, 36))
|
||||
>key3 : Symbol(key3, Decl(keyofAndIndexedAccess.ts, 286, 116))
|
||||
>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 286, 60))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 286, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 286, 16))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 286, 36))
|
||||
>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 286, 60))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16))
|
||||
>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 333, 60))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 333, 89))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14))
|
||||
>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 333, 96))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16))
|
||||
>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 333, 106))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36))
|
||||
>key3 : Symbol(key3, Decl(keyofAndIndexedAccess.ts, 333, 116))
|
||||
>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 333, 60))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36))
|
||||
>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 333, 60))
|
||||
|
||||
function path(obj: any, ...keys: (string | number)[]): any;
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 280, 1), Decl(keyofAndIndexedAccess.ts, 284, 62), Decl(keyofAndIndexedAccess.ts, 285, 100), Decl(keyofAndIndexedAccess.ts, 286, 142), Decl(keyofAndIndexedAccess.ts, 287, 59))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 287, 14))
|
||||
>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 287, 23))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 334, 14))
|
||||
>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 334, 23))
|
||||
|
||||
function path(obj: any, ...keys: (string | number)[]): any {
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 280, 1), Decl(keyofAndIndexedAccess.ts, 284, 62), Decl(keyofAndIndexedAccess.ts, 285, 100), Decl(keyofAndIndexedAccess.ts, 286, 142), Decl(keyofAndIndexedAccess.ts, 287, 59))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 288, 14))
|
||||
>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 288, 23))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 335, 14))
|
||||
>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 335, 23))
|
||||
|
||||
let result = obj;
|
||||
>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 289, 7))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 288, 14))
|
||||
>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7))
|
||||
>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 335, 14))
|
||||
|
||||
for (let k of keys) {
|
||||
>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 290, 12))
|
||||
>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 288, 23))
|
||||
>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 337, 12))
|
||||
>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 335, 23))
|
||||
|
||||
result = result[k];
|
||||
>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 289, 7))
|
||||
>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 289, 7))
|
||||
>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 290, 12))
|
||||
>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7))
|
||||
>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7))
|
||||
>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 337, 12))
|
||||
}
|
||||
return result;
|
||||
>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 289, 7))
|
||||
>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7))
|
||||
}
|
||||
|
||||
type Thing = {
|
||||
>Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 294, 1))
|
||||
>Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 341, 1))
|
||||
|
||||
a: { x: number, y: string },
|
||||
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 296, 14))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 297, 8))
|
||||
>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 297, 19))
|
||||
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 343, 14))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 344, 8))
|
||||
>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 344, 19))
|
||||
|
||||
b: boolean
|
||||
>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 297, 32))
|
||||
>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 344, 32))
|
||||
|
||||
};
|
||||
|
||||
|
||||
function f1(thing: Thing) {
|
||||
>f1 : Symbol(f1, Decl(keyofAndIndexedAccess.ts, 299, 2))
|
||||
>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 302, 12))
|
||||
>Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 294, 1))
|
||||
>f1 : Symbol(f1, Decl(keyofAndIndexedAccess.ts, 346, 2))
|
||||
>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12))
|
||||
>Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 341, 1))
|
||||
|
||||
let x1 = path(thing, 'a'); // { x: number, y: string }
|
||||
>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 303, 7))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 280, 1), Decl(keyofAndIndexedAccess.ts, 284, 62), Decl(keyofAndIndexedAccess.ts, 285, 100), Decl(keyofAndIndexedAccess.ts, 286, 142), Decl(keyofAndIndexedAccess.ts, 287, 59))
|
||||
>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 302, 12))
|
||||
>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 350, 7))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59))
|
||||
>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12))
|
||||
|
||||
let x2 = path(thing, 'a', 'y'); // string
|
||||
>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 304, 7))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 280, 1), Decl(keyofAndIndexedAccess.ts, 284, 62), Decl(keyofAndIndexedAccess.ts, 285, 100), Decl(keyofAndIndexedAccess.ts, 286, 142), Decl(keyofAndIndexedAccess.ts, 287, 59))
|
||||
>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 302, 12))
|
||||
>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 351, 7))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59))
|
||||
>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12))
|
||||
|
||||
let x3 = path(thing, 'b'); // boolean
|
||||
>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 305, 7))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 280, 1), Decl(keyofAndIndexedAccess.ts, 284, 62), Decl(keyofAndIndexedAccess.ts, 285, 100), Decl(keyofAndIndexedAccess.ts, 286, 142), Decl(keyofAndIndexedAccess.ts, 287, 59))
|
||||
>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 302, 12))
|
||||
>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 352, 7))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59))
|
||||
>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12))
|
||||
|
||||
let x4 = path(thing, ...['a', 'x']); // any
|
||||
>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 306, 7))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 280, 1), Decl(keyofAndIndexedAccess.ts, 284, 62), Decl(keyofAndIndexedAccess.ts, 285, 100), Decl(keyofAndIndexedAccess.ts, 286, 142), Decl(keyofAndIndexedAccess.ts, 287, 59))
|
||||
>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 302, 12))
|
||||
>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 353, 7))
|
||||
>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59))
|
||||
>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12))
|
||||
}
|
||||
|
||||
// Repro from comment in #12114
|
||||
|
||||
const assignTo2 = <T, K1 extends keyof T, K2 extends keyof T[K1]>(object: T, key1: K1, key2: K2) =>
|
||||
>assignTo2 : Symbol(assignTo2, Decl(keyofAndIndexedAccess.ts, 311, 5))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 311, 19))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 311, 21))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 311, 19))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 311, 41))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 311, 19))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 311, 21))
|
||||
>object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 311, 66))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 311, 19))
|
||||
>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 311, 76))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 311, 21))
|
||||
>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 311, 86))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 311, 41))
|
||||
>assignTo2 : Symbol(assignTo2, Decl(keyofAndIndexedAccess.ts, 358, 5))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 358, 41))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21))
|
||||
>object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 358, 66))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19))
|
||||
>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 358, 76))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21))
|
||||
>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 358, 86))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 358, 41))
|
||||
|
||||
(value: T[K1][K2]) => object[key1][key2] = value;
|
||||
>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 312, 5))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 311, 19))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 311, 21))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 311, 41))
|
||||
>object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 311, 66))
|
||||
>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 311, 76))
|
||||
>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 311, 86))
|
||||
>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 312, 5))
|
||||
>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 359, 5))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19))
|
||||
>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21))
|
||||
>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 358, 41))
|
||||
>object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 358, 66))
|
||||
>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 358, 76))
|
||||
>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 358, 86))
|
||||
>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 359, 5))
|
||||
|
||||
// Modified repro from #12573
|
||||
|
||||
declare function one<T>(handler: (t: T) => void): T
|
||||
>one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 312, 53))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 316, 21))
|
||||
>handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 316, 24))
|
||||
>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 316, 34))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 316, 21))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 316, 21))
|
||||
>one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 359, 53))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 363, 21))
|
||||
>handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 363, 24))
|
||||
>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 363, 34))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 363, 21))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 363, 21))
|
||||
|
||||
var empty = one(() => {}) // inferred as {}, expected
|
||||
>empty : Symbol(empty, Decl(keyofAndIndexedAccess.ts, 317, 3))
|
||||
>one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 312, 53))
|
||||
>empty : Symbol(empty, Decl(keyofAndIndexedAccess.ts, 364, 3))
|
||||
>one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 359, 53))
|
||||
|
||||
type Handlers<T> = { [K in keyof T]: (t: T[K]) => void }
|
||||
>Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 317, 25))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 319, 14))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 319, 22))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 319, 14))
|
||||
>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 319, 38))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 319, 14))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 319, 22))
|
||||
>Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 364, 25))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 366, 14))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 366, 22))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 366, 14))
|
||||
>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 366, 38))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 366, 14))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 366, 22))
|
||||
|
||||
declare function on<T>(handlerHash: Handlers<T>): T
|
||||
>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 319, 56))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 320, 20))
|
||||
>handlerHash : Symbol(handlerHash, Decl(keyofAndIndexedAccess.ts, 320, 23))
|
||||
>Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 317, 25))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 320, 20))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 320, 20))
|
||||
>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 366, 56))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 367, 20))
|
||||
>handlerHash : Symbol(handlerHash, Decl(keyofAndIndexedAccess.ts, 367, 23))
|
||||
>Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 364, 25))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 367, 20))
|
||||
>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 367, 20))
|
||||
|
||||
var hashOfEmpty1 = on({ test: () => {} }); // {}
|
||||
>hashOfEmpty1 : Symbol(hashOfEmpty1, Decl(keyofAndIndexedAccess.ts, 321, 3))
|
||||
>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 319, 56))
|
||||
>test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 321, 23))
|
||||
>hashOfEmpty1 : Symbol(hashOfEmpty1, Decl(keyofAndIndexedAccess.ts, 368, 3))
|
||||
>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 366, 56))
|
||||
>test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 368, 23))
|
||||
|
||||
var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean }
|
||||
>hashOfEmpty2 : Symbol(hashOfEmpty2, Decl(keyofAndIndexedAccess.ts, 322, 3))
|
||||
>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 319, 56))
|
||||
>test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 322, 23))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 322, 31))
|
||||
>hashOfEmpty2 : Symbol(hashOfEmpty2, Decl(keyofAndIndexedAccess.ts, 369, 3))
|
||||
>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 366, 56))
|
||||
>test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 369, 23))
|
||||
>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 369, 31))
|
||||
|
||||
// Repro from #12624
|
||||
|
||||
interface Options1<Data, Computed> {
|
||||
>Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 322, 52))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 326, 19))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 326, 24))
|
||||
>Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 369, 52))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 373, 19))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 373, 24))
|
||||
|
||||
data?: Data
|
||||
>data : Symbol(Options1.data, Decl(keyofAndIndexedAccess.ts, 326, 36))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 326, 19))
|
||||
>data : Symbol(Options1.data, Decl(keyofAndIndexedAccess.ts, 373, 36))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 373, 19))
|
||||
|
||||
computed?: Computed;
|
||||
>computed : Symbol(Options1.computed, Decl(keyofAndIndexedAccess.ts, 327, 15))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 326, 24))
|
||||
>computed : Symbol(Options1.computed, Decl(keyofAndIndexedAccess.ts, 374, 15))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 373, 24))
|
||||
}
|
||||
|
||||
declare class Component1<Data, Computed> {
|
||||
>Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 329, 1))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 331, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 331, 30))
|
||||
>Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 376, 1))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30))
|
||||
|
||||
constructor(options: Options1<Data, Computed>);
|
||||
>options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 332, 16))
|
||||
>Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 322, 52))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 331, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 331, 30))
|
||||
>options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 379, 16))
|
||||
>Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 369, 52))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30))
|
||||
|
||||
get<K extends keyof (Data & Computed)>(key: K): (Data & Computed)[K];
|
||||
>get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 332, 51))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 333, 8))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 331, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 331, 30))
|
||||
>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 333, 43))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 333, 8))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 331, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 331, 30))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 333, 8))
|
||||
>get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 379, 51))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 380, 8))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30))
|
||||
>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 380, 43))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 380, 8))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 380, 8))
|
||||
}
|
||||
|
||||
let c1 = new Component1({
|
||||
>c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 336, 3))
|
||||
>Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 329, 1))
|
||||
>c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 383, 3))
|
||||
>Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 376, 1))
|
||||
|
||||
data: {
|
||||
>data : Symbol(data, Decl(keyofAndIndexedAccess.ts, 336, 25))
|
||||
>data : Symbol(data, Decl(keyofAndIndexedAccess.ts, 383, 25))
|
||||
|
||||
hello: ""
|
||||
>hello : Symbol(hello, Decl(keyofAndIndexedAccess.ts, 337, 11))
|
||||
>hello : Symbol(hello, Decl(keyofAndIndexedAccess.ts, 384, 11))
|
||||
}
|
||||
});
|
||||
|
||||
c1.get("hello");
|
||||
>c1.get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 332, 51))
|
||||
>c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 336, 3))
|
||||
>get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 332, 51))
|
||||
>c1.get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 379, 51))
|
||||
>c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 383, 3))
|
||||
>get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 379, 51))
|
||||
|
||||
// Repro from #12625
|
||||
|
||||
interface Options2<Data, Computed> {
|
||||
>Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 342, 16))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 346, 19))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 346, 24))
|
||||
>Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 389, 16))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 393, 19))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 393, 24))
|
||||
|
||||
data?: Data
|
||||
>data : Symbol(Options2.data, Decl(keyofAndIndexedAccess.ts, 346, 36))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 346, 19))
|
||||
>data : Symbol(Options2.data, Decl(keyofAndIndexedAccess.ts, 393, 36))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 393, 19))
|
||||
|
||||
computed?: Computed;
|
||||
>computed : Symbol(Options2.computed, Decl(keyofAndIndexedAccess.ts, 347, 15))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 346, 24))
|
||||
>computed : Symbol(Options2.computed, Decl(keyofAndIndexedAccess.ts, 394, 15))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 393, 24))
|
||||
}
|
||||
|
||||
declare class Component2<Data, Computed> {
|
||||
>Component2 : Symbol(Component2, Decl(keyofAndIndexedAccess.ts, 349, 1))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 351, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 351, 30))
|
||||
>Component2 : Symbol(Component2, Decl(keyofAndIndexedAccess.ts, 396, 1))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30))
|
||||
|
||||
constructor(options: Options2<Data, Computed>);
|
||||
>options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 352, 16))
|
||||
>Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 342, 16))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 351, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 351, 30))
|
||||
>options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 399, 16))
|
||||
>Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 389, 16))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30))
|
||||
|
||||
get<K extends keyof Data | keyof Computed>(key: K): (Data & Computed)[K];
|
||||
>get : Symbol(Component2.get, Decl(keyofAndIndexedAccess.ts, 352, 51))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 353, 8))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 351, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 351, 30))
|
||||
>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 353, 47))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 353, 8))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 351, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 351, 30))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 353, 8))
|
||||
>get : Symbol(Component2.get, Decl(keyofAndIndexedAccess.ts, 399, 51))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 400, 8))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30))
|
||||
>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 400, 47))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 400, 8))
|
||||
>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25))
|
||||
>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 400, 8))
|
||||
}
|
||||
|
||||
// Repro from #12641
|
||||
|
||||
interface R {
|
||||
>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 354, 1))
|
||||
>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 401, 1))
|
||||
|
||||
p: number;
|
||||
>p : Symbol(R.p, Decl(keyofAndIndexedAccess.ts, 358, 13))
|
||||
>p : Symbol(R.p, Decl(keyofAndIndexedAccess.ts, 405, 13))
|
||||
}
|
||||
|
||||
function f<K extends keyof R>(p: K) {
|
||||
>f : Symbol(f, Decl(keyofAndIndexedAccess.ts, 360, 1))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 362, 11))
|
||||
>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 354, 1))
|
||||
>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 362, 30))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 362, 11))
|
||||
>f : Symbol(f, Decl(keyofAndIndexedAccess.ts, 407, 1))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 409, 11))
|
||||
>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 401, 1))
|
||||
>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 409, 30))
|
||||
>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 409, 11))
|
||||
|
||||
let a: any;
|
||||
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 363, 7))
|
||||
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 410, 7))
|
||||
|
||||
a[p].add; // any
|
||||
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 363, 7))
|
||||
>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 362, 30))
|
||||
>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 410, 7))
|
||||
>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 409, 30))
|
||||
}
|
||||
|
||||
// Repro from #12651
|
||||
|
||||
type MethodDescriptor = {
|
||||
>MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 412, 1))
|
||||
|
||||
name: string;
|
||||
>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 416, 25))
|
||||
|
||||
args: any[];
|
||||
>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 417, 14))
|
||||
|
||||
returnValue: any;
|
||||
>returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 418, 13))
|
||||
}
|
||||
|
||||
declare function dispatchMethod<M extends MethodDescriptor>(name: M['name'], args: M['args']): M['returnValue'];
|
||||
>dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 420, 1))
|
||||
>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32))
|
||||
>MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 412, 1))
|
||||
>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 422, 60))
|
||||
>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32))
|
||||
>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 422, 76))
|
||||
>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32))
|
||||
>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32))
|
||||
|
||||
type SomeMethodDescriptor = {
|
||||
>SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 422, 112))
|
||||
|
||||
name: "someMethod";
|
||||
>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 424, 29))
|
||||
|
||||
args: [string, number];
|
||||
>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 425, 20))
|
||||
|
||||
returnValue: string[];
|
||||
>returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 426, 24))
|
||||
}
|
||||
|
||||
let result = dispatchMethod<SomeMethodDescriptor>("someMethod", ["hello", 35]);
|
||||
>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 430, 3))
|
||||
>dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 420, 1))
|
||||
>SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 422, 112))
|
||||
|
||||
@@ -626,8 +626,8 @@ function f33<S extends Shape, K extends keyof S>(shape: S, key: K) {
|
||||
>K : K
|
||||
|
||||
let name = getProperty(shape, "name");
|
||||
>name : string
|
||||
>getProperty(shape, "name") : string
|
||||
>name : S["name"]
|
||||
>getProperty(shape, "name") : S["name"]
|
||||
>getProperty : <T, K extends keyof T>(obj: T, key: K) => T[K]
|
||||
>shape : S
|
||||
>"name" : "name"
|
||||
@@ -1146,6 +1146,245 @@ function f74(func: <T, U, K extends keyof (T | U)>(x: T, y: U, k: K) => (T | U)[
|
||||
>'b' : "b"
|
||||
}
|
||||
|
||||
function f80<T extends { a: { x: any } }>(obj: T) {
|
||||
>f80 : <T extends { a: { x: any; }; }>(obj: T) => void
|
||||
>T : T
|
||||
>a : { x: any; }
|
||||
>x : any
|
||||
>obj : T
|
||||
>T : T
|
||||
|
||||
let a1 = obj.a; // { x: any }
|
||||
>a1 : { x: any; }
|
||||
>obj.a : { x: any; }
|
||||
>obj : T
|
||||
>a : { x: any; }
|
||||
|
||||
let a2 = obj['a']; // { x: any }
|
||||
>a2 : { x: any; }
|
||||
>obj['a'] : { x: any; }
|
||||
>obj : T
|
||||
>'a' : "a"
|
||||
|
||||
let a3 = obj['a'] as T['a']; // T["a"]
|
||||
>a3 : T["a"]
|
||||
>obj['a'] as T['a'] : T["a"]
|
||||
>obj['a'] : { x: any; }
|
||||
>obj : T
|
||||
>'a' : "a"
|
||||
>T : T
|
||||
|
||||
let x1 = obj.a.x; // any
|
||||
>x1 : any
|
||||
>obj.a.x : any
|
||||
>obj.a : { x: any; }
|
||||
>obj : T
|
||||
>a : { x: any; }
|
||||
>x : any
|
||||
|
||||
let x2 = obj['a']['x']; // any
|
||||
>x2 : any
|
||||
>obj['a']['x'] : any
|
||||
>obj['a'] : { x: any; }
|
||||
>obj : T
|
||||
>'a' : "a"
|
||||
>'x' : "x"
|
||||
|
||||
let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"]
|
||||
>x3 : T["a"]["x"]
|
||||
>obj['a']['x'] as T['a']['x'] : T["a"]["x"]
|
||||
>obj['a']['x'] : any
|
||||
>obj['a'] : { x: any; }
|
||||
>obj : T
|
||||
>'a' : "a"
|
||||
>'x' : "x"
|
||||
>T : T
|
||||
}
|
||||
|
||||
function f81<T extends { a: { x: any } }>(obj: T) {
|
||||
>f81 : <T extends { a: { x: any; }; }>(obj: T) => T["a"]["x"]
|
||||
>T : T
|
||||
>a : { x: any; }
|
||||
>x : any
|
||||
>obj : T
|
||||
>T : T
|
||||
|
||||
return obj['a']['x'] as T['a']['x'];
|
||||
>obj['a']['x'] as T['a']['x'] : T["a"]["x"]
|
||||
>obj['a']['x'] : any
|
||||
>obj['a'] : { x: any; }
|
||||
>obj : T
|
||||
>'a' : "a"
|
||||
>'x' : "x"
|
||||
>T : T
|
||||
}
|
||||
|
||||
function f82() {
|
||||
>f82 : () => void
|
||||
|
||||
let x1 = f81({ a: { x: "hello" } }); // string
|
||||
>x1 : string
|
||||
>f81({ a: { x: "hello" } }) : string
|
||||
>f81 : <T extends { a: { x: any; }; }>(obj: T) => T["a"]["x"]
|
||||
>{ a: { x: "hello" } } : { a: { x: string; }; }
|
||||
>a : { x: string; }
|
||||
>{ x: "hello" } : { x: string; }
|
||||
>x : string
|
||||
>"hello" : "hello"
|
||||
|
||||
let x2 = f81({ a: { x: 42 } }); // number
|
||||
>x2 : number
|
||||
>f81({ a: { x: 42 } }) : number
|
||||
>f81 : <T extends { a: { x: any; }; }>(obj: T) => T["a"]["x"]
|
||||
>{ a: { x: 42 } } : { a: { x: number; }; }
|
||||
>a : { x: number; }
|
||||
>{ x: 42 } : { x: number; }
|
||||
>x : number
|
||||
>42 : 42
|
||||
}
|
||||
|
||||
function f83<T extends { [x: string]: { x: any } }, K extends keyof T>(obj: T, key: K) {
|
||||
>f83 : <T extends { [x: string]: { x: any; }; }, K extends keyof T>(obj: T, key: K) => T[K]["x"]
|
||||
>T : T
|
||||
>x : string
|
||||
>x : any
|
||||
>K : K
|
||||
>T : T
|
||||
>obj : T
|
||||
>T : T
|
||||
>key : K
|
||||
>K : K
|
||||
|
||||
return obj[key]['x'] as T[K]['x'];
|
||||
>obj[key]['x'] as T[K]['x'] : T[K]["x"]
|
||||
>obj[key]['x'] : any
|
||||
>obj[key] : T[K]
|
||||
>obj : T
|
||||
>key : K
|
||||
>'x' : "x"
|
||||
>T : T
|
||||
>K : K
|
||||
}
|
||||
|
||||
function f84() {
|
||||
>f84 : () => void
|
||||
|
||||
let x1 = f83({ foo: { x: "hello" } }, "foo"); // string
|
||||
>x1 : string
|
||||
>f83({ foo: { x: "hello" } }, "foo") : string
|
||||
>f83 : <T extends { [x: string]: { x: any; }; }, K extends keyof T>(obj: T, key: K) => T[K]["x"]
|
||||
>{ foo: { x: "hello" } } : { foo: { x: string; }; }
|
||||
>foo : { x: string; }
|
||||
>{ x: "hello" } : { x: string; }
|
||||
>x : string
|
||||
>"hello" : "hello"
|
||||
>"foo" : "foo"
|
||||
|
||||
let x2 = f83({ bar: { x: 42 } }, "bar"); // number
|
||||
>x2 : number
|
||||
>f83({ bar: { x: 42 } }, "bar") : number
|
||||
>f83 : <T extends { [x: string]: { x: any; }; }, K extends keyof T>(obj: T, key: K) => T[K]["x"]
|
||||
>{ bar: { x: 42 } } : { bar: { x: number; }; }
|
||||
>bar : { x: number; }
|
||||
>{ x: 42 } : { x: number; }
|
||||
>x : number
|
||||
>42 : 42
|
||||
>"bar" : "bar"
|
||||
}
|
||||
|
||||
class C1 {
|
||||
>C1 : C1
|
||||
|
||||
x: number;
|
||||
>x : number
|
||||
|
||||
get<K extends keyof this>(key: K) {
|
||||
>get : <K extends keyof this>(key: K) => this[K]
|
||||
>K : K
|
||||
>key : K
|
||||
>K : K
|
||||
|
||||
return this[key];
|
||||
>this[key] : this[K]
|
||||
>this : this
|
||||
>key : K
|
||||
}
|
||||
set<K extends keyof this>(key: K, value: this[K]) {
|
||||
>set : <K extends keyof this>(key: K, value: this[K]) => void
|
||||
>K : K
|
||||
>key : K
|
||||
>K : K
|
||||
>value : this[K]
|
||||
>K : K
|
||||
|
||||
this[key] = value;
|
||||
>this[key] = value : this[K]
|
||||
>this[key] : this[K]
|
||||
>this : this
|
||||
>key : K
|
||||
>value : this[K]
|
||||
}
|
||||
foo() {
|
||||
>foo : () => void
|
||||
|
||||
let x1 = this.x; // number
|
||||
>x1 : number
|
||||
>this.x : number
|
||||
>this : this
|
||||
>x : number
|
||||
|
||||
let x2 = this["x"]; // number
|
||||
>x2 : number
|
||||
>this["x"] : number
|
||||
>this : this
|
||||
>"x" : "x"
|
||||
|
||||
let x3 = this.get("x"); // this["x"]
|
||||
>x3 : this["x"]
|
||||
>this.get("x") : this["x"]
|
||||
>this.get : <K extends keyof this>(key: K) => this[K]
|
||||
>this : this
|
||||
>get : <K extends keyof this>(key: K) => this[K]
|
||||
>"x" : "x"
|
||||
|
||||
let x4 = getProperty(this, "x"); // this["x"]
|
||||
>x4 : this["x"]
|
||||
>getProperty(this, "x") : this["x"]
|
||||
>getProperty : <T, K extends keyof T>(obj: T, key: K) => T[K]
|
||||
>this : this
|
||||
>"x" : "x"
|
||||
|
||||
this.x = 42;
|
||||
>this.x = 42 : 42
|
||||
>this.x : number
|
||||
>this : this
|
||||
>x : number
|
||||
>42 : 42
|
||||
|
||||
this["x"] = 42;
|
||||
>this["x"] = 42 : 42
|
||||
>this["x"] : number
|
||||
>this : this
|
||||
>"x" : "x"
|
||||
>42 : 42
|
||||
|
||||
this.set("x", 42);
|
||||
>this.set("x", 42) : void
|
||||
>this.set : <K extends keyof this>(key: K, value: this[K]) => void
|
||||
>this : this
|
||||
>set : <K extends keyof this>(key: K, value: this[K]) => void
|
||||
>"x" : "x"
|
||||
>42 : 42
|
||||
|
||||
setProperty(this, "x", 42);
|
||||
>setProperty(this, "x", 42) : void
|
||||
>setProperty : <T, K extends keyof T>(obj: T, key: K, value: T[K]) => void
|
||||
>this : this
|
||||
>"x" : "x"
|
||||
>42 : 42
|
||||
}
|
||||
}
|
||||
|
||||
// Repros from #12011
|
||||
|
||||
class Base {
|
||||
@@ -1202,10 +1441,10 @@ class Person extends Base {
|
||||
>parts : number
|
||||
}
|
||||
getParts() {
|
||||
>getParts : () => number
|
||||
>getParts : () => this["parts"]
|
||||
|
||||
return this.get("parts")
|
||||
>this.get("parts") : number
|
||||
>this.get("parts") : this["parts"]
|
||||
>this.get : <K extends keyof this>(prop: K) => this[K]
|
||||
>this : this
|
||||
>get : <K extends keyof this>(prop: K) => this[K]
|
||||
@@ -1230,10 +1469,10 @@ class OtherPerson {
|
||||
>parts : number
|
||||
}
|
||||
getParts() {
|
||||
>getParts : () => number
|
||||
>getParts : () => this["parts"]
|
||||
|
||||
return getProperty(this, "parts")
|
||||
>getProperty(this, "parts") : number
|
||||
>getProperty(this, "parts") : this["parts"]
|
||||
>getProperty : <T, K extends keyof T>(obj: T, key: K) => T[K]
|
||||
>this : this
|
||||
>"parts" : "parts"
|
||||
@@ -1587,3 +1826,52 @@ function f<K extends keyof R>(p: K) {
|
||||
>p : K
|
||||
>add : any
|
||||
}
|
||||
|
||||
// Repro from #12651
|
||||
|
||||
type MethodDescriptor = {
|
||||
>MethodDescriptor : MethodDescriptor
|
||||
|
||||
name: string;
|
||||
>name : string
|
||||
|
||||
args: any[];
|
||||
>args : any[]
|
||||
|
||||
returnValue: any;
|
||||
>returnValue : any
|
||||
}
|
||||
|
||||
declare function dispatchMethod<M extends MethodDescriptor>(name: M['name'], args: M['args']): M['returnValue'];
|
||||
>dispatchMethod : <M extends MethodDescriptor>(name: M["name"], args: M["args"]) => M["returnValue"]
|
||||
>M : M
|
||||
>MethodDescriptor : MethodDescriptor
|
||||
>name : M["name"]
|
||||
>M : M
|
||||
>args : M["args"]
|
||||
>M : M
|
||||
>M : M
|
||||
|
||||
type SomeMethodDescriptor = {
|
||||
>SomeMethodDescriptor : SomeMethodDescriptor
|
||||
|
||||
name: "someMethod";
|
||||
>name : "someMethod"
|
||||
|
||||
args: [string, number];
|
||||
>args : [string, number]
|
||||
|
||||
returnValue: string[];
|
||||
>returnValue : string[]
|
||||
}
|
||||
|
||||
let result = dispatchMethod<SomeMethodDescriptor>("someMethod", ["hello", 35]);
|
||||
>result : string[]
|
||||
>dispatchMethod<SomeMethodDescriptor>("someMethod", ["hello", 35]) : string[]
|
||||
>dispatchMethod : <M extends MethodDescriptor>(name: M["name"], args: M["args"]) => M["returnValue"]
|
||||
>SomeMethodDescriptor : SomeMethodDescriptor
|
||||
>"someMethod" : "someMethod"
|
||||
>["hello", 35] : [string, number]
|
||||
>"hello" : "hello"
|
||||
>35 : 35
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
tests/cases/compiler/keyofIsLiteralContexualType.ts(5,9): error TS2322: Type '("a" | "b" | "c")[]' is not assignable to type 'keyof T[]'.
|
||||
Type '"a" | "b" | "c"' is not assignable to type 'keyof T'.
|
||||
Type '"a" | "b" | "c"' is not assignable to type '"a" | "b"'.
|
||||
Type '"c"' is not assignable to type 'keyof T'.
|
||||
Type '"c"' is not assignable to type '"a" | "b"'.
|
||||
Type '"c"' is not assignable to type 'keyof T'.
|
||||
Type '"c"' is not assignable to type '"a" | "b"'.
|
||||
tests/cases/compiler/keyofIsLiteralContexualType.ts(13,11): error TS2339: Property 'b' does not exist on type 'Pick<{ a: number; b: number; c: number; }, "a" | "c">'.
|
||||
|
||||
|
||||
@@ -16,10 +14,8 @@ tests/cases/compiler/keyofIsLiteralContexualType.ts(13,11): error TS2339: Proper
|
||||
~
|
||||
!!! error TS2322: Type '("a" | "b" | "c")[]' is not assignable to type 'keyof T[]'.
|
||||
!!! error TS2322: Type '"a" | "b" | "c"' is not assignable to type 'keyof T'.
|
||||
!!! error TS2322: Type '"a" | "b" | "c"' is not assignable to type '"a" | "b"'.
|
||||
!!! error TS2322: Type '"c"' is not assignable to type 'keyof T'.
|
||||
!!! error TS2322: Type '"c"' is not assignable to type '"a" | "b"'.
|
||||
!!! error TS2322: Type '"c"' is not assignable to type 'keyof T'.
|
||||
!!! error TS2322: Type '"c"' is not assignable to type '"a" | "b"'.
|
||||
}
|
||||
|
||||
// Repro from #12455
|
||||
|
||||
@@ -26,9 +26,19 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(78,59): error TS2345: A
|
||||
Object literal may only specify known properties, and 'z' does not exist in type 'Readonly<{ x: number; y: number; }>'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(84,58): error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Partial<{ x: number; y: number; }>'.
|
||||
Object literal may only specify known properties, and 'z' does not exist in type 'Partial<{ x: number; y: number; }>'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(106,15): error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick<Foo, "a">'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(107,17): error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick<Foo, "a" | "b">'.
|
||||
Object literal may only specify known properties, and 'c' does not exist in type 'Pick<Foo, "a" | "b">'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(124,12): error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick<Foo, "a">'.
|
||||
Types of property 'a' are incompatible.
|
||||
Type 'undefined' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(125,14): error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick<Foo, "a" | "b">'.
|
||||
Object literal may only specify known properties, and 'c' does not exist in type 'Pick<Foo, "a" | "b">'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (17 errors) ====
|
||||
==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (21 errors) ====
|
||||
|
||||
interface Shape {
|
||||
name: string;
|
||||
@@ -158,4 +168,59 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(84,58): error TS2345: A
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Partial<{ x: number; y: number; }>'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'z' does not exist in type 'Partial<{ x: number; y: number; }>'.
|
||||
}
|
||||
}
|
||||
|
||||
// Verify use of Pick<T, K> for setState functions (#12793)
|
||||
|
||||
interface Foo {
|
||||
a: string;
|
||||
b?: number;
|
||||
}
|
||||
|
||||
function setState<T, K extends keyof T>(obj: T, props: Pick<T, K>) {
|
||||
for (let k in props) {
|
||||
obj[k] = props[k];
|
||||
}
|
||||
}
|
||||
|
||||
let foo: Foo = { a: "hello", b: 42 };
|
||||
setState(foo, { a: "test", b: 43 })
|
||||
setState(foo, { a: "hi" });
|
||||
setState(foo, { b: undefined });
|
||||
setState(foo, { });
|
||||
setState(foo, foo);
|
||||
setState(foo, { a: undefined }); // Error
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick<Foo, "a">'.
|
||||
!!! error TS2345: Types of property 'a' are incompatible.
|
||||
!!! error TS2345: Type 'undefined' is not assignable to type 'string'.
|
||||
setState(foo, { c: true }); // Error
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick<Foo, "a" | "b">'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'c' does not exist in type 'Pick<Foo, "a" | "b">'.
|
||||
|
||||
class C<T> {
|
||||
state: T;
|
||||
setState<K extends keyof T>(props: Pick<T, K>) {
|
||||
for (let k in props) {
|
||||
this.state[k] = props[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let c = new C<Foo>();
|
||||
c.setState({ a: "test", b: 43 });
|
||||
c.setState({ a: "hi" });
|
||||
c.setState({ b: undefined });
|
||||
c.setState({ });
|
||||
c.setState(foo);
|
||||
c.setState({ a: undefined }); // Error
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick<Foo, "a">'.
|
||||
!!! error TS2345: Types of property 'a' are incompatible.
|
||||
!!! error TS2345: Type 'undefined' is not assignable to type 'string'.
|
||||
c.setState({ c: true }); // Error
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick<Foo, "a" | "b">'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'c' does not exist in type 'Pick<Foo, "a" | "b">'.
|
||||
|
||||
@@ -83,7 +83,48 @@ function f21() {
|
||||
let x1 = objAndPartial({ x: 0, y: 0 }, { x: 1 });
|
||||
let x2 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1 });
|
||||
let x3 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error
|
||||
}
|
||||
}
|
||||
|
||||
// Verify use of Pick<T, K> for setState functions (#12793)
|
||||
|
||||
interface Foo {
|
||||
a: string;
|
||||
b?: number;
|
||||
}
|
||||
|
||||
function setState<T, K extends keyof T>(obj: T, props: Pick<T, K>) {
|
||||
for (let k in props) {
|
||||
obj[k] = props[k];
|
||||
}
|
||||
}
|
||||
|
||||
let foo: Foo = { a: "hello", b: 42 };
|
||||
setState(foo, { a: "test", b: 43 })
|
||||
setState(foo, { a: "hi" });
|
||||
setState(foo, { b: undefined });
|
||||
setState(foo, { });
|
||||
setState(foo, foo);
|
||||
setState(foo, { a: undefined }); // Error
|
||||
setState(foo, { c: true }); // Error
|
||||
|
||||
class C<T> {
|
||||
state: T;
|
||||
setState<K extends keyof T>(props: Pick<T, K>) {
|
||||
for (let k in props) {
|
||||
this.state[k] = props[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let c = new C<Foo>();
|
||||
c.setState({ a: "test", b: 43 });
|
||||
c.setState({ a: "hi" });
|
||||
c.setState({ b: undefined });
|
||||
c.setState({ });
|
||||
c.setState(foo);
|
||||
c.setState({ a: undefined }); // Error
|
||||
c.setState({ c: true }); // Error
|
||||
|
||||
|
||||
//// [mappedTypeErrors.js]
|
||||
function f1(x) {
|
||||
@@ -124,6 +165,37 @@ function f21() {
|
||||
var x2 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1 });
|
||||
var x3 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error
|
||||
}
|
||||
function setState(obj, props) {
|
||||
for (var k in props) {
|
||||
obj[k] = props[k];
|
||||
}
|
||||
}
|
||||
var foo = { a: "hello", b: 42 };
|
||||
setState(foo, { a: "test", b: 43 });
|
||||
setState(foo, { a: "hi" });
|
||||
setState(foo, { b: undefined });
|
||||
setState(foo, {});
|
||||
setState(foo, foo);
|
||||
setState(foo, { a: undefined }); // Error
|
||||
setState(foo, { c: true }); // Error
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.setState = function (props) {
|
||||
for (var k in props) {
|
||||
this.state[k] = props[k];
|
||||
}
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
var c = new C();
|
||||
c.setState({ a: "test", b: 43 });
|
||||
c.setState({ a: "hi" });
|
||||
c.setState({ b: undefined });
|
||||
c.setState({});
|
||||
c.setState(foo);
|
||||
c.setState({ a: undefined }); // Error
|
||||
c.setState({ c: true }); // Error
|
||||
|
||||
|
||||
//// [mappedTypeErrors.d.ts]
|
||||
@@ -168,3 +240,14 @@ declare function objAndReadonly<T>(primary: T, secondary: Readonly<T>): T;
|
||||
declare function objAndPartial<T>(primary: T, secondary: Partial<T>): T;
|
||||
declare function f20(): void;
|
||||
declare function f21(): void;
|
||||
interface Foo {
|
||||
a: string;
|
||||
b?: number;
|
||||
}
|
||||
declare function setState<T, K extends keyof T>(obj: T, props: Pick<T, K>): void;
|
||||
declare let foo: Foo;
|
||||
declare class C<T> {
|
||||
state: T;
|
||||
setState<K extends keyof T>(props: Pick<T, K>): void;
|
||||
}
|
||||
declare let c: C<Foo>;
|
||||
@@ -1,145 +1,133 @@
|
||||
//// [mappedTypeModifiers.ts]
|
||||
|
||||
type T = { a: number, b: string };
|
||||
type TU = { a: number | undefined, b: string | undefined };
|
||||
type TP = { a?: number, b?: string };
|
||||
type TR = { readonly a: number, readonly b: string };
|
||||
type TPR = { readonly a?: number, readonly b?: string };
|
||||
|
||||
// Validate they all have the same keys
|
||||
var v00: "a" | "b";
|
||||
var v00: keyof T;
|
||||
var v00: keyof TU;
|
||||
var v00: keyof TP;
|
||||
var v00: keyof TR;
|
||||
var v00: keyof TPR;
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var v01: T;
|
||||
var v01: Pick<TR, keyof T>;
|
||||
var v01: Pick<Readonly<T>, keyof T>;
|
||||
var v01: { [P in keyof T]: T[P] };
|
||||
var v01: Pick<T, keyof T>;
|
||||
var v01: Pick<Pick<T, keyof T>, keyof T>;
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var v02: TU;
|
||||
var v02: Pick<TP, keyof T>;
|
||||
var v02: Pick<TPR, keyof T>;
|
||||
var v02: Pick<Partial<T>, keyof T>;
|
||||
var v02: Pick<Partial<Readonly<T>>, keyof T>;
|
||||
var v02: TP;
|
||||
var v02: { [P in keyof T]?: T[P] };
|
||||
var v02: Partial<T>;
|
||||
var v02: { [P in keyof TP]: TP[P] }
|
||||
var v02: Pick<TP, keyof TP>;
|
||||
|
||||
// Validate that isomorphic mapped types preserve optional modifier
|
||||
var v03: TP;
|
||||
var v03: Partial<T>;
|
||||
var v03: TR;
|
||||
var v03: { readonly [P in keyof T]: T[P] };
|
||||
var v03: Readonly<T>;
|
||||
var v03: { [P in keyof TR]: TR[P] }
|
||||
var v03: Pick<TR, keyof TR>;
|
||||
|
||||
// Validate that isomorphic mapped types preserve readonly modifier
|
||||
var v04: TR;
|
||||
var v04: Readonly<T>;
|
||||
|
||||
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
|
||||
var v05: TPR;
|
||||
var v05: Partial<TR>;
|
||||
var v05: Readonly<TP>;
|
||||
var v05: Partial<Readonly<T>>;
|
||||
var v05: Readonly<Partial<T>>;
|
||||
var v04: TPR;
|
||||
var v04: { readonly [P in keyof T]?: T[P] };
|
||||
var v04: Partial<TR>;
|
||||
var v04: Readonly<TP>;
|
||||
var v04: Partial<Readonly<T>>;
|
||||
var v04: Readonly<Partial<T>>;
|
||||
var v04: { [P in keyof TPR]: TPR[P] }
|
||||
var v04: Pick<TPR, keyof T>;
|
||||
|
||||
type Boxified<T> = { [P in keyof T]: { x: T[P] } };
|
||||
|
||||
type B = { a: { x: number }, b: { x: string } };
|
||||
type BU = { a: { x: number } | undefined, b: { x: string } | undefined };
|
||||
type BP = { a?: { x: number }, b?: { x: string } };
|
||||
type BR = { readonly a: { x: number }, readonly b: { x: string } };
|
||||
type BPR = { readonly a?: { x: number }, readonly b?: { x: string } };
|
||||
|
||||
// Validate they all have the same keys
|
||||
var b00: "a" | "b";
|
||||
var b00: keyof B;
|
||||
var b00: keyof BU;
|
||||
var b00: keyof BP;
|
||||
var b00: keyof BR;
|
||||
var b00: keyof BPR;
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var b01: B;
|
||||
var b01: Pick<BR, keyof B>;
|
||||
var b01: Pick<Readonly<BR>, keyof B>;
|
||||
var b01: { [P in keyof B]: B[P] };
|
||||
var b01: Pick<B, keyof B>;
|
||||
var b01: Pick<Pick<B, keyof B>, keyof B>;
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var b02: BU;
|
||||
var b02: Pick<BP, keyof B>;
|
||||
var b02: Pick<BPR, keyof B>;
|
||||
var b02: Pick<Partial<B>, keyof B>;
|
||||
var b02: Pick<Partial<Readonly<B>>, keyof B>;
|
||||
var b02: BP;
|
||||
var b02: { [P in keyof B]?: B[P] };
|
||||
var b02: Partial<B>;
|
||||
var b02: { [P in keyof BP]: BP[P] }
|
||||
var b02: Pick<BP, keyof BP>;
|
||||
|
||||
// Validate that isomorphic mapped types preserve optional modifier
|
||||
var b03: BP;
|
||||
var b03: Partial<B>;
|
||||
var b03: BR;
|
||||
var b03: { readonly [P in keyof B]: B[P] };
|
||||
var b03: Readonly<B>;
|
||||
var b03: { [P in keyof BR]: BR[P] }
|
||||
var b03: Pick<BR, keyof BR>;
|
||||
|
||||
// Validate that isomorphic mapped types preserve readonly modifier
|
||||
var b04: BR;
|
||||
var b04: Readonly<B>;
|
||||
|
||||
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
|
||||
var b05: BPR;
|
||||
var b05: Partial<BR>;
|
||||
var b05: Readonly<BP>;
|
||||
var b05: Partial<Readonly<B>>;
|
||||
var b05: Readonly<Partial<B>>;
|
||||
var b04: BPR;
|
||||
var b04: { readonly [P in keyof B]?: B[P] };
|
||||
var b04: Partial<BR>;
|
||||
var b04: Readonly<BP>;
|
||||
var b04: Partial<Readonly<B>>;
|
||||
var b04: Readonly<Partial<B>>;
|
||||
var b04: { [P in keyof BPR]: BPR[P] }
|
||||
var b04: Pick<BPR, keyof BPR>;
|
||||
|
||||
//// [mappedTypeModifiers.js]
|
||||
// Validate they all have the same keys
|
||||
var v00;
|
||||
var v00;
|
||||
var v00;
|
||||
var v00;
|
||||
var v00;
|
||||
var v00;
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var v01;
|
||||
var v01;
|
||||
var v01;
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var v01;
|
||||
var v02;
|
||||
var v02;
|
||||
var v02;
|
||||
var v02;
|
||||
var v02;
|
||||
// Validate that isomorphic mapped types preserve optional modifier
|
||||
var v03;
|
||||
var v03;
|
||||
// Validate that isomorphic mapped types preserve readonly modifier
|
||||
var v03;
|
||||
var v03;
|
||||
var v03;
|
||||
var v04;
|
||||
var v04;
|
||||
var v04;
|
||||
var v04;
|
||||
var v04;
|
||||
var v04;
|
||||
var v04;
|
||||
var v04;
|
||||
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
|
||||
var v05;
|
||||
var v05;
|
||||
var v05;
|
||||
var v05;
|
||||
var v05;
|
||||
// Validate they all have the same keys
|
||||
var b00;
|
||||
var b00;
|
||||
var b00;
|
||||
var b00;
|
||||
var b00;
|
||||
var b00;
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var b01;
|
||||
var b01;
|
||||
var b01;
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var b01;
|
||||
var b02;
|
||||
var b02;
|
||||
var b02;
|
||||
var b02;
|
||||
var b02;
|
||||
// Validate that isomorphic mapped types preserve optional modifier
|
||||
var b03;
|
||||
var b03;
|
||||
// Validate that isomorphic mapped types preserve readonly modifier
|
||||
var b03;
|
||||
var b03;
|
||||
var b03;
|
||||
var b04;
|
||||
var b04;
|
||||
var b04;
|
||||
var b04;
|
||||
var b04;
|
||||
var b04;
|
||||
var b04;
|
||||
var b04;
|
||||
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
|
||||
var b05;
|
||||
var b05;
|
||||
var b05;
|
||||
var b05;
|
||||
var b05;
|
||||
@@ -5,309 +5,351 @@ type T = { a: number, b: string };
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 1, 10))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 1, 21))
|
||||
|
||||
type TU = { a: number | undefined, b: string | undefined };
|
||||
>TU : Symbol(TU, Decl(mappedTypeModifiers.ts, 1, 34))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 2, 11))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 2, 34))
|
||||
|
||||
type TP = { a?: number, b?: string };
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 2, 59))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 3, 11))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 3, 23))
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 2, 11))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 2, 23))
|
||||
|
||||
type TR = { readonly a: number, readonly b: string };
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 3, 37))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 4, 11))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 4, 31))
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 3, 11))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 3, 31))
|
||||
|
||||
type TPR = { readonly a?: number, readonly b?: string };
|
||||
>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 4, 53))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 5, 12))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 5, 33))
|
||||
>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 4, 12))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 4, 33))
|
||||
|
||||
// Validate they all have the same keys
|
||||
var v00: "a" | "b";
|
||||
>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3), Decl(mappedTypeModifiers.ts, 11, 3), Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3))
|
||||
>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3))
|
||||
|
||||
var v00: keyof T;
|
||||
>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3), Decl(mappedTypeModifiers.ts, 11, 3), Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3))
|
||||
>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
|
||||
var v00: keyof TU;
|
||||
>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3), Decl(mappedTypeModifiers.ts, 11, 3), Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3))
|
||||
>TU : Symbol(TU, Decl(mappedTypeModifiers.ts, 1, 34))
|
||||
|
||||
var v00: keyof TP;
|
||||
>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3), Decl(mappedTypeModifiers.ts, 11, 3), Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3))
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 2, 59))
|
||||
>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3))
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34))
|
||||
|
||||
var v00: keyof TR;
|
||||
>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3), Decl(mappedTypeModifiers.ts, 11, 3), Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3))
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 3, 37))
|
||||
>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3))
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37))
|
||||
|
||||
var v00: keyof TPR;
|
||||
>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3), Decl(mappedTypeModifiers.ts, 11, 3), Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3))
|
||||
>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 4, 53))
|
||||
>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3))
|
||||
>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53))
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var v01: T;
|
||||
>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 16, 3), Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3))
|
||||
>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3), Decl(mappedTypeModifiers.ts, 14, 3), Decl(mappedTypeModifiers.ts, 15, 3))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
|
||||
var v01: Pick<TR, keyof T>;
|
||||
>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 16, 3), Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3))
|
||||
var v01: { [P in keyof T]: T[P] };
|
||||
>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3), Decl(mappedTypeModifiers.ts, 14, 3), Decl(mappedTypeModifiers.ts, 15, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 13, 12))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 13, 12))
|
||||
|
||||
var v01: Pick<T, keyof T>;
|
||||
>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3), Decl(mappedTypeModifiers.ts, 14, 3), Decl(mappedTypeModifiers.ts, 15, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 3, 37))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
|
||||
var v01: Pick<Readonly<T>, keyof T>;
|
||||
>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 16, 3), Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3))
|
||||
var v01: Pick<Pick<T, keyof T>, keyof T>;
|
||||
>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3), Decl(mappedTypeModifiers.ts, 14, 3), Decl(mappedTypeModifiers.ts, 15, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var v02: TU;
|
||||
>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 21, 3), Decl(mappedTypeModifiers.ts, 22, 3), Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3))
|
||||
>TU : Symbol(TU, Decl(mappedTypeModifiers.ts, 1, 34))
|
||||
|
||||
var v02: Pick<TP, keyof T>;
|
||||
>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 21, 3), Decl(mappedTypeModifiers.ts, 22, 3), Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 2, 59))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
|
||||
var v02: Pick<TPR, keyof T>;
|
||||
>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 21, 3), Decl(mappedTypeModifiers.ts, 22, 3), Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 4, 53))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
|
||||
var v02: Pick<Partial<T>, keyof T>;
|
||||
>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 21, 3), Decl(mappedTypeModifiers.ts, 22, 3), Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
|
||||
var v02: Pick<Partial<Readonly<T>>, keyof T>;
|
||||
>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 21, 3), Decl(mappedTypeModifiers.ts, 22, 3), Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
var v02: TP;
|
||||
>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3))
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34))
|
||||
|
||||
var v02: { [P in keyof T]?: T[P] };
|
||||
>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 18, 12))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 18, 12))
|
||||
|
||||
// Validate that isomorphic mapped types preserve optional modifier
|
||||
var v03: TP;
|
||||
>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 28, 3), Decl(mappedTypeModifiers.ts, 29, 3))
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 2, 59))
|
||||
|
||||
var v03: Partial<T>;
|
||||
>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 28, 3), Decl(mappedTypeModifiers.ts, 29, 3))
|
||||
var v02: Partial<T>;
|
||||
>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
|
||||
// Validate that isomorphic mapped types preserve readonly modifier
|
||||
var v04: TR;
|
||||
>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3))
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 3, 37))
|
||||
var v02: { [P in keyof TP]: TP[P] }
|
||||
>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 20, 12))
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34))
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 20, 12))
|
||||
|
||||
var v04: Readonly<T>;
|
||||
>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3))
|
||||
var v02: Pick<TP, keyof TP>;
|
||||
>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34))
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34))
|
||||
|
||||
var v03: TR;
|
||||
>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3))
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37))
|
||||
|
||||
var v03: { readonly [P in keyof T]: T[P] };
|
||||
>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 24, 21))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 24, 21))
|
||||
|
||||
var v03: Readonly<T>;
|
||||
>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
|
||||
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
|
||||
var v05: TPR;
|
||||
>v05 : Symbol(v05, Decl(mappedTypeModifiers.ts, 36, 3), Decl(mappedTypeModifiers.ts, 37, 3), Decl(mappedTypeModifiers.ts, 38, 3), Decl(mappedTypeModifiers.ts, 39, 3), Decl(mappedTypeModifiers.ts, 40, 3))
|
||||
>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 4, 53))
|
||||
var v03: { [P in keyof TR]: TR[P] }
|
||||
>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 26, 12))
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37))
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 26, 12))
|
||||
|
||||
var v05: Partial<TR>;
|
||||
>v05 : Symbol(v05, Decl(mappedTypeModifiers.ts, 36, 3), Decl(mappedTypeModifiers.ts, 37, 3), Decl(mappedTypeModifiers.ts, 38, 3), Decl(mappedTypeModifiers.ts, 39, 3), Decl(mappedTypeModifiers.ts, 40, 3))
|
||||
var v03: Pick<TR, keyof TR>;
|
||||
>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37))
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37))
|
||||
|
||||
var v04: TPR;
|
||||
>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3))
|
||||
>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53))
|
||||
|
||||
var v04: { readonly [P in keyof T]?: T[P] };
|
||||
>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 30, 21))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 30, 21))
|
||||
|
||||
var v04: Partial<TR>;
|
||||
>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 3, 37))
|
||||
>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37))
|
||||
|
||||
var v05: Readonly<TP>;
|
||||
>v05 : Symbol(v05, Decl(mappedTypeModifiers.ts, 36, 3), Decl(mappedTypeModifiers.ts, 37, 3), Decl(mappedTypeModifiers.ts, 38, 3), Decl(mappedTypeModifiers.ts, 39, 3), Decl(mappedTypeModifiers.ts, 40, 3))
|
||||
var v04: Readonly<TP>;
|
||||
>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 2, 59))
|
||||
>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34))
|
||||
|
||||
var v05: Partial<Readonly<T>>;
|
||||
>v05 : Symbol(v05, Decl(mappedTypeModifiers.ts, 36, 3), Decl(mappedTypeModifiers.ts, 37, 3), Decl(mappedTypeModifiers.ts, 38, 3), Decl(mappedTypeModifiers.ts, 39, 3), Decl(mappedTypeModifiers.ts, 40, 3))
|
||||
var v04: Partial<Readonly<T>>;
|
||||
>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
|
||||
var v05: Readonly<Partial<T>>;
|
||||
>v05 : Symbol(v05, Decl(mappedTypeModifiers.ts, 36, 3), Decl(mappedTypeModifiers.ts, 37, 3), Decl(mappedTypeModifiers.ts, 38, 3), Decl(mappedTypeModifiers.ts, 39, 3), Decl(mappedTypeModifiers.ts, 40, 3))
|
||||
var v04: Readonly<Partial<T>>;
|
||||
>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
|
||||
var v04: { [P in keyof TPR]: TPR[P] }
|
||||
>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 35, 12))
|
||||
>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53))
|
||||
>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 35, 12))
|
||||
|
||||
var v04: Pick<TPR, keyof T>;
|
||||
>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0))
|
||||
|
||||
type Boxified<T> = { [P in keyof T]: { x: T[P] } };
|
||||
>Boxified : Symbol(Boxified, Decl(mappedTypeModifiers.ts, 40, 30))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 42, 14))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 42, 22))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 42, 14))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 42, 38))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 42, 14))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 42, 22))
|
||||
>Boxified : Symbol(Boxified, Decl(mappedTypeModifiers.ts, 36, 28))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 38, 14))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 38, 22))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 38, 14))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 38, 38))
|
||||
>T : Symbol(T, Decl(mappedTypeModifiers.ts, 38, 14))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 38, 22))
|
||||
|
||||
type B = { a: { x: number }, b: { x: string } };
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 44, 10))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 44, 15))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 44, 28))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 44, 33))
|
||||
|
||||
type BU = { a: { x: number } | undefined, b: { x: string } | undefined };
|
||||
>BU : Symbol(BU, Decl(mappedTypeModifiers.ts, 44, 48))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 45, 11))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 45, 16))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 45, 41))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 45, 46))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 40, 10))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 40, 15))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 40, 28))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 40, 33))
|
||||
|
||||
type BP = { a?: { x: number }, b?: { x: string } };
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 45, 73))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 46, 11))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 46, 17))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 46, 30))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 46, 36))
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 41, 11))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 41, 17))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 41, 30))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 41, 36))
|
||||
|
||||
type BR = { readonly a: { x: number }, readonly b: { x: string } };
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 46, 51))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 47, 11))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 47, 25))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 47, 38))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 47, 52))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 42, 11))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 42, 25))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 42, 38))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 42, 52))
|
||||
|
||||
type BPR = { readonly a?: { x: number }, readonly b?: { x: string } };
|
||||
>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 47, 67))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 48, 12))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 48, 27))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 48, 40))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 48, 55))
|
||||
>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67))
|
||||
>a : Symbol(a, Decl(mappedTypeModifiers.ts, 43, 12))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 43, 27))
|
||||
>b : Symbol(b, Decl(mappedTypeModifiers.ts, 43, 40))
|
||||
>x : Symbol(x, Decl(mappedTypeModifiers.ts, 43, 55))
|
||||
|
||||
// Validate they all have the same keys
|
||||
var b00: "a" | "b";
|
||||
>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3), Decl(mappedTypeModifiers.ts, 55, 3), Decl(mappedTypeModifiers.ts, 56, 3))
|
||||
>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3))
|
||||
|
||||
var b00: keyof B;
|
||||
>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3), Decl(mappedTypeModifiers.ts, 55, 3), Decl(mappedTypeModifiers.ts, 56, 3))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
|
||||
var b00: keyof BU;
|
||||
>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3), Decl(mappedTypeModifiers.ts, 55, 3), Decl(mappedTypeModifiers.ts, 56, 3))
|
||||
>BU : Symbol(BU, Decl(mappedTypeModifiers.ts, 44, 48))
|
||||
>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
|
||||
var b00: keyof BP;
|
||||
>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3), Decl(mappedTypeModifiers.ts, 55, 3), Decl(mappedTypeModifiers.ts, 56, 3))
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 45, 73))
|
||||
>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3))
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48))
|
||||
|
||||
var b00: keyof BR;
|
||||
>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3), Decl(mappedTypeModifiers.ts, 55, 3), Decl(mappedTypeModifiers.ts, 56, 3))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 46, 51))
|
||||
>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51))
|
||||
|
||||
var b00: keyof BPR;
|
||||
>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3), Decl(mappedTypeModifiers.ts, 55, 3), Decl(mappedTypeModifiers.ts, 56, 3))
|
||||
>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 47, 67))
|
||||
>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3))
|
||||
>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67))
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var b01: B;
|
||||
>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3), Decl(mappedTypeModifiers.ts, 61, 3))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
|
||||
var b01: Pick<BR, keyof B>;
|
||||
>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3), Decl(mappedTypeModifiers.ts, 61, 3))
|
||||
var b01: { [P in keyof B]: B[P] };
|
||||
>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 52, 12))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 52, 12))
|
||||
|
||||
var b01: Pick<B, keyof B>;
|
||||
>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 46, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
|
||||
var b01: Pick<Readonly<BR>, keyof B>;
|
||||
>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3), Decl(mappedTypeModifiers.ts, 61, 3))
|
||||
var b01: Pick<Pick<B, keyof B>, keyof B>;
|
||||
>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 46, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var b02: BU;
|
||||
>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3), Decl(mappedTypeModifiers.ts, 67, 3), Decl(mappedTypeModifiers.ts, 68, 3))
|
||||
>BU : Symbol(BU, Decl(mappedTypeModifiers.ts, 44, 48))
|
||||
|
||||
var b02: Pick<BP, keyof B>;
|
||||
>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3), Decl(mappedTypeModifiers.ts, 67, 3), Decl(mappedTypeModifiers.ts, 68, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 45, 73))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
|
||||
var b02: Pick<BPR, keyof B>;
|
||||
>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3), Decl(mappedTypeModifiers.ts, 67, 3), Decl(mappedTypeModifiers.ts, 68, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 47, 67))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
var b02: BP;
|
||||
>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3))
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48))
|
||||
|
||||
var b02: Pick<Partial<B>, keyof B>;
|
||||
>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3), Decl(mappedTypeModifiers.ts, 67, 3), Decl(mappedTypeModifiers.ts, 68, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
var b02: { [P in keyof B]?: B[P] };
|
||||
>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 57, 12))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 57, 12))
|
||||
|
||||
var b02: Partial<B>;
|
||||
>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
|
||||
var b02: Pick<Partial<Readonly<B>>, keyof B>;
|
||||
>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3), Decl(mappedTypeModifiers.ts, 67, 3), Decl(mappedTypeModifiers.ts, 68, 3))
|
||||
var b02: { [P in keyof BP]: BP[P] }
|
||||
>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 59, 12))
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48))
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 59, 12))
|
||||
|
||||
var b02: Pick<BP, keyof BP>;
|
||||
>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48))
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48))
|
||||
|
||||
var b03: BR;
|
||||
>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51))
|
||||
|
||||
var b03: { readonly [P in keyof B]: B[P] };
|
||||
>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 63, 21))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 63, 21))
|
||||
|
||||
var b03: Readonly<B>;
|
||||
>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
|
||||
var b03: { [P in keyof BR]: BR[P] }
|
||||
>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 65, 12))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 65, 12))
|
||||
|
||||
var b03: Pick<BR, keyof BR>;
|
||||
>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51))
|
||||
|
||||
var b04: BPR;
|
||||
>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3))
|
||||
>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67))
|
||||
|
||||
var b04: { readonly [P in keyof B]?: B[P] };
|
||||
>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 69, 21))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 69, 21))
|
||||
|
||||
var b04: Partial<BR>;
|
||||
>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51))
|
||||
|
||||
var b04: Readonly<BP>;
|
||||
>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48))
|
||||
|
||||
var b04: Partial<Readonly<B>>;
|
||||
>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
|
||||
// Validate that isomorphic mapped types preserve optional modifier
|
||||
var b03: BP;
|
||||
>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3))
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 45, 73))
|
||||
|
||||
var b03: Partial<B>;
|
||||
>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
|
||||
// Validate that isomorphic mapped types preserve readonly modifier
|
||||
var b04: BR;
|
||||
>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 75, 3), Decl(mappedTypeModifiers.ts, 76, 3))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 46, 51))
|
||||
|
||||
var b04: Readonly<B>;
|
||||
>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 75, 3), Decl(mappedTypeModifiers.ts, 76, 3))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
|
||||
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
|
||||
var b05: BPR;
|
||||
>b05 : Symbol(b05, Decl(mappedTypeModifiers.ts, 79, 3), Decl(mappedTypeModifiers.ts, 80, 3), Decl(mappedTypeModifiers.ts, 81, 3), Decl(mappedTypeModifiers.ts, 82, 3), Decl(mappedTypeModifiers.ts, 83, 3))
|
||||
>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 47, 67))
|
||||
|
||||
var b05: Partial<BR>;
|
||||
>b05 : Symbol(b05, Decl(mappedTypeModifiers.ts, 79, 3), Decl(mappedTypeModifiers.ts, 80, 3), Decl(mappedTypeModifiers.ts, 81, 3), Decl(mappedTypeModifiers.ts, 82, 3), Decl(mappedTypeModifiers.ts, 83, 3))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 46, 51))
|
||||
|
||||
var b05: Readonly<BP>;
|
||||
>b05 : Symbol(b05, Decl(mappedTypeModifiers.ts, 79, 3), Decl(mappedTypeModifiers.ts, 80, 3), Decl(mappedTypeModifiers.ts, 81, 3), Decl(mappedTypeModifiers.ts, 82, 3), Decl(mappedTypeModifiers.ts, 83, 3))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 45, 73))
|
||||
|
||||
var b05: Partial<Readonly<B>>;
|
||||
>b05 : Symbol(b05, Decl(mappedTypeModifiers.ts, 79, 3), Decl(mappedTypeModifiers.ts, 80, 3), Decl(mappedTypeModifiers.ts, 81, 3), Decl(mappedTypeModifiers.ts, 82, 3), Decl(mappedTypeModifiers.ts, 83, 3))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
|
||||
var b05: Readonly<Partial<B>>;
|
||||
>b05 : Symbol(b05, Decl(mappedTypeModifiers.ts, 79, 3), Decl(mappedTypeModifiers.ts, 80, 3), Decl(mappedTypeModifiers.ts, 81, 3), Decl(mappedTypeModifiers.ts, 82, 3), Decl(mappedTypeModifiers.ts, 83, 3))
|
||||
var b04: Readonly<Partial<B>>;
|
||||
>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3))
|
||||
>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 42, 51))
|
||||
>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51))
|
||||
|
||||
var b04: { [P in keyof BPR]: BPR[P] }
|
||||
>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 74, 12))
|
||||
>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67))
|
||||
>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67))
|
||||
>P : Symbol(P, Decl(mappedTypeModifiers.ts, 74, 12))
|
||||
|
||||
var b04: Pick<BPR, keyof BPR>;
|
||||
>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3))
|
||||
>Pick : Symbol(Pick, Decl(lib.d.ts, --, --))
|
||||
>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67))
|
||||
>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67))
|
||||
|
||||
@@ -5,11 +5,6 @@ type T = { a: number, b: string };
|
||||
>a : number
|
||||
>b : string
|
||||
|
||||
type TU = { a: number | undefined, b: string | undefined };
|
||||
>TU : TU
|
||||
>a : number | undefined
|
||||
>b : string | undefined
|
||||
|
||||
type TP = { a?: number, b?: string };
|
||||
>TP : TP
|
||||
>a : number | undefined
|
||||
@@ -25,7 +20,6 @@ type TPR = { readonly a?: number, readonly b?: string };
|
||||
>a : number | undefined
|
||||
>b : string | undefined
|
||||
|
||||
// Validate they all have the same keys
|
||||
var v00: "a" | "b";
|
||||
>v00 : "a" | "b"
|
||||
|
||||
@@ -33,10 +27,6 @@ var v00: keyof T;
|
||||
>v00 : "a" | "b"
|
||||
>T : T
|
||||
|
||||
var v00: keyof TU;
|
||||
>v00 : "a" | "b"
|
||||
>TU : TU
|
||||
|
||||
var v00: keyof TP;
|
||||
>v00 : "a" | "b"
|
||||
>TP : TP
|
||||
@@ -49,103 +39,135 @@ var v00: keyof TPR;
|
||||
>v00 : "a" | "b"
|
||||
>TPR : TPR
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var v01: T;
|
||||
>v01 : T
|
||||
>T : T
|
||||
|
||||
var v01: Pick<TR, keyof T>;
|
||||
var v01: { [P in keyof T]: T[P] };
|
||||
>v01 : T
|
||||
>P : P
|
||||
>T : T
|
||||
>T : T
|
||||
>P : P
|
||||
|
||||
var v01: Pick<T, keyof T>;
|
||||
>v01 : T
|
||||
>Pick : Pick<T, K>
|
||||
>TR : TR
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var v01: Pick<Readonly<T>, keyof T>;
|
||||
var v01: Pick<Pick<T, keyof T>, keyof T>;
|
||||
>v01 : T
|
||||
>Pick : Pick<T, K>
|
||||
>Readonly : Readonly<T>
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var v02: TU;
|
||||
>v02 : TU
|
||||
>TU : TU
|
||||
|
||||
var v02: Pick<TP, keyof T>;
|
||||
>v02 : TU
|
||||
>Pick : Pick<T, K>
|
||||
>TP : TP
|
||||
>T : T
|
||||
|
||||
var v02: Pick<TPR, keyof T>;
|
||||
>v02 : TU
|
||||
>Pick : Pick<T, K>
|
||||
>TPR : TPR
|
||||
>T : T
|
||||
|
||||
var v02: Pick<Partial<T>, keyof T>;
|
||||
>v02 : TU
|
||||
>Pick : Pick<T, K>
|
||||
>Partial : Partial<T>
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
var v02: Pick<Partial<Readonly<T>>, keyof T>;
|
||||
>v02 : TU
|
||||
>Pick : Pick<T, K>
|
||||
>Partial : Partial<T>
|
||||
>Readonly : Readonly<T>
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
// Validate that isomorphic mapped types preserve optional modifier
|
||||
var v03: TP;
|
||||
>v03 : TP
|
||||
var v02: TP;
|
||||
>v02 : TP
|
||||
>TP : TP
|
||||
|
||||
var v03: Partial<T>;
|
||||
>v03 : TP
|
||||
var v02: { [P in keyof T]?: T[P] };
|
||||
>v02 : TP
|
||||
>P : P
|
||||
>T : T
|
||||
>T : T
|
||||
>P : P
|
||||
|
||||
var v02: Partial<T>;
|
||||
>v02 : TP
|
||||
>Partial : Partial<T>
|
||||
>T : T
|
||||
|
||||
// Validate that isomorphic mapped types preserve readonly modifier
|
||||
var v04: TR;
|
||||
>v04 : TR
|
||||
var v02: { [P in keyof TP]: TP[P] }
|
||||
>v02 : TP
|
||||
>P : P
|
||||
>TP : TP
|
||||
>TP : TP
|
||||
>P : P
|
||||
|
||||
var v02: Pick<TP, keyof TP>;
|
||||
>v02 : TP
|
||||
>Pick : Pick<T, K>
|
||||
>TP : TP
|
||||
>TP : TP
|
||||
|
||||
var v03: TR;
|
||||
>v03 : TR
|
||||
>TR : TR
|
||||
|
||||
var v04: Readonly<T>;
|
||||
>v04 : TR
|
||||
var v03: { readonly [P in keyof T]: T[P] };
|
||||
>v03 : TR
|
||||
>P : P
|
||||
>T : T
|
||||
>T : T
|
||||
>P : P
|
||||
|
||||
var v03: Readonly<T>;
|
||||
>v03 : TR
|
||||
>Readonly : Readonly<T>
|
||||
>T : T
|
||||
|
||||
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
|
||||
var v05: TPR;
|
||||
>v05 : TPR
|
||||
var v03: { [P in keyof TR]: TR[P] }
|
||||
>v03 : TR
|
||||
>P : P
|
||||
>TR : TR
|
||||
>TR : TR
|
||||
>P : P
|
||||
|
||||
var v03: Pick<TR, keyof TR>;
|
||||
>v03 : TR
|
||||
>Pick : Pick<T, K>
|
||||
>TR : TR
|
||||
>TR : TR
|
||||
|
||||
var v04: TPR;
|
||||
>v04 : TPR
|
||||
>TPR : TPR
|
||||
|
||||
var v05: Partial<TR>;
|
||||
>v05 : TPR
|
||||
var v04: { readonly [P in keyof T]?: T[P] };
|
||||
>v04 : TPR
|
||||
>P : P
|
||||
>T : T
|
||||
>T : T
|
||||
>P : P
|
||||
|
||||
var v04: Partial<TR>;
|
||||
>v04 : TPR
|
||||
>Partial : Partial<T>
|
||||
>TR : TR
|
||||
|
||||
var v05: Readonly<TP>;
|
||||
>v05 : TPR
|
||||
var v04: Readonly<TP>;
|
||||
>v04 : TPR
|
||||
>Readonly : Readonly<T>
|
||||
>TP : TP
|
||||
|
||||
var v05: Partial<Readonly<T>>;
|
||||
>v05 : TPR
|
||||
var v04: Partial<Readonly<T>>;
|
||||
>v04 : TPR
|
||||
>Partial : Partial<T>
|
||||
>Readonly : Readonly<T>
|
||||
>T : T
|
||||
|
||||
var v05: Readonly<Partial<T>>;
|
||||
>v05 : TPR
|
||||
var v04: Readonly<Partial<T>>;
|
||||
>v04 : TPR
|
||||
>Readonly : Readonly<T>
|
||||
>Partial : Partial<T>
|
||||
>T : T
|
||||
|
||||
var v04: { [P in keyof TPR]: TPR[P] }
|
||||
>v04 : TPR
|
||||
>P : P
|
||||
>TPR : TPR
|
||||
>TPR : TPR
|
||||
>P : P
|
||||
|
||||
var v04: Pick<TPR, keyof T>;
|
||||
>v04 : TPR
|
||||
>Pick : Pick<T, K>
|
||||
>TPR : TPR
|
||||
>T : T
|
||||
|
||||
type Boxified<T> = { [P in keyof T]: { x: T[P] } };
|
||||
>Boxified : Boxified<T>
|
||||
>T : T
|
||||
@@ -162,13 +184,6 @@ type B = { a: { x: number }, b: { x: string } };
|
||||
>b : { x: string; }
|
||||
>x : string
|
||||
|
||||
type BU = { a: { x: number } | undefined, b: { x: string } | undefined };
|
||||
>BU : BU
|
||||
>a : { x: number; } | undefined
|
||||
>x : number
|
||||
>b : { x: string; } | undefined
|
||||
>x : string
|
||||
|
||||
type BP = { a?: { x: number }, b?: { x: string } };
|
||||
>BP : BP
|
||||
>a : { x: number; } | undefined
|
||||
@@ -190,7 +205,6 @@ type BPR = { readonly a?: { x: number }, readonly b?: { x: string } };
|
||||
>b : { x: string; } | undefined
|
||||
>x : string
|
||||
|
||||
// Validate they all have the same keys
|
||||
var b00: "a" | "b";
|
||||
>b00 : "a" | "b"
|
||||
|
||||
@@ -198,10 +212,6 @@ var b00: keyof B;
|
||||
>b00 : "a" | "b"
|
||||
>B : B
|
||||
|
||||
var b00: keyof BU;
|
||||
>b00 : "a" | "b"
|
||||
>BU : BU
|
||||
|
||||
var b00: keyof BP;
|
||||
>b00 : "a" | "b"
|
||||
>BP : BP
|
||||
@@ -214,100 +224,132 @@ var b00: keyof BPR;
|
||||
>b00 : "a" | "b"
|
||||
>BPR : BPR
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var b01: B;
|
||||
>b01 : B
|
||||
>B : B
|
||||
|
||||
var b01: Pick<BR, keyof B>;
|
||||
var b01: { [P in keyof B]: B[P] };
|
||||
>b01 : B
|
||||
>P : P
|
||||
>B : B
|
||||
>B : B
|
||||
>P : P
|
||||
|
||||
var b01: Pick<B, keyof B>;
|
||||
>b01 : B
|
||||
>Pick : Pick<T, K>
|
||||
>BR : BR
|
||||
>B : B
|
||||
>B : B
|
||||
|
||||
var b01: Pick<Readonly<BR>, keyof B>;
|
||||
var b01: Pick<Pick<B, keyof B>, keyof B>;
|
||||
>b01 : B
|
||||
>Pick : Pick<T, K>
|
||||
>Readonly : Readonly<T>
|
||||
>BR : BR
|
||||
>B : B
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var b02: BU;
|
||||
>b02 : BU
|
||||
>BU : BU
|
||||
|
||||
var b02: Pick<BP, keyof B>;
|
||||
>b02 : BU
|
||||
>Pick : Pick<T, K>
|
||||
>BP : BP
|
||||
>B : B
|
||||
|
||||
var b02: Pick<BPR, keyof B>;
|
||||
>b02 : BU
|
||||
>Pick : Pick<T, K>
|
||||
>BPR : BPR
|
||||
>B : B
|
||||
|
||||
var b02: Pick<Partial<B>, keyof B>;
|
||||
>b02 : BU
|
||||
>Pick : Pick<T, K>
|
||||
>Partial : Partial<T>
|
||||
>B : B
|
||||
>B : B
|
||||
|
||||
var b02: Pick<Partial<Readonly<B>>, keyof B>;
|
||||
>b02 : BU
|
||||
>Pick : Pick<T, K>
|
||||
>Partial : Partial<T>
|
||||
>Readonly : Readonly<T>
|
||||
>B : B
|
||||
>B : B
|
||||
|
||||
// Validate that isomorphic mapped types preserve optional modifier
|
||||
var b03: BP;
|
||||
>b03 : BP
|
||||
var b02: BP;
|
||||
>b02 : BP
|
||||
>BP : BP
|
||||
|
||||
var b03: Partial<B>;
|
||||
>b03 : BP
|
||||
var b02: { [P in keyof B]?: B[P] };
|
||||
>b02 : BP
|
||||
>P : P
|
||||
>B : B
|
||||
>B : B
|
||||
>P : P
|
||||
|
||||
var b02: Partial<B>;
|
||||
>b02 : BP
|
||||
>Partial : Partial<T>
|
||||
>B : B
|
||||
|
||||
// Validate that isomorphic mapped types preserve readonly modifier
|
||||
var b04: BR;
|
||||
>b04 : BR
|
||||
var b02: { [P in keyof BP]: BP[P] }
|
||||
>b02 : BP
|
||||
>P : P
|
||||
>BP : BP
|
||||
>BP : BP
|
||||
>P : P
|
||||
|
||||
var b02: Pick<BP, keyof BP>;
|
||||
>b02 : BP
|
||||
>Pick : Pick<T, K>
|
||||
>BP : BP
|
||||
>BP : BP
|
||||
|
||||
var b03: BR;
|
||||
>b03 : BR
|
||||
>BR : BR
|
||||
|
||||
var b04: Readonly<B>;
|
||||
>b04 : BR
|
||||
var b03: { readonly [P in keyof B]: B[P] };
|
||||
>b03 : BR
|
||||
>P : P
|
||||
>B : B
|
||||
>B : B
|
||||
>P : P
|
||||
|
||||
var b03: Readonly<B>;
|
||||
>b03 : BR
|
||||
>Readonly : Readonly<T>
|
||||
>B : B
|
||||
|
||||
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
|
||||
var b05: BPR;
|
||||
>b05 : BPR
|
||||
var b03: { [P in keyof BR]: BR[P] }
|
||||
>b03 : BR
|
||||
>P : P
|
||||
>BR : BR
|
||||
>BR : BR
|
||||
>P : P
|
||||
|
||||
var b03: Pick<BR, keyof BR>;
|
||||
>b03 : BR
|
||||
>Pick : Pick<T, K>
|
||||
>BR : BR
|
||||
>BR : BR
|
||||
|
||||
var b04: BPR;
|
||||
>b04 : BPR
|
||||
>BPR : BPR
|
||||
|
||||
var b05: Partial<BR>;
|
||||
>b05 : BPR
|
||||
var b04: { readonly [P in keyof B]?: B[P] };
|
||||
>b04 : BPR
|
||||
>P : P
|
||||
>B : B
|
||||
>B : B
|
||||
>P : P
|
||||
|
||||
var b04: Partial<BR>;
|
||||
>b04 : BPR
|
||||
>Partial : Partial<T>
|
||||
>BR : BR
|
||||
|
||||
var b05: Readonly<BP>;
|
||||
>b05 : BPR
|
||||
var b04: Readonly<BP>;
|
||||
>b04 : BPR
|
||||
>Readonly : Readonly<T>
|
||||
>BP : BP
|
||||
|
||||
var b05: Partial<Readonly<B>>;
|
||||
>b05 : BPR
|
||||
var b04: Partial<Readonly<B>>;
|
||||
>b04 : BPR
|
||||
>Partial : Partial<T>
|
||||
>Readonly : Readonly<T>
|
||||
>B : B
|
||||
|
||||
var b05: Readonly<Partial<B>>;
|
||||
>b05 : BPR
|
||||
var b04: Readonly<Partial<B>>;
|
||||
>b04 : BPR
|
||||
>Readonly : Readonly<T>
|
||||
>Partial : Partial<T>
|
||||
>B : B
|
||||
|
||||
var b04: { [P in keyof BPR]: BPR[P] }
|
||||
>b04 : BPR
|
||||
>P : P
|
||||
>BPR : BPR
|
||||
>BPR : BPR
|
||||
>P : P
|
||||
|
||||
var b04: Pick<BPR, keyof BPR>;
|
||||
>b04 : BPR
|
||||
>Pick : Pick<T, K>
|
||||
>BPR : BPR
|
||||
>BPR : BPR
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
tests/cases/compiler/nestedFreshLiteral.ts(12,21): error TS2322: Type '{ nested: { prop: { colour: string; }; }; }' is not assignable to type 'NestedCSSProps'.
|
||||
Types of property 'nested' are incompatible.
|
||||
Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector | undefined'.
|
||||
Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'.
|
||||
Types of property 'prop' are incompatible.
|
||||
Type '{ colour: string; }' is not assignable to type 'CSSProps'.
|
||||
Object literal may only specify known properties, and 'colour' does not exist in type 'CSSProps'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/nestedFreshLiteral.ts (1 errors) ====
|
||||
interface CSSProps {
|
||||
color?: string
|
||||
}
|
||||
interface NestedCSSProps {
|
||||
nested?: NestedSelector
|
||||
}
|
||||
interface NestedSelector {
|
||||
prop: CSSProps;
|
||||
}
|
||||
|
||||
let stylen: NestedCSSProps = {
|
||||
nested: { prop: { colour: 'red' } }
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ nested: { prop: { colour: string; }; }; }' is not assignable to type 'NestedCSSProps'.
|
||||
!!! error TS2322: Types of property 'nested' are incompatible.
|
||||
!!! error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector | undefined'.
|
||||
!!! error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'.
|
||||
!!! error TS2322: Types of property 'prop' are incompatible.
|
||||
!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'CSSProps'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'colour' does not exist in type 'CSSProps'.
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//// [nestedFreshLiteral.ts]
|
||||
interface CSSProps {
|
||||
color?: string
|
||||
}
|
||||
interface NestedCSSProps {
|
||||
nested?: NestedSelector
|
||||
}
|
||||
interface NestedSelector {
|
||||
prop: CSSProps;
|
||||
}
|
||||
|
||||
let stylen: NestedCSSProps = {
|
||||
nested: { prop: { colour: 'red' } }
|
||||
}
|
||||
|
||||
//// [nestedFreshLiteral.js]
|
||||
var stylen = {
|
||||
nested: { prop: { colour: 'red' } }
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
//// [newLexicalEnvironmentForConvertedLoop.ts]
|
||||
function baz(x: any) {
|
||||
return [[x, x]];
|
||||
}
|
||||
|
||||
function foo(set: any) {
|
||||
for (const [value, i] of baz(set.values)) {
|
||||
const bar: any = [];
|
||||
(() => bar);
|
||||
|
||||
set.values.push(...[]);
|
||||
}
|
||||
};
|
||||
|
||||
//// [newLexicalEnvironmentForConvertedLoop.js]
|
||||
function baz(x) {
|
||||
return [[x, x]];
|
||||
}
|
||||
function foo(set) {
|
||||
var _loop_1 = function (value, i) {
|
||||
var bar = [];
|
||||
(function () { return bar; });
|
||||
(_a = set.values).push.apply(_a, []);
|
||||
var _a;
|
||||
};
|
||||
for (var _i = 0, _a = baz(set.values); _i < _a.length; _i++) {
|
||||
var _b = _a[_i], value = _b[0], i = _b[1];
|
||||
_loop_1(value, i);
|
||||
}
|
||||
}
|
||||
;
|
||||
@@ -0,0 +1,30 @@
|
||||
=== tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts ===
|
||||
function baz(x: any) {
|
||||
>baz : Symbol(baz, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 13))
|
||||
|
||||
return [[x, x]];
|
||||
>x : Symbol(x, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 13))
|
||||
>x : Symbol(x, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 13))
|
||||
}
|
||||
|
||||
function foo(set: any) {
|
||||
>foo : Symbol(foo, Decl(newLexicalEnvironmentForConvertedLoop.ts, 2, 1))
|
||||
>set : Symbol(set, Decl(newLexicalEnvironmentForConvertedLoop.ts, 4, 13))
|
||||
|
||||
for (const [value, i] of baz(set.values)) {
|
||||
>value : Symbol(value, Decl(newLexicalEnvironmentForConvertedLoop.ts, 5, 14))
|
||||
>i : Symbol(i, Decl(newLexicalEnvironmentForConvertedLoop.ts, 5, 20))
|
||||
>baz : Symbol(baz, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 0))
|
||||
>set : Symbol(set, Decl(newLexicalEnvironmentForConvertedLoop.ts, 4, 13))
|
||||
|
||||
const bar: any = [];
|
||||
>bar : Symbol(bar, Decl(newLexicalEnvironmentForConvertedLoop.ts, 6, 9))
|
||||
|
||||
(() => bar);
|
||||
>bar : Symbol(bar, Decl(newLexicalEnvironmentForConvertedLoop.ts, 6, 9))
|
||||
|
||||
set.values.push(...[]);
|
||||
>set : Symbol(set, Decl(newLexicalEnvironmentForConvertedLoop.ts, 4, 13))
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
=== tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts ===
|
||||
function baz(x: any) {
|
||||
>baz : (x: any) => any[][]
|
||||
>x : any
|
||||
|
||||
return [[x, x]];
|
||||
>[[x, x]] : any[][]
|
||||
>[x, x] : any[]
|
||||
>x : any
|
||||
>x : any
|
||||
}
|
||||
|
||||
function foo(set: any) {
|
||||
>foo : (set: any) => void
|
||||
>set : any
|
||||
|
||||
for (const [value, i] of baz(set.values)) {
|
||||
>value : any
|
||||
>i : any
|
||||
>baz(set.values) : any[][]
|
||||
>baz : (x: any) => any[][]
|
||||
>set.values : any
|
||||
>set : any
|
||||
>values : any
|
||||
|
||||
const bar: any = [];
|
||||
>bar : any
|
||||
>[] : undefined[]
|
||||
|
||||
(() => bar);
|
||||
>(() => bar) : () => any
|
||||
>() => bar : () => any
|
||||
>bar : any
|
||||
|
||||
set.values.push(...[]);
|
||||
>set.values.push(...[]) : any
|
||||
>set.values.push : any
|
||||
>set.values : any
|
||||
>set : any
|
||||
>values : any
|
||||
>push : any
|
||||
>...[] : undefined
|
||||
>[] : undefined[]
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/compiler/selfReferencingSpreadInLoop.ts(1,5): error TS7034: Variable 'additional' implicitly has type 'any[]' in some locations where its type cannot be determined.
|
||||
tests/cases/compiler/selfReferencingSpreadInLoop.ts(3,22): error TS7005: Variable 'additional' implicitly has an 'any[]' type.
|
||||
|
||||
|
||||
==== tests/cases/compiler/selfReferencingSpreadInLoop.ts (2 errors) ====
|
||||
let additional = [];
|
||||
~~~~~~~~~~
|
||||
!!! error TS7034: Variable 'additional' implicitly has type 'any[]' in some locations where its type cannot be determined.
|
||||
for (const subcomponent of [1, 2, 3]) {
|
||||
additional = [...additional, subcomponent];
|
||||
~~~~~~~~~~
|
||||
!!! error TS7005: Variable 'additional' implicitly has an 'any[]' type.
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [selfReferencingSpreadInLoop.ts]
|
||||
let additional = [];
|
||||
for (const subcomponent of [1, 2, 3]) {
|
||||
additional = [...additional, subcomponent];
|
||||
}
|
||||
|
||||
|
||||
//// [selfReferencingSpreadInLoop.js]
|
||||
var additional = [];
|
||||
for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) {
|
||||
var subcomponent = _a[_i];
|
||||
additional = additional.concat([subcomponent]);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [subSubClassCanAccessProtectedConstructor.ts]
|
||||
class Base {
|
||||
protected constructor() { }
|
||||
public instance1 = new Base(); // allowed
|
||||
}
|
||||
|
||||
class Subclass extends Base {
|
||||
public instance1_1 = new Base(); // allowed
|
||||
public instance1_2 = new Subclass(); // allowed
|
||||
}
|
||||
|
||||
class SubclassOfSubclass extends Subclass {
|
||||
public instance2_1 = new Base(); // allowed
|
||||
public instance2_2 = new Subclass(); // allowed
|
||||
public instance2_3 = new SubclassOfSubclass(); // allowed
|
||||
}
|
||||
|
||||
|
||||
//// [subSubClassCanAccessProtectedConstructor.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
this.instance1 = new Base(); // allowed
|
||||
}
|
||||
return Base;
|
||||
}());
|
||||
var Subclass = (function (_super) {
|
||||
__extends(Subclass, _super);
|
||||
function Subclass() {
|
||||
var _this = _super.apply(this, arguments) || this;
|
||||
_this.instance1_1 = new Base(); // allowed
|
||||
_this.instance1_2 = new Subclass(); // allowed
|
||||
return _this;
|
||||
}
|
||||
return Subclass;
|
||||
}(Base));
|
||||
var SubclassOfSubclass = (function (_super) {
|
||||
__extends(SubclassOfSubclass, _super);
|
||||
function SubclassOfSubclass() {
|
||||
var _this = _super.apply(this, arguments) || this;
|
||||
_this.instance2_1 = new Base(); // allowed
|
||||
_this.instance2_2 = new Subclass(); // allowed
|
||||
_this.instance2_3 = new SubclassOfSubclass(); // allowed
|
||||
return _this;
|
||||
}
|
||||
return SubclassOfSubclass;
|
||||
}(Subclass));
|
||||
@@ -0,0 +1,40 @@
|
||||
=== tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts ===
|
||||
class Base {
|
||||
>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0))
|
||||
|
||||
protected constructor() { }
|
||||
public instance1 = new Base(); // allowed
|
||||
>instance1 : Symbol(Base.instance1, Decl(subSubClassCanAccessProtectedConstructor.ts, 1, 31))
|
||||
>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0))
|
||||
}
|
||||
|
||||
class Subclass extends Base {
|
||||
>Subclass : Symbol(Subclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 3, 1))
|
||||
>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0))
|
||||
|
||||
public instance1_1 = new Base(); // allowed
|
||||
>instance1_1 : Symbol(Subclass.instance1_1, Decl(subSubClassCanAccessProtectedConstructor.ts, 5, 29))
|
||||
>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0))
|
||||
|
||||
public instance1_2 = new Subclass(); // allowed
|
||||
>instance1_2 : Symbol(Subclass.instance1_2, Decl(subSubClassCanAccessProtectedConstructor.ts, 6, 36))
|
||||
>Subclass : Symbol(Subclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 3, 1))
|
||||
}
|
||||
|
||||
class SubclassOfSubclass extends Subclass {
|
||||
>SubclassOfSubclass : Symbol(SubclassOfSubclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 8, 1))
|
||||
>Subclass : Symbol(Subclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 3, 1))
|
||||
|
||||
public instance2_1 = new Base(); // allowed
|
||||
>instance2_1 : Symbol(SubclassOfSubclass.instance2_1, Decl(subSubClassCanAccessProtectedConstructor.ts, 10, 43))
|
||||
>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0))
|
||||
|
||||
public instance2_2 = new Subclass(); // allowed
|
||||
>instance2_2 : Symbol(SubclassOfSubclass.instance2_2, Decl(subSubClassCanAccessProtectedConstructor.ts, 11, 36))
|
||||
>Subclass : Symbol(Subclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 3, 1))
|
||||
|
||||
public instance2_3 = new SubclassOfSubclass(); // allowed
|
||||
>instance2_3 : Symbol(SubclassOfSubclass.instance2_3, Decl(subSubClassCanAccessProtectedConstructor.ts, 12, 40))
|
||||
>SubclassOfSubclass : Symbol(SubclassOfSubclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 8, 1))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
=== tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts ===
|
||||
class Base {
|
||||
>Base : Base
|
||||
|
||||
protected constructor() { }
|
||||
public instance1 = new Base(); // allowed
|
||||
>instance1 : Base
|
||||
>new Base() : Base
|
||||
>Base : typeof Base
|
||||
}
|
||||
|
||||
class Subclass extends Base {
|
||||
>Subclass : Subclass
|
||||
>Base : Base
|
||||
|
||||
public instance1_1 = new Base(); // allowed
|
||||
>instance1_1 : Base
|
||||
>new Base() : Base
|
||||
>Base : typeof Base
|
||||
|
||||
public instance1_2 = new Subclass(); // allowed
|
||||
>instance1_2 : Subclass
|
||||
>new Subclass() : Subclass
|
||||
>Subclass : typeof Subclass
|
||||
}
|
||||
|
||||
class SubclassOfSubclass extends Subclass {
|
||||
>SubclassOfSubclass : SubclassOfSubclass
|
||||
>Subclass : Subclass
|
||||
|
||||
public instance2_1 = new Base(); // allowed
|
||||
>instance2_1 : Base
|
||||
>new Base() : Base
|
||||
>Base : typeof Base
|
||||
|
||||
public instance2_2 = new Subclass(); // allowed
|
||||
>instance2_2 : Subclass
|
||||
>new Subclass() : Subclass
|
||||
>Subclass : typeof Subclass
|
||||
|
||||
public instance2_3 = new SubclassOfSubclass(); // allowed
|
||||
>instance2_3 : SubclassOfSubclass
|
||||
>new SubclassOfSubclass() : SubclassOfSubclass
|
||||
>SubclassOfSubclass : typeof SubclassOfSubclass
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/node_modules/augmenter/index.d.ts(3,16): error TS2665: Invalid module name in augmentation. Module 'js' resolves to an untyped module at '/node_modules/js/index.js', which cannot be augmented.
|
||||
|
||||
|
||||
==== /a.ts (0 errors) ====
|
||||
import { } from "augmenter";
|
||||
|
||||
==== /node_modules/augmenter/index.d.ts (1 errors) ====
|
||||
// This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`.
|
||||
|
||||
declare module "js" {
|
||||
~~~~
|
||||
!!! error TS2665: Invalid module name in augmentation. Module 'js' resolves to an untyped module at '/node_modules/js/index.js', which cannot be augmented.
|
||||
export const j: number;
|
||||
}
|
||||
export {};
|
||||
|
||||
==== /node_modules/js/index.js (0 errors) ====
|
||||
This file is not processed.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
//// [tests/cases/compiler/untypedModuleImport_withAugmentation2.ts] ////
|
||||
|
||||
//// [index.d.ts]
|
||||
// This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`.
|
||||
|
||||
declare module "js" {
|
||||
export const j: number;
|
||||
}
|
||||
export {};
|
||||
|
||||
//// [index.js]
|
||||
This file is not processed.
|
||||
|
||||
//// [a.ts]
|
||||
import { } from "augmenter";
|
||||
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,40 @@
|
||||
tests/cases/compiler/unusedLocalsAndObjectSpread.ts(21,18): error TS6133: 'bar' is declared but never used.
|
||||
tests/cases/compiler/unusedLocalsAndObjectSpread.ts(28,21): error TS6133: 'bar' is declared but never used.
|
||||
|
||||
|
||||
==== tests/cases/compiler/unusedLocalsAndObjectSpread.ts (2 errors) ====
|
||||
|
||||
declare var console: { log(a: any): void };
|
||||
|
||||
function one() {
|
||||
const foo = { a: 1, b: 2 };
|
||||
// 'a' is declared but never used
|
||||
const {a, ...bar} = foo;
|
||||
console.log(bar);
|
||||
}
|
||||
|
||||
function two() {
|
||||
const foo = { a: 1, b: 2 };
|
||||
// '_' is declared but never used
|
||||
const {a: _, ...bar} = foo;
|
||||
console.log(bar);
|
||||
}
|
||||
|
||||
function three() {
|
||||
const foo = { a: 1, b: 2 };
|
||||
// 'a' is declared but never used
|
||||
const {a, ...bar} = foo; // bar should be unused
|
||||
~~~
|
||||
!!! error TS6133: 'bar' is declared but never used.
|
||||
//console.log(bar);
|
||||
}
|
||||
|
||||
function four() {
|
||||
const foo = { a: 1, b: 2 };
|
||||
// '_' is declared but never used
|
||||
const {a: _, ...bar} = foo; // bar should be unused
|
||||
~~~
|
||||
!!! error TS6133: 'bar' is declared but never used.
|
||||
//console.log(bar);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
//// [unusedLocalsAndObjectSpread.ts]
|
||||
|
||||
declare var console: { log(a: any): void };
|
||||
|
||||
function one() {
|
||||
const foo = { a: 1, b: 2 };
|
||||
// 'a' is declared but never used
|
||||
const {a, ...bar} = foo;
|
||||
console.log(bar);
|
||||
}
|
||||
|
||||
function two() {
|
||||
const foo = { a: 1, b: 2 };
|
||||
// '_' is declared but never used
|
||||
const {a: _, ...bar} = foo;
|
||||
console.log(bar);
|
||||
}
|
||||
|
||||
function three() {
|
||||
const foo = { a: 1, b: 2 };
|
||||
// 'a' is declared but never used
|
||||
const {a, ...bar} = foo; // bar should be unused
|
||||
//console.log(bar);
|
||||
}
|
||||
|
||||
function four() {
|
||||
const foo = { a: 1, b: 2 };
|
||||
// '_' is declared but never used
|
||||
const {a: _, ...bar} = foo; // bar should be unused
|
||||
//console.log(bar);
|
||||
}
|
||||
|
||||
|
||||
//// [unusedLocalsAndObjectSpread.js]
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
|
||||
t[p[i]] = s[p[i]];
|
||||
return t;
|
||||
};
|
||||
function one() {
|
||||
var foo = { a: 1, b: 2 };
|
||||
// 'a' is declared but never used
|
||||
var a = foo.a, bar = __rest(foo, ["a"]);
|
||||
console.log(bar);
|
||||
}
|
||||
function two() {
|
||||
var foo = { a: 1, b: 2 };
|
||||
// '_' is declared but never used
|
||||
var _ = foo.a, bar = __rest(foo, ["a"]);
|
||||
console.log(bar);
|
||||
}
|
||||
function three() {
|
||||
var foo = { a: 1, b: 2 };
|
||||
// 'a' is declared but never used
|
||||
var a = foo.a, bar = __rest(foo, ["a"]); // bar should be unused
|
||||
//console.log(bar);
|
||||
}
|
||||
function four() {
|
||||
var foo = { a: 1, b: 2 };
|
||||
// '_' is declared but never used
|
||||
var _ = foo.a, bar = __rest(foo, ["a"]); // bar should be unused
|
||||
//console.log(bar);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// @declaration: true
|
||||
|
||||
// @filename: db.d.ts
|
||||
declare namespace Db {
|
||||
export import Types = Db;
|
||||
}
|
||||
|
||||
export = Db;
|
||||
|
||||
// @filename: app.ts
|
||||
import * as Db from "./db"
|
||||
|
||||
export function foo() {
|
||||
return new Object()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// @importHelpers: true
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
// @moduleResolution: classic
|
||||
// @filename: declaration.d.ts
|
||||
export declare class D {
|
||||
}
|
||||
export declare class E extends D {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// @strictNullChecks: true
|
||||
interface CSSProps {
|
||||
color?: string
|
||||
}
|
||||
interface NestedCSSProps {
|
||||
nested?: NestedSelector
|
||||
}
|
||||
interface NestedSelector {
|
||||
prop: CSSProps;
|
||||
}
|
||||
|
||||
let stylen: NestedCSSProps = {
|
||||
nested: { prop: { colour: 'red' } }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// @target: es5
|
||||
function baz(x: any) {
|
||||
return [[x, x]];
|
||||
}
|
||||
|
||||
function foo(set: any) {
|
||||
for (const [value, i] of baz(set.values)) {
|
||||
const bar: any = [];
|
||||
(() => bar);
|
||||
|
||||
set.values.push(...[]);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
// @noImplicitAny: true
|
||||
let additional = [];
|
||||
for (const subcomponent of [1, 2, 3]) {
|
||||
additional = [...additional, subcomponent];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class Base {
|
||||
protected constructor() { }
|
||||
public instance1 = new Base(); // allowed
|
||||
}
|
||||
|
||||
class Subclass extends Base {
|
||||
public instance1_1 = new Base(); // allowed
|
||||
public instance1_2 = new Subclass(); // allowed
|
||||
}
|
||||
|
||||
class SubclassOfSubclass extends Subclass {
|
||||
public instance2_1 = new Base(); // allowed
|
||||
public instance2_2 = new Subclass(); // allowed
|
||||
public instance2_3 = new SubclassOfSubclass(); // allowed
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// @noImplicitReferences: true
|
||||
// This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`.
|
||||
|
||||
// @Filename: /node_modules/augmenter/index.d.ts
|
||||
declare module "js" {
|
||||
export const j: number;
|
||||
}
|
||||
export {};
|
||||
|
||||
// @Filename: /node_modules/js/index.js
|
||||
This file is not processed.
|
||||
|
||||
// @Filename: /a.ts
|
||||
import { } from "augmenter";
|
||||
@@ -0,0 +1,31 @@
|
||||
//@noUnusedLocals:true
|
||||
|
||||
declare var console: { log(a: any): void };
|
||||
|
||||
function one() {
|
||||
const foo = { a: 1, b: 2 };
|
||||
// 'a' is declared but never used
|
||||
const {a, ...bar} = foo;
|
||||
console.log(bar);
|
||||
}
|
||||
|
||||
function two() {
|
||||
const foo = { a: 1, b: 2 };
|
||||
// '_' is declared but never used
|
||||
const {a: _, ...bar} = foo;
|
||||
console.log(bar);
|
||||
}
|
||||
|
||||
function three() {
|
||||
const foo = { a: 1, b: 2 };
|
||||
// 'a' is declared but never used
|
||||
const {a, ...bar} = foo; // bar should be unused
|
||||
//console.log(bar);
|
||||
}
|
||||
|
||||
function four() {
|
||||
const foo = { a: 1, b: 2 };
|
||||
// '_' is declared but never used
|
||||
const {a: _, ...bar} = foo; // bar should be unused
|
||||
//console.log(bar);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// @target: es2017
|
||||
// @strictNullChecks: true
|
||||
interface A extends Promise<string> {}
|
||||
declare var a: A;
|
||||
async function f() {
|
||||
await a;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// @target:es5
|
||||
// @experimentaldecorators: true
|
||||
declare function dec1<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
declare function dec2<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class A {
|
||||
@dec1 get x() { return 0; }
|
||||
set x(value: number) { }
|
||||
}
|
||||
|
||||
class B {
|
||||
get x() { return 0; }
|
||||
@dec2 set x(value: number) { }
|
||||
}
|
||||
|
||||
class C {
|
||||
@dec1 set x(value: number) { }
|
||||
get x() { return 0; }
|
||||
}
|
||||
|
||||
class D {
|
||||
set x(value: number) { }
|
||||
@dec2 get x() { return 0; }
|
||||
}
|
||||
|
||||
class E {
|
||||
@dec1 get x() { return 0; }
|
||||
@dec2 set x(value: number) { }
|
||||
}
|
||||
|
||||
class F {
|
||||
@dec1 set x(value: number) { }
|
||||
@dec2 get x() { return 0; }
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// @target:es5
|
||||
// @experimentaldecorators: true
|
||||
// @emitdecoratormetadata: true
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class A {
|
||||
@dec get x() { return 0; }
|
||||
set x(value: number) { }
|
||||
}
|
||||
|
||||
class B {
|
||||
get x() { return 0; }
|
||||
@dec set x(value: number) { }
|
||||
}
|
||||
|
||||
class C {
|
||||
@dec set x(value: number) { }
|
||||
get x() { return 0; }
|
||||
}
|
||||
|
||||
class D {
|
||||
set x(value: number) { }
|
||||
@dec get x() { return 0; }
|
||||
}
|
||||
|
||||
class E {
|
||||
@dec get x() { return 0; }
|
||||
}
|
||||
|
||||
class F {
|
||||
@dec set x(value: number) { }
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
// @experimentaldecorators: true
|
||||
// @emitdecoratormetadata: true
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class A {
|
||||
}
|
||||
|
||||
@dec
|
||||
class B {
|
||||
constructor(x: number) {}
|
||||
}
|
||||
|
||||
@dec
|
||||
class C extends A {
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// @declaration: true
|
||||
|
||||
type T1 = {
|
||||
x: T1["x"]; // Error
|
||||
};
|
||||
|
||||
type T2<K extends "x" | "y"> = {
|
||||
x: T2<K>[K]; // Error
|
||||
y: number;
|
||||
}
|
||||
|
||||
declare let x2: T2<"x">;
|
||||
let x2x = x2.x;
|
||||
|
||||
interface T3<T extends T3<T>> {
|
||||
x: T["x"]; // Error
|
||||
}
|
||||
|
||||
interface T4<T extends T4<T>> {
|
||||
x: T4<T>["x"]; // Error
|
||||
}
|
||||
|
||||
class C1 {
|
||||
x: C1["x"]; // Error
|
||||
}
|
||||
|
||||
class C2 {
|
||||
x: this["y"]; // Error
|
||||
y: this["z"]; // Error
|
||||
z: this["x"]; // Error
|
||||
}
|
||||
@@ -250,6 +250,53 @@ function f74(func: <T, U, K extends keyof (T | U)>(x: T, y: U, k: K) => (T | U)[
|
||||
let b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean
|
||||
}
|
||||
|
||||
function f80<T extends { a: { x: any } }>(obj: T) {
|
||||
let a1 = obj.a; // { x: any }
|
||||
let a2 = obj['a']; // { x: any }
|
||||
let a3 = obj['a'] as T['a']; // T["a"]
|
||||
let x1 = obj.a.x; // any
|
||||
let x2 = obj['a']['x']; // any
|
||||
let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"]
|
||||
}
|
||||
|
||||
function f81<T extends { a: { x: any } }>(obj: T) {
|
||||
return obj['a']['x'] as T['a']['x'];
|
||||
}
|
||||
|
||||
function f82() {
|
||||
let x1 = f81({ a: { x: "hello" } }); // string
|
||||
let x2 = f81({ a: { x: 42 } }); // number
|
||||
}
|
||||
|
||||
function f83<T extends { [x: string]: { x: any } }, K extends keyof T>(obj: T, key: K) {
|
||||
return obj[key]['x'] as T[K]['x'];
|
||||
}
|
||||
|
||||
function f84() {
|
||||
let x1 = f83({ foo: { x: "hello" } }, "foo"); // string
|
||||
let x2 = f83({ bar: { x: 42 } }, "bar"); // number
|
||||
}
|
||||
|
||||
class C1 {
|
||||
x: number;
|
||||
get<K extends keyof this>(key: K) {
|
||||
return this[key];
|
||||
}
|
||||
set<K extends keyof this>(key: K, value: this[K]) {
|
||||
this[key] = value;
|
||||
}
|
||||
foo() {
|
||||
let x1 = this.x; // number
|
||||
let x2 = this["x"]; // number
|
||||
let x3 = this.get("x"); // this["x"]
|
||||
let x4 = getProperty(this, "x"); // this["x"]
|
||||
this.x = 42;
|
||||
this["x"] = 42;
|
||||
this.set("x", 42);
|
||||
setProperty(this, "x", 42);
|
||||
}
|
||||
}
|
||||
|
||||
// Repros from #12011
|
||||
|
||||
class Base {
|
||||
@@ -365,4 +412,22 @@ interface R {
|
||||
function f<K extends keyof R>(p: K) {
|
||||
let a: any;
|
||||
a[p].add; // any
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #12651
|
||||
|
||||
type MethodDescriptor = {
|
||||
name: string;
|
||||
args: any[];
|
||||
returnValue: any;
|
||||
}
|
||||
|
||||
declare function dispatchMethod<M extends MethodDescriptor>(name: M['name'], args: M['args']): M['returnValue'];
|
||||
|
||||
type SomeMethodDescriptor = {
|
||||
name: "someMethod";
|
||||
args: [string, number];
|
||||
returnValue: string[];
|
||||
}
|
||||
|
||||
let result = dispatchMethod<SomeMethodDescriptor>("someMethod", ["hello", 35]);
|
||||
@@ -84,4 +84,44 @@ function f21() {
|
||||
let x1 = objAndPartial({ x: 0, y: 0 }, { x: 1 });
|
||||
let x2 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1 });
|
||||
let x3 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error
|
||||
}
|
||||
}
|
||||
|
||||
// Verify use of Pick<T, K> for setState functions (#12793)
|
||||
|
||||
interface Foo {
|
||||
a: string;
|
||||
b?: number;
|
||||
}
|
||||
|
||||
function setState<T, K extends keyof T>(obj: T, props: Pick<T, K>) {
|
||||
for (let k in props) {
|
||||
obj[k] = props[k];
|
||||
}
|
||||
}
|
||||
|
||||
let foo: Foo = { a: "hello", b: 42 };
|
||||
setState(foo, { a: "test", b: 43 })
|
||||
setState(foo, { a: "hi" });
|
||||
setState(foo, { b: undefined });
|
||||
setState(foo, { });
|
||||
setState(foo, foo);
|
||||
setState(foo, { a: undefined }); // Error
|
||||
setState(foo, { c: true }); // Error
|
||||
|
||||
class C<T> {
|
||||
state: T;
|
||||
setState<K extends keyof T>(props: Pick<T, K>) {
|
||||
for (let k in props) {
|
||||
this.state[k] = props[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let c = new C<Foo>();
|
||||
c.setState({ a: "test", b: 43 });
|
||||
c.setState({ a: "hi" });
|
||||
c.setState({ b: undefined });
|
||||
c.setState({ });
|
||||
c.setState(foo);
|
||||
c.setState({ a: undefined }); // Error
|
||||
c.setState({ c: true }); // Error
|
||||
@@ -1,85 +1,77 @@
|
||||
// @strictNullChecks: true
|
||||
|
||||
type T = { a: number, b: string };
|
||||
type TU = { a: number | undefined, b: string | undefined };
|
||||
type TP = { a?: number, b?: string };
|
||||
type TR = { readonly a: number, readonly b: string };
|
||||
type TPR = { readonly a?: number, readonly b?: string };
|
||||
|
||||
// Validate they all have the same keys
|
||||
var v00: "a" | "b";
|
||||
var v00: keyof T;
|
||||
var v00: keyof TU;
|
||||
var v00: keyof TP;
|
||||
var v00: keyof TR;
|
||||
var v00: keyof TPR;
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var v01: T;
|
||||
var v01: Pick<TR, keyof T>;
|
||||
var v01: Pick<Readonly<T>, keyof T>;
|
||||
var v01: { [P in keyof T]: T[P] };
|
||||
var v01: Pick<T, keyof T>;
|
||||
var v01: Pick<Pick<T, keyof T>, keyof T>;
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var v02: TU;
|
||||
var v02: Pick<TP, keyof T>;
|
||||
var v02: Pick<TPR, keyof T>;
|
||||
var v02: Pick<Partial<T>, keyof T>;
|
||||
var v02: Pick<Partial<Readonly<T>>, keyof T>;
|
||||
var v02: TP;
|
||||
var v02: { [P in keyof T]?: T[P] };
|
||||
var v02: Partial<T>;
|
||||
var v02: { [P in keyof TP]: TP[P] }
|
||||
var v02: Pick<TP, keyof TP>;
|
||||
|
||||
// Validate that isomorphic mapped types preserve optional modifier
|
||||
var v03: TP;
|
||||
var v03: Partial<T>;
|
||||
var v03: TR;
|
||||
var v03: { readonly [P in keyof T]: T[P] };
|
||||
var v03: Readonly<T>;
|
||||
var v03: { [P in keyof TR]: TR[P] }
|
||||
var v03: Pick<TR, keyof TR>;
|
||||
|
||||
// Validate that isomorphic mapped types preserve readonly modifier
|
||||
var v04: TR;
|
||||
var v04: Readonly<T>;
|
||||
|
||||
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
|
||||
var v05: TPR;
|
||||
var v05: Partial<TR>;
|
||||
var v05: Readonly<TP>;
|
||||
var v05: Partial<Readonly<T>>;
|
||||
var v05: Readonly<Partial<T>>;
|
||||
var v04: TPR;
|
||||
var v04: { readonly [P in keyof T]?: T[P] };
|
||||
var v04: Partial<TR>;
|
||||
var v04: Readonly<TP>;
|
||||
var v04: Partial<Readonly<T>>;
|
||||
var v04: Readonly<Partial<T>>;
|
||||
var v04: { [P in keyof TPR]: TPR[P] }
|
||||
var v04: Pick<TPR, keyof T>;
|
||||
|
||||
type Boxified<T> = { [P in keyof T]: { x: T[P] } };
|
||||
|
||||
type B = { a: { x: number }, b: { x: string } };
|
||||
type BU = { a: { x: number } | undefined, b: { x: string } | undefined };
|
||||
type BP = { a?: { x: number }, b?: { x: string } };
|
||||
type BR = { readonly a: { x: number }, readonly b: { x: string } };
|
||||
type BPR = { readonly a?: { x: number }, readonly b?: { x: string } };
|
||||
|
||||
// Validate they all have the same keys
|
||||
var b00: "a" | "b";
|
||||
var b00: keyof B;
|
||||
var b00: keyof BU;
|
||||
var b00: keyof BP;
|
||||
var b00: keyof BR;
|
||||
var b00: keyof BPR;
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var b01: B;
|
||||
var b01: Pick<BR, keyof B>;
|
||||
var b01: Pick<Readonly<BR>, keyof B>;
|
||||
var b01: { [P in keyof B]: B[P] };
|
||||
var b01: Pick<B, keyof B>;
|
||||
var b01: Pick<Pick<B, keyof B>, keyof B>;
|
||||
|
||||
// Validate that non-isomorphic mapped types strip modifiers
|
||||
var b02: BU;
|
||||
var b02: Pick<BP, keyof B>;
|
||||
var b02: Pick<BPR, keyof B>;
|
||||
var b02: Pick<Partial<B>, keyof B>;
|
||||
var b02: Pick<Partial<Readonly<B>>, keyof B>;
|
||||
var b02: BP;
|
||||
var b02: { [P in keyof B]?: B[P] };
|
||||
var b02: Partial<B>;
|
||||
var b02: { [P in keyof BP]: BP[P] }
|
||||
var b02: Pick<BP, keyof BP>;
|
||||
|
||||
// Validate that isomorphic mapped types preserve optional modifier
|
||||
var b03: BP;
|
||||
var b03: Partial<B>;
|
||||
var b03: BR;
|
||||
var b03: { readonly [P in keyof B]: B[P] };
|
||||
var b03: Readonly<B>;
|
||||
var b03: { [P in keyof BR]: BR[P] }
|
||||
var b03: Pick<BR, keyof BR>;
|
||||
|
||||
// Validate that isomorphic mapped types preserve readonly modifier
|
||||
var b04: BR;
|
||||
var b04: Readonly<B>;
|
||||
|
||||
// Validate that isomorphic mapped types preserve both partial and readonly modifiers
|
||||
var b05: BPR;
|
||||
var b05: Partial<BR>;
|
||||
var b05: Readonly<BP>;
|
||||
var b05: Partial<Readonly<B>>;
|
||||
var b05: Readonly<Partial<B>>;
|
||||
var b04: BPR;
|
||||
var b04: { readonly [P in keyof B]?: B[P] };
|
||||
var b04: Partial<BR>;
|
||||
var b04: Readonly<BP>;
|
||||
var b04: Partial<Readonly<B>>;
|
||||
var b04: Readonly<Partial<B>>;
|
||||
var b04: { [P in keyof BPR]: BPR[P] }
|
||||
var b04: Pick<BPR, keyof BPR>;
|
||||
@@ -7,6 +7,6 @@
|
||||
|
||||
goTo.eof();
|
||||
edit.insert('t.');
|
||||
verify.memberListContains('x');
|
||||
verify.memberListContains('y');
|
||||
verify.not.memberListContains('z');
|
||||
verify.completionListContains('x');
|
||||
verify.completionListContains('y');
|
||||
verify.not.completionListContains('z');
|
||||
@@ -14,10 +14,10 @@
|
||||
//// }
|
||||
|
||||
goTo.marker('1');
|
||||
verify.not.isValidBraceCompletionAtPosition('(');
|
||||
verify.isValidBraceCompletionAtPosition('(');
|
||||
|
||||
goTo.marker('2');
|
||||
verify.not.isValidBraceCompletionAtPosition('(');
|
||||
verify.isValidBraceCompletionAtPosition('(');
|
||||
|
||||
goTo.marker('3');
|
||||
verify.not.isValidBraceCompletionAtPosition('(');
|
||||
verify.isValidBraceCompletionAtPosition('(');
|
||||
@@ -139,18 +139,18 @@ verify.quickInfos({
|
||||
});
|
||||
|
||||
goTo.marker('4');
|
||||
verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
|
||||
goTo.marker('5');
|
||||
verify.completionListContains("b", "(parameter) b: number", "number to add");
|
||||
@@ -158,18 +158,18 @@ verify.completionListContains("b", "(parameter) b: number", "number to add");
|
||||
verify.quickInfoAt("6", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
|
||||
goTo.marker('7');
|
||||
verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
|
||||
goTo.marker('8');
|
||||
verify.currentSignatureHelpDocCommentIs("sum with property");
|
||||
@@ -177,48 +177,48 @@ verify.currentParameterHelpArgumentDocCommentIs("number to add");
|
||||
verify.quickInfoAt("8q", "(method) c1.p2(b: number): number", "sum with property");
|
||||
|
||||
goTo.marker('9');
|
||||
verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
|
||||
verify.quickInfoAt("10", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
|
||||
goTo.marker('11');
|
||||
verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
|
||||
goTo.marker('12');
|
||||
verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
|
||||
goTo.marker('13');
|
||||
verify.currentSignatureHelpDocCommentIs("sum with property");
|
||||
@@ -232,18 +232,18 @@ verify.quickInfos({
|
||||
});
|
||||
|
||||
goTo.marker('16');
|
||||
verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
|
||||
goTo.marker('17');
|
||||
verify.completionListContains("b", "(parameter) b: number", "number to add");
|
||||
@@ -251,18 +251,18 @@ verify.completionListContains("b", "(parameter) b: number", "number to add");
|
||||
verify.quickInfoAt("18", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
|
||||
goTo.marker('19');
|
||||
verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
|
||||
goTo.marker('20');
|
||||
verify.currentSignatureHelpDocCommentIs("sum with property");
|
||||
@@ -270,48 +270,48 @@ verify.currentParameterHelpArgumentDocCommentIs("number to add");
|
||||
verify.quickInfoAt("20q", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
|
||||
goTo.marker('21');
|
||||
verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
|
||||
verify.quickInfoAt("22", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
|
||||
goTo.marker('23');
|
||||
verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
|
||||
goTo.marker('24');
|
||||
verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1");
|
||||
verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property");
|
||||
verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2");
|
||||
verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", "");
|
||||
verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", "");
|
||||
verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", "");
|
||||
|
||||
goTo.marker('25');
|
||||
verify.currentSignatureHelpDocCommentIs("sum with property");
|
||||
@@ -329,12 +329,12 @@ goTo.marker('29');
|
||||
verify.completionListContains("c1", "class c1", "This is comment for c1");
|
||||
|
||||
goTo.marker('30');
|
||||
verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", "");
|
||||
verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", "");
|
||||
verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", "");
|
||||
verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", "");
|
||||
verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", "");
|
||||
verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", "");
|
||||
|
||||
goTo.marker('31');
|
||||
verify.completionListContains("b", "(parameter) b: number", "number to add");
|
||||
@@ -345,12 +345,12 @@ goTo.marker('33');
|
||||
verify.completionListContains("c1", "class c1", "This is comment for c1");
|
||||
|
||||
goTo.marker('34');
|
||||
verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", "");
|
||||
verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", "");
|
||||
verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", "");
|
||||
verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", "");
|
||||
verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", "");
|
||||
verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", "");
|
||||
|
||||
goTo.marker('35');
|
||||
verify.currentSignatureHelpDocCommentIs("static sum with property");
|
||||
@@ -359,12 +359,12 @@ verify.completionListContains("c1", "class c1", "This is comment for c1");
|
||||
verify.quickInfoAt("35q", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
|
||||
goTo.marker('36');
|
||||
verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", "");
|
||||
verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", "");
|
||||
verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", "");
|
||||
verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", "");
|
||||
verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", "");
|
||||
verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", "");
|
||||
|
||||
verify.quickInfoAt("37", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
|
||||
@@ -372,23 +372,23 @@ goTo.marker('38');
|
||||
verify.completionListContains("c1", "class c1", "This is comment for c1");
|
||||
|
||||
goTo.marker('39');
|
||||
verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", "");
|
||||
verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", "");
|
||||
verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", "");
|
||||
verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", "");
|
||||
verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", "");
|
||||
verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", "");
|
||||
|
||||
goTo.marker('40');
|
||||
verify.completionListContains("c1", "class c1", "This is comment for c1");
|
||||
|
||||
goTo.marker('41');
|
||||
verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", "");
|
||||
verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", "");
|
||||
verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", "");
|
||||
verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", "");
|
||||
verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", "");
|
||||
verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", "");
|
||||
|
||||
goTo.marker('42');
|
||||
verify.currentSignatureHelpDocCommentIs("static sum with property");
|
||||
@@ -477,12 +477,12 @@ verify.quickInfos({
|
||||
|
||||
goTo.marker("67");
|
||||
verify.quickInfoIs("(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1");
|
||||
verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property");
|
||||
verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1");
|
||||
verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", "");
|
||||
verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", "");
|
||||
|
||||
verify.quickInfos({
|
||||
68: "var i1_f: (b: number) => number",
|
||||
@@ -526,12 +526,12 @@ verify.completionListContains("c1", "class c1", "This is comment for c1");
|
||||
|
||||
goTo.marker('88');
|
||||
verify.quickInfoIs("(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", "");
|
||||
verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", "");
|
||||
verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", "");
|
||||
verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1");
|
||||
verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property");
|
||||
verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3");
|
||||
verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", "");
|
||||
verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", "");
|
||||
verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", "");
|
||||
|
||||
verify.quickInfos({
|
||||
89: "var i1_s_f: (b: number) => number",
|
||||
@@ -593,10 +593,10 @@ verify.completionListContains("i1_c", "var i1_c: typeof c1", "");
|
||||
|
||||
goTo.marker('110');
|
||||
verify.quickInfoIs("(property) cProperties.p2: number", "setter only property");
|
||||
verify.memberListContains("p1", "(property) cProperties.p1: number", "getter only property");
|
||||
verify.memberListContains("p2", "(property) cProperties.p2: number", "setter only property");
|
||||
verify.memberListContains("nc_p1", "(property) cProperties.nc_p1: number", "");
|
||||
verify.memberListContains("nc_p2", "(property) cProperties.nc_p2: number", "");
|
||||
verify.completionListContains("p1", "(property) cProperties.p1: number", "getter only property");
|
||||
verify.completionListContains("p2", "(property) cProperties.p2: number", "setter only property");
|
||||
verify.completionListContains("nc_p1", "(property) cProperties.nc_p1: number", "");
|
||||
verify.completionListContains("nc_p2", "(property) cProperties.nc_p2: number", "");
|
||||
|
||||
verify.quickInfos({
|
||||
111: ["(property) cProperties.p1: number", "getter only property"],
|
||||
@@ -605,7 +605,7 @@ verify.quickInfos({
|
||||
});
|
||||
|
||||
goTo.marker('114');
|
||||
verify.memberListContains("a", "(property) cWithConstructorProperty.a: number", "this is first parameter a\nmore info about a");
|
||||
verify.completionListContains("a", "(property) cWithConstructorProperty.a: number", "this is first parameter a\nmore info about a");
|
||||
verify.quickInfoIs("(property) cWithConstructorProperty.a: number", "this is first parameter a\nmore info about a");
|
||||
|
||||
goTo.marker('115');
|
||||
|
||||
@@ -22,11 +22,11 @@ verify.completionListContains("Colors", "enum Colors", "Enum of colors");
|
||||
verify.quickInfoIs("enum Colors", "Enum of colors");
|
||||
|
||||
goTo.marker('6');
|
||||
verify.memberListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'");
|
||||
verify.memberListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'");
|
||||
verify.completionListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'");
|
||||
verify.completionListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'");
|
||||
verify.quickInfoIs("(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'");
|
||||
|
||||
goTo.marker('7');
|
||||
verify.memberListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'");
|
||||
verify.memberListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'");
|
||||
verify.completionListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'");
|
||||
verify.completionListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'");
|
||||
verify.quickInfoIs("(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'");
|
||||
@@ -46,9 +46,9 @@ goTo.marker('4');
|
||||
verify.completionListContains("m1", "namespace m1", "Namespace comment");
|
||||
|
||||
goTo.marker('5');
|
||||
verify.memberListContains("b", "var m1.b: number", "b's comment");
|
||||
verify.memberListContains("fooExport", "function m1.fooExport(): number", "exported function");
|
||||
verify.memberListContains("m2", "namespace m1.m2");
|
||||
verify.completionListContains("b", "var m1.b: number", "b's comment");
|
||||
verify.completionListContains("fooExport", "function m1.fooExport(): number", "exported function");
|
||||
verify.completionListContains("m2", "namespace m1.m2");
|
||||
|
||||
goTo.marker('6');
|
||||
verify.currentSignatureHelpDocCommentIs("exported function");
|
||||
@@ -57,8 +57,8 @@ verify.quickInfoAt("6q", "function m1.fooExport(): number", "exported function")
|
||||
verify.quickInfoAt("7", "var myvar: m1.m2.c");
|
||||
|
||||
goTo.marker('8');
|
||||
verify.memberListContains("c", "constructor m1.m2.c(): m1.m2.c", "");
|
||||
verify.memberListContains("i", "var m1.m2.i: m1.m2.c", "i");
|
||||
verify.completionListContains("c", "constructor m1.m2.c(): m1.m2.c", "");
|
||||
verify.completionListContains("i", "var m1.m2.i: m1.m2.c", "i");
|
||||
|
||||
goTo.file("commentsExternalModules_file1.ts");
|
||||
verify.quickInfoAt("9", 'import extMod = require("./commentsExternalModules_file0")', "This is on import declaration");
|
||||
@@ -67,12 +67,12 @@ goTo.marker('10');
|
||||
verify.completionListContains("extMod", 'import extMod = require("./commentsExternalModules_file0")', "This is on import declaration");
|
||||
|
||||
goTo.marker('11');
|
||||
verify.memberListContains("m1", "namespace extMod.m1");
|
||||
verify.completionListContains("m1", "namespace extMod.m1");
|
||||
|
||||
goTo.marker('12');
|
||||
verify.memberListContains("b", "var extMod.m1.b: number", "b's comment");
|
||||
verify.memberListContains("fooExport", "function extMod.m1.fooExport(): number", "exported function");
|
||||
verify.memberListContains("m2", "namespace extMod.m1.m2");
|
||||
verify.completionListContains("b", "var extMod.m1.b: number", "b's comment");
|
||||
verify.completionListContains("fooExport", "function extMod.m1.fooExport(): number", "exported function");
|
||||
verify.completionListContains("m2", "namespace extMod.m1.m2");
|
||||
|
||||
goTo.marker('13');
|
||||
verify.currentSignatureHelpDocCommentIs("exported function");
|
||||
@@ -81,5 +81,5 @@ verify.quickInfoAt("13q", "function extMod.m1.fooExport(): number", "exported fu
|
||||
verify.quickInfoAt("14", "var newVar: extMod.m1.m2.c");
|
||||
|
||||
goTo.marker('15');
|
||||
verify.memberListContains("c", "constructor extMod.m1.m2.c(): extMod.m1.m2.c", "");
|
||||
verify.memberListContains("i", "var extMod.m1.m2.i: extMod.m1.m2.c", "i");
|
||||
verify.completionListContains("c", "constructor extMod.m1.m2.c(): extMod.m1.m2.c", "");
|
||||
verify.completionListContains("i", "var extMod.m1.m2.i: extMod.m1.m2.c", "i");
|
||||
@@ -30,12 +30,12 @@ verify.quickInfos({
|
||||
});
|
||||
|
||||
goTo.marker('6');
|
||||
verify.memberListContains("m1", "namespace extMod.m1");
|
||||
verify.completionListContains("m1", "namespace extMod.m1");
|
||||
|
||||
goTo.marker('7');
|
||||
verify.memberListContains("b", "var extMod.m1.b: number", "b's comment");
|
||||
verify.memberListContains("fooExport", "function extMod.m1.fooExport(): number", "exported function");
|
||||
verify.memberListContains("m2", "namespace extMod.m1.m2");
|
||||
verify.completionListContains("b", "var extMod.m1.b: number", "b's comment");
|
||||
verify.completionListContains("fooExport", "function extMod.m1.fooExport(): number", "exported function");
|
||||
verify.completionListContains("m2", "namespace extMod.m1.m2");
|
||||
|
||||
goTo.marker('8');
|
||||
verify.currentSignatureHelpDocCommentIs("exported function");
|
||||
@@ -45,5 +45,5 @@ verify.quickInfos({
|
||||
});
|
||||
|
||||
goTo.marker('10');
|
||||
verify.memberListContains("c", "constructor extMod.m1.m2.c(): extMod.m1.m2.c", "");
|
||||
verify.memberListContains("i", "var extMod.m1.m2.i: extMod.m1.m2.c", "i");
|
||||
verify.completionListContains("c", "constructor extMod.m1.m2.c(): extMod.m1.m2.c", "");
|
||||
verify.completionListContains("i", "var extMod.m1.m2.i: extMod.m1.m2.c", "i");
|
||||
@@ -221,18 +221,18 @@
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
verify.memberListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1");
|
||||
verify.memberListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1");
|
||||
verify.memberListContains("i1_l1", "(property) i1.i1_l1: () => void", "");
|
||||
verify.memberListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", "");
|
||||
verify.memberListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", "");
|
||||
verify.memberListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", "");
|
||||
verify.memberListContains("p1", "(property) i1.p1: number", "");
|
||||
verify.memberListContains("f1", "(method) i1.f1(): void", "");
|
||||
verify.memberListContains("l1", "(property) i1.l1: () => void", "");
|
||||
verify.memberListContains("nc_p1", "(property) i1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_f1", "(method) i1.nc_f1(): void", "");
|
||||
verify.memberListContains("nc_l1", "(property) i1.nc_l1: () => void", "");
|
||||
verify.completionListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1");
|
||||
verify.completionListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1");
|
||||
verify.completionListContains("i1_l1", "(property) i1.i1_l1: () => void", "");
|
||||
verify.completionListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", "");
|
||||
verify.completionListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", "");
|
||||
verify.completionListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", "");
|
||||
verify.completionListContains("p1", "(property) i1.p1: number", "");
|
||||
verify.completionListContains("f1", "(method) i1.f1(): void", "");
|
||||
verify.completionListContains("l1", "(property) i1.l1: () => void", "");
|
||||
verify.completionListContains("nc_p1", "(property) i1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_f1", "(method) i1.nc_f1(): void", "");
|
||||
verify.completionListContains("nc_l1", "(property) i1.nc_l1: () => void", "");
|
||||
goTo.marker('2');
|
||||
verify.currentSignatureHelpDocCommentIs("i1_f1");
|
||||
goTo.marker('3');
|
||||
@@ -263,18 +263,18 @@ verify.quickInfos({
|
||||
});
|
||||
|
||||
goTo.marker('6');
|
||||
verify.memberListContains("i1_p1", "(property) c1.i1_p1: number", "");
|
||||
verify.memberListContains("i1_f1", "(method) c1.i1_f1(): void", "");
|
||||
verify.memberListContains("i1_l1", "(property) c1.i1_l1: () => void", "");
|
||||
verify.memberListContains("i1_nc_p1", "(property) c1.i1_nc_p1: number", "");
|
||||
verify.memberListContains("i1_nc_f1", "(method) c1.i1_nc_f1(): void", "");
|
||||
verify.memberListContains("i1_nc_l1", "(property) c1.i1_nc_l1: () => void", "");
|
||||
verify.memberListContains("p1", "(property) c1.p1: number", "c1_p1");
|
||||
verify.memberListContains("f1", "(method) c1.f1(): void", "c1_f1");
|
||||
verify.memberListContains("l1", "(property) c1.l1: () => void", "");
|
||||
verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "c1_nc_p1");
|
||||
verify.memberListContains("nc_f1", "(method) c1.nc_f1(): void", "c1_nc_f1");
|
||||
verify.memberListContains("nc_l1", "(property) c1.nc_l1: () => void", "");
|
||||
verify.completionListContains("i1_p1", "(property) c1.i1_p1: number", "");
|
||||
verify.completionListContains("i1_f1", "(method) c1.i1_f1(): void", "");
|
||||
verify.completionListContains("i1_l1", "(property) c1.i1_l1: () => void", "");
|
||||
verify.completionListContains("i1_nc_p1", "(property) c1.i1_nc_p1: number", "");
|
||||
verify.completionListContains("i1_nc_f1", "(method) c1.i1_nc_f1(): void", "");
|
||||
verify.completionListContains("i1_nc_l1", "(property) c1.i1_nc_l1: () => void", "");
|
||||
verify.completionListContains("p1", "(property) c1.p1: number", "c1_p1");
|
||||
verify.completionListContains("f1", "(method) c1.f1(): void", "c1_f1");
|
||||
verify.completionListContains("l1", "(property) c1.l1: () => void", "");
|
||||
verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "c1_nc_p1");
|
||||
verify.completionListContains("nc_f1", "(method) c1.nc_f1(): void", "c1_nc_f1");
|
||||
verify.completionListContains("nc_l1", "(property) c1.nc_l1: () => void", "");
|
||||
goTo.marker('7');
|
||||
verify.currentSignatureHelpDocCommentIs("");
|
||||
goTo.marker('8');
|
||||
@@ -305,18 +305,18 @@ verify.quickInfos({
|
||||
});
|
||||
|
||||
goTo.marker('11');
|
||||
verify.memberListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1");
|
||||
verify.memberListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1");
|
||||
verify.memberListContains("i1_l1", "(property) i1.i1_l1: () => void", "");
|
||||
verify.memberListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", "");
|
||||
verify.memberListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", "");
|
||||
verify.memberListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", "");
|
||||
verify.memberListContains("p1", "(property) i1.p1: number", "");
|
||||
verify.memberListContains("f1", "(method) i1.f1(): void", "");
|
||||
verify.memberListContains("l1", "(property) i1.l1: () => void", "");
|
||||
verify.memberListContains("nc_p1", "(property) i1.nc_p1: number", "");
|
||||
verify.memberListContains("nc_f1", "(method) i1.nc_f1(): void", "");
|
||||
verify.memberListContains("nc_l1", "(property) i1.nc_l1: () => void", "");
|
||||
verify.completionListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1");
|
||||
verify.completionListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1");
|
||||
verify.completionListContains("i1_l1", "(property) i1.i1_l1: () => void", "");
|
||||
verify.completionListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", "");
|
||||
verify.completionListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", "");
|
||||
verify.completionListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", "");
|
||||
verify.completionListContains("p1", "(property) i1.p1: number", "");
|
||||
verify.completionListContains("f1", "(method) i1.f1(): void", "");
|
||||
verify.completionListContains("l1", "(property) i1.l1: () => void", "");
|
||||
verify.completionListContains("nc_p1", "(property) i1.nc_p1: number", "");
|
||||
verify.completionListContains("nc_f1", "(method) i1.nc_f1(): void", "");
|
||||
verify.completionListContains("nc_l1", "(property) i1.nc_l1: () => void", "");
|
||||
goTo.marker('12');
|
||||
verify.currentSignatureHelpDocCommentIs("i1_f1");
|
||||
goTo.marker('13');
|
||||
@@ -376,18 +376,18 @@ verify.quickInfos({
|
||||
});
|
||||
|
||||
goTo.marker('19');
|
||||
verify.memberListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1");
|
||||
verify.memberListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1");
|
||||
verify.memberListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop");
|
||||
verify.memberListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", "");
|
||||
verify.memberListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", "");
|
||||
verify.memberListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", "");
|
||||
verify.memberListContains("p1", "(property) c2.p1: number", "c2 p1");
|
||||
verify.memberListContains("f1", "(method) c2.f1(): void", "c2 f1");
|
||||
verify.memberListContains("prop", "(property) c2.prop: number", "c2 prop");
|
||||
verify.memberListContains("nc_p1", "(property) c2.nc_p1: number", "");
|
||||
verify.memberListContains("nc_f1", "(method) c2.nc_f1(): void", "");
|
||||
verify.memberListContains("nc_prop", "(property) c2.nc_prop: number", "");
|
||||
verify.completionListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1");
|
||||
verify.completionListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1");
|
||||
verify.completionListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop");
|
||||
verify.completionListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", "");
|
||||
verify.completionListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", "");
|
||||
verify.completionListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", "");
|
||||
verify.completionListContains("p1", "(property) c2.p1: number", "c2 p1");
|
||||
verify.completionListContains("f1", "(method) c2.f1(): void", "c2 f1");
|
||||
verify.completionListContains("prop", "(property) c2.prop: number", "c2 prop");
|
||||
verify.completionListContains("nc_p1", "(property) c2.nc_p1: number", "");
|
||||
verify.completionListContains("nc_f1", "(method) c2.nc_f1(): void", "");
|
||||
verify.completionListContains("nc_prop", "(property) c2.nc_prop: number", "");
|
||||
goTo.marker('20');
|
||||
verify.currentSignatureHelpDocCommentIs("c2 c2_f1");
|
||||
goTo.marker('21');
|
||||
@@ -405,18 +405,18 @@ verify.quickInfos({
|
||||
});
|
||||
|
||||
goTo.marker('24');
|
||||
verify.memberListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1");
|
||||
verify.memberListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1");
|
||||
verify.memberListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop");
|
||||
verify.memberListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", "");
|
||||
verify.memberListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", "");
|
||||
verify.memberListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", "");
|
||||
verify.memberListContains("p1", "(property) c3.p1: number", "c3 p1");
|
||||
verify.memberListContains("f1", "(method) c3.f1(): void", "c3 f1");
|
||||
verify.memberListContains("prop", "(property) c3.prop: number", "c3 prop");
|
||||
verify.memberListContains("nc_p1", "(property) c3.nc_p1: number", "");
|
||||
verify.memberListContains("nc_f1", "(method) c3.nc_f1(): void", "");
|
||||
verify.memberListContains("nc_prop", "(property) c3.nc_prop: number", "");
|
||||
verify.completionListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1");
|
||||
verify.completionListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1");
|
||||
verify.completionListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop");
|
||||
verify.completionListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", "");
|
||||
verify.completionListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", "");
|
||||
verify.completionListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", "");
|
||||
verify.completionListContains("p1", "(property) c3.p1: number", "c3 p1");
|
||||
verify.completionListContains("f1", "(method) c3.f1(): void", "c3 f1");
|
||||
verify.completionListContains("prop", "(property) c3.prop: number", "c3 prop");
|
||||
verify.completionListContains("nc_p1", "(property) c3.nc_p1: number", "");
|
||||
verify.completionListContains("nc_f1", "(method) c3.nc_f1(): void", "");
|
||||
verify.completionListContains("nc_prop", "(property) c3.nc_prop: number", "");
|
||||
goTo.marker('25');
|
||||
verify.currentSignatureHelpDocCommentIs("c2 c2_f1");
|
||||
goTo.marker('26');
|
||||
@@ -434,18 +434,18 @@ verify.quickInfos({
|
||||
});
|
||||
|
||||
goTo.marker('29');
|
||||
verify.memberListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1");
|
||||
verify.memberListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1");
|
||||
verify.memberListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop");
|
||||
verify.memberListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", "");
|
||||
verify.memberListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", "");
|
||||
verify.memberListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number");
|
||||
verify.memberListContains("p1", "(property) c2.p1: number", "c2 p1");
|
||||
verify.memberListContains("f1", "(method) c2.f1(): void", "c2 f1");
|
||||
verify.memberListContains("prop", "(property) c2.prop: number", "c2 prop");
|
||||
verify.memberListContains("nc_p1", "(property) c2.nc_p1: number", "");
|
||||
verify.memberListContains("nc_f1", "(method) c2.nc_f1(): void", "");
|
||||
verify.memberListContains("nc_prop", "(property) c2.nc_prop: number", "");
|
||||
verify.completionListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1");
|
||||
verify.completionListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1");
|
||||
verify.completionListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop");
|
||||
verify.completionListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", "");
|
||||
verify.completionListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", "");
|
||||
verify.completionListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number");
|
||||
verify.completionListContains("p1", "(property) c2.p1: number", "c2 p1");
|
||||
verify.completionListContains("f1", "(method) c2.f1(): void", "c2 f1");
|
||||
verify.completionListContains("prop", "(property) c2.prop: number", "c2 prop");
|
||||
verify.completionListContains("nc_p1", "(property) c2.nc_p1: number", "");
|
||||
verify.completionListContains("nc_f1", "(method) c2.nc_f1(): void", "");
|
||||
verify.completionListContains("nc_prop", "(property) c2.nc_prop: number", "");
|
||||
goTo.marker('30');
|
||||
verify.currentSignatureHelpDocCommentIs("c2 c2_f1");
|
||||
goTo.marker('31');
|
||||
@@ -478,18 +478,18 @@ verify.completionListContains("c4", "class c4", "");
|
||||
verify.completionListContains("c4_i", "var c4_i: c4", "");
|
||||
|
||||
goTo.marker('36');
|
||||
verify.memberListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1");
|
||||
verify.memberListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1");
|
||||
verify.memberListContains("i2_l1", "(property) i2.i2_l1: () => void", "");
|
||||
verify.memberListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", "");
|
||||
verify.memberListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", "");
|
||||
verify.memberListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", "");
|
||||
verify.memberListContains("p1", "(property) i2.p1: number", "i2 p1");
|
||||
verify.memberListContains("f1", "(method) i2.f1(): void", "i2 f1");
|
||||
verify.memberListContains("l1", "(property) i2.l1: () => void", "");
|
||||
verify.memberListContains("nc_p1", "(property) i2.nc_p1: number", "");
|
||||
verify.memberListContains("nc_f1", "(method) i2.nc_f1(): void", "");
|
||||
verify.memberListContains("nc_l1", "(property) i2.nc_l1: () => void", "");
|
||||
verify.completionListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1");
|
||||
verify.completionListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1");
|
||||
verify.completionListContains("i2_l1", "(property) i2.i2_l1: () => void", "");
|
||||
verify.completionListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", "");
|
||||
verify.completionListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", "");
|
||||
verify.completionListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", "");
|
||||
verify.completionListContains("p1", "(property) i2.p1: number", "i2 p1");
|
||||
verify.completionListContains("f1", "(method) i2.f1(): void", "i2 f1");
|
||||
verify.completionListContains("l1", "(property) i2.l1: () => void", "");
|
||||
verify.completionListContains("nc_p1", "(property) i2.nc_p1: number", "");
|
||||
verify.completionListContains("nc_f1", "(method) i2.nc_f1(): void", "");
|
||||
verify.completionListContains("nc_l1", "(property) i2.nc_l1: () => void", "");
|
||||
goTo.marker('37');
|
||||
verify.currentSignatureHelpDocCommentIs("i2_f1");
|
||||
goTo.marker('38');
|
||||
@@ -521,18 +521,18 @@ verify.quickInfos({
|
||||
});
|
||||
|
||||
goTo.marker('41');
|
||||
verify.memberListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1");
|
||||
verify.memberListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1");
|
||||
verify.memberListContains("i2_l1", "(property) i2.i2_l1: () => void", "");
|
||||
verify.memberListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", "");
|
||||
verify.memberListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", "");
|
||||
verify.memberListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", "");
|
||||
verify.memberListContains("p1", "(property) i3.p1: number", "i3 p1");
|
||||
verify.memberListContains("f1", "(method) i3.f1(): void", "i3 f1");
|
||||
verify.memberListContains("l1", "(property) i3.l1: () => void", "");
|
||||
verify.memberListContains("nc_p1", "(property) i3.nc_p1: number", "");
|
||||
verify.memberListContains("nc_f1", "(method) i3.nc_f1(): void", "");
|
||||
verify.memberListContains("nc_l1", "(property) i3.nc_l1: () => void", "");
|
||||
verify.completionListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1");
|
||||
verify.completionListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1");
|
||||
verify.completionListContains("i2_l1", "(property) i2.i2_l1: () => void", "");
|
||||
verify.completionListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", "");
|
||||
verify.completionListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", "");
|
||||
verify.completionListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", "");
|
||||
verify.completionListContains("p1", "(property) i3.p1: number", "i3 p1");
|
||||
verify.completionListContains("f1", "(method) i3.f1(): void", "i3 f1");
|
||||
verify.completionListContains("l1", "(property) i3.l1: () => void", "");
|
||||
verify.completionListContains("nc_p1", "(property) i3.nc_p1: number", "");
|
||||
verify.completionListContains("nc_f1", "(method) i3.nc_f1(): void", "");
|
||||
verify.completionListContains("nc_l1", "(property) i3.nc_l1: () => void", "");
|
||||
goTo.marker('42');
|
||||
verify.currentSignatureHelpDocCommentIs("i2_f1");
|
||||
goTo.marker('43');
|
||||
@@ -562,18 +562,18 @@ verify.quickInfos({
|
||||
});
|
||||
|
||||
goTo.marker('46');
|
||||
verify.memberListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1");
|
||||
verify.memberListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1");
|
||||
verify.memberListContains("i2_l1", "(property) i2.i2_l1: () => void", "");
|
||||
verify.memberListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", "");
|
||||
verify.memberListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", "");
|
||||
verify.memberListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", "");
|
||||
verify.memberListContains("p1", "(property) i2.p1: number", "i2 p1");
|
||||
verify.memberListContains("f1", "(method) i2.f1(): void", "i2 f1");
|
||||
verify.memberListContains("l1", "(property) i2.l1: () => void", "");
|
||||
verify.memberListContains("nc_p1", "(property) i2.nc_p1: number", "");
|
||||
verify.memberListContains("nc_f1", "(method) i2.nc_f1(): void", "");
|
||||
verify.memberListContains("nc_l1", "(property) i2.nc_l1: () => void", "");
|
||||
verify.completionListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1");
|
||||
verify.completionListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1");
|
||||
verify.completionListContains("i2_l1", "(property) i2.i2_l1: () => void", "");
|
||||
verify.completionListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", "");
|
||||
verify.completionListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", "");
|
||||
verify.completionListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", "");
|
||||
verify.completionListContains("p1", "(property) i2.p1: number", "i2 p1");
|
||||
verify.completionListContains("f1", "(method) i2.f1(): void", "i2 f1");
|
||||
verify.completionListContains("l1", "(property) i2.l1: () => void", "");
|
||||
verify.completionListContains("nc_p1", "(property) i2.nc_p1: number", "");
|
||||
verify.completionListContains("nc_f1", "(method) i2.nc_f1(): void", "");
|
||||
verify.completionListContains("nc_l1", "(property) i2.nc_l1: () => void", "");
|
||||
goTo.marker('47');
|
||||
verify.currentSignatureHelpDocCommentIs("i2_f1");
|
||||
goTo.marker('48');
|
||||
|
||||
Loaded 100 of 269 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user