mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'release-2.0' into release-2.0.5
This commit is contained in:
commit
7fd5699511
161 files changed
+14227
-827
No files matched your search
Vendored
-2
@@ -32,7 +32,6 @@ interface MapConstructor {
|
||||
declare var Map: MapConstructor;
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
@@ -64,7 +63,6 @@ declare var Set: SetConstructor;
|
||||
|
||||
interface WeakSet<T> {
|
||||
add(value: T): this;
|
||||
clear(): void;
|
||||
delete(value: T): boolean;
|
||||
has(value: T): boolean;
|
||||
}
|
||||
|
||||
Vendored
-2
@@ -4672,7 +4672,6 @@ interface MapConstructor {
|
||||
declare var Map: MapConstructor;
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
@@ -4704,7 +4703,6 @@ declare var Set: SetConstructor;
|
||||
|
||||
interface WeakSet<T> {
|
||||
add(value: T): this;
|
||||
clear(): void;
|
||||
delete(value: T): boolean;
|
||||
has(value: T): boolean;
|
||||
}
|
||||
|
||||
+77
-31
@@ -4271,10 +4271,13 @@ var ts;
|
||||
(node.name.kind === 9 || isGlobalScopeAugmentation(node));
|
||||
}
|
||||
ts.isAmbientModule = isAmbientModule;
|
||||
function isShorthandAmbientModuleSymbol(moduleSymbol) {
|
||||
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
|
||||
}
|
||||
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
|
||||
function isShorthandAmbientModule(node) {
|
||||
return node.kind === 225 && (!node.body);
|
||||
}
|
||||
ts.isShorthandAmbientModule = isShorthandAmbientModule;
|
||||
function isBlockScopedContainerTopLevel(node) {
|
||||
return node.kind === 256 ||
|
||||
node.kind === 225 ||
|
||||
@@ -13316,6 +13319,7 @@ var ts;
|
||||
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false);
|
||||
var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false);
|
||||
var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false);
|
||||
var enumNumberIndexInfo = createIndexInfo(stringType, true);
|
||||
var globals = ts.createMap();
|
||||
var patternAmbientModules;
|
||||
@@ -13410,6 +13414,7 @@ var ts;
|
||||
var assignableRelation = ts.createMap();
|
||||
var comparableRelation = ts.createMap();
|
||||
var identityRelation = ts.createMap();
|
||||
var enumRelation = ts.createMap();
|
||||
var _displayBuilder;
|
||||
var builtinGlobals = ts.createMap();
|
||||
builtinGlobals[undefinedSymbol.name] = undefinedSymbol;
|
||||
@@ -13843,7 +13848,7 @@ var ts;
|
||||
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
||||
}
|
||||
}
|
||||
if (result && isInExternalModule) {
|
||||
if (result && isInExternalModule && (meaning & 107455) === 107455) {
|
||||
var decls = result.declarations;
|
||||
if (decls && decls.length === 1 && decls[0].kind === 228) {
|
||||
error(errorLocation, ts.Diagnostics.Identifier_0_must_be_imported_from_a_module, name);
|
||||
@@ -13943,7 +13948,7 @@ var ts;
|
||||
function getTargetOfImportClause(node) {
|
||||
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
|
||||
if (moduleSymbol) {
|
||||
var exportDefaultSymbol = ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration) ?
|
||||
var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?
|
||||
moduleSymbol :
|
||||
moduleSymbol.exports["export="] ?
|
||||
getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") :
|
||||
@@ -13998,7 +14003,7 @@ var ts;
|
||||
if (targetSymbol) {
|
||||
var name_10 = specifier.propertyName || specifier.name;
|
||||
if (name_10.text) {
|
||||
if (ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration)) {
|
||||
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
||||
return moduleSymbol;
|
||||
}
|
||||
var symbolFromVariable = void 0;
|
||||
@@ -14787,8 +14792,13 @@ var ts;
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064, 0, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512) && type.flags & (2097152 | 1572864) && type.aliasSymbol) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
if (type.flags & 2097152 || !(flags & 1024)) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
}
|
||||
}
|
||||
else if (type.flags & 1572864) {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
@@ -15483,7 +15493,9 @@ var ts;
|
||||
if (strictNullChecks && declaration.initializer && !(getFalsyFlags(checkExpressionCached(declaration.initializer)) & 2048)) {
|
||||
type = getTypeWithFacts(type, 131072);
|
||||
}
|
||||
return type;
|
||||
return declaration.initializer ?
|
||||
getUnionType([type, checkExpressionCached(declaration.initializer)], true) :
|
||||
type;
|
||||
}
|
||||
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
|
||||
var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration);
|
||||
@@ -15771,7 +15783,7 @@ var ts;
|
||||
function getTypeOfFuncClassEnumModule(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModule(symbol.valueDeclaration)) {
|
||||
if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModuleSymbol(symbol)) {
|
||||
links.type = anyType;
|
||||
}
|
||||
else {
|
||||
@@ -18123,8 +18135,14 @@ var ts;
|
||||
if (source === target) {
|
||||
return true;
|
||||
}
|
||||
if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256) || !(target.symbol.flags & 256)) {
|
||||
return false;
|
||||
var id = source.id + "," + target.id;
|
||||
if (enumRelation[id] !== undefined) {
|
||||
return enumRelation[id];
|
||||
}
|
||||
if (source.symbol.name !== target.symbol.name ||
|
||||
!(source.symbol.flags & 256) || !(target.symbol.flags & 256) ||
|
||||
(source.flags & 524288) !== (target.flags & 524288)) {
|
||||
return enumRelation[id] = false;
|
||||
}
|
||||
var targetEnumType = getTypeOfSymbol(target.symbol);
|
||||
for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) {
|
||||
@@ -18135,11 +18153,11 @@ var ts;
|
||||
if (errorReporter) {
|
||||
errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128));
|
||||
}
|
||||
return false;
|
||||
return enumRelation[id] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return enumRelation[id] = true;
|
||||
}
|
||||
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
||||
if (target.flags & 8192)
|
||||
@@ -18163,10 +18181,19 @@ var ts;
|
||||
if (relation === assignableRelation || relation === comparableRelation) {
|
||||
if (source.flags & 1)
|
||||
return true;
|
||||
if (source.flags & (4 | 64) && target.flags & 16)
|
||||
if ((source.flags & 4 | source.flags & 64) && target.flags & 272)
|
||||
return true;
|
||||
if (source.flags & 64 && target.flags & 256 && source.text === target.text)
|
||||
if (source.flags & 256 &&
|
||||
target.flags & 256 &&
|
||||
source.text === target.text &&
|
||||
isEnumTypeRelatedTo(source.baseType, target.baseType, errorReporter)) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 256 &&
|
||||
target.flags & 16 &&
|
||||
isEnumTypeRelatedTo(target, source.baseType, errorReporter)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -20051,6 +20078,9 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
function narrowTypeByEquality(type, operator, value, assumeTrue) {
|
||||
if (type.flags & 1) {
|
||||
return type;
|
||||
}
|
||||
if (operator === 31 || operator === 33) {
|
||||
assumeTrue = !assumeTrue;
|
||||
}
|
||||
@@ -20164,7 +20194,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
var targetType = type.flags & 16384 ? getApparentType(type) : type;
|
||||
return isTypeSubtypeOf(candidate, targetType) ? candidate :
|
||||
return isTypeSubtypeOf(candidate, type) ? candidate :
|
||||
isTypeAssignableTo(type, candidate) ? type :
|
||||
isTypeAssignableTo(candidate, targetType) ? candidate :
|
||||
getIntersectionType([type, candidate]);
|
||||
@@ -20336,13 +20366,14 @@ var ts;
|
||||
var isParameter = ts.getRootDeclaration(declaration).kind === 142;
|
||||
var declarationContainer = getControlFlowContainer(declaration);
|
||||
var flowContainer = getControlFlowContainer(node);
|
||||
var isOuterVariable = flowContainer !== declarationContainer;
|
||||
while (flowContainer !== declarationContainer &&
|
||||
(flowContainer.kind === 179 || flowContainer.kind === 180) &&
|
||||
(isReadonlySymbol(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
|
||||
flowContainer = getControlFlowContainer(flowContainer);
|
||||
}
|
||||
var assumeInitialized = !strictNullChecks || (type.flags & 1) !== 0 || isParameter ||
|
||||
flowContainer !== declarationContainer || ts.isInAmbientContext(declaration);
|
||||
isOuterVariable || ts.isInAmbientContext(declaration);
|
||||
var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
|
||||
if (!assumeInitialized && !(getFalsyFlags(type) & 2048) && getFalsyFlags(flowType) & 2048) {
|
||||
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
||||
@@ -22572,16 +22603,16 @@ var ts;
|
||||
function getResolvedSignature(node, candidatesOutArray) {
|
||||
var links = getNodeLinks(node);
|
||||
var cached = links.resolvedSignature;
|
||||
if (cached && cached !== anySignature && !candidatesOutArray) {
|
||||
if (cached && cached !== resolvingSignature && !candidatesOutArray) {
|
||||
return cached;
|
||||
}
|
||||
links.resolvedSignature = anySignature;
|
||||
links.resolvedSignature = resolvingSignature;
|
||||
var result = resolveSignature(node, candidatesOutArray);
|
||||
links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;
|
||||
return result;
|
||||
}
|
||||
function getResolvedOrAnySignature(node) {
|
||||
return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node);
|
||||
return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node);
|
||||
}
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
@@ -23533,7 +23564,7 @@ var ts;
|
||||
return maybeTypeOfKind(contextualType, (64 | 256));
|
||||
}
|
||||
if (type.flags & 8) {
|
||||
return maybeTypeOfKind(contextualType, 128) && !isTypeAssignableTo(booleanType, contextualType);
|
||||
return maybeTypeOfKind(contextualType, 128);
|
||||
}
|
||||
if (type.flags & 16) {
|
||||
return typeContainsLiteralFromEnum(contextualType, type);
|
||||
@@ -27119,7 +27150,7 @@ var ts;
|
||||
}
|
||||
function moduleExportsSomeValue(moduleReferenceExpression) {
|
||||
var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
|
||||
if (!moduleSymbol) {
|
||||
if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
||||
return true;
|
||||
}
|
||||
var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);
|
||||
@@ -29013,7 +29044,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = declaration.name;
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 | 1024, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -29025,7 +29056,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = signature.name;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 | 1024, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -29218,7 +29249,7 @@ var ts;
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2, writer);
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 | 1024, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
@@ -29623,7 +29654,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2, writer);
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer);
|
||||
}
|
||||
function getHeritageClauseVisibilityError(symbolAccessibilityResult) {
|
||||
var diagnosticMessage;
|
||||
@@ -36533,9 +36564,8 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.version = "2.0.2";
|
||||
ts.version = "2.0.3";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
while (true) {
|
||||
var fileName = ts.combinePaths(searchPath, "tsconfig.json");
|
||||
@@ -36668,11 +36698,27 @@ var ts;
|
||||
else if (host.getCurrentDirectory) {
|
||||
currentDirectory = host.getCurrentDirectory();
|
||||
}
|
||||
if (!currentDirectory) {
|
||||
return undefined;
|
||||
}
|
||||
return ts.map(defaultTypeRoots, function (d) { return ts.combinePaths(currentDirectory, d); });
|
||||
return currentDirectory && getDefaultTypeRoots(currentDirectory, host);
|
||||
}
|
||||
function getDefaultTypeRoots(currentDirectory, host) {
|
||||
if (!host.directoryExists) {
|
||||
return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];
|
||||
}
|
||||
var typeRoots;
|
||||
while (true) {
|
||||
var atTypes = ts.combinePaths(currentDirectory, nodeModulesAtTypes);
|
||||
if (host.directoryExists(atTypes)) {
|
||||
(typeRoots || (typeRoots = [])).push(atTypes);
|
||||
}
|
||||
var parent_15 = ts.getDirectoryPath(currentDirectory);
|
||||
if (parent_15 === currentDirectory) {
|
||||
break;
|
||||
}
|
||||
currentDirectory = parent_15;
|
||||
}
|
||||
return typeRoots;
|
||||
}
|
||||
var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types");
|
||||
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) {
|
||||
var traceEnabled = isTraceEnabled(options, host);
|
||||
var moduleResolutionState = {
|
||||
|
||||
+118
-72
@@ -5267,10 +5267,13 @@ var ts;
|
||||
(node.name.kind === 9 || isGlobalScopeAugmentation(node));
|
||||
}
|
||||
ts.isAmbientModule = isAmbientModule;
|
||||
function isShorthandAmbientModuleSymbol(moduleSymbol) {
|
||||
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
|
||||
}
|
||||
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
|
||||
function isShorthandAmbientModule(node) {
|
||||
return node.kind === 225 && (!node.body);
|
||||
}
|
||||
ts.isShorthandAmbientModule = isShorthandAmbientModule;
|
||||
function isBlockScopedContainerTopLevel(node) {
|
||||
return node.kind === 256 ||
|
||||
node.kind === 225 ||
|
||||
@@ -14312,6 +14315,7 @@ var ts;
|
||||
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false);
|
||||
var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false);
|
||||
var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false);
|
||||
var enumNumberIndexInfo = createIndexInfo(stringType, true);
|
||||
var globals = ts.createMap();
|
||||
var patternAmbientModules;
|
||||
@@ -14406,6 +14410,7 @@ var ts;
|
||||
var assignableRelation = ts.createMap();
|
||||
var comparableRelation = ts.createMap();
|
||||
var identityRelation = ts.createMap();
|
||||
var enumRelation = ts.createMap();
|
||||
var _displayBuilder;
|
||||
var builtinGlobals = ts.createMap();
|
||||
builtinGlobals[undefinedSymbol.name] = undefinedSymbol;
|
||||
@@ -14839,7 +14844,7 @@ var ts;
|
||||
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
||||
}
|
||||
}
|
||||
if (result && isInExternalModule) {
|
||||
if (result && isInExternalModule && (meaning & 107455) === 107455) {
|
||||
var decls = result.declarations;
|
||||
if (decls && decls.length === 1 && decls[0].kind === 228) {
|
||||
error(errorLocation, ts.Diagnostics.Identifier_0_must_be_imported_from_a_module, name);
|
||||
@@ -14939,7 +14944,7 @@ var ts;
|
||||
function getTargetOfImportClause(node) {
|
||||
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
|
||||
if (moduleSymbol) {
|
||||
var exportDefaultSymbol = ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration) ?
|
||||
var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?
|
||||
moduleSymbol :
|
||||
moduleSymbol.exports["export="] ?
|
||||
getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") :
|
||||
@@ -14994,7 +14999,7 @@ var ts;
|
||||
if (targetSymbol) {
|
||||
var name_12 = specifier.propertyName || specifier.name;
|
||||
if (name_12.text) {
|
||||
if (ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration)) {
|
||||
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
||||
return moduleSymbol;
|
||||
}
|
||||
var symbolFromVariable = void 0;
|
||||
@@ -15783,8 +15788,13 @@ var ts;
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064, 0, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512) && type.flags & (2097152 | 1572864) && type.aliasSymbol) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
if (type.flags & 2097152 || !(flags & 1024)) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
}
|
||||
}
|
||||
else if (type.flags & 1572864) {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
@@ -16479,7 +16489,9 @@ var ts;
|
||||
if (strictNullChecks && declaration.initializer && !(getFalsyFlags(checkExpressionCached(declaration.initializer)) & 2048)) {
|
||||
type = getTypeWithFacts(type, 131072);
|
||||
}
|
||||
return type;
|
||||
return declaration.initializer ?
|
||||
getUnionType([type, checkExpressionCached(declaration.initializer)], true) :
|
||||
type;
|
||||
}
|
||||
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
|
||||
var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration);
|
||||
@@ -16767,7 +16779,7 @@ var ts;
|
||||
function getTypeOfFuncClassEnumModule(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModule(symbol.valueDeclaration)) {
|
||||
if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModuleSymbol(symbol)) {
|
||||
links.type = anyType;
|
||||
}
|
||||
else {
|
||||
@@ -19119,8 +19131,14 @@ var ts;
|
||||
if (source === target) {
|
||||
return true;
|
||||
}
|
||||
if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256) || !(target.symbol.flags & 256)) {
|
||||
return false;
|
||||
var id = source.id + "," + target.id;
|
||||
if (enumRelation[id] !== undefined) {
|
||||
return enumRelation[id];
|
||||
}
|
||||
if (source.symbol.name !== target.symbol.name ||
|
||||
!(source.symbol.flags & 256) || !(target.symbol.flags & 256) ||
|
||||
(source.flags & 524288) !== (target.flags & 524288)) {
|
||||
return enumRelation[id] = false;
|
||||
}
|
||||
var targetEnumType = getTypeOfSymbol(target.symbol);
|
||||
for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) {
|
||||
@@ -19131,11 +19149,11 @@ var ts;
|
||||
if (errorReporter) {
|
||||
errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128));
|
||||
}
|
||||
return false;
|
||||
return enumRelation[id] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return enumRelation[id] = true;
|
||||
}
|
||||
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
||||
if (target.flags & 8192)
|
||||
@@ -19159,10 +19177,19 @@ var ts;
|
||||
if (relation === assignableRelation || relation === comparableRelation) {
|
||||
if (source.flags & 1)
|
||||
return true;
|
||||
if (source.flags & (4 | 64) && target.flags & 16)
|
||||
if ((source.flags & 4 | source.flags & 64) && target.flags & 272)
|
||||
return true;
|
||||
if (source.flags & 64 && target.flags & 256 && source.text === target.text)
|
||||
if (source.flags & 256 &&
|
||||
target.flags & 256 &&
|
||||
source.text === target.text &&
|
||||
isEnumTypeRelatedTo(source.baseType, target.baseType, errorReporter)) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 256 &&
|
||||
target.flags & 16 &&
|
||||
isEnumTypeRelatedTo(target, source.baseType, errorReporter)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -21047,6 +21074,9 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
function narrowTypeByEquality(type, operator, value, assumeTrue) {
|
||||
if (type.flags & 1) {
|
||||
return type;
|
||||
}
|
||||
if (operator === 31 || operator === 33) {
|
||||
assumeTrue = !assumeTrue;
|
||||
}
|
||||
@@ -21160,7 +21190,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
var targetType = type.flags & 16384 ? getApparentType(type) : type;
|
||||
return isTypeSubtypeOf(candidate, targetType) ? candidate :
|
||||
return isTypeSubtypeOf(candidate, type) ? candidate :
|
||||
isTypeAssignableTo(type, candidate) ? type :
|
||||
isTypeAssignableTo(candidate, targetType) ? candidate :
|
||||
getIntersectionType([type, candidate]);
|
||||
@@ -21332,13 +21362,14 @@ var ts;
|
||||
var isParameter = ts.getRootDeclaration(declaration).kind === 142;
|
||||
var declarationContainer = getControlFlowContainer(declaration);
|
||||
var flowContainer = getControlFlowContainer(node);
|
||||
var isOuterVariable = flowContainer !== declarationContainer;
|
||||
while (flowContainer !== declarationContainer &&
|
||||
(flowContainer.kind === 179 || flowContainer.kind === 180) &&
|
||||
(isReadonlySymbol(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
|
||||
flowContainer = getControlFlowContainer(flowContainer);
|
||||
}
|
||||
var assumeInitialized = !strictNullChecks || (type.flags & 1) !== 0 || isParameter ||
|
||||
flowContainer !== declarationContainer || ts.isInAmbientContext(declaration);
|
||||
isOuterVariable || ts.isInAmbientContext(declaration);
|
||||
var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
|
||||
if (!assumeInitialized && !(getFalsyFlags(type) & 2048) && getFalsyFlags(flowType) & 2048) {
|
||||
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
||||
@@ -23568,16 +23599,16 @@ var ts;
|
||||
function getResolvedSignature(node, candidatesOutArray) {
|
||||
var links = getNodeLinks(node);
|
||||
var cached = links.resolvedSignature;
|
||||
if (cached && cached !== anySignature && !candidatesOutArray) {
|
||||
if (cached && cached !== resolvingSignature && !candidatesOutArray) {
|
||||
return cached;
|
||||
}
|
||||
links.resolvedSignature = anySignature;
|
||||
links.resolvedSignature = resolvingSignature;
|
||||
var result = resolveSignature(node, candidatesOutArray);
|
||||
links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;
|
||||
return result;
|
||||
}
|
||||
function getResolvedOrAnySignature(node) {
|
||||
return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node);
|
||||
return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node);
|
||||
}
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
@@ -24529,7 +24560,7 @@ var ts;
|
||||
return maybeTypeOfKind(contextualType, (64 | 256));
|
||||
}
|
||||
if (type.flags & 8) {
|
||||
return maybeTypeOfKind(contextualType, 128) && !isTypeAssignableTo(booleanType, contextualType);
|
||||
return maybeTypeOfKind(contextualType, 128);
|
||||
}
|
||||
if (type.flags & 16) {
|
||||
return typeContainsLiteralFromEnum(contextualType, type);
|
||||
@@ -28115,7 +28146,7 @@ var ts;
|
||||
}
|
||||
function moduleExportsSomeValue(moduleReferenceExpression) {
|
||||
var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
|
||||
if (!moduleSymbol) {
|
||||
if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
||||
return true;
|
||||
}
|
||||
var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);
|
||||
@@ -30009,7 +30040,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = declaration.name;
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 | 1024, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -30021,7 +30052,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = signature.name;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 | 1024, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -30214,7 +30245,7 @@ var ts;
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2, writer);
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 | 1024, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
@@ -30619,7 +30650,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2, writer);
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer);
|
||||
}
|
||||
function getHeritageClauseVisibilityError(symbolAccessibilityResult) {
|
||||
var diagnosticMessage;
|
||||
@@ -37529,9 +37560,8 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.version = "2.0.2";
|
||||
ts.version = "2.0.3";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
while (true) {
|
||||
var fileName = ts.combinePaths(searchPath, "tsconfig.json");
|
||||
@@ -37664,11 +37694,27 @@ var ts;
|
||||
else if (host.getCurrentDirectory) {
|
||||
currentDirectory = host.getCurrentDirectory();
|
||||
}
|
||||
if (!currentDirectory) {
|
||||
return undefined;
|
||||
}
|
||||
return ts.map(defaultTypeRoots, function (d) { return ts.combinePaths(currentDirectory, d); });
|
||||
return currentDirectory && getDefaultTypeRoots(currentDirectory, host);
|
||||
}
|
||||
function getDefaultTypeRoots(currentDirectory, host) {
|
||||
if (!host.directoryExists) {
|
||||
return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];
|
||||
}
|
||||
var typeRoots;
|
||||
while (true) {
|
||||
var atTypes = ts.combinePaths(currentDirectory, nodeModulesAtTypes);
|
||||
if (host.directoryExists(atTypes)) {
|
||||
(typeRoots || (typeRoots = [])).push(atTypes);
|
||||
}
|
||||
var parent_15 = ts.getDirectoryPath(currentDirectory);
|
||||
if (parent_15 === currentDirectory) {
|
||||
break;
|
||||
}
|
||||
currentDirectory = parent_15;
|
||||
}
|
||||
return typeRoots;
|
||||
}
|
||||
var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types");
|
||||
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) {
|
||||
var traceEnabled = isTraceEnabled(options, host);
|
||||
var moduleResolutionState = {
|
||||
@@ -39877,24 +39923,24 @@ var ts;
|
||||
switch (n.kind) {
|
||||
case 199:
|
||||
if (!ts.isFunctionBlock(n)) {
|
||||
var parent_15 = n.parent;
|
||||
var parent_16 = n.parent;
|
||||
var openBrace = ts.findChildOfKind(n, 15, sourceFile);
|
||||
var closeBrace = ts.findChildOfKind(n, 16, sourceFile);
|
||||
if (parent_15.kind === 204 ||
|
||||
parent_15.kind === 207 ||
|
||||
parent_15.kind === 208 ||
|
||||
parent_15.kind === 206 ||
|
||||
parent_15.kind === 203 ||
|
||||
parent_15.kind === 205 ||
|
||||
parent_15.kind === 212 ||
|
||||
parent_15.kind === 252) {
|
||||
addOutliningSpan(parent_15, openBrace, closeBrace, autoCollapse(n));
|
||||
if (parent_16.kind === 204 ||
|
||||
parent_16.kind === 207 ||
|
||||
parent_16.kind === 208 ||
|
||||
parent_16.kind === 206 ||
|
||||
parent_16.kind === 203 ||
|
||||
parent_16.kind === 205 ||
|
||||
parent_16.kind === 212 ||
|
||||
parent_16.kind === 252) {
|
||||
addOutliningSpan(parent_16, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
if (parent_15.kind === 216) {
|
||||
var tryStatement = parent_15;
|
||||
if (parent_16.kind === 216) {
|
||||
var tryStatement = parent_16;
|
||||
if (tryStatement.tryBlock === n) {
|
||||
addOutliningSpan(parent_15, openBrace, closeBrace, autoCollapse(n));
|
||||
addOutliningSpan(parent_16, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
else if (tryStatement.finallyBlock === n) {
|
||||
@@ -45512,8 +45558,8 @@ var ts;
|
||||
if (declaration.kind !== 218 && declaration.kind !== 220) {
|
||||
return false;
|
||||
}
|
||||
for (var parent_16 = declaration.parent; !ts.isFunctionBlock(parent_16); parent_16 = parent_16.parent) {
|
||||
if (parent_16.kind === 256 || parent_16.kind === 226) {
|
||||
for (var parent_17 = declaration.parent; !ts.isFunctionBlock(parent_17); parent_17 = parent_17.parent) {
|
||||
if (parent_17.kind === 256 || parent_17.kind === 226) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -46642,13 +46688,13 @@ var ts;
|
||||
log("Returning an empty list because completion was requested in an invalid position.");
|
||||
return undefined;
|
||||
}
|
||||
var parent_17 = contextToken.parent, kind = contextToken.kind;
|
||||
var parent_18 = contextToken.parent, kind = contextToken.kind;
|
||||
if (kind === 21) {
|
||||
if (parent_17.kind === 172) {
|
||||
if (parent_18.kind === 172) {
|
||||
node = contextToken.parent.expression;
|
||||
isRightOfDot = true;
|
||||
}
|
||||
else if (parent_17.kind === 139) {
|
||||
else if (parent_18.kind === 139) {
|
||||
node = contextToken.parent.left;
|
||||
isRightOfDot = true;
|
||||
}
|
||||
@@ -46936,9 +46982,9 @@ var ts;
|
||||
switch (contextToken.kind) {
|
||||
case 15:
|
||||
case 24:
|
||||
var parent_18 = contextToken.parent;
|
||||
if (parent_18 && (parent_18.kind === 171 || parent_18.kind === 167)) {
|
||||
return parent_18;
|
||||
var parent_19 = contextToken.parent;
|
||||
if (parent_19 && (parent_19.kind === 171 || parent_19.kind === 167)) {
|
||||
return parent_19;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -46961,34 +47007,34 @@ var ts;
|
||||
}
|
||||
function tryGetContainingJsxElement(contextToken) {
|
||||
if (contextToken) {
|
||||
var parent_19 = contextToken.parent;
|
||||
var parent_20 = contextToken.parent;
|
||||
switch (contextToken.kind) {
|
||||
case 26:
|
||||
case 39:
|
||||
case 69:
|
||||
case 246:
|
||||
case 247:
|
||||
if (parent_19 && (parent_19.kind === 242 || parent_19.kind === 243)) {
|
||||
return parent_19;
|
||||
if (parent_20 && (parent_20.kind === 242 || parent_20.kind === 243)) {
|
||||
return parent_20;
|
||||
}
|
||||
else if (parent_19.kind === 246) {
|
||||
return parent_19.parent;
|
||||
else if (parent_20.kind === 246) {
|
||||
return parent_20.parent;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (parent_19 && ((parent_19.kind === 246) || (parent_19.kind === 247))) {
|
||||
return parent_19.parent;
|
||||
if (parent_20 && ((parent_20.kind === 246) || (parent_20.kind === 247))) {
|
||||
return parent_20.parent;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
if (parent_19 &&
|
||||
parent_19.kind === 248 &&
|
||||
parent_19.parent &&
|
||||
(parent_19.parent.kind === 246)) {
|
||||
return parent_19.parent.parent;
|
||||
if (parent_20 &&
|
||||
parent_20.kind === 248 &&
|
||||
parent_20.parent &&
|
||||
(parent_20.parent.kind === 246)) {
|
||||
return parent_20.parent.parent;
|
||||
}
|
||||
if (parent_19 && parent_19.kind === 247) {
|
||||
return parent_19.parent;
|
||||
if (parent_20 && parent_20.kind === 247) {
|
||||
return parent_20.parent;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -48228,17 +48274,17 @@ var ts;
|
||||
function getThrowStatementOwner(throwStatement) {
|
||||
var child = throwStatement;
|
||||
while (child.parent) {
|
||||
var parent_20 = child.parent;
|
||||
if (ts.isFunctionBlock(parent_20) || parent_20.kind === 256) {
|
||||
return parent_20;
|
||||
var parent_21 = child.parent;
|
||||
if (ts.isFunctionBlock(parent_21) || parent_21.kind === 256) {
|
||||
return parent_21;
|
||||
}
|
||||
if (parent_20.kind === 216) {
|
||||
var tryStatement = parent_20;
|
||||
if (parent_21.kind === 216) {
|
||||
var tryStatement = parent_21;
|
||||
if (tryStatement.tryBlock === child && tryStatement.catchClause) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
child = parent_20;
|
||||
child = parent_21;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -1319,6 +1319,7 @@ declare namespace ts {
|
||||
UseFullyQualifiedType = 128,
|
||||
InFirstTypeArgument = 256,
|
||||
InTypeAlias = 512,
|
||||
UseTypeAliasValue = 1024,
|
||||
}
|
||||
const enum SymbolFormatFlags {
|
||||
None = 0,
|
||||
@@ -7043,7 +7044,7 @@ declare namespace ts {
|
||||
function makeIdentifierFromModuleName(moduleName: string): string;
|
||||
function isBlockOrCatchScoped(declaration: Declaration): boolean;
|
||||
function isAmbientModule(node: Node): boolean;
|
||||
function isShorthandAmbientModule(node: Node): boolean;
|
||||
function isShorthandAmbientModuleSymbol(moduleSymbol: Symbol): boolean;
|
||||
function isBlockScopedContainerTopLevel(node: Node): boolean;
|
||||
function isGlobalScopeAugmentation(module: ModuleDeclaration): boolean;
|
||||
function isExternalModuleAugmentation(node: Node): boolean;
|
||||
|
||||
+118
-72
@@ -5267,10 +5267,13 @@ var ts;
|
||||
(node.name.kind === 9 || isGlobalScopeAugmentation(node));
|
||||
}
|
||||
ts.isAmbientModule = isAmbientModule;
|
||||
function isShorthandAmbientModuleSymbol(moduleSymbol) {
|
||||
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
|
||||
}
|
||||
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
|
||||
function isShorthandAmbientModule(node) {
|
||||
return node.kind === 225 && (!node.body);
|
||||
}
|
||||
ts.isShorthandAmbientModule = isShorthandAmbientModule;
|
||||
function isBlockScopedContainerTopLevel(node) {
|
||||
return node.kind === 256 ||
|
||||
node.kind === 225 ||
|
||||
@@ -14312,6 +14315,7 @@ var ts;
|
||||
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false);
|
||||
var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false);
|
||||
var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false);
|
||||
var enumNumberIndexInfo = createIndexInfo(stringType, true);
|
||||
var globals = ts.createMap();
|
||||
var patternAmbientModules;
|
||||
@@ -14406,6 +14410,7 @@ var ts;
|
||||
var assignableRelation = ts.createMap();
|
||||
var comparableRelation = ts.createMap();
|
||||
var identityRelation = ts.createMap();
|
||||
var enumRelation = ts.createMap();
|
||||
var _displayBuilder;
|
||||
var builtinGlobals = ts.createMap();
|
||||
builtinGlobals[undefinedSymbol.name] = undefinedSymbol;
|
||||
@@ -14839,7 +14844,7 @@ var ts;
|
||||
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
||||
}
|
||||
}
|
||||
if (result && isInExternalModule) {
|
||||
if (result && isInExternalModule && (meaning & 107455) === 107455) {
|
||||
var decls = result.declarations;
|
||||
if (decls && decls.length === 1 && decls[0].kind === 228) {
|
||||
error(errorLocation, ts.Diagnostics.Identifier_0_must_be_imported_from_a_module, name);
|
||||
@@ -14939,7 +14944,7 @@ var ts;
|
||||
function getTargetOfImportClause(node) {
|
||||
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
|
||||
if (moduleSymbol) {
|
||||
var exportDefaultSymbol = ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration) ?
|
||||
var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?
|
||||
moduleSymbol :
|
||||
moduleSymbol.exports["export="] ?
|
||||
getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") :
|
||||
@@ -14994,7 +14999,7 @@ var ts;
|
||||
if (targetSymbol) {
|
||||
var name_12 = specifier.propertyName || specifier.name;
|
||||
if (name_12.text) {
|
||||
if (ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration)) {
|
||||
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
||||
return moduleSymbol;
|
||||
}
|
||||
var symbolFromVariable = void 0;
|
||||
@@ -15783,8 +15788,13 @@ var ts;
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064, 0, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512) && type.flags & (2097152 | 1572864) && type.aliasSymbol) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
if (type.flags & 2097152 || !(flags & 1024)) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
}
|
||||
}
|
||||
else if (type.flags & 1572864) {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
@@ -16479,7 +16489,9 @@ var ts;
|
||||
if (strictNullChecks && declaration.initializer && !(getFalsyFlags(checkExpressionCached(declaration.initializer)) & 2048)) {
|
||||
type = getTypeWithFacts(type, 131072);
|
||||
}
|
||||
return type;
|
||||
return declaration.initializer ?
|
||||
getUnionType([type, checkExpressionCached(declaration.initializer)], true) :
|
||||
type;
|
||||
}
|
||||
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
|
||||
var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration);
|
||||
@@ -16767,7 +16779,7 @@ var ts;
|
||||
function getTypeOfFuncClassEnumModule(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModule(symbol.valueDeclaration)) {
|
||||
if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModuleSymbol(symbol)) {
|
||||
links.type = anyType;
|
||||
}
|
||||
else {
|
||||
@@ -19119,8 +19131,14 @@ var ts;
|
||||
if (source === target) {
|
||||
return true;
|
||||
}
|
||||
if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256) || !(target.symbol.flags & 256)) {
|
||||
return false;
|
||||
var id = source.id + "," + target.id;
|
||||
if (enumRelation[id] !== undefined) {
|
||||
return enumRelation[id];
|
||||
}
|
||||
if (source.symbol.name !== target.symbol.name ||
|
||||
!(source.symbol.flags & 256) || !(target.symbol.flags & 256) ||
|
||||
(source.flags & 524288) !== (target.flags & 524288)) {
|
||||
return enumRelation[id] = false;
|
||||
}
|
||||
var targetEnumType = getTypeOfSymbol(target.symbol);
|
||||
for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) {
|
||||
@@ -19131,11 +19149,11 @@ var ts;
|
||||
if (errorReporter) {
|
||||
errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128));
|
||||
}
|
||||
return false;
|
||||
return enumRelation[id] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return enumRelation[id] = true;
|
||||
}
|
||||
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
||||
if (target.flags & 8192)
|
||||
@@ -19159,10 +19177,19 @@ var ts;
|
||||
if (relation === assignableRelation || relation === comparableRelation) {
|
||||
if (source.flags & 1)
|
||||
return true;
|
||||
if (source.flags & (4 | 64) && target.flags & 16)
|
||||
if ((source.flags & 4 | source.flags & 64) && target.flags & 272)
|
||||
return true;
|
||||
if (source.flags & 64 && target.flags & 256 && source.text === target.text)
|
||||
if (source.flags & 256 &&
|
||||
target.flags & 256 &&
|
||||
source.text === target.text &&
|
||||
isEnumTypeRelatedTo(source.baseType, target.baseType, errorReporter)) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 256 &&
|
||||
target.flags & 16 &&
|
||||
isEnumTypeRelatedTo(target, source.baseType, errorReporter)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -21047,6 +21074,9 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
function narrowTypeByEquality(type, operator, value, assumeTrue) {
|
||||
if (type.flags & 1) {
|
||||
return type;
|
||||
}
|
||||
if (operator === 31 || operator === 33) {
|
||||
assumeTrue = !assumeTrue;
|
||||
}
|
||||
@@ -21160,7 +21190,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
var targetType = type.flags & 16384 ? getApparentType(type) : type;
|
||||
return isTypeSubtypeOf(candidate, targetType) ? candidate :
|
||||
return isTypeSubtypeOf(candidate, type) ? candidate :
|
||||
isTypeAssignableTo(type, candidate) ? type :
|
||||
isTypeAssignableTo(candidate, targetType) ? candidate :
|
||||
getIntersectionType([type, candidate]);
|
||||
@@ -21332,13 +21362,14 @@ var ts;
|
||||
var isParameter = ts.getRootDeclaration(declaration).kind === 142;
|
||||
var declarationContainer = getControlFlowContainer(declaration);
|
||||
var flowContainer = getControlFlowContainer(node);
|
||||
var isOuterVariable = flowContainer !== declarationContainer;
|
||||
while (flowContainer !== declarationContainer &&
|
||||
(flowContainer.kind === 179 || flowContainer.kind === 180) &&
|
||||
(isReadonlySymbol(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
|
||||
flowContainer = getControlFlowContainer(flowContainer);
|
||||
}
|
||||
var assumeInitialized = !strictNullChecks || (type.flags & 1) !== 0 || isParameter ||
|
||||
flowContainer !== declarationContainer || ts.isInAmbientContext(declaration);
|
||||
isOuterVariable || ts.isInAmbientContext(declaration);
|
||||
var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
|
||||
if (!assumeInitialized && !(getFalsyFlags(type) & 2048) && getFalsyFlags(flowType) & 2048) {
|
||||
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
||||
@@ -23568,16 +23599,16 @@ var ts;
|
||||
function getResolvedSignature(node, candidatesOutArray) {
|
||||
var links = getNodeLinks(node);
|
||||
var cached = links.resolvedSignature;
|
||||
if (cached && cached !== anySignature && !candidatesOutArray) {
|
||||
if (cached && cached !== resolvingSignature && !candidatesOutArray) {
|
||||
return cached;
|
||||
}
|
||||
links.resolvedSignature = anySignature;
|
||||
links.resolvedSignature = resolvingSignature;
|
||||
var result = resolveSignature(node, candidatesOutArray);
|
||||
links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;
|
||||
return result;
|
||||
}
|
||||
function getResolvedOrAnySignature(node) {
|
||||
return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node);
|
||||
return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node);
|
||||
}
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
@@ -24529,7 +24560,7 @@ var ts;
|
||||
return maybeTypeOfKind(contextualType, (64 | 256));
|
||||
}
|
||||
if (type.flags & 8) {
|
||||
return maybeTypeOfKind(contextualType, 128) && !isTypeAssignableTo(booleanType, contextualType);
|
||||
return maybeTypeOfKind(contextualType, 128);
|
||||
}
|
||||
if (type.flags & 16) {
|
||||
return typeContainsLiteralFromEnum(contextualType, type);
|
||||
@@ -28115,7 +28146,7 @@ var ts;
|
||||
}
|
||||
function moduleExportsSomeValue(moduleReferenceExpression) {
|
||||
var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
|
||||
if (!moduleSymbol) {
|
||||
if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
||||
return true;
|
||||
}
|
||||
var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);
|
||||
@@ -30009,7 +30040,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = declaration.name;
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 | 1024, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -30021,7 +30052,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = signature.name;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 | 1024, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -30214,7 +30245,7 @@ var ts;
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2, writer);
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 | 1024, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
@@ -30619,7 +30650,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2, writer);
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 | 1024, writer);
|
||||
}
|
||||
function getHeritageClauseVisibilityError(symbolAccessibilityResult) {
|
||||
var diagnosticMessage;
|
||||
@@ -37529,9 +37560,8 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.version = "2.0.2";
|
||||
ts.version = "2.0.3";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
while (true) {
|
||||
var fileName = ts.combinePaths(searchPath, "tsconfig.json");
|
||||
@@ -37664,11 +37694,27 @@ var ts;
|
||||
else if (host.getCurrentDirectory) {
|
||||
currentDirectory = host.getCurrentDirectory();
|
||||
}
|
||||
if (!currentDirectory) {
|
||||
return undefined;
|
||||
}
|
||||
return ts.map(defaultTypeRoots, function (d) { return ts.combinePaths(currentDirectory, d); });
|
||||
return currentDirectory && getDefaultTypeRoots(currentDirectory, host);
|
||||
}
|
||||
function getDefaultTypeRoots(currentDirectory, host) {
|
||||
if (!host.directoryExists) {
|
||||
return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];
|
||||
}
|
||||
var typeRoots;
|
||||
while (true) {
|
||||
var atTypes = ts.combinePaths(currentDirectory, nodeModulesAtTypes);
|
||||
if (host.directoryExists(atTypes)) {
|
||||
(typeRoots || (typeRoots = [])).push(atTypes);
|
||||
}
|
||||
var parent_15 = ts.getDirectoryPath(currentDirectory);
|
||||
if (parent_15 === currentDirectory) {
|
||||
break;
|
||||
}
|
||||
currentDirectory = parent_15;
|
||||
}
|
||||
return typeRoots;
|
||||
}
|
||||
var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types");
|
||||
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) {
|
||||
var traceEnabled = isTraceEnabled(options, host);
|
||||
var moduleResolutionState = {
|
||||
@@ -39877,24 +39923,24 @@ var ts;
|
||||
switch (n.kind) {
|
||||
case 199:
|
||||
if (!ts.isFunctionBlock(n)) {
|
||||
var parent_15 = n.parent;
|
||||
var parent_16 = n.parent;
|
||||
var openBrace = ts.findChildOfKind(n, 15, sourceFile);
|
||||
var closeBrace = ts.findChildOfKind(n, 16, sourceFile);
|
||||
if (parent_15.kind === 204 ||
|
||||
parent_15.kind === 207 ||
|
||||
parent_15.kind === 208 ||
|
||||
parent_15.kind === 206 ||
|
||||
parent_15.kind === 203 ||
|
||||
parent_15.kind === 205 ||
|
||||
parent_15.kind === 212 ||
|
||||
parent_15.kind === 252) {
|
||||
addOutliningSpan(parent_15, openBrace, closeBrace, autoCollapse(n));
|
||||
if (parent_16.kind === 204 ||
|
||||
parent_16.kind === 207 ||
|
||||
parent_16.kind === 208 ||
|
||||
parent_16.kind === 206 ||
|
||||
parent_16.kind === 203 ||
|
||||
parent_16.kind === 205 ||
|
||||
parent_16.kind === 212 ||
|
||||
parent_16.kind === 252) {
|
||||
addOutliningSpan(parent_16, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
if (parent_15.kind === 216) {
|
||||
var tryStatement = parent_15;
|
||||
if (parent_16.kind === 216) {
|
||||
var tryStatement = parent_16;
|
||||
if (tryStatement.tryBlock === n) {
|
||||
addOutliningSpan(parent_15, openBrace, closeBrace, autoCollapse(n));
|
||||
addOutliningSpan(parent_16, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
else if (tryStatement.finallyBlock === n) {
|
||||
@@ -45512,8 +45558,8 @@ var ts;
|
||||
if (declaration.kind !== 218 && declaration.kind !== 220) {
|
||||
return false;
|
||||
}
|
||||
for (var parent_16 = declaration.parent; !ts.isFunctionBlock(parent_16); parent_16 = parent_16.parent) {
|
||||
if (parent_16.kind === 256 || parent_16.kind === 226) {
|
||||
for (var parent_17 = declaration.parent; !ts.isFunctionBlock(parent_17); parent_17 = parent_17.parent) {
|
||||
if (parent_17.kind === 256 || parent_17.kind === 226) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -46642,13 +46688,13 @@ var ts;
|
||||
log("Returning an empty list because completion was requested in an invalid position.");
|
||||
return undefined;
|
||||
}
|
||||
var parent_17 = contextToken.parent, kind = contextToken.kind;
|
||||
var parent_18 = contextToken.parent, kind = contextToken.kind;
|
||||
if (kind === 21) {
|
||||
if (parent_17.kind === 172) {
|
||||
if (parent_18.kind === 172) {
|
||||
node = contextToken.parent.expression;
|
||||
isRightOfDot = true;
|
||||
}
|
||||
else if (parent_17.kind === 139) {
|
||||
else if (parent_18.kind === 139) {
|
||||
node = contextToken.parent.left;
|
||||
isRightOfDot = true;
|
||||
}
|
||||
@@ -46936,9 +46982,9 @@ var ts;
|
||||
switch (contextToken.kind) {
|
||||
case 15:
|
||||
case 24:
|
||||
var parent_18 = contextToken.parent;
|
||||
if (parent_18 && (parent_18.kind === 171 || parent_18.kind === 167)) {
|
||||
return parent_18;
|
||||
var parent_19 = contextToken.parent;
|
||||
if (parent_19 && (parent_19.kind === 171 || parent_19.kind === 167)) {
|
||||
return parent_19;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -46961,34 +47007,34 @@ var ts;
|
||||
}
|
||||
function tryGetContainingJsxElement(contextToken) {
|
||||
if (contextToken) {
|
||||
var parent_19 = contextToken.parent;
|
||||
var parent_20 = contextToken.parent;
|
||||
switch (contextToken.kind) {
|
||||
case 26:
|
||||
case 39:
|
||||
case 69:
|
||||
case 246:
|
||||
case 247:
|
||||
if (parent_19 && (parent_19.kind === 242 || parent_19.kind === 243)) {
|
||||
return parent_19;
|
||||
if (parent_20 && (parent_20.kind === 242 || parent_20.kind === 243)) {
|
||||
return parent_20;
|
||||
}
|
||||
else if (parent_19.kind === 246) {
|
||||
return parent_19.parent;
|
||||
else if (parent_20.kind === 246) {
|
||||
return parent_20.parent;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (parent_19 && ((parent_19.kind === 246) || (parent_19.kind === 247))) {
|
||||
return parent_19.parent;
|
||||
if (parent_20 && ((parent_20.kind === 246) || (parent_20.kind === 247))) {
|
||||
return parent_20.parent;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
if (parent_19 &&
|
||||
parent_19.kind === 248 &&
|
||||
parent_19.parent &&
|
||||
(parent_19.parent.kind === 246)) {
|
||||
return parent_19.parent.parent;
|
||||
if (parent_20 &&
|
||||
parent_20.kind === 248 &&
|
||||
parent_20.parent &&
|
||||
(parent_20.parent.kind === 246)) {
|
||||
return parent_20.parent.parent;
|
||||
}
|
||||
if (parent_19 && parent_19.kind === 247) {
|
||||
return parent_19.parent;
|
||||
if (parent_20 && parent_20.kind === 247) {
|
||||
return parent_20.parent;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -48228,17 +48274,17 @@ var ts;
|
||||
function getThrowStatementOwner(throwStatement) {
|
||||
var child = throwStatement;
|
||||
while (child.parent) {
|
||||
var parent_20 = child.parent;
|
||||
if (ts.isFunctionBlock(parent_20) || parent_20.kind === 256) {
|
||||
return parent_20;
|
||||
var parent_21 = child.parent;
|
||||
if (ts.isFunctionBlock(parent_21) || parent_21.kind === 256) {
|
||||
return parent_21;
|
||||
}
|
||||
if (parent_20.kind === 216) {
|
||||
var tryStatement = parent_20;
|
||||
if (parent_21.kind === 216) {
|
||||
var tryStatement = parent_21;
|
||||
if (tryStatement.tryBlock === child && tryStatement.catchClause) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
child = parent_20;
|
||||
child = parent_21;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -1328,6 +1328,7 @@ declare namespace ts {
|
||||
UseFullyQualifiedType = 128,
|
||||
InFirstTypeArgument = 256,
|
||||
InTypeAlias = 512,
|
||||
UseTypeAliasValue = 1024,
|
||||
}
|
||||
enum SymbolFormatFlags {
|
||||
None = 0,
|
||||
|
||||
+125
-74
@@ -480,6 +480,7 @@ var ts;
|
||||
TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 128] = "UseFullyQualifiedType";
|
||||
TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument";
|
||||
TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias";
|
||||
TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue";
|
||||
})(ts.TypeFormatFlags || (ts.TypeFormatFlags = {}));
|
||||
var TypeFormatFlags = ts.TypeFormatFlags;
|
||||
(function (SymbolFormatFlags) {
|
||||
@@ -5636,11 +5637,14 @@ var ts;
|
||||
(node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node));
|
||||
}
|
||||
ts.isAmbientModule = isAmbientModule;
|
||||
function isShorthandAmbientModuleSymbol(moduleSymbol) {
|
||||
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
|
||||
}
|
||||
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
|
||||
function isShorthandAmbientModule(node) {
|
||||
// The only kind of module that can be missing a body is a shorthand ambient module.
|
||||
return node.kind === 225 /* ModuleDeclaration */ && (!node.body);
|
||||
}
|
||||
ts.isShorthandAmbientModule = isShorthandAmbientModule;
|
||||
function isBlockScopedContainerTopLevel(node) {
|
||||
return node.kind === 256 /* SourceFile */ ||
|
||||
node.kind === 225 /* ModuleDeclaration */ ||
|
||||
@@ -16621,6 +16625,7 @@ var ts;
|
||||
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true);
|
||||
var globals = ts.createMap();
|
||||
/**
|
||||
@@ -16787,6 +16792,7 @@ var ts;
|
||||
var assignableRelation = ts.createMap();
|
||||
var comparableRelation = ts.createMap();
|
||||
var identityRelation = ts.createMap();
|
||||
var enumRelation = ts.createMap();
|
||||
// This is for caching the result of getSymbolDisplayBuilder. Do not access directly.
|
||||
var _displayBuilder;
|
||||
var TypeSystemPropertyName;
|
||||
@@ -17331,8 +17337,8 @@ var ts;
|
||||
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
||||
}
|
||||
}
|
||||
// If we're in an external module, we can't reference symbols created from UMD export declarations
|
||||
if (result && isInExternalModule) {
|
||||
// If we're in an external module, we can't reference value symbols created from UMD export declarations
|
||||
if (result && isInExternalModule && (meaning & 107455 /* Value */) === 107455 /* Value */) {
|
||||
var decls = result.declarations;
|
||||
if (decls && decls.length === 1 && decls[0].kind === 228 /* NamespaceExportDeclaration */) {
|
||||
error(errorLocation, ts.Diagnostics.Identifier_0_must_be_imported_from_a_module, name);
|
||||
@@ -17444,7 +17450,7 @@ var ts;
|
||||
function getTargetOfImportClause(node) {
|
||||
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
|
||||
if (moduleSymbol) {
|
||||
var exportDefaultSymbol = ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration) ?
|
||||
var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?
|
||||
moduleSymbol :
|
||||
moduleSymbol.exports["export="] ?
|
||||
getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") :
|
||||
@@ -17517,7 +17523,7 @@ var ts;
|
||||
if (targetSymbol) {
|
||||
var name_10 = specifier.propertyName || specifier.name;
|
||||
if (name_10.text) {
|
||||
if (ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration)) {
|
||||
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
||||
return moduleSymbol;
|
||||
}
|
||||
var symbolFromVariable = void 0;
|
||||
@@ -18427,8 +18433,13 @@ var ts;
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512 /* InTypeAlias */) && type.flags & (2097152 /* Anonymous */ | 1572864 /* UnionOrIntersection */) && type.aliasSymbol) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
if (type.flags & 2097152 /* Anonymous */ || !(flags & 1024 /* UseTypeAliasValue */)) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
}
|
||||
}
|
||||
else if (type.flags & 1572864 /* UnionOrIntersection */) {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
@@ -19194,7 +19205,9 @@ var ts;
|
||||
if (strictNullChecks && declaration.initializer && !(getFalsyFlags(checkExpressionCached(declaration.initializer)) & 2048 /* Undefined */)) {
|
||||
type = getTypeWithFacts(type, 131072 /* NEUndefined */);
|
||||
}
|
||||
return type;
|
||||
return declaration.initializer ?
|
||||
getUnionType([type, checkExpressionCached(declaration.initializer)], /*subtypeReduction*/ true) :
|
||||
type;
|
||||
}
|
||||
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
|
||||
var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration);
|
||||
@@ -19546,7 +19559,7 @@ var ts;
|
||||
function getTypeOfFuncClassEnumModule(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
if (symbol.valueDeclaration.kind === 225 /* ModuleDeclaration */ && ts.isShorthandAmbientModule(symbol.valueDeclaration)) {
|
||||
if (symbol.valueDeclaration.kind === 225 /* ModuleDeclaration */ && ts.isShorthandAmbientModuleSymbol(symbol)) {
|
||||
links.type = anyType;
|
||||
}
|
||||
else {
|
||||
@@ -22129,8 +22142,14 @@ var ts;
|
||||
if (source === target) {
|
||||
return true;
|
||||
}
|
||||
if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256 /* RegularEnum */) || !(target.symbol.flags & 256 /* RegularEnum */)) {
|
||||
return false;
|
||||
var id = source.id + "," + target.id;
|
||||
if (enumRelation[id] !== undefined) {
|
||||
return enumRelation[id];
|
||||
}
|
||||
if (source.symbol.name !== target.symbol.name ||
|
||||
!(source.symbol.flags & 256 /* RegularEnum */) || !(target.symbol.flags & 256 /* RegularEnum */) ||
|
||||
(source.flags & 524288 /* Union */) !== (target.flags & 524288 /* Union */)) {
|
||||
return enumRelation[id] = false;
|
||||
}
|
||||
var targetEnumType = getTypeOfSymbol(target.symbol);
|
||||
for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) {
|
||||
@@ -22141,11 +22160,11 @@ var ts;
|
||||
if (errorReporter) {
|
||||
errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */));
|
||||
}
|
||||
return false;
|
||||
return enumRelation[id] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return enumRelation[id] = true;
|
||||
}
|
||||
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
||||
if (target.flags & 8192 /* Never */)
|
||||
@@ -22169,10 +22188,19 @@ var ts;
|
||||
if (relation === assignableRelation || relation === comparableRelation) {
|
||||
if (source.flags & 1 /* Any */)
|
||||
return true;
|
||||
if (source.flags & (4 /* Number */ | 64 /* NumberLiteral */) && target.flags & 16 /* Enum */)
|
||||
if ((source.flags & 4 /* Number */ | source.flags & 64 /* NumberLiteral */) && target.flags & 272 /* EnumLike */)
|
||||
return true;
|
||||
if (source.flags & 64 /* NumberLiteral */ && target.flags & 256 /* EnumLiteral */ && source.text === target.text)
|
||||
if (source.flags & 256 /* EnumLiteral */ &&
|
||||
target.flags & 256 /* EnumLiteral */ &&
|
||||
source.text === target.text &&
|
||||
isEnumTypeRelatedTo(source.baseType, target.baseType, errorReporter)) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 256 /* EnumLiteral */ &&
|
||||
target.flags & 16 /* Enum */ &&
|
||||
isEnumTypeRelatedTo(target, source.baseType, errorReporter)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -24318,6 +24346,9 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
function narrowTypeByEquality(type, operator, value, assumeTrue) {
|
||||
if (type.flags & 1 /* Any */) {
|
||||
return type;
|
||||
}
|
||||
if (operator === 31 /* ExclamationEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) {
|
||||
assumeTrue = !assumeTrue;
|
||||
}
|
||||
@@ -24451,7 +24482,7 @@ var ts;
|
||||
// type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
|
||||
// two types.
|
||||
var targetType = type.flags & 16384 /* TypeParameter */ ? getApparentType(type) : type;
|
||||
return isTypeSubtypeOf(candidate, targetType) ? candidate :
|
||||
return isTypeSubtypeOf(candidate, type) ? candidate :
|
||||
isTypeAssignableTo(type, candidate) ? type :
|
||||
isTypeAssignableTo(candidate, targetType) ? candidate :
|
||||
getIntersectionType([type, candidate]);
|
||||
@@ -24650,6 +24681,7 @@ var ts;
|
||||
var isParameter = ts.getRootDeclaration(declaration).kind === 142 /* Parameter */;
|
||||
var declarationContainer = getControlFlowContainer(declaration);
|
||||
var flowContainer = getControlFlowContainer(node);
|
||||
var isOuterVariable = flowContainer !== declarationContainer;
|
||||
// When the control flow originates in a function expression or arrow function and we are referencing
|
||||
// a const variable or parameter from an outer function, we extend the origin of the control flow
|
||||
// analysis to include the immediately enclosing function.
|
||||
@@ -24662,7 +24694,7 @@ var ts;
|
||||
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
|
||||
// declaration container are the same).
|
||||
var assumeInitialized = !strictNullChecks || (type.flags & 1 /* Any */) !== 0 || isParameter ||
|
||||
flowContainer !== declarationContainer || ts.isInAmbientContext(declaration);
|
||||
isOuterVariable || ts.isInAmbientContext(declaration);
|
||||
var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
|
||||
// A variable is considered uninitialized when it is possible to analyze the entire control flow graph
|
||||
// from declaration to use, and when the variable's declared type doesn't include undefined but the
|
||||
@@ -27628,10 +27660,10 @@ var ts;
|
||||
// or that a different candidatesOutArray was passed in. Therefore, we need to redo the work
|
||||
// to correctly fill the candidatesOutArray.
|
||||
var cached = links.resolvedSignature;
|
||||
if (cached && cached !== anySignature && !candidatesOutArray) {
|
||||
if (cached && cached !== resolvingSignature && !candidatesOutArray) {
|
||||
return cached;
|
||||
}
|
||||
links.resolvedSignature = anySignature;
|
||||
links.resolvedSignature = resolvingSignature;
|
||||
var result = resolveSignature(node, candidatesOutArray);
|
||||
// If signature resolution originated in control flow type analysis (for example to compute the
|
||||
// assigned type in a flow assignment) we don't cache the result as it may be based on temporary
|
||||
@@ -27642,7 +27674,7 @@ var ts;
|
||||
function getResolvedOrAnySignature(node) {
|
||||
// If we're already in the process of resolving the given signature, don't resolve again as
|
||||
// that could cause infinite recursion. Instead, return anySignature.
|
||||
return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node);
|
||||
return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node);
|
||||
}
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
@@ -28775,7 +28807,7 @@ var ts;
|
||||
return maybeTypeOfKind(contextualType, (64 /* NumberLiteral */ | 256 /* EnumLiteral */));
|
||||
}
|
||||
if (type.flags & 8 /* Boolean */) {
|
||||
return maybeTypeOfKind(contextualType, 128 /* BooleanLiteral */) && !isTypeAssignableTo(booleanType, contextualType);
|
||||
return maybeTypeOfKind(contextualType, 128 /* BooleanLiteral */);
|
||||
}
|
||||
if (type.flags & 16 /* Enum */) {
|
||||
return typeContainsLiteralFromEnum(contextualType, type);
|
||||
@@ -33078,8 +33110,8 @@ var ts;
|
||||
}
|
||||
function moduleExportsSomeValue(moduleReferenceExpression) {
|
||||
var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
|
||||
if (!moduleSymbol) {
|
||||
// module not found - be conservative
|
||||
if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
||||
// If the module is not found or is shorthand, assume that it may export a value.
|
||||
return true;
|
||||
}
|
||||
var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);
|
||||
@@ -35207,7 +35239,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = declaration.name;
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -35220,7 +35252,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = signature.name;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -35422,7 +35454,7 @@ var ts;
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
@@ -35843,7 +35875,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
}
|
||||
function getHeritageClauseVisibilityError(symbolAccessibilityResult) {
|
||||
var diagnosticMessage;
|
||||
@@ -43940,9 +43972,8 @@ var ts;
|
||||
var ts;
|
||||
(function (ts) {
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = "2.0.2";
|
||||
ts.version = "2.0.3";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
while (true) {
|
||||
var fileName = ts.combinePaths(searchPath, "tsconfig.json");
|
||||
@@ -44086,11 +44117,31 @@ var ts;
|
||||
else if (host.getCurrentDirectory) {
|
||||
currentDirectory = host.getCurrentDirectory();
|
||||
}
|
||||
if (!currentDirectory) {
|
||||
return undefined;
|
||||
}
|
||||
return ts.map(defaultTypeRoots, function (d) { return ts.combinePaths(currentDirectory, d); });
|
||||
return currentDirectory && getDefaultTypeRoots(currentDirectory, host);
|
||||
}
|
||||
/**
|
||||
* Returns the path to every node_modules/@types directory from some ancestor directory.
|
||||
* Returns undefined if there are none.
|
||||
*/
|
||||
function getDefaultTypeRoots(currentDirectory, host) {
|
||||
if (!host.directoryExists) {
|
||||
return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];
|
||||
}
|
||||
var typeRoots;
|
||||
while (true) {
|
||||
var atTypes = ts.combinePaths(currentDirectory, nodeModulesAtTypes);
|
||||
if (host.directoryExists(atTypes)) {
|
||||
(typeRoots || (typeRoots = [])).push(atTypes);
|
||||
}
|
||||
var parent_15 = ts.getDirectoryPath(currentDirectory);
|
||||
if (parent_15 === currentDirectory) {
|
||||
break;
|
||||
}
|
||||
currentDirectory = parent_15;
|
||||
}
|
||||
return typeRoots;
|
||||
}
|
||||
var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types");
|
||||
/**
|
||||
* @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown.
|
||||
* This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups
|
||||
@@ -47263,28 +47314,28 @@ var ts;
|
||||
switch (n.kind) {
|
||||
case 199 /* Block */:
|
||||
if (!ts.isFunctionBlock(n)) {
|
||||
var parent_15 = n.parent;
|
||||
var parent_16 = n.parent;
|
||||
var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile);
|
||||
var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile);
|
||||
// Check if the block is standalone, or 'attached' to some parent statement.
|
||||
// If the latter, we want to collapse the block, but consider its hint span
|
||||
// to be the entire span of the parent.
|
||||
if (parent_15.kind === 204 /* DoStatement */ ||
|
||||
parent_15.kind === 207 /* ForInStatement */ ||
|
||||
parent_15.kind === 208 /* ForOfStatement */ ||
|
||||
parent_15.kind === 206 /* ForStatement */ ||
|
||||
parent_15.kind === 203 /* IfStatement */ ||
|
||||
parent_15.kind === 205 /* WhileStatement */ ||
|
||||
parent_15.kind === 212 /* WithStatement */ ||
|
||||
parent_15.kind === 252 /* CatchClause */) {
|
||||
addOutliningSpan(parent_15, openBrace, closeBrace, autoCollapse(n));
|
||||
if (parent_16.kind === 204 /* DoStatement */ ||
|
||||
parent_16.kind === 207 /* ForInStatement */ ||
|
||||
parent_16.kind === 208 /* ForOfStatement */ ||
|
||||
parent_16.kind === 206 /* ForStatement */ ||
|
||||
parent_16.kind === 203 /* IfStatement */ ||
|
||||
parent_16.kind === 205 /* WhileStatement */ ||
|
||||
parent_16.kind === 212 /* WithStatement */ ||
|
||||
parent_16.kind === 252 /* CatchClause */) {
|
||||
addOutliningSpan(parent_16, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
if (parent_15.kind === 216 /* TryStatement */) {
|
||||
if (parent_16.kind === 216 /* TryStatement */) {
|
||||
// Could be the try-block, or the finally-block.
|
||||
var tryStatement = parent_15;
|
||||
var tryStatement = parent_16;
|
||||
if (tryStatement.tryBlock === n) {
|
||||
addOutliningSpan(parent_15, openBrace, closeBrace, autoCollapse(n));
|
||||
addOutliningSpan(parent_16, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
else if (tryStatement.finallyBlock === n) {
|
||||
@@ -54114,9 +54165,9 @@ var ts;
|
||||
return false;
|
||||
}
|
||||
// If the parent is not sourceFile or module block it is local variable
|
||||
for (var parent_16 = declaration.parent; !ts.isFunctionBlock(parent_16); parent_16 = parent_16.parent) {
|
||||
for (var parent_17 = declaration.parent; !ts.isFunctionBlock(parent_17); parent_17 = parent_17.parent) {
|
||||
// Reached source file or module block
|
||||
if (parent_16.kind === 256 /* SourceFile */ || parent_16.kind === 226 /* ModuleBlock */) {
|
||||
if (parent_17.kind === 256 /* SourceFile */ || parent_17.kind === 226 /* ModuleBlock */) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -55482,13 +55533,13 @@ var ts;
|
||||
log("Returning an empty list because completion was requested in an invalid position.");
|
||||
return undefined;
|
||||
}
|
||||
var parent_17 = contextToken.parent, kind = contextToken.kind;
|
||||
var parent_18 = contextToken.parent, kind = contextToken.kind;
|
||||
if (kind === 21 /* DotToken */) {
|
||||
if (parent_17.kind === 172 /* PropertyAccessExpression */) {
|
||||
if (parent_18.kind === 172 /* PropertyAccessExpression */) {
|
||||
node = contextToken.parent.expression;
|
||||
isRightOfDot = true;
|
||||
}
|
||||
else if (parent_17.kind === 139 /* QualifiedName */) {
|
||||
else if (parent_18.kind === 139 /* QualifiedName */) {
|
||||
node = contextToken.parent.left;
|
||||
isRightOfDot = true;
|
||||
}
|
||||
@@ -55866,9 +55917,9 @@ var ts;
|
||||
switch (contextToken.kind) {
|
||||
case 15 /* OpenBraceToken */: // const x = { |
|
||||
case 24 /* CommaToken */:
|
||||
var parent_18 = contextToken.parent;
|
||||
if (parent_18 && (parent_18.kind === 171 /* ObjectLiteralExpression */ || parent_18.kind === 167 /* ObjectBindingPattern */)) {
|
||||
return parent_18;
|
||||
var parent_19 = contextToken.parent;
|
||||
if (parent_19 && (parent_19.kind === 171 /* ObjectLiteralExpression */ || parent_19.kind === 167 /* ObjectBindingPattern */)) {
|
||||
return parent_19;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -55895,37 +55946,37 @@ var ts;
|
||||
}
|
||||
function tryGetContainingJsxElement(contextToken) {
|
||||
if (contextToken) {
|
||||
var parent_19 = contextToken.parent;
|
||||
var parent_20 = contextToken.parent;
|
||||
switch (contextToken.kind) {
|
||||
case 26 /* LessThanSlashToken */:
|
||||
case 39 /* SlashToken */:
|
||||
case 69 /* Identifier */:
|
||||
case 246 /* JsxAttribute */:
|
||||
case 247 /* JsxSpreadAttribute */:
|
||||
if (parent_19 && (parent_19.kind === 242 /* JsxSelfClosingElement */ || parent_19.kind === 243 /* JsxOpeningElement */)) {
|
||||
return parent_19;
|
||||
if (parent_20 && (parent_20.kind === 242 /* JsxSelfClosingElement */ || parent_20.kind === 243 /* JsxOpeningElement */)) {
|
||||
return parent_20;
|
||||
}
|
||||
else if (parent_19.kind === 246 /* JsxAttribute */) {
|
||||
return parent_19.parent;
|
||||
else if (parent_20.kind === 246 /* JsxAttribute */) {
|
||||
return parent_20.parent;
|
||||
}
|
||||
break;
|
||||
// The context token is the closing } or " of an attribute, which means
|
||||
// its parent is a JsxExpression, whose parent is a JsxAttribute,
|
||||
// whose parent is a JsxOpeningLikeElement
|
||||
case 9 /* StringLiteral */:
|
||||
if (parent_19 && ((parent_19.kind === 246 /* JsxAttribute */) || (parent_19.kind === 247 /* JsxSpreadAttribute */))) {
|
||||
return parent_19.parent;
|
||||
if (parent_20 && ((parent_20.kind === 246 /* JsxAttribute */) || (parent_20.kind === 247 /* JsxSpreadAttribute */))) {
|
||||
return parent_20.parent;
|
||||
}
|
||||
break;
|
||||
case 16 /* CloseBraceToken */:
|
||||
if (parent_19 &&
|
||||
parent_19.kind === 248 /* JsxExpression */ &&
|
||||
parent_19.parent &&
|
||||
(parent_19.parent.kind === 246 /* JsxAttribute */)) {
|
||||
return parent_19.parent.parent;
|
||||
if (parent_20 &&
|
||||
parent_20.kind === 248 /* JsxExpression */ &&
|
||||
parent_20.parent &&
|
||||
(parent_20.parent.kind === 246 /* JsxAttribute */)) {
|
||||
return parent_20.parent.parent;
|
||||
}
|
||||
if (parent_19 && parent_19.kind === 247 /* JsxSpreadAttribute */) {
|
||||
return parent_19.parent;
|
||||
if (parent_20 && parent_20.kind === 247 /* JsxSpreadAttribute */) {
|
||||
return parent_20.parent;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -57319,19 +57370,19 @@ var ts;
|
||||
function getThrowStatementOwner(throwStatement) {
|
||||
var child = throwStatement;
|
||||
while (child.parent) {
|
||||
var parent_20 = child.parent;
|
||||
if (ts.isFunctionBlock(parent_20) || parent_20.kind === 256 /* SourceFile */) {
|
||||
return parent_20;
|
||||
var parent_21 = child.parent;
|
||||
if (ts.isFunctionBlock(parent_21) || parent_21.kind === 256 /* SourceFile */) {
|
||||
return parent_21;
|
||||
}
|
||||
// A throw-statement is only owned by a try-statement if the try-statement has
|
||||
// a catch clause, and if the throw-statement occurs within the try block.
|
||||
if (parent_20.kind === 216 /* TryStatement */) {
|
||||
var tryStatement = parent_20;
|
||||
if (parent_21.kind === 216 /* TryStatement */) {
|
||||
var tryStatement = parent_21;
|
||||
if (tryStatement.tryBlock === child && tryStatement.catchClause) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
child = parent_20;
|
||||
child = parent_21;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -1328,6 +1328,7 @@ declare namespace ts {
|
||||
UseFullyQualifiedType = 128,
|
||||
InFirstTypeArgument = 256,
|
||||
InTypeAlias = 512,
|
||||
UseTypeAliasValue = 1024,
|
||||
}
|
||||
enum SymbolFormatFlags {
|
||||
None = 0,
|
||||
|
||||
+125
-74
@@ -480,6 +480,7 @@ var ts;
|
||||
TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 128] = "UseFullyQualifiedType";
|
||||
TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument";
|
||||
TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias";
|
||||
TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue";
|
||||
})(ts.TypeFormatFlags || (ts.TypeFormatFlags = {}));
|
||||
var TypeFormatFlags = ts.TypeFormatFlags;
|
||||
(function (SymbolFormatFlags) {
|
||||
@@ -5636,11 +5637,14 @@ var ts;
|
||||
(node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node));
|
||||
}
|
||||
ts.isAmbientModule = isAmbientModule;
|
||||
function isShorthandAmbientModuleSymbol(moduleSymbol) {
|
||||
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
|
||||
}
|
||||
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
|
||||
function isShorthandAmbientModule(node) {
|
||||
// The only kind of module that can be missing a body is a shorthand ambient module.
|
||||
return node.kind === 225 /* ModuleDeclaration */ && (!node.body);
|
||||
}
|
||||
ts.isShorthandAmbientModule = isShorthandAmbientModule;
|
||||
function isBlockScopedContainerTopLevel(node) {
|
||||
return node.kind === 256 /* SourceFile */ ||
|
||||
node.kind === 225 /* ModuleDeclaration */ ||
|
||||
@@ -16621,6 +16625,7 @@ var ts;
|
||||
var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true);
|
||||
var globals = ts.createMap();
|
||||
/**
|
||||
@@ -16787,6 +16792,7 @@ var ts;
|
||||
var assignableRelation = ts.createMap();
|
||||
var comparableRelation = ts.createMap();
|
||||
var identityRelation = ts.createMap();
|
||||
var enumRelation = ts.createMap();
|
||||
// This is for caching the result of getSymbolDisplayBuilder. Do not access directly.
|
||||
var _displayBuilder;
|
||||
var TypeSystemPropertyName;
|
||||
@@ -17331,8 +17337,8 @@ var ts;
|
||||
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
||||
}
|
||||
}
|
||||
// If we're in an external module, we can't reference symbols created from UMD export declarations
|
||||
if (result && isInExternalModule) {
|
||||
// If we're in an external module, we can't reference value symbols created from UMD export declarations
|
||||
if (result && isInExternalModule && (meaning & 107455 /* Value */) === 107455 /* Value */) {
|
||||
var decls = result.declarations;
|
||||
if (decls && decls.length === 1 && decls[0].kind === 228 /* NamespaceExportDeclaration */) {
|
||||
error(errorLocation, ts.Diagnostics.Identifier_0_must_be_imported_from_a_module, name);
|
||||
@@ -17444,7 +17450,7 @@ var ts;
|
||||
function getTargetOfImportClause(node) {
|
||||
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
|
||||
if (moduleSymbol) {
|
||||
var exportDefaultSymbol = ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration) ?
|
||||
var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?
|
||||
moduleSymbol :
|
||||
moduleSymbol.exports["export="] ?
|
||||
getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") :
|
||||
@@ -17517,7 +17523,7 @@ var ts;
|
||||
if (targetSymbol) {
|
||||
var name_10 = specifier.propertyName || specifier.name;
|
||||
if (name_10.text) {
|
||||
if (ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration)) {
|
||||
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
||||
return moduleSymbol;
|
||||
}
|
||||
var symbolFromVariable = void 0;
|
||||
@@ -18427,8 +18433,13 @@ var ts;
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, nextFlags);
|
||||
}
|
||||
else if (!(flags & 512 /* InTypeAlias */) && type.flags & (2097152 /* Anonymous */ | 1572864 /* UnionOrIntersection */) && type.aliasSymbol) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
if (type.flags & 2097152 /* Anonymous */ || !(flags & 1024 /* UseTypeAliasValue */)) {
|
||||
var typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
}
|
||||
}
|
||||
else if (type.flags & 1572864 /* UnionOrIntersection */) {
|
||||
writeUnionOrIntersectionType(type, nextFlags);
|
||||
@@ -19194,7 +19205,9 @@ var ts;
|
||||
if (strictNullChecks && declaration.initializer && !(getFalsyFlags(checkExpressionCached(declaration.initializer)) & 2048 /* Undefined */)) {
|
||||
type = getTypeWithFacts(type, 131072 /* NEUndefined */);
|
||||
}
|
||||
return type;
|
||||
return declaration.initializer ?
|
||||
getUnionType([type, checkExpressionCached(declaration.initializer)], /*subtypeReduction*/ true) :
|
||||
type;
|
||||
}
|
||||
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
|
||||
var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration);
|
||||
@@ -19546,7 +19559,7 @@ var ts;
|
||||
function getTypeOfFuncClassEnumModule(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
if (symbol.valueDeclaration.kind === 225 /* ModuleDeclaration */ && ts.isShorthandAmbientModule(symbol.valueDeclaration)) {
|
||||
if (symbol.valueDeclaration.kind === 225 /* ModuleDeclaration */ && ts.isShorthandAmbientModuleSymbol(symbol)) {
|
||||
links.type = anyType;
|
||||
}
|
||||
else {
|
||||
@@ -22129,8 +22142,14 @@ var ts;
|
||||
if (source === target) {
|
||||
return true;
|
||||
}
|
||||
if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256 /* RegularEnum */) || !(target.symbol.flags & 256 /* RegularEnum */)) {
|
||||
return false;
|
||||
var id = source.id + "," + target.id;
|
||||
if (enumRelation[id] !== undefined) {
|
||||
return enumRelation[id];
|
||||
}
|
||||
if (source.symbol.name !== target.symbol.name ||
|
||||
!(source.symbol.flags & 256 /* RegularEnum */) || !(target.symbol.flags & 256 /* RegularEnum */) ||
|
||||
(source.flags & 524288 /* Union */) !== (target.flags & 524288 /* Union */)) {
|
||||
return enumRelation[id] = false;
|
||||
}
|
||||
var targetEnumType = getTypeOfSymbol(target.symbol);
|
||||
for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(source.symbol)); _i < _a.length; _i++) {
|
||||
@@ -22141,11 +22160,11 @@ var ts;
|
||||
if (errorReporter) {
|
||||
errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */));
|
||||
}
|
||||
return false;
|
||||
return enumRelation[id] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return enumRelation[id] = true;
|
||||
}
|
||||
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
||||
if (target.flags & 8192 /* Never */)
|
||||
@@ -22169,10 +22188,19 @@ var ts;
|
||||
if (relation === assignableRelation || relation === comparableRelation) {
|
||||
if (source.flags & 1 /* Any */)
|
||||
return true;
|
||||
if (source.flags & (4 /* Number */ | 64 /* NumberLiteral */) && target.flags & 16 /* Enum */)
|
||||
if ((source.flags & 4 /* Number */ | source.flags & 64 /* NumberLiteral */) && target.flags & 272 /* EnumLike */)
|
||||
return true;
|
||||
if (source.flags & 64 /* NumberLiteral */ && target.flags & 256 /* EnumLiteral */ && source.text === target.text)
|
||||
if (source.flags & 256 /* EnumLiteral */ &&
|
||||
target.flags & 256 /* EnumLiteral */ &&
|
||||
source.text === target.text &&
|
||||
isEnumTypeRelatedTo(source.baseType, target.baseType, errorReporter)) {
|
||||
return true;
|
||||
}
|
||||
if (source.flags & 256 /* EnumLiteral */ &&
|
||||
target.flags & 16 /* Enum */ &&
|
||||
isEnumTypeRelatedTo(target, source.baseType, errorReporter)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -24318,6 +24346,9 @@ var ts;
|
||||
return type;
|
||||
}
|
||||
function narrowTypeByEquality(type, operator, value, assumeTrue) {
|
||||
if (type.flags & 1 /* Any */) {
|
||||
return type;
|
||||
}
|
||||
if (operator === 31 /* ExclamationEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) {
|
||||
assumeTrue = !assumeTrue;
|
||||
}
|
||||
@@ -24451,7 +24482,7 @@ var ts;
|
||||
// type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
|
||||
// two types.
|
||||
var targetType = type.flags & 16384 /* TypeParameter */ ? getApparentType(type) : type;
|
||||
return isTypeSubtypeOf(candidate, targetType) ? candidate :
|
||||
return isTypeSubtypeOf(candidate, type) ? candidate :
|
||||
isTypeAssignableTo(type, candidate) ? type :
|
||||
isTypeAssignableTo(candidate, targetType) ? candidate :
|
||||
getIntersectionType([type, candidate]);
|
||||
@@ -24650,6 +24681,7 @@ var ts;
|
||||
var isParameter = ts.getRootDeclaration(declaration).kind === 142 /* Parameter */;
|
||||
var declarationContainer = getControlFlowContainer(declaration);
|
||||
var flowContainer = getControlFlowContainer(node);
|
||||
var isOuterVariable = flowContainer !== declarationContainer;
|
||||
// When the control flow originates in a function expression or arrow function and we are referencing
|
||||
// a const variable or parameter from an outer function, we extend the origin of the control flow
|
||||
// analysis to include the immediately enclosing function.
|
||||
@@ -24662,7 +24694,7 @@ var ts;
|
||||
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
|
||||
// declaration container are the same).
|
||||
var assumeInitialized = !strictNullChecks || (type.flags & 1 /* Any */) !== 0 || isParameter ||
|
||||
flowContainer !== declarationContainer || ts.isInAmbientContext(declaration);
|
||||
isOuterVariable || ts.isInAmbientContext(declaration);
|
||||
var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
|
||||
// A variable is considered uninitialized when it is possible to analyze the entire control flow graph
|
||||
// from declaration to use, and when the variable's declared type doesn't include undefined but the
|
||||
@@ -27628,10 +27660,10 @@ var ts;
|
||||
// or that a different candidatesOutArray was passed in. Therefore, we need to redo the work
|
||||
// to correctly fill the candidatesOutArray.
|
||||
var cached = links.resolvedSignature;
|
||||
if (cached && cached !== anySignature && !candidatesOutArray) {
|
||||
if (cached && cached !== resolvingSignature && !candidatesOutArray) {
|
||||
return cached;
|
||||
}
|
||||
links.resolvedSignature = anySignature;
|
||||
links.resolvedSignature = resolvingSignature;
|
||||
var result = resolveSignature(node, candidatesOutArray);
|
||||
// If signature resolution originated in control flow type analysis (for example to compute the
|
||||
// assigned type in a flow assignment) we don't cache the result as it may be based on temporary
|
||||
@@ -27642,7 +27674,7 @@ var ts;
|
||||
function getResolvedOrAnySignature(node) {
|
||||
// If we're already in the process of resolving the given signature, don't resolve again as
|
||||
// that could cause infinite recursion. Instead, return anySignature.
|
||||
return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node);
|
||||
return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node);
|
||||
}
|
||||
function getInferredClassType(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
@@ -28775,7 +28807,7 @@ var ts;
|
||||
return maybeTypeOfKind(contextualType, (64 /* NumberLiteral */ | 256 /* EnumLiteral */));
|
||||
}
|
||||
if (type.flags & 8 /* Boolean */) {
|
||||
return maybeTypeOfKind(contextualType, 128 /* BooleanLiteral */) && !isTypeAssignableTo(booleanType, contextualType);
|
||||
return maybeTypeOfKind(contextualType, 128 /* BooleanLiteral */);
|
||||
}
|
||||
if (type.flags & 16 /* Enum */) {
|
||||
return typeContainsLiteralFromEnum(contextualType, type);
|
||||
@@ -33078,8 +33110,8 @@ var ts;
|
||||
}
|
||||
function moduleExportsSomeValue(moduleReferenceExpression) {
|
||||
var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
|
||||
if (!moduleSymbol) {
|
||||
// module not found - be conservative
|
||||
if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
||||
// If the module is not found or is shorthand, assume that it may export a value.
|
||||
return true;
|
||||
}
|
||||
var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);
|
||||
@@ -35207,7 +35239,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = declaration.name;
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -35220,7 +35252,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
errorNameNode = signature.name;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -35422,7 +35454,7 @@ var ts;
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
@@ -35843,7 +35875,7 @@ var ts;
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer);
|
||||
resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer);
|
||||
}
|
||||
function getHeritageClauseVisibilityError(symbolAccessibilityResult) {
|
||||
var diagnosticMessage;
|
||||
@@ -43940,9 +43972,8 @@ var ts;
|
||||
var ts;
|
||||
(function (ts) {
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = "2.0.2";
|
||||
ts.version = "2.0.3";
|
||||
var emptyArray = [];
|
||||
var defaultTypeRoots = ["node_modules/@types"];
|
||||
function findConfigFile(searchPath, fileExists) {
|
||||
while (true) {
|
||||
var fileName = ts.combinePaths(searchPath, "tsconfig.json");
|
||||
@@ -44086,11 +44117,31 @@ var ts;
|
||||
else if (host.getCurrentDirectory) {
|
||||
currentDirectory = host.getCurrentDirectory();
|
||||
}
|
||||
if (!currentDirectory) {
|
||||
return undefined;
|
||||
}
|
||||
return ts.map(defaultTypeRoots, function (d) { return ts.combinePaths(currentDirectory, d); });
|
||||
return currentDirectory && getDefaultTypeRoots(currentDirectory, host);
|
||||
}
|
||||
/**
|
||||
* Returns the path to every node_modules/@types directory from some ancestor directory.
|
||||
* Returns undefined if there are none.
|
||||
*/
|
||||
function getDefaultTypeRoots(currentDirectory, host) {
|
||||
if (!host.directoryExists) {
|
||||
return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];
|
||||
}
|
||||
var typeRoots;
|
||||
while (true) {
|
||||
var atTypes = ts.combinePaths(currentDirectory, nodeModulesAtTypes);
|
||||
if (host.directoryExists(atTypes)) {
|
||||
(typeRoots || (typeRoots = [])).push(atTypes);
|
||||
}
|
||||
var parent_15 = ts.getDirectoryPath(currentDirectory);
|
||||
if (parent_15 === currentDirectory) {
|
||||
break;
|
||||
}
|
||||
currentDirectory = parent_15;
|
||||
}
|
||||
return typeRoots;
|
||||
}
|
||||
var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types");
|
||||
/**
|
||||
* @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown.
|
||||
* This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups
|
||||
@@ -47263,28 +47314,28 @@ var ts;
|
||||
switch (n.kind) {
|
||||
case 199 /* Block */:
|
||||
if (!ts.isFunctionBlock(n)) {
|
||||
var parent_15 = n.parent;
|
||||
var parent_16 = n.parent;
|
||||
var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile);
|
||||
var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile);
|
||||
// Check if the block is standalone, or 'attached' to some parent statement.
|
||||
// If the latter, we want to collapse the block, but consider its hint span
|
||||
// to be the entire span of the parent.
|
||||
if (parent_15.kind === 204 /* DoStatement */ ||
|
||||
parent_15.kind === 207 /* ForInStatement */ ||
|
||||
parent_15.kind === 208 /* ForOfStatement */ ||
|
||||
parent_15.kind === 206 /* ForStatement */ ||
|
||||
parent_15.kind === 203 /* IfStatement */ ||
|
||||
parent_15.kind === 205 /* WhileStatement */ ||
|
||||
parent_15.kind === 212 /* WithStatement */ ||
|
||||
parent_15.kind === 252 /* CatchClause */) {
|
||||
addOutliningSpan(parent_15, openBrace, closeBrace, autoCollapse(n));
|
||||
if (parent_16.kind === 204 /* DoStatement */ ||
|
||||
parent_16.kind === 207 /* ForInStatement */ ||
|
||||
parent_16.kind === 208 /* ForOfStatement */ ||
|
||||
parent_16.kind === 206 /* ForStatement */ ||
|
||||
parent_16.kind === 203 /* IfStatement */ ||
|
||||
parent_16.kind === 205 /* WhileStatement */ ||
|
||||
parent_16.kind === 212 /* WithStatement */ ||
|
||||
parent_16.kind === 252 /* CatchClause */) {
|
||||
addOutliningSpan(parent_16, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
if (parent_15.kind === 216 /* TryStatement */) {
|
||||
if (parent_16.kind === 216 /* TryStatement */) {
|
||||
// Could be the try-block, or the finally-block.
|
||||
var tryStatement = parent_15;
|
||||
var tryStatement = parent_16;
|
||||
if (tryStatement.tryBlock === n) {
|
||||
addOutliningSpan(parent_15, openBrace, closeBrace, autoCollapse(n));
|
||||
addOutliningSpan(parent_16, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
}
|
||||
else if (tryStatement.finallyBlock === n) {
|
||||
@@ -54114,9 +54165,9 @@ var ts;
|
||||
return false;
|
||||
}
|
||||
// If the parent is not sourceFile or module block it is local variable
|
||||
for (var parent_16 = declaration.parent; !ts.isFunctionBlock(parent_16); parent_16 = parent_16.parent) {
|
||||
for (var parent_17 = declaration.parent; !ts.isFunctionBlock(parent_17); parent_17 = parent_17.parent) {
|
||||
// Reached source file or module block
|
||||
if (parent_16.kind === 256 /* SourceFile */ || parent_16.kind === 226 /* ModuleBlock */) {
|
||||
if (parent_17.kind === 256 /* SourceFile */ || parent_17.kind === 226 /* ModuleBlock */) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -55482,13 +55533,13 @@ var ts;
|
||||
log("Returning an empty list because completion was requested in an invalid position.");
|
||||
return undefined;
|
||||
}
|
||||
var parent_17 = contextToken.parent, kind = contextToken.kind;
|
||||
var parent_18 = contextToken.parent, kind = contextToken.kind;
|
||||
if (kind === 21 /* DotToken */) {
|
||||
if (parent_17.kind === 172 /* PropertyAccessExpression */) {
|
||||
if (parent_18.kind === 172 /* PropertyAccessExpression */) {
|
||||
node = contextToken.parent.expression;
|
||||
isRightOfDot = true;
|
||||
}
|
||||
else if (parent_17.kind === 139 /* QualifiedName */) {
|
||||
else if (parent_18.kind === 139 /* QualifiedName */) {
|
||||
node = contextToken.parent.left;
|
||||
isRightOfDot = true;
|
||||
}
|
||||
@@ -55866,9 +55917,9 @@ var ts;
|
||||
switch (contextToken.kind) {
|
||||
case 15 /* OpenBraceToken */: // const x = { |
|
||||
case 24 /* CommaToken */:
|
||||
var parent_18 = contextToken.parent;
|
||||
if (parent_18 && (parent_18.kind === 171 /* ObjectLiteralExpression */ || parent_18.kind === 167 /* ObjectBindingPattern */)) {
|
||||
return parent_18;
|
||||
var parent_19 = contextToken.parent;
|
||||
if (parent_19 && (parent_19.kind === 171 /* ObjectLiteralExpression */ || parent_19.kind === 167 /* ObjectBindingPattern */)) {
|
||||
return parent_19;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -55895,37 +55946,37 @@ var ts;
|
||||
}
|
||||
function tryGetContainingJsxElement(contextToken) {
|
||||
if (contextToken) {
|
||||
var parent_19 = contextToken.parent;
|
||||
var parent_20 = contextToken.parent;
|
||||
switch (contextToken.kind) {
|
||||
case 26 /* LessThanSlashToken */:
|
||||
case 39 /* SlashToken */:
|
||||
case 69 /* Identifier */:
|
||||
case 246 /* JsxAttribute */:
|
||||
case 247 /* JsxSpreadAttribute */:
|
||||
if (parent_19 && (parent_19.kind === 242 /* JsxSelfClosingElement */ || parent_19.kind === 243 /* JsxOpeningElement */)) {
|
||||
return parent_19;
|
||||
if (parent_20 && (parent_20.kind === 242 /* JsxSelfClosingElement */ || parent_20.kind === 243 /* JsxOpeningElement */)) {
|
||||
return parent_20;
|
||||
}
|
||||
else if (parent_19.kind === 246 /* JsxAttribute */) {
|
||||
return parent_19.parent;
|
||||
else if (parent_20.kind === 246 /* JsxAttribute */) {
|
||||
return parent_20.parent;
|
||||
}
|
||||
break;
|
||||
// The context token is the closing } or " of an attribute, which means
|
||||
// its parent is a JsxExpression, whose parent is a JsxAttribute,
|
||||
// whose parent is a JsxOpeningLikeElement
|
||||
case 9 /* StringLiteral */:
|
||||
if (parent_19 && ((parent_19.kind === 246 /* JsxAttribute */) || (parent_19.kind === 247 /* JsxSpreadAttribute */))) {
|
||||
return parent_19.parent;
|
||||
if (parent_20 && ((parent_20.kind === 246 /* JsxAttribute */) || (parent_20.kind === 247 /* JsxSpreadAttribute */))) {
|
||||
return parent_20.parent;
|
||||
}
|
||||
break;
|
||||
case 16 /* CloseBraceToken */:
|
||||
if (parent_19 &&
|
||||
parent_19.kind === 248 /* JsxExpression */ &&
|
||||
parent_19.parent &&
|
||||
(parent_19.parent.kind === 246 /* JsxAttribute */)) {
|
||||
return parent_19.parent.parent;
|
||||
if (parent_20 &&
|
||||
parent_20.kind === 248 /* JsxExpression */ &&
|
||||
parent_20.parent &&
|
||||
(parent_20.parent.kind === 246 /* JsxAttribute */)) {
|
||||
return parent_20.parent.parent;
|
||||
}
|
||||
if (parent_19 && parent_19.kind === 247 /* JsxSpreadAttribute */) {
|
||||
return parent_19.parent;
|
||||
if (parent_20 && parent_20.kind === 247 /* JsxSpreadAttribute */) {
|
||||
return parent_20.parent;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -57319,19 +57370,19 @@ var ts;
|
||||
function getThrowStatementOwner(throwStatement) {
|
||||
var child = throwStatement;
|
||||
while (child.parent) {
|
||||
var parent_20 = child.parent;
|
||||
if (ts.isFunctionBlock(parent_20) || parent_20.kind === 256 /* SourceFile */) {
|
||||
return parent_20;
|
||||
var parent_21 = child.parent;
|
||||
if (ts.isFunctionBlock(parent_21) || parent_21.kind === 256 /* SourceFile */) {
|
||||
return parent_21;
|
||||
}
|
||||
// A throw-statement is only owned by a try-statement if the try-statement has
|
||||
// a catch clause, and if the throw-statement occurs within the try block.
|
||||
if (parent_20.kind === 216 /* TryStatement */) {
|
||||
var tryStatement = parent_20;
|
||||
if (parent_21.kind === 216 /* TryStatement */) {
|
||||
var tryStatement = parent_21;
|
||||
if (tryStatement.tryBlock === child && tryStatement.catchClause) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
child = parent_20;
|
||||
child = parent_21;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
+28
-16
@@ -146,6 +146,7 @@ namespace ts {
|
||||
|
||||
const anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
const unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
const resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false);
|
||||
|
||||
const enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true);
|
||||
|
||||
@@ -911,8 +912,8 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
// If we're in an external module, we can't reference symbols created from UMD export declarations
|
||||
if (result && isInExternalModule) {
|
||||
// If we're in an external module, we can't reference value symbols created from UMD export declarations
|
||||
if (result && isInExternalModule && (meaning & SymbolFlags.Value) === SymbolFlags.Value) {
|
||||
const decls = result.declarations;
|
||||
if (decls && decls.length === 1 && decls[0].kind === SyntaxKind.NamespaceExportDeclaration) {
|
||||
error(errorLocation, Diagnostics.Identifier_0_must_be_imported_from_a_module, name);
|
||||
@@ -1042,7 +1043,7 @@ namespace ts {
|
||||
const moduleSymbol = resolveExternalModuleName(node, (<ImportDeclaration>node.parent).moduleSpecifier);
|
||||
|
||||
if (moduleSymbol) {
|
||||
const exportDefaultSymbol = isShorthandAmbientModule(moduleSymbol.valueDeclaration) ?
|
||||
const exportDefaultSymbol = isShorthandAmbientModuleSymbol(moduleSymbol) ?
|
||||
moduleSymbol :
|
||||
moduleSymbol.exports["export="] ?
|
||||
getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") :
|
||||
@@ -1118,7 +1119,7 @@ namespace ts {
|
||||
if (targetSymbol) {
|
||||
const name = specifier.propertyName || specifier.name;
|
||||
if (name.text) {
|
||||
if (isShorthandAmbientModule(moduleSymbol.valueDeclaration)) {
|
||||
if (isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
||||
return moduleSymbol;
|
||||
}
|
||||
|
||||
@@ -2152,8 +2153,13 @@ namespace ts {
|
||||
buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Type, SymbolFormatFlags.None, nextFlags);
|
||||
}
|
||||
else if (!(flags & TypeFormatFlags.InTypeAlias) && type.flags & (TypeFlags.Anonymous | TypeFlags.UnionOrIntersection) && type.aliasSymbol) {
|
||||
const typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
if (type.flags & TypeFlags.Anonymous || !(flags & TypeFormatFlags.UseTypeAliasValue)) {
|
||||
const typeArguments = type.aliasTypeArguments;
|
||||
writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags);
|
||||
}
|
||||
else {
|
||||
writeUnionOrIntersectionType(<UnionOrIntersectionType>type, nextFlags);
|
||||
}
|
||||
}
|
||||
else if (type.flags & TypeFlags.UnionOrIntersection) {
|
||||
writeUnionOrIntersectionType(<UnionOrIntersectionType>type, nextFlags);
|
||||
@@ -2978,7 +2984,9 @@ namespace ts {
|
||||
if (strictNullChecks && declaration.initializer && !(getFalsyFlags(checkExpressionCached(declaration.initializer)) & TypeFlags.Undefined)) {
|
||||
type = getTypeWithFacts(type, TypeFacts.NEUndefined);
|
||||
}
|
||||
return type;
|
||||
return declaration.initializer ?
|
||||
getUnionType([type, checkExpressionCached(declaration.initializer)], /*subtypeReduction*/ true) :
|
||||
type;
|
||||
}
|
||||
|
||||
function getTypeForVariableLikeDeclarationFromJSDocComment(declaration: VariableLikeDeclaration) {
|
||||
@@ -3378,7 +3386,7 @@ namespace ts {
|
||||
function getTypeOfFuncClassEnumModule(symbol: Symbol): Type {
|
||||
const links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
if (symbol.valueDeclaration.kind === SyntaxKind.ModuleDeclaration && isShorthandAmbientModule(<ModuleDeclaration>symbol.valueDeclaration)) {
|
||||
if (symbol.valueDeclaration.kind === SyntaxKind.ModuleDeclaration && isShorthandAmbientModuleSymbol(symbol)) {
|
||||
links.type = anyType;
|
||||
}
|
||||
else {
|
||||
@@ -8545,6 +8553,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
function narrowTypeByEquality(type: Type, operator: SyntaxKind, value: Expression, assumeTrue: boolean): Type {
|
||||
if (type.flags & TypeFlags.Any) {
|
||||
return type;
|
||||
}
|
||||
if (operator === SyntaxKind.ExclamationEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) {
|
||||
assumeTrue = !assumeTrue;
|
||||
}
|
||||
@@ -8688,7 +8699,7 @@ namespace ts {
|
||||
// type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
|
||||
// two types.
|
||||
const targetType = type.flags & TypeFlags.TypeParameter ? getApparentType(type) : type;
|
||||
return isTypeSubtypeOf(candidate, targetType) ? candidate :
|
||||
return isTypeSubtypeOf(candidate, type) ? candidate :
|
||||
isTypeAssignableTo(type, candidate) ? type :
|
||||
isTypeAssignableTo(candidate, targetType) ? candidate :
|
||||
getIntersectionType([type, candidate]);
|
||||
@@ -8906,6 +8917,7 @@ namespace ts {
|
||||
const isParameter = getRootDeclaration(declaration).kind === SyntaxKind.Parameter;
|
||||
const declarationContainer = getControlFlowContainer(declaration);
|
||||
let flowContainer = getControlFlowContainer(node);
|
||||
const isOuterVariable = flowContainer !== declarationContainer;
|
||||
// When the control flow originates in a function expression or arrow function and we are referencing
|
||||
// a const variable or parameter from an outer function, we extend the origin of the control flow
|
||||
// analysis to include the immediately enclosing function.
|
||||
@@ -8918,7 +8930,7 @@ namespace ts {
|
||||
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
|
||||
// declaration container are the same).
|
||||
const assumeInitialized = !strictNullChecks || (type.flags & TypeFlags.Any) !== 0 || isParameter ||
|
||||
flowContainer !== declarationContainer || isInAmbientContext(declaration);
|
||||
isOuterVariable || isInAmbientContext(declaration);
|
||||
const flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
|
||||
// A variable is considered uninitialized when it is possible to analyze the entire control flow graph
|
||||
// from declaration to use, and when the variable's declared type doesn't include undefined but the
|
||||
@@ -12250,10 +12262,10 @@ namespace ts {
|
||||
// or that a different candidatesOutArray was passed in. Therefore, we need to redo the work
|
||||
// to correctly fill the candidatesOutArray.
|
||||
const cached = links.resolvedSignature;
|
||||
if (cached && cached !== anySignature && !candidatesOutArray) {
|
||||
if (cached && cached !== resolvingSignature && !candidatesOutArray) {
|
||||
return cached;
|
||||
}
|
||||
links.resolvedSignature = anySignature;
|
||||
links.resolvedSignature = resolvingSignature;
|
||||
const result = resolveSignature(node, candidatesOutArray);
|
||||
// If signature resolution originated in control flow type analysis (for example to compute the
|
||||
// assigned type in a flow assignment) we don't cache the result as it may be based on temporary
|
||||
@@ -12265,7 +12277,7 @@ namespace ts {
|
||||
function getResolvedOrAnySignature(node: CallLikeExpression) {
|
||||
// If we're already in the process of resolving the given signature, don't resolve again as
|
||||
// that could cause infinite recursion. Instead, return anySignature.
|
||||
return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node);
|
||||
return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node);
|
||||
}
|
||||
|
||||
function getInferredClassType(symbol: Symbol) {
|
||||
@@ -13508,7 +13520,7 @@ namespace ts {
|
||||
return maybeTypeOfKind(contextualType, (TypeFlags.NumberLiteral | TypeFlags.EnumLiteral));
|
||||
}
|
||||
if (type.flags & TypeFlags.Boolean) {
|
||||
return maybeTypeOfKind(contextualType, TypeFlags.BooleanLiteral) && !isTypeAssignableTo(booleanType, contextualType);
|
||||
return maybeTypeOfKind(contextualType, TypeFlags.BooleanLiteral);
|
||||
}
|
||||
if (type.flags & TypeFlags.Enum) {
|
||||
return typeContainsLiteralFromEnum(contextualType, <EnumType>type);
|
||||
@@ -18336,8 +18348,8 @@ namespace ts {
|
||||
|
||||
function moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean {
|
||||
let moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
|
||||
if (!moduleSymbol) {
|
||||
// module not found - be conservative
|
||||
if (!moduleSymbol || isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
||||
// If the module is not found or is shorthand, assume that it may export a value.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
errorNameNode = declaration.name;
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -341,7 +341,7 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
errorNameNode = signature.name;
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue, writer);
|
||||
errorNameNode = undefined;
|
||||
}
|
||||
}
|
||||
@@ -563,7 +563,7 @@ namespace ts {
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
@@ -1025,7 +1025,7 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError;
|
||||
resolver.writeBaseConstructorTypeOfClass(<ClassLikeDeclaration>enclosingDeclaration, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
resolver.writeBaseConstructorTypeOfClass(<ClassLikeDeclaration>enclosingDeclaration, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue, writer);
|
||||
}
|
||||
|
||||
function getHeritageClauseVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
|
||||
|
||||
+37
-9
@@ -9,8 +9,6 @@ namespace ts {
|
||||
|
||||
const emptyArray: any[] = [];
|
||||
|
||||
const defaultTypeRoots = ["node_modules/@types"];
|
||||
|
||||
export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName = "tsconfig.json"): string {
|
||||
while (true) {
|
||||
const fileName = combinePaths(searchPath, configName);
|
||||
@@ -79,22 +77,52 @@ namespace ts {
|
||||
|
||||
const typeReferenceExtensions = [".d.ts"];
|
||||
|
||||
export function getEffectiveTypeRoots(options: CompilerOptions, currentDirectory: string) {
|
||||
// @internal
|
||||
export function getEffectiveTypeRoots(options: CompilerOptions, host: { directoryExists?(directoryName: string): boolean; getCurrentDirectory?(): string; }): string[] | undefined {
|
||||
if (options.typeRoots) {
|
||||
return options.typeRoots;
|
||||
}
|
||||
|
||||
let currentDirectory: string;
|
||||
if (options.configFilePath) {
|
||||
currentDirectory = getDirectoryPath(options.configFilePath);
|
||||
}
|
||||
|
||||
if (!currentDirectory) {
|
||||
return undefined;
|
||||
else if (host.getCurrentDirectory) {
|
||||
currentDirectory = host.getCurrentDirectory();
|
||||
}
|
||||
|
||||
return map(defaultTypeRoots, d => combinePaths(currentDirectory, d));
|
||||
return currentDirectory && getDefaultTypeRoots(currentDirectory, host);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to every node_modules/@types directory from some ancestor directory.
|
||||
* Returns undefined if there are none.
|
||||
*/
|
||||
function getDefaultTypeRoots(currentDirectory: string, host: { directoryExists?(directoryName: string): boolean; getCurrentDirectory?(): string; }): string[] | undefined {
|
||||
if (!host.directoryExists) {
|
||||
return [combinePaths(currentDirectory, nodeModulesAtTypes)];
|
||||
}
|
||||
|
||||
let typeRoots: string[];
|
||||
|
||||
while (true) {
|
||||
const atTypes = combinePaths(currentDirectory, nodeModulesAtTypes);
|
||||
if (host.directoryExists(atTypes)) {
|
||||
(typeRoots || (typeRoots = [])).push(atTypes);
|
||||
}
|
||||
|
||||
const parent = getDirectoryPath(currentDirectory);
|
||||
if (parent === currentDirectory) {
|
||||
break;
|
||||
}
|
||||
currentDirectory = parent;
|
||||
}
|
||||
|
||||
return typeRoots;
|
||||
}
|
||||
|
||||
const nodeModulesAtTypes = combinePaths("node_modules", "@types");
|
||||
|
||||
/**
|
||||
* @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown.
|
||||
* This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups
|
||||
@@ -109,7 +137,7 @@ namespace ts {
|
||||
traceEnabled
|
||||
};
|
||||
|
||||
const typeRoots = getEffectiveTypeRoots(options, host.getCurrentDirectory && host.getCurrentDirectory());
|
||||
const typeRoots = getEffectiveTypeRoots(options, host);
|
||||
if (traceEnabled) {
|
||||
if (containingFile === undefined) {
|
||||
if (typeRoots === undefined) {
|
||||
@@ -424,7 +452,7 @@ namespace ts {
|
||||
// Walk the primary type lookup locations
|
||||
const result: string[] = [];
|
||||
if (host.directoryExists && host.getDirectories) {
|
||||
const typeRoots = getEffectiveTypeRoots(options, host.getCurrentDirectory && host.getCurrentDirectory());
|
||||
const typeRoots = getEffectiveTypeRoots(options, host);
|
||||
if (typeRoots) {
|
||||
for (const root of typeRoots) {
|
||||
if (host.directoryExists(root)) {
|
||||
|
||||
@@ -1949,6 +1949,7 @@ namespace ts {
|
||||
UseFullyQualifiedType = 0x00000080, // Write out the fully qualified type name (eg. Module.Type, instead of Type)
|
||||
InFirstTypeArgument = 0x00000100, // Writing first type argument of the instantiated type
|
||||
InTypeAlias = 0x00000200, // Writing type in type alias declaration
|
||||
UseTypeAliasValue = 0x00000400, // Serialize the type instead of using type-alias. This is needed when we emit declaration file.
|
||||
}
|
||||
|
||||
export const enum SymbolFormatFlags {
|
||||
|
||||
@@ -360,7 +360,11 @@ namespace ts {
|
||||
((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral || isGlobalScopeAugmentation(<ModuleDeclaration>node));
|
||||
}
|
||||
|
||||
export function isShorthandAmbientModule(node: Node): boolean {
|
||||
export function isShorthandAmbientModuleSymbol(moduleSymbol: Symbol): boolean {
|
||||
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
|
||||
}
|
||||
|
||||
function isShorthandAmbientModule(node: Node): boolean {
|
||||
// The only kind of module that can be missing a body is a shorthand ambient module.
|
||||
return node.kind === SyntaxKind.ModuleDeclaration && (!(<ModuleDeclaration>node).body);
|
||||
}
|
||||
|
||||
Vendored
-2
@@ -16,7 +16,6 @@ interface MapConstructor {
|
||||
declare var Map: MapConstructor;
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
get(key: K): V | undefined;
|
||||
has(key: K): boolean;
|
||||
@@ -48,7 +47,6 @@ declare var Set: SetConstructor;
|
||||
|
||||
interface WeakSet<T> {
|
||||
add(value: T): this;
|
||||
clear(): void;
|
||||
delete(value: T): boolean;
|
||||
has(value: T): boolean;
|
||||
}
|
||||
|
||||
@@ -4927,7 +4927,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else if (host.getDirectories) {
|
||||
const typeRoots = getEffectiveTypeRoots(options, host.getCurrentDirectory());
|
||||
const typeRoots = getEffectiveTypeRoots(options, host);
|
||||
for (const root of typeRoots) {
|
||||
getCompletionEntriesFromDirectories(host, options, root, span, result);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@ var jquery_1 = require("jquery");
|
||||
exports.x = jquery_1.x;
|
||||
//// [reExportAll.js]
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
__export(require("jquery"));
|
||||
//// [reExportUser.js]
|
||||
"use strict";
|
||||
var reExportX_1 = require("./reExportX");
|
||||
|
||||
@@ -28,7 +28,7 @@ var y: typeof foo.C1.s1 = false;
|
||||
>foo : typeof foo
|
||||
>C1 : typeof foo.C1
|
||||
>s1 : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
|
||||
var z: foo.M1.I2;
|
||||
>z : f.I2
|
||||
|
||||
@@ -255,16 +255,16 @@ module EmptyTypes {
|
||||
>x : boolean
|
||||
>y : base
|
||||
>base : base
|
||||
>[{ x: true, y: new derived() }, { x: false, y: new base() }] : { x: boolean; y: derived; }[]
|
||||
>{ x: true, y: new derived() } : { x: boolean; y: derived; }
|
||||
>x : boolean
|
||||
>true : boolean
|
||||
>[{ x: true, y: new derived() }, { x: false, y: new base() }] : ({ x: true; y: derived; } | { x: false; y: base; })[]
|
||||
>{ x: true, y: new derived() } : { x: true; y: derived; }
|
||||
>x : true
|
||||
>true : true
|
||||
>y : derived
|
||||
>new derived() : derived
|
||||
>derived : typeof derived
|
||||
>{ x: false, y: new base() } : { x: boolean; y: base; }
|
||||
>x : boolean
|
||||
>false : boolean
|
||||
>{ x: false, y: new base() } : { x: false; y: base; }
|
||||
>x : false
|
||||
>false : false
|
||||
>y : base
|
||||
>new base() : base
|
||||
>base : typeof base
|
||||
@@ -658,16 +658,16 @@ module NonEmptyTypes {
|
||||
>x : boolean
|
||||
>y : base
|
||||
>base : base
|
||||
>[{ x: true, y: new derived() }, { x: false, y: new base() }] : { x: boolean; y: base; }[]
|
||||
>{ x: true, y: new derived() } : { x: boolean; y: derived; }
|
||||
>x : boolean
|
||||
>true : boolean
|
||||
>[{ x: true, y: new derived() }, { x: false, y: new base() }] : ({ x: true; y: derived; } | { x: false; y: base; })[]
|
||||
>{ x: true, y: new derived() } : { x: true; y: derived; }
|
||||
>x : true
|
||||
>true : true
|
||||
>y : derived
|
||||
>new derived() : derived
|
||||
>derived : typeof derived
|
||||
>{ x: false, y: new base() } : { x: boolean; y: base; }
|
||||
>x : boolean
|
||||
>false : boolean
|
||||
>{ x: false, y: new base() } : { x: false; y: base; }
|
||||
>x : false
|
||||
>false : false
|
||||
>y : base
|
||||
>new base() : base
|
||||
>base : typeof base
|
||||
|
||||
@@ -12,14 +12,14 @@ x; // string
|
||||
>x : string
|
||||
|
||||
[x] = [true];
|
||||
>[x] = [true] : [boolean]
|
||||
>[x] = [true] : [true]
|
||||
>[x] : [string | number | boolean | RegExp]
|
||||
>x : string | number | boolean | RegExp
|
||||
>[true] : [boolean]
|
||||
>true : boolean
|
||||
>[true] : [true]
|
||||
>true : true
|
||||
|
||||
x; // boolean
|
||||
>x : boolean
|
||||
>x : true
|
||||
|
||||
[x = ""] = [1];
|
||||
>[x = ""] = [1] : [number]
|
||||
@@ -34,16 +34,16 @@ x; // string | number
|
||||
>x : string | number
|
||||
|
||||
({x} = {x: true});
|
||||
>({x} = {x: true}) : { x: boolean; }
|
||||
>{x} = {x: true} : { x: boolean; }
|
||||
>({x} = {x: true}) : { x: true; }
|
||||
>{x} = {x: true} : { x: true; }
|
||||
>{x} : { x: string | number | boolean | RegExp; }
|
||||
>x : string | number | boolean | RegExp
|
||||
>{x: true} : { x: boolean; }
|
||||
>x : boolean
|
||||
>true : boolean
|
||||
>{x: true} : { x: true; }
|
||||
>x : true
|
||||
>true : true
|
||||
|
||||
x; // boolean
|
||||
>x : boolean
|
||||
>x : true
|
||||
|
||||
({y: x} = {y: 1});
|
||||
>({y: x} = {y: 1}) : { y: number; }
|
||||
@@ -59,16 +59,16 @@ x; // number
|
||||
>x : number
|
||||
|
||||
({x = ""} = {x: true});
|
||||
>({x = ""} = {x: true}) : { x?: boolean; }
|
||||
>{x = ""} = {x: true} : { x?: boolean; }
|
||||
>({x = ""} = {x: true}) : { x?: true; }
|
||||
>{x = ""} = {x: true} : { x?: true; }
|
||||
>{x = ""} : { x?: string | number | boolean | RegExp; }
|
||||
>x : string | number | boolean | RegExp
|
||||
>{x: true} : { x?: boolean; }
|
||||
>x : boolean
|
||||
>true : boolean
|
||||
>{x: true} : { x?: true; }
|
||||
>x : true
|
||||
>true : true
|
||||
|
||||
x; // string | boolean
|
||||
>x : string | boolean
|
||||
>x : string | true
|
||||
|
||||
({y: x = /a/} = {y: 1});
|
||||
>({y: x = /a/} = {y: 1}) : { y?: number; }
|
||||
|
||||
@@ -15,8 +15,8 @@ async function fAsyncExplicit(): Promise<[number, boolean]> {
|
||||
|
||||
// This is contextually typed as a tuple.
|
||||
return [1, true];
|
||||
>[1, true] : [number, boolean]
|
||||
>[1, true] : [number, true]
|
||||
>1 : number
|
||||
>true : boolean
|
||||
>true : true
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ function f2(x: number): number { return 10; }
|
||||
function f3(x: number): boolean { return true; }
|
||||
>f3 : (x: number) => boolean
|
||||
>x : number
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
enum E1 { one }
|
||||
>E1 : E1
|
||||
|
||||
@@ -5,7 +5,7 @@ var BOOLEAN: boolean;
|
||||
|
||||
function foo(): boolean { return true; }
|
||||
>foo : () => boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
@@ -23,7 +23,7 @@ var a = <any>0;
|
||||
var b = <boolean>true;
|
||||
>b : boolean
|
||||
><boolean>true : boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
var s = <string>"";
|
||||
>s : string
|
||||
|
||||
@@ -18,11 +18,11 @@ class Derived extends Based {
|
||||
|
||||
constructor() {
|
||||
this.y = true;
|
||||
>this.y = true : boolean
|
||||
>this.y = true : true
|
||||
>this.y : boolean
|
||||
>this : this
|
||||
>y : boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
}
|
||||
}
|
||||
super();
|
||||
|
||||
@@ -111,32 +111,32 @@ ANY = undefined, BOOLEAN;
|
||||
>BOOLEAN : boolean
|
||||
|
||||
OBJECT = [1, 2, 3], BOOLEAN = false;
|
||||
>OBJECT = [1, 2, 3], BOOLEAN = false : boolean
|
||||
>OBJECT = [1, 2, 3], BOOLEAN = false : false
|
||||
>OBJECT = [1, 2, 3] : number[]
|
||||
>OBJECT : Object
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
>BOOLEAN = false : boolean
|
||||
>BOOLEAN = false : false
|
||||
>BOOLEAN : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
|
||||
var resultIsBoolean6 = (null, BOOLEAN);
|
||||
>resultIsBoolean6 : boolean
|
||||
>(null, BOOLEAN) : boolean
|
||||
>null, BOOLEAN : boolean
|
||||
>resultIsBoolean6 : false
|
||||
>(null, BOOLEAN) : false
|
||||
>null, BOOLEAN : false
|
||||
>null : null
|
||||
>BOOLEAN : boolean
|
||||
>BOOLEAN : false
|
||||
|
||||
var resultIsBoolean7 = (ANY = undefined, BOOLEAN);
|
||||
>resultIsBoolean7 : boolean
|
||||
>(ANY = undefined, BOOLEAN) : boolean
|
||||
>ANY = undefined, BOOLEAN : boolean
|
||||
>resultIsBoolean7 : false
|
||||
>(ANY = undefined, BOOLEAN) : false
|
||||
>ANY = undefined, BOOLEAN : false
|
||||
>ANY = undefined : undefined
|
||||
>ANY : any
|
||||
>undefined : undefined
|
||||
>BOOLEAN : boolean
|
||||
>BOOLEAN : false
|
||||
|
||||
var resultIsBoolean8 = (1, true);
|
||||
>resultIsBoolean8 : boolean
|
||||
@@ -154,27 +154,27 @@ var resultIsBoolean9 = (++NUMBER, true);
|
||||
>true : boolean
|
||||
|
||||
var resultIsBoolean10 = ([1, 2, 3], !BOOLEAN);
|
||||
>resultIsBoolean10 : boolean
|
||||
>([1, 2, 3], !BOOLEAN) : boolean
|
||||
>[1, 2, 3], !BOOLEAN : boolean
|
||||
>resultIsBoolean10 : true
|
||||
>([1, 2, 3], !BOOLEAN) : true
|
||||
>[1, 2, 3], !BOOLEAN : true
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
>!BOOLEAN : boolean
|
||||
>BOOLEAN : boolean
|
||||
>!BOOLEAN : true
|
||||
>BOOLEAN : false
|
||||
|
||||
var resultIsBoolean11 = (OBJECT = [1, 2, 3], BOOLEAN = false);
|
||||
>resultIsBoolean11 : boolean
|
||||
>(OBJECT = [1, 2, 3], BOOLEAN = false) : boolean
|
||||
>OBJECT = [1, 2, 3], BOOLEAN = false : boolean
|
||||
>resultIsBoolean11 : false
|
||||
>(OBJECT = [1, 2, 3], BOOLEAN = false) : false
|
||||
>OBJECT = [1, 2, 3], BOOLEAN = false : false
|
||||
>OBJECT = [1, 2, 3] : number[]
|
||||
>OBJECT : Object
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
>BOOLEAN = false : boolean
|
||||
>BOOLEAN = false : false
|
||||
>BOOLEAN : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
|
||||
@@ -97,9 +97,9 @@ true, 1;
|
||||
|
||||
BOOLEAN = false, 1;
|
||||
>BOOLEAN = false, 1 : number
|
||||
>BOOLEAN = false : boolean
|
||||
>BOOLEAN = false : false
|
||||
>BOOLEAN : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
>1 : number
|
||||
|
||||
"", NUMBER = 1;
|
||||
@@ -146,9 +146,9 @@ var resultIsNumber9 = (BOOLEAN = false, 1);
|
||||
>resultIsNumber9 : number
|
||||
>(BOOLEAN = false, 1) : number
|
||||
>BOOLEAN = false, 1 : number
|
||||
>BOOLEAN = false : boolean
|
||||
>BOOLEAN = false : false
|
||||
>BOOLEAN : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
>1 : number
|
||||
|
||||
var resultIsNumber10 = ("", NUMBER = 1);
|
||||
|
||||
@@ -28,7 +28,7 @@ var y: typeof foo.C1.s1 = false;
|
||||
>foo : typeof foo
|
||||
>C1 : typeof foo.C1
|
||||
>s1 : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
|
||||
var z: foo.M1.I2;
|
||||
>z : f.I2
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(6,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'void'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(7,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(7,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'true'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(8,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'number'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'E'.
|
||||
tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and '{}'.
|
||||
@@ -38,7 +38,7 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'void'.
|
||||
x1 += true;
|
||||
~~~~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'.
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'true'.
|
||||
x1 += 0;
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'number'.
|
||||
|
||||
@@ -19,7 +19,7 @@ declare function foo<T>(obj: I<T>): T
|
||||
foo({
|
||||
>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[]
|
||||
>foo : <T>(obj: I<T>) => T
|
||||
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; [x: number]: number | (() => void) | number[]; 0: () => void; p: string; }
|
||||
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | true | (() => void) | number[]; [x: number]: number | (() => void) | number[]; 0: () => void; p: string; }
|
||||
|
||||
p: "",
|
||||
>p : string
|
||||
@@ -32,7 +32,7 @@ foo({
|
||||
>"hi" + "bye" : string
|
||||
>"hi" : string
|
||||
>"bye" : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
[0 + 1]: 0,
|
||||
>0 + 1 : number
|
||||
|
||||
@@ -19,7 +19,7 @@ declare function foo<T>(obj: I<T>): T
|
||||
foo({
|
||||
>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[]
|
||||
>foo : <T>(obj: I<T>) => T
|
||||
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; [x: number]: number | (() => void) | number[]; 0: () => void; p: string; }
|
||||
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | true | (() => void) | number[]; [x: number]: number | (() => void) | number[]; 0: () => void; p: string; }
|
||||
|
||||
p: "",
|
||||
>p : string
|
||||
@@ -32,7 +32,7 @@ foo({
|
||||
>"hi" + "bye" : string
|
||||
>"hi" : string
|
||||
>"bye" : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
[0 + 1]: 0,
|
||||
>0 + 1 : number
|
||||
|
||||
@@ -146,7 +146,7 @@ true || false ? exprIsObject1 : exprIsObject2;
|
||||
>true || false ? exprIsObject1 : exprIsObject2 : Object
|
||||
>true || false : boolean
|
||||
>true : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
>exprIsObject1 : Object
|
||||
>exprIsObject2 : Object
|
||||
|
||||
@@ -291,7 +291,7 @@ var resultIsObject3 = true || false ? exprIsObject1 : exprIsObject2;
|
||||
>true || false ? exprIsObject1 : exprIsObject2 : Object
|
||||
>true || false : boolean
|
||||
>true : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
>exprIsObject1 : Object
|
||||
>exprIsObject2 : Object
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ var o: {
|
||||
>idx : number
|
||||
|
||||
} = {
|
||||
>{ 1: true } : { 1: boolean; }
|
||||
>{ 1: true } : { 1: true; }
|
||||
|
||||
1: true
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(4,20): error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(5,23): error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(6,25): error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(11,23): error TS2322: Type '{ show: (v: number) => number; }' is not assignable to type 'Show'.
|
||||
Types of property 'show' are incompatible.
|
||||
Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(16,23): error TS2322: Type '(arg: string) => number' is not assignable to type '(s: string) => string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(21,14): error TS2322: Type '[number, number]' is not assignable to type '[string, number]'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts(26,14): error TS2322: Type '"baz"' is not assignable to type '"foo" | "bar"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts (7 errors) ====
|
||||
interface Show {
|
||||
show: (x: number) => string;
|
||||
}
|
||||
function f({ show: showRename = v => v }: Show) {}
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
function f2({ "show": showRename = v => v }: Show) {}
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
function f3({ ["show"]: showRename = v => v }: Show) {}
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
interface Nested {
|
||||
nested: Show
|
||||
}
|
||||
function ff({ nested: nestedRename = { show: v => v } }: Nested) {}
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ show: (v: number) => number; }' is not assignable to type 'Show'.
|
||||
!!! error TS2322: Types of property 'show' are incompatible.
|
||||
!!! error TS2322: Type '(v: number) => number' is not assignable to type '(x: number) => string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
interface StringIdentity {
|
||||
stringIdentity(s: string): string;
|
||||
}
|
||||
let { stringIdentity: id = arg => arg.length }: StringIdentity = { stringIdentity: x => x};
|
||||
~~
|
||||
!!! error TS2322: Type '(arg: string) => number' is not assignable to type '(s: string) => string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
interface Tuples {
|
||||
prop: [string, number];
|
||||
}
|
||||
function g({ prop = [101, 1234] }: Tuples) {}
|
||||
~~~~
|
||||
!!! error TS2322: Type '[number, number]' is not assignable to type '[string, number]'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
interface StringUnion {
|
||||
prop: "foo" | "bar";
|
||||
}
|
||||
function h({ prop = "baz" }: StringUnion) {}
|
||||
~~~~
|
||||
!!! error TS2322: Type '"baz"' is not assignable to type '"foo" | "bar"'.
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
=== tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts ===
|
||||
interface Show {
|
||||
>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 0))
|
||||
|
||||
show: (x: number) => string;
|
||||
>show : Symbol(Show.show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 16))
|
||||
>x : Symbol(x, Decl(contextuallyTypedBindingInitializerNegative.ts, 1, 11))
|
||||
}
|
||||
function f({ show: showRename = v => v }: Show) {}
|
||||
>f : Symbol(f, Decl(contextuallyTypedBindingInitializerNegative.ts, 2, 1))
|
||||
>show : Symbol(Show.show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 16))
|
||||
>showRename : Symbol(showRename, Decl(contextuallyTypedBindingInitializerNegative.ts, 3, 12))
|
||||
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 3, 31))
|
||||
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 3, 31))
|
||||
>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 0))
|
||||
|
||||
function f2({ "show": showRename = v => v }: Show) {}
|
||||
>f2 : Symbol(f2, Decl(contextuallyTypedBindingInitializerNegative.ts, 3, 50))
|
||||
>showRename : Symbol(showRename, Decl(contextuallyTypedBindingInitializerNegative.ts, 4, 13))
|
||||
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 4, 34))
|
||||
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 4, 34))
|
||||
>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 0))
|
||||
|
||||
function f3({ ["show"]: showRename = v => v }: Show) {}
|
||||
>f3 : Symbol(f3, Decl(contextuallyTypedBindingInitializerNegative.ts, 4, 53))
|
||||
>"show" : Symbol(showRename, Decl(contextuallyTypedBindingInitializerNegative.ts, 5, 13))
|
||||
>showRename : Symbol(showRename, Decl(contextuallyTypedBindingInitializerNegative.ts, 5, 13))
|
||||
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 5, 36))
|
||||
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 5, 36))
|
||||
>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 0))
|
||||
|
||||
interface Nested {
|
||||
>Nested : Symbol(Nested, Decl(contextuallyTypedBindingInitializerNegative.ts, 5, 55))
|
||||
|
||||
nested: Show
|
||||
>nested : Symbol(Nested.nested, Decl(contextuallyTypedBindingInitializerNegative.ts, 7, 18))
|
||||
>Show : Symbol(Show, Decl(contextuallyTypedBindingInitializerNegative.ts, 0, 0))
|
||||
}
|
||||
function ff({ nested: nestedRename = { show: v => v } }: Nested) {}
|
||||
>ff : Symbol(ff, Decl(contextuallyTypedBindingInitializerNegative.ts, 9, 1))
|
||||
>nested : Symbol(Nested.nested, Decl(contextuallyTypedBindingInitializerNegative.ts, 7, 18))
|
||||
>nestedRename : Symbol(nestedRename, Decl(contextuallyTypedBindingInitializerNegative.ts, 10, 13))
|
||||
>show : Symbol(show, Decl(contextuallyTypedBindingInitializerNegative.ts, 10, 38))
|
||||
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 10, 44))
|
||||
>v : Symbol(v, Decl(contextuallyTypedBindingInitializerNegative.ts, 10, 44))
|
||||
>Nested : Symbol(Nested, Decl(contextuallyTypedBindingInitializerNegative.ts, 5, 55))
|
||||
|
||||
interface StringIdentity {
|
||||
>StringIdentity : Symbol(StringIdentity, Decl(contextuallyTypedBindingInitializerNegative.ts, 10, 67))
|
||||
|
||||
stringIdentity(s: string): string;
|
||||
>stringIdentity : Symbol(StringIdentity.stringIdentity, Decl(contextuallyTypedBindingInitializerNegative.ts, 12, 26))
|
||||
>s : Symbol(s, Decl(contextuallyTypedBindingInitializerNegative.ts, 13, 19))
|
||||
}
|
||||
let { stringIdentity: id = arg => arg.length }: StringIdentity = { stringIdentity: x => x};
|
||||
>stringIdentity : Symbol(StringIdentity.stringIdentity, Decl(contextuallyTypedBindingInitializerNegative.ts, 12, 26))
|
||||
>id : Symbol(id, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 5))
|
||||
>arg : Symbol(arg, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 26))
|
||||
>arg.length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
>arg : Symbol(arg, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 26))
|
||||
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
>StringIdentity : Symbol(StringIdentity, Decl(contextuallyTypedBindingInitializerNegative.ts, 10, 67))
|
||||
>stringIdentity : Symbol(stringIdentity, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 66))
|
||||
>x : Symbol(x, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 82))
|
||||
>x : Symbol(x, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 82))
|
||||
|
||||
interface Tuples {
|
||||
>Tuples : Symbol(Tuples, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 91))
|
||||
|
||||
prop: [string, number];
|
||||
>prop : Symbol(Tuples.prop, Decl(contextuallyTypedBindingInitializerNegative.ts, 17, 18))
|
||||
}
|
||||
function g({ prop = [101, 1234] }: Tuples) {}
|
||||
>g : Symbol(g, Decl(contextuallyTypedBindingInitializerNegative.ts, 19, 1))
|
||||
>prop : Symbol(prop, Decl(contextuallyTypedBindingInitializerNegative.ts, 20, 12))
|
||||
>Tuples : Symbol(Tuples, Decl(contextuallyTypedBindingInitializerNegative.ts, 15, 91))
|
||||
|
||||
interface StringUnion {
|
||||
>StringUnion : Symbol(StringUnion, Decl(contextuallyTypedBindingInitializerNegative.ts, 20, 45))
|
||||
|
||||
prop: "foo" | "bar";
|
||||
>prop : Symbol(StringUnion.prop, Decl(contextuallyTypedBindingInitializerNegative.ts, 22, 23))
|
||||
}
|
||||
function h({ prop = "baz" }: StringUnion) {}
|
||||
>h : Symbol(h, Decl(contextuallyTypedBindingInitializerNegative.ts, 24, 1))
|
||||
>prop : Symbol(prop, Decl(contextuallyTypedBindingInitializerNegative.ts, 25, 12))
|
||||
>StringUnion : Symbol(StringUnion, Decl(contextuallyTypedBindingInitializerNegative.ts, 20, 45))
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
=== tests/cases/conformance/types/contextualTypes/methodDeclarations/contextuallyTypedBindingInitializerNegative.ts ===
|
||||
interface Show {
|
||||
>Show : Show
|
||||
|
||||
show: (x: number) => string;
|
||||
>show : (x: number) => string
|
||||
>x : number
|
||||
}
|
||||
function f({ show: showRename = v => v }: Show) {}
|
||||
>f : ({show: showRename}: Show) => void
|
||||
>show : any
|
||||
>showRename : ((x: number) => string) | ((v: number) => number)
|
||||
>v => v : (v: number) => number
|
||||
>v : number
|
||||
>v : number
|
||||
>Show : Show
|
||||
|
||||
function f2({ "show": showRename = v => v }: Show) {}
|
||||
>f2 : ({"show": showRename}: Show) => void
|
||||
>showRename : ((x: number) => string) | ((v: number) => number)
|
||||
>v => v : (v: number) => number
|
||||
>v : number
|
||||
>v : number
|
||||
>Show : Show
|
||||
|
||||
function f3({ ["show"]: showRename = v => v }: Show) {}
|
||||
>f3 : ({["show"]: showRename}: Show) => void
|
||||
>"show" : string
|
||||
>showRename : ((x: number) => string) | ((v: number) => number)
|
||||
>v => v : (v: number) => number
|
||||
>v : number
|
||||
>v : number
|
||||
>Show : Show
|
||||
|
||||
interface Nested {
|
||||
>Nested : Nested
|
||||
|
||||
nested: Show
|
||||
>nested : Show
|
||||
>Show : Show
|
||||
}
|
||||
function ff({ nested: nestedRename = { show: v => v } }: Nested) {}
|
||||
>ff : ({nested: nestedRename}: Nested) => void
|
||||
>nested : any
|
||||
>nestedRename : Show | { show: (v: number) => number; }
|
||||
>{ show: v => v } : { show: (v: number) => number; }
|
||||
>show : (v: number) => number
|
||||
>v => v : (v: number) => number
|
||||
>v : number
|
||||
>v : number
|
||||
>Nested : Nested
|
||||
|
||||
interface StringIdentity {
|
||||
>StringIdentity : StringIdentity
|
||||
|
||||
stringIdentity(s: string): string;
|
||||
>stringIdentity : (s: string) => string
|
||||
>s : string
|
||||
}
|
||||
let { stringIdentity: id = arg => arg.length }: StringIdentity = { stringIdentity: x => x};
|
||||
>stringIdentity : any
|
||||
>id : ((s: string) => string) | ((arg: string) => number)
|
||||
>arg => arg.length : (arg: string) => number
|
||||
>arg : string
|
||||
>arg.length : number
|
||||
>arg : string
|
||||
>length : number
|
||||
>StringIdentity : StringIdentity
|
||||
>{ stringIdentity: x => x} : { stringIdentity: (x: string) => string; }
|
||||
>stringIdentity : (x: string) => string
|
||||
>x => x : (x: string) => string
|
||||
>x : string
|
||||
>x : string
|
||||
|
||||
interface Tuples {
|
||||
>Tuples : Tuples
|
||||
|
||||
prop: [string, number];
|
||||
>prop : [string, number]
|
||||
}
|
||||
function g({ prop = [101, 1234] }: Tuples) {}
|
||||
>g : ({prop}: Tuples) => void
|
||||
>prop : [string, number] | [number, number]
|
||||
>[101, 1234] : [number, number]
|
||||
>101 : number
|
||||
>1234 : number
|
||||
>Tuples : Tuples
|
||||
|
||||
interface StringUnion {
|
||||
>StringUnion : StringUnion
|
||||
|
||||
prop: "foo" | "bar";
|
||||
>prop : "foo" | "bar"
|
||||
}
|
||||
function h({ prop = "baz" }: StringUnion) {}
|
||||
>h : ({prop}: StringUnion) => void
|
||||
>prop : "foo" | "bar" | "baz"
|
||||
>"baz" : "baz"
|
||||
>StringUnion : StringUnion
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
>c : boolean
|
||||
>"foo" : string
|
||||
>101 : number
|
||||
>false : boolean
|
||||
>false : false
|
||||
|
||||
// default parameters
|
||||
((m = 10) => m + 1)(12);
|
||||
|
||||
@@ -21,9 +21,9 @@ x; // number
|
||||
>x : number
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x = true : true
|
||||
>x : string | number | boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
(x = "", obj).foo = (x = x.length);
|
||||
>(x = "", obj).foo = (x = x.length) : number
|
||||
|
||||
@@ -5,11 +5,11 @@ function f(x: string | number | boolean) {
|
||||
|
||||
let y: string | number | boolean = false;
|
||||
>y : string | number | boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
|
||||
let z: string | number | boolean = false;
|
||||
>z : string | number | boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
|
||||
if (y = "", typeof x === "string") {
|
||||
>y = "", typeof x === "string" : boolean
|
||||
@@ -28,7 +28,7 @@ function f(x: string | number | boolean) {
|
||||
>y : string
|
||||
|
||||
z; // boolean
|
||||
>z : boolean
|
||||
>z : false
|
||||
}
|
||||
else if (z = 1, typeof x === "number") {
|
||||
>z = 1, typeof x === "number" : boolean
|
||||
@@ -66,6 +66,6 @@ function f(x: string | number | boolean) {
|
||||
>y : string
|
||||
|
||||
z; // number | boolean
|
||||
>z : number | boolean
|
||||
>z : number | false
|
||||
}
|
||||
|
||||
@@ -155,9 +155,9 @@ function f() {
|
||||
>cond : boolean
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x = true : true
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ function f() {
|
||||
>cond : boolean
|
||||
|
||||
x; // number | boolean | RegExp
|
||||
>x : number | boolean | RegExp
|
||||
>x : number | true | RegExp
|
||||
}
|
||||
function g() {
|
||||
>g : () => void
|
||||
@@ -200,9 +200,9 @@ function g() {
|
||||
>cond : boolean
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x = true : true
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -38,13 +38,13 @@ for (let y in obj) {
|
||||
>cond : boolean
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x = true : true
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
x; // RegExp | string | number | boolean
|
||||
>x : string | number | boolean | RegExp
|
||||
>x : string | number | true | RegExp
|
||||
|
||||
@@ -10,9 +10,9 @@ function a() {
|
||||
>a : () => void
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x = true : true
|
||||
>x : string | number | boolean | RegExp
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
for (x of obj) {
|
||||
>x : string | number | boolean | RegExp
|
||||
@@ -27,6 +27,6 @@ function a() {
|
||||
>toExponential : (fractionDigits?: number) => string
|
||||
}
|
||||
x; // string | boolean
|
||||
>x : string | boolean
|
||||
>x : string | true
|
||||
}
|
||||
|
||||
@@ -108,16 +108,16 @@ function e() {
|
||||
>0 : number
|
||||
>typeof x !== "string" : boolean
|
||||
>typeof x : string
|
||||
>x : string | number | boolean
|
||||
>x : string | number | true
|
||||
>"string" : "string"
|
||||
>x = "" || true : string | boolean
|
||||
>x = "" || true : string | true
|
||||
>x : string | number | boolean | RegExp
|
||||
>"" || true : string | boolean
|
||||
>"" || true : string | true
|
||||
>"" : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
x; // number | boolean
|
||||
>x : number | boolean
|
||||
>x : number | true
|
||||
}
|
||||
}
|
||||
function f() {
|
||||
|
||||
@@ -12,12 +12,12 @@ x = /a/;
|
||||
>/a/ : RegExp
|
||||
|
||||
if (x /* RegExp */, (x = true)) {
|
||||
>x /* RegExp */, (x = true) : boolean
|
||||
>x /* RegExp */, (x = true) : true
|
||||
>x : RegExp
|
||||
>(x = true) : boolean
|
||||
>x = true : boolean
|
||||
>(x = true) : true
|
||||
>x = true : true
|
||||
>x : string | number | boolean | RegExp
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
x; // boolean
|
||||
>x : true
|
||||
@@ -29,7 +29,7 @@ if (x /* RegExp */, (x = true)) {
|
||||
}
|
||||
else {
|
||||
x; // boolean
|
||||
>x : boolean
|
||||
>x : true
|
||||
|
||||
x = 42;
|
||||
>x = 42 : number
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [controlFlowOuterVariable.ts]
|
||||
|
||||
// Repros from #10641
|
||||
|
||||
const CONFIG = {
|
||||
foo: '',
|
||||
setFoo: function(foo: string) {
|
||||
CONFIG.foo = foo;
|
||||
}
|
||||
};
|
||||
|
||||
const helper = function<T>(t: T[]) {
|
||||
helper(t.slice(1));
|
||||
}
|
||||
|
||||
//// [controlFlowOuterVariable.js]
|
||||
// Repros from #10641
|
||||
var CONFIG = {
|
||||
foo: '',
|
||||
setFoo: function (foo) {
|
||||
CONFIG.foo = foo;
|
||||
}
|
||||
};
|
||||
var helper = function (t) {
|
||||
helper(t.slice(1));
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
=== tests/cases/compiler/controlFlowOuterVariable.ts ===
|
||||
|
||||
// Repros from #10641
|
||||
|
||||
const CONFIG = {
|
||||
>CONFIG : Symbol(CONFIG, Decl(controlFlowOuterVariable.ts, 3, 5))
|
||||
|
||||
foo: '',
|
||||
>foo : Symbol(foo, Decl(controlFlowOuterVariable.ts, 3, 16))
|
||||
|
||||
setFoo: function(foo: string) {
|
||||
>setFoo : Symbol(setFoo, Decl(controlFlowOuterVariable.ts, 4, 12))
|
||||
>foo : Symbol(foo, Decl(controlFlowOuterVariable.ts, 5, 21))
|
||||
|
||||
CONFIG.foo = foo;
|
||||
>CONFIG.foo : Symbol(foo, Decl(controlFlowOuterVariable.ts, 3, 16))
|
||||
>CONFIG : Symbol(CONFIG, Decl(controlFlowOuterVariable.ts, 3, 5))
|
||||
>foo : Symbol(foo, Decl(controlFlowOuterVariable.ts, 3, 16))
|
||||
>foo : Symbol(foo, Decl(controlFlowOuterVariable.ts, 5, 21))
|
||||
}
|
||||
};
|
||||
|
||||
const helper = function<T>(t: T[]) {
|
||||
>helper : Symbol(helper, Decl(controlFlowOuterVariable.ts, 10, 5))
|
||||
>T : Symbol(T, Decl(controlFlowOuterVariable.ts, 10, 24))
|
||||
>t : Symbol(t, Decl(controlFlowOuterVariable.ts, 10, 27))
|
||||
>T : Symbol(T, Decl(controlFlowOuterVariable.ts, 10, 24))
|
||||
|
||||
helper(t.slice(1));
|
||||
>helper : Symbol(helper, Decl(controlFlowOuterVariable.ts, 10, 5))
|
||||
>t.slice : Symbol(Array.slice, Decl(lib.d.ts, --, --))
|
||||
>t : Symbol(t, Decl(controlFlowOuterVariable.ts, 10, 27))
|
||||
>slice : Symbol(Array.slice, Decl(lib.d.ts, --, --))
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
=== tests/cases/compiler/controlFlowOuterVariable.ts ===
|
||||
|
||||
// Repros from #10641
|
||||
|
||||
const CONFIG = {
|
||||
>CONFIG : { foo: string; setFoo: (foo: string) => void; }
|
||||
>{ foo: '', setFoo: function(foo: string) { CONFIG.foo = foo; }} : { foo: string; setFoo: (foo: string) => void; }
|
||||
|
||||
foo: '',
|
||||
>foo : string
|
||||
>'' : string
|
||||
|
||||
setFoo: function(foo: string) {
|
||||
>setFoo : (foo: string) => void
|
||||
>function(foo: string) { CONFIG.foo = foo; } : (foo: string) => void
|
||||
>foo : string
|
||||
|
||||
CONFIG.foo = foo;
|
||||
>CONFIG.foo = foo : string
|
||||
>CONFIG.foo : string
|
||||
>CONFIG : { foo: string; setFoo: (foo: string) => void; }
|
||||
>foo : string
|
||||
>foo : string
|
||||
}
|
||||
};
|
||||
|
||||
const helper = function<T>(t: T[]) {
|
||||
>helper : <T>(t: T[]) => void
|
||||
>function<T>(t: T[]) { helper(t.slice(1));} : <T>(t: T[]) => void
|
||||
>T : T
|
||||
>t : T[]
|
||||
>T : T
|
||||
|
||||
helper(t.slice(1));
|
||||
>helper(t.slice(1)) : void
|
||||
>helper : <T>(t: T[]) => void
|
||||
>t.slice(1) : T[]
|
||||
>t.slice : (start?: number | undefined, end?: number | undefined) => T[]
|
||||
>t : T[]
|
||||
>slice : (start?: number | undefined, end?: number | undefined) => T[]
|
||||
>1 : number
|
||||
}
|
||||
@@ -161,9 +161,9 @@ function f() {
|
||||
>cond : true
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x = true : true
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -173,7 +173,7 @@ function f() {
|
||||
>/a/ : RegExp
|
||||
}
|
||||
x; // string | number | boolean | RegExp
|
||||
>x : string | number | boolean | RegExp
|
||||
>x : string | number | true | RegExp
|
||||
}
|
||||
function g() {
|
||||
>g : () => void
|
||||
@@ -205,9 +205,9 @@ function g() {
|
||||
>cond : boolean
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x = true : true
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ export function fooWithTypePredicate(a: any): a is number {
|
||||
>a : any
|
||||
|
||||
return true;
|
||||
>true : boolean
|
||||
>true : true
|
||||
}
|
||||
export function fooWithTypePredicateAndMulitpleParams(a: any, b: any, c: any): a is number {
|
||||
>fooWithTypePredicateAndMulitpleParams : (a: any, b: any, c: any) => a is number
|
||||
@@ -76,7 +76,7 @@ export function fooWithTypePredicateAndMulitpleParams(a: any, b: any, c: any): a
|
||||
>a : any
|
||||
|
||||
return true;
|
||||
>true : boolean
|
||||
>true : true
|
||||
}
|
||||
export function fooWithTypeTypePredicateAndGeneric<T>(a: any): a is T {
|
||||
>fooWithTypeTypePredicateAndGeneric : <T>(a: any) => a is T
|
||||
@@ -86,7 +86,7 @@ export function fooWithTypeTypePredicateAndGeneric<T>(a: any): a is T {
|
||||
>T : T
|
||||
|
||||
return true;
|
||||
>true : boolean
|
||||
>true : true
|
||||
}
|
||||
export function fooWithTypeTypePredicateAndRestParam(a: any, ...rest): a is number {
|
||||
>fooWithTypeTypePredicateAndRestParam : (a: any, ...rest: any[]) => a is number
|
||||
@@ -95,7 +95,7 @@ export function fooWithTypeTypePredicateAndRestParam(a: any, ...rest): a is numb
|
||||
>a : any
|
||||
|
||||
return true;
|
||||
>true : boolean
|
||||
>true : true
|
||||
}
|
||||
|
||||
/** This comment should appear for nonExportedFoo*/
|
||||
|
||||
@@ -33,7 +33,7 @@ function foo5(): boolean {
|
||||
>foo5 : () => boolean
|
||||
|
||||
return true;
|
||||
>true : boolean
|
||||
>true : true
|
||||
}
|
||||
function foo6() {
|
||||
>foo6 : () => boolean
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
//// [tests/cases/compiler/declarationEmitInferedTypeAlias1.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
let obj: Data = true;
|
||||
}
|
||||
export { }
|
||||
|
||||
//// [1.ts]
|
||||
let v = "str" || true;
|
||||
export { v }
|
||||
|
||||
//// [0.js]
|
||||
"use strict";
|
||||
{
|
||||
var obj = true;
|
||||
}
|
||||
//// [1.js]
|
||||
"use strict";
|
||||
var v = "str" || true;
|
||||
exports.v = v;
|
||||
|
||||
|
||||
//// [0.d.ts]
|
||||
export { };
|
||||
//// [1.d.ts]
|
||||
declare let v: string | boolean;
|
||||
export { v };
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
>Data : Symbol(Data, Decl(0.ts, 1, 1))
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Symbol(obj, Decl(0.ts, 3, 7))
|
||||
>Data : Symbol(Data, Decl(0.ts, 1, 1))
|
||||
}
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
let v = "str" || true;
|
||||
>v : Symbol(v, Decl(1.ts, 0, 3))
|
||||
|
||||
export { v }
|
||||
>v : Symbol(v, Decl(1.ts, 1, 8))
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
>Data : Data
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Data
|
||||
>Data : Data
|
||||
>true : true
|
||||
}
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
let v = "str" || true;
|
||||
>v : Data
|
||||
>"str" || true : Data
|
||||
>"str" : string
|
||||
>true : boolean
|
||||
|
||||
export { v }
|
||||
>v : Data
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
//// [tests/cases/compiler/declarationEmitInferedTypeAlias2.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
let obj: Data = true;
|
||||
}
|
||||
export { }
|
||||
|
||||
//// [1.ts]
|
||||
var x = "hi" || 5;
|
||||
export default x;
|
||||
|
||||
//// [0.js]
|
||||
"use strict";
|
||||
{
|
||||
var obj = true;
|
||||
}
|
||||
//// [1.js]
|
||||
"use strict";
|
||||
var x = "hi" || 5;
|
||||
exports.__esModule = true;
|
||||
exports["default"] = x;
|
||||
|
||||
|
||||
//// [0.d.ts]
|
||||
export { };
|
||||
//// [1.d.ts]
|
||||
declare var x: string | number;
|
||||
export default x;
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
>Data : Symbol(Data, Decl(0.ts, 1, 1))
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Symbol(obj, Decl(0.ts, 3, 7))
|
||||
>Data : Symbol(Data, Decl(0.ts, 1, 1))
|
||||
}
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
var x = "hi" || 5;
|
||||
>x : Symbol(x, Decl(1.ts, 0, 3))
|
||||
|
||||
export default x;
|
||||
>x : Symbol(x, Decl(1.ts, 0, 3))
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
>Data : Data
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Data
|
||||
>Data : Data
|
||||
>true : true
|
||||
}
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
var x = "hi" || 5;
|
||||
>x : string | number
|
||||
>"hi" || 5 : string | number
|
||||
>"hi" : string
|
||||
>5 : number
|
||||
|
||||
export default x;
|
||||
>x : string | number
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
//// [tests/cases/compiler/declarationEmitInferedTypeAlias3.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
let obj: Data = true;
|
||||
}
|
||||
export { }
|
||||
|
||||
//// [1.ts]
|
||||
let v = "str" || true;
|
||||
function bar () {
|
||||
return v;
|
||||
}
|
||||
export { v, bar }
|
||||
|
||||
//// [0.js]
|
||||
"use strict";
|
||||
{
|
||||
var obj = true;
|
||||
}
|
||||
//// [1.js]
|
||||
"use strict";
|
||||
var v = "str" || true;
|
||||
exports.v = v;
|
||||
function bar() {
|
||||
return v;
|
||||
}
|
||||
exports.bar = bar;
|
||||
|
||||
|
||||
//// [0.d.ts]
|
||||
export { };
|
||||
//// [1.d.ts]
|
||||
declare let v: string | boolean;
|
||||
declare function bar(): string | boolean;
|
||||
export { v, bar };
|
||||
@@ -0,0 +1,26 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
>Data : Symbol(Data, Decl(0.ts, 1, 1))
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Symbol(obj, Decl(0.ts, 3, 7))
|
||||
>Data : Symbol(Data, Decl(0.ts, 1, 1))
|
||||
}
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
let v = "str" || true;
|
||||
>v : Symbol(v, Decl(1.ts, 0, 3))
|
||||
|
||||
function bar () {
|
||||
>bar : Symbol(bar, Decl(1.ts, 0, 22))
|
||||
|
||||
return v;
|
||||
>v : Symbol(v, Decl(1.ts, 0, 3))
|
||||
}
|
||||
export { v, bar }
|
||||
>v : Symbol(v, Decl(1.ts, 4, 8))
|
||||
>bar : Symbol(bar, Decl(1.ts, 4, 11))
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
{
|
||||
type Data = string | boolean;
|
||||
>Data : Data
|
||||
|
||||
let obj: Data = true;
|
||||
>obj : Data
|
||||
>Data : Data
|
||||
>true : true
|
||||
}
|
||||
export { }
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
let v = "str" || true;
|
||||
>v : Data
|
||||
>"str" || true : Data
|
||||
>"str" : string
|
||||
>true : boolean
|
||||
|
||||
function bar () {
|
||||
>bar : () => Data
|
||||
|
||||
return v;
|
||||
>v : Data
|
||||
}
|
||||
export { v, bar }
|
||||
>v : Data
|
||||
>bar : () => Data
|
||||
|
||||
@@ -5,7 +5,7 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(23,25):
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(24,19): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(28,28): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(29,22): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(56,17): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(58,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string | number', but here has type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,10): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
@@ -17,10 +17,10 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,11):
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,14): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(74,11): error TS2459: Type 'undefined[]' has no property 'a' and no string index signature.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(74,14): error TS2459: Type 'undefined[]' has no property 'b' and no string index signature.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(106,5): error TS2345: Argument of type '[number, [string, { y: boolean; }]]' is not assignable to parameter of type '[number, [string, { x: any; y?: boolean; }]]'.
|
||||
Type '[string, { y: boolean; }]' is not assignable to type '[string, { x: any; y?: boolean; }]'.
|
||||
Type '{ y: boolean; }' is not assignable to type '{ x: any; y?: boolean; }'.
|
||||
Property 'x' is missing in type '{ y: boolean; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(106,5): error TS2345: Argument of type '[number, [string, { y: false; }]]' is not assignable to parameter of type '[number, [string, { x: any; y?: boolean; }]]'.
|
||||
Type '[string, { y: false; }]' is not assignable to type '[string, { x: any; y?: boolean; }]'.
|
||||
Type '{ y: false; }' is not assignable to type '{ x: any; y?: boolean; }'.
|
||||
Property 'x' is missing in type '{ y: false; }'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,6): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
|
||||
@@ -96,10 +96,10 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
|
||||
|
||||
function f7() {
|
||||
var [x = 0, y = 1] = [1, "hello"]; // Error, initializer for y must be string
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
var x: number;
|
||||
var y: string;
|
||||
~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string | number', but here has type 'string'.
|
||||
}
|
||||
|
||||
function f8() {
|
||||
@@ -171,10 +171,10 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
|
||||
f14([2, ["abc", { x: 0 }]]);
|
||||
f14([2, ["abc", { y: false }]]); // Error, no x
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '[number, [string, { y: boolean; }]]' is not assignable to parameter of type '[number, [string, { x: any; y?: boolean; }]]'.
|
||||
!!! error TS2345: Type '[string, { y: boolean; }]' is not assignable to type '[string, { x: any; y?: boolean; }]'.
|
||||
!!! error TS2345: Type '{ y: boolean; }' is not assignable to type '{ x: any; y?: boolean; }'.
|
||||
!!! error TS2345: Property 'x' is missing in type '{ y: boolean; }'.
|
||||
!!! error TS2345: Argument of type '[number, [string, { y: false; }]]' is not assignable to parameter of type '[number, [string, { x: any; y?: boolean; }]]'.
|
||||
!!! error TS2345: Type '[string, { y: false; }]' is not assignable to type '[string, { x: any; y?: boolean; }]'.
|
||||
!!! error TS2345: Type '{ y: false; }' is not assignable to type '{ x: any; y?: boolean; }'.
|
||||
!!! error TS2345: Property 'x' is missing in type '{ y: false; }'.
|
||||
|
||||
module M {
|
||||
export var [a, b] = [1, 2];
|
||||
|
||||
@@ -5,7 +5,7 @@ var BOOLEAN: boolean;
|
||||
|
||||
function foo(): boolean { return true; }
|
||||
>foo : () => boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
@@ -3,7 +3,6 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(4,5): error TS2461: Type 'undefined' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(9,5): error TS2322: Type '[number, number, string]' is not assignable to type '[number, boolean, string]'.
|
||||
Type 'number' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(17,6): error TS2322: Type 'string' is not assignable to type 'Number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(22,5): error TS2322: Type 'number[]' is not assignable to type '[number, number]'.
|
||||
Property '0' is missing in type 'number[]'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(23,5): error TS2322: Type 'number[]' is not assignable to type '[string, string]'.
|
||||
@@ -11,7 +10,7 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
|
||||
tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts(34,5): error TS2461: Type 'F' is not an array type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts (8 errors) ====
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment2.ts (7 errors) ====
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is the type Any, or
|
||||
var [[a0], [[a1]]] = [] // Error
|
||||
@@ -38,8 +37,6 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss
|
||||
return <[number, number, number]>[1, 2, 3];
|
||||
}
|
||||
var [b3 = "string", b4, b5] = bar(); // Error
|
||||
~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'Number'.
|
||||
|
||||
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V,
|
||||
// S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E.
|
||||
|
||||
@@ -69,10 +69,10 @@ function foo(): F {
|
||||
>F : F
|
||||
|
||||
return {
|
||||
>{ 1: true } : { 1: boolean; }
|
||||
>{ 1: true } : { 1: true; }
|
||||
|
||||
1: true
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
};
|
||||
}
|
||||
@@ -82,10 +82,10 @@ function bar(): F {
|
||||
>F : F
|
||||
|
||||
return {
|
||||
>{ 2: true } : { 2: boolean; }
|
||||
>{ 2: true } : { 2: true; }
|
||||
|
||||
2: true
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -69,10 +69,10 @@ function foo(): F {
|
||||
>F : F
|
||||
|
||||
return {
|
||||
>{ 1: true } : { 1: boolean; }
|
||||
>{ 1: true } : { 1: true; }
|
||||
|
||||
1: true
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
};
|
||||
}
|
||||
@@ -82,10 +82,10 @@ function bar(): F {
|
||||
>F : F
|
||||
|
||||
return {
|
||||
>{ 2: true } : { 2: boolean; }
|
||||
>{ 2: true } : { 2: true; }
|
||||
|
||||
2: true
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [["hello"]], true];
|
||||
>a3 : number
|
||||
>a4 : string
|
||||
>a5 : boolean
|
||||
>[1, [["hello"]], true] : [number, [[string]], boolean]
|
||||
>[1, [["hello"]], true] : [number, [[string]], true]
|
||||
>1 : number
|
||||
>[["hello"]] : [[string]]
|
||||
>["hello"] : [string]
|
||||
>"hello" : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
// The type T associated with a destructuring variable declaration is determined as follows:
|
||||
// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression.
|
||||
@@ -52,21 +52,21 @@ var [b2 = 3, b3 = true, b4 = temp] = [3, false, { t1: false, t2: "hello" }];
|
||||
>true : boolean
|
||||
>b4 : { t1: boolean; t2: string; }
|
||||
>temp : { t1: boolean; t2: string; }
|
||||
>[3, false, { t1: false, t2: "hello" }] : [number, boolean, { t1: boolean; t2: string; }]
|
||||
>[3, false, { t1: false, t2: "hello" }] : [number, false, { t1: false; t2: string; }]
|
||||
>3 : number
|
||||
>false : boolean
|
||||
>{ t1: false, t2: "hello" } : { t1: boolean; t2: string; }
|
||||
>t1 : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
>{ t1: false, t2: "hello" } : { t1: false; t2: string; }
|
||||
>t1 : false
|
||||
>false : false
|
||||
>t2 : string
|
||||
>"hello" : string
|
||||
|
||||
var [b5 = 3, b6 = true, b7 = temp] = [undefined, undefined, undefined];
|
||||
>b5 : any
|
||||
>b5 : number
|
||||
>3 : number
|
||||
>b6 : any
|
||||
>b6 : boolean
|
||||
>true : boolean
|
||||
>b7 : any
|
||||
>b7 : { t1: boolean; t2: string; }
|
||||
>temp : { t1: boolean; t2: string; }
|
||||
>[undefined, undefined, undefined] : [undefined, undefined, undefined]
|
||||
>undefined : undefined
|
||||
|
||||
@@ -16,12 +16,12 @@ var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [["hello"]], true];
|
||||
>a3 : number
|
||||
>a4 : string
|
||||
>a5 : boolean
|
||||
>[1, [["hello"]], true] : [number, [[string]], boolean]
|
||||
>[1, [["hello"]], true] : [number, [[string]], true]
|
||||
>1 : number
|
||||
>[["hello"]] : [[string]]
|
||||
>["hello"] : [string]
|
||||
>"hello" : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
// The type T associated with a destructuring variable declaration is determined as follows:
|
||||
// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression.
|
||||
@@ -52,21 +52,21 @@ var [b2 = 3, b3 = true, b4 = temp] = [3, false, { t1: false, t2: "hello" }];
|
||||
>true : boolean
|
||||
>b4 : { t1: boolean; t2: string; }
|
||||
>temp : { t1: boolean; t2: string; }
|
||||
>[3, false, { t1: false, t2: "hello" }] : [number, boolean, { t1: boolean; t2: string; }]
|
||||
>[3, false, { t1: false, t2: "hello" }] : [number, false, { t1: false; t2: string; }]
|
||||
>3 : number
|
||||
>false : boolean
|
||||
>{ t1: false, t2: "hello" } : { t1: boolean; t2: string; }
|
||||
>t1 : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
>{ t1: false, t2: "hello" } : { t1: false; t2: string; }
|
||||
>t1 : false
|
||||
>false : false
|
||||
>t2 : string
|
||||
>"hello" : string
|
||||
|
||||
var [b5 = 3, b6 = true, b7 = temp] = [undefined, undefined, undefined];
|
||||
>b5 : any
|
||||
>b5 : number
|
||||
>3 : number
|
||||
>b6 : any
|
||||
>b6 : boolean
|
||||
>true : boolean
|
||||
>b7 : any
|
||||
>b7 : { t1: boolean; t2: string; }
|
||||
>temp : { t1: boolean; t2: string; }
|
||||
>[undefined, undefined, undefined] : [undefined, undefined, undefined]
|
||||
>undefined : undefined
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(3,5): error TS2322: Type '{ a1: boolean; a2: number; }' is not assignable to type '{ a1: number; a2: string; }'.
|
||||
Types of property 'a1' are incompatible.
|
||||
Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(4,5): error TS2322: Type '[number, [[boolean]], boolean]' is not assignable to type '[number, [[string]], boolean]'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(4,5): error TS2322: Type '[number, [[boolean]], true]' is not assignable to type '[number, [[string]], boolean]'.
|
||||
Type '[[boolean]]' is not assignable to type '[[string]]'.
|
||||
Type '[boolean]' is not assignable to type '[string]'.
|
||||
Type 'boolean' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(9,25): error TS2322: Type '{ t1: boolean; t2: string; }' is not assignable to type '{ t1: boolean; t2: number; }'.
|
||||
Types of property 't2' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(14,16): error TS2459: Type 'number | { c3: number; c5: number; }' has no property 'c3' and no string index signature.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(14,24): error TS2459: Type 'number | { c3: number; c5: number; }' has no property 'c5' and no string index signature.
|
||||
tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(19,10): error TS2322: Type 'string[]' is not assignable to type 'number[]'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts (6 errors) ====
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts (4 errors) ====
|
||||
// The type T associated with a destructuring variable declaration is determined as follows:
|
||||
// If the declaration includes a type annotation, T is that type.
|
||||
var {a1, a2}: { a1: number, a2: string } = { a1: true, a2: 1 } // Error
|
||||
@@ -24,7 +19,7 @@ tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(1
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [[false]], true]; // Error
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '[number, [[boolean]], boolean]' is not assignable to type '[number, [[string]], boolean]'.
|
||||
!!! error TS2322: Type '[number, [[boolean]], true]' is not assignable to type '[number, [[string]], boolean]'.
|
||||
!!! error TS2322: Type '[[boolean]]' is not assignable to type '[[string]]'.
|
||||
!!! error TS2322: Type '[boolean]' is not assignable to type '[string]'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
|
||||
@@ -33,10 +28,6 @@ tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(1
|
||||
// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression.
|
||||
var temp = { t1: true, t2: "false" };
|
||||
var [b0 = 3, b1 = true, b2 = temp] = [3, false, { t1: false, t2: 5}]; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '{ t1: boolean; t2: string; }' is not assignable to type '{ t1: boolean; t2: number; }'.
|
||||
!!! error TS2322: Types of property 't2' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
// The type T associated with a binding element is determined as follows:
|
||||
// If the binding element is a rest element, T is an array type with
|
||||
@@ -50,7 +41,4 @@ tests/cases/conformance/es6/destructuring/destructuringVariableDeclaration2.ts(1
|
||||
// When a destructuring variable declaration, binding property, or binding element specifies
|
||||
// an initializer expression, the type of the initializer expression is required to be assignable
|
||||
// to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element.
|
||||
var {d: {d1 = ["string", null]}}: { d: { d1: number[] } } = { d: { d1: [1, 2] } }; // Error
|
||||
~~
|
||||
!!! error TS2322: Type 'string[]' is not assignable to type 'number[]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
var {d: {d1 = ["string", null]}}: { d: { d1: number[] } } = { d: { d1: [1, 2] } }; // Error
|
||||
@@ -31,12 +31,12 @@ function foo(func: () => boolean) { }
|
||||
foo(() => true);
|
||||
>foo(() => true) : void
|
||||
>foo : (func: () => boolean) => void
|
||||
>() => true : () => boolean
|
||||
>true : boolean
|
||||
>() => true : () => true
|
||||
>true : true
|
||||
|
||||
foo(() => { return false; });
|
||||
>foo(() => { return false; }) : void
|
||||
>foo : (func: () => boolean) => void
|
||||
>() => { return false; } : () => boolean
|
||||
>false : boolean
|
||||
>() => { return false; } : () => false
|
||||
>false : false
|
||||
|
||||
@@ -31,14 +31,14 @@ function foo(func: () => boolean) { }
|
||||
foo(() => true);
|
||||
>foo(() => true) : void
|
||||
>foo : (func: () => boolean) => void
|
||||
>() => true : () => boolean
|
||||
>true : boolean
|
||||
>() => true : () => true
|
||||
>true : true
|
||||
|
||||
foo(() => { return false; });
|
||||
>foo(() => { return false; }) : void
|
||||
>foo : (func: () => boolean) => void
|
||||
>() => { return false; } : () => boolean
|
||||
>false : boolean
|
||||
>() => { return false; } : () => false
|
||||
>false : false
|
||||
|
||||
// Binding patterns in arrow functions
|
||||
var p1 = ([a]) => { };
|
||||
|
||||
@@ -32,7 +32,7 @@ function foo(func: () => boolean) { }
|
||||
foo(() => {
|
||||
>foo(() => { this.age = 100; return true;}) : void
|
||||
>foo : (func: () => boolean) => void
|
||||
>() => { this.age = 100; return true;} : () => boolean
|
||||
>() => { this.age = 100; return true;} : () => true
|
||||
|
||||
this.age = 100;
|
||||
>this.age = 100 : number
|
||||
@@ -42,7 +42,7 @@ foo(() => {
|
||||
>100 : number
|
||||
|
||||
return true;
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
});
|
||||
|
||||
@@ -32,7 +32,7 @@ function foo(func: () => boolean){ }
|
||||
foo(() => {
|
||||
>foo(() => { this.age = 100; return true;}) : void
|
||||
>foo : (func: () => boolean) => void
|
||||
>() => { this.age = 100; return true;} : () => boolean
|
||||
>() => { this.age = 100; return true;} : () => true
|
||||
|
||||
this.age = 100;
|
||||
>this.age = 100 : number
|
||||
@@ -42,7 +42,7 @@ foo(() => {
|
||||
>100 : number
|
||||
|
||||
return true;
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ class D {
|
||||
static ["computedname6"](a: string): boolean { return true; }
|
||||
>"computedname6" : string
|
||||
>a : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
static staticMethod() {
|
||||
>staticMethod : () => number
|
||||
|
||||
@@ -33,7 +33,7 @@ class E extends D{
|
||||
|
||||
z: boolean = true;
|
||||
>z : boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
}
|
||||
|
||||
class F extends D{
|
||||
@@ -42,7 +42,7 @@ class F extends D{
|
||||
|
||||
z: boolean = true;
|
||||
>z : boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
j: string;
|
||||
>j : string
|
||||
|
||||
@@ -238,9 +238,9 @@ class testClass {
|
||||
>'string' : string
|
||||
|
||||
arg\u0033 = true;
|
||||
>arg\u0033 = true : boolean
|
||||
>arg\u0033 = true : true
|
||||
>arg\u0033 : boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
arg4 = 2;
|
||||
>arg4 = 2 : number
|
||||
@@ -266,7 +266,7 @@ var constructorTestObject = new constructorTestClass(1, 'string', true, 2);
|
||||
>constructorTestClass : typeof constructorTestClass
|
||||
>1 : number
|
||||
>'string' : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
>2 : number
|
||||
|
||||
constructorTestObject.arg\u0031 = 1;
|
||||
@@ -284,11 +284,11 @@ constructorTestObject.arg2 = 'string';
|
||||
>'string' : string
|
||||
|
||||
constructorTestObject.arg\u0033 = true;
|
||||
>constructorTestObject.arg\u0033 = true : boolean
|
||||
>constructorTestObject.arg\u0033 = true : true
|
||||
>constructorTestObject.arg\u0033 : boolean
|
||||
>constructorTestObject : constructorTestClass
|
||||
>arg\u0033 : boolean
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
constructorTestObject.arg4 = 2;
|
||||
>constructorTestObject.arg4 = 2 : number
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,9 +1,9 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of36.ts ===
|
||||
var tuple: [string, boolean] = ["", true];
|
||||
>tuple : [string, boolean]
|
||||
>["", true] : [string, boolean]
|
||||
>["", true] : [string, true]
|
||||
>"" : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
for (var v of tuple) {
|
||||
>v : string | boolean
|
||||
|
||||
@@ -3,10 +3,10 @@ var map = new Map([["", true]]);
|
||||
>map : Map<string, boolean>
|
||||
>new Map([["", true]]) : Map<string, boolean>
|
||||
>Map : MapConstructor
|
||||
>[["", true]] : [string, boolean][]
|
||||
>["", true] : [string, boolean]
|
||||
>[["", true]] : [string, true][]
|
||||
>["", true] : [string, true]
|
||||
>"" : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
for (var v of map) {
|
||||
>v : [string, boolean]
|
||||
|
||||
@@ -3,10 +3,10 @@ var map = new Map([["", true]]);
|
||||
>map : Map<string, boolean>
|
||||
>new Map([["", true]]) : Map<string, boolean>
|
||||
>Map : MapConstructor
|
||||
>[["", true]] : [string, boolean][]
|
||||
>["", true] : [string, boolean]
|
||||
>[["", true]] : [string, true][]
|
||||
>["", true] : [string, true]
|
||||
>"" : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
for (var [k, v] of map) {
|
||||
>k : string
|
||||
|
||||
@@ -3,10 +3,10 @@ var map = new Map([["", true]]);
|
||||
>map : Map<string, boolean>
|
||||
>new Map([["", true]]) : Map<string, boolean>
|
||||
>Map : MapConstructor
|
||||
>[["", true]] : [string, boolean][]
|
||||
>["", true] : [string, boolean]
|
||||
>[["", true]] : [string, true][]
|
||||
>["", true] : [string, true]
|
||||
>"" : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
for (var [k = "", v = false] of map) {
|
||||
>k : string
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of43.ts(2,25): error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/for-ofStatements/for-of43.ts (1 errors) ====
|
||||
var array = [{ x: "", y: 0 }]
|
||||
for (var {x: a = "", y: b = true} of array) {
|
||||
~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
a;
|
||||
b;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of43.ts ===
|
||||
var array = [{ x: "", y: 0 }]
|
||||
>array : Symbol(array, Decl(for-of43.ts, 0, 3))
|
||||
>x : Symbol(x, Decl(for-of43.ts, 0, 14))
|
||||
>y : Symbol(y, Decl(for-of43.ts, 0, 21))
|
||||
|
||||
for (var {x: a = "", y: b = true} of array) {
|
||||
>x : Symbol(x, Decl(for-of43.ts, 0, 14))
|
||||
>a : Symbol(a, Decl(for-of43.ts, 1, 10))
|
||||
>y : Symbol(y, Decl(for-of43.ts, 0, 21))
|
||||
>b : Symbol(b, Decl(for-of43.ts, 1, 20))
|
||||
>array : Symbol(array, Decl(for-of43.ts, 0, 3))
|
||||
|
||||
a;
|
||||
>a : Symbol(a, Decl(for-of43.ts, 1, 10))
|
||||
|
||||
b;
|
||||
>b : Symbol(b, Decl(for-of43.ts, 1, 20))
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of43.ts ===
|
||||
var array = [{ x: "", y: 0 }]
|
||||
>array : { x: string; y: number; }[]
|
||||
>[{ x: "", y: 0 }] : { x: string; y: number; }[]
|
||||
>{ x: "", y: 0 } : { x: string; y: number; }
|
||||
>x : string
|
||||
>"" : string
|
||||
>y : number
|
||||
>0 : number
|
||||
|
||||
for (var {x: a = "", y: b = true} of array) {
|
||||
>x : any
|
||||
>a : string
|
||||
>"" : string
|
||||
>y : any
|
||||
>b : number | boolean
|
||||
>true : boolean
|
||||
>array : { x: string; y: number; }[]
|
||||
|
||||
a;
|
||||
>a : string
|
||||
|
||||
b;
|
||||
>b : number | boolean
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
=== tests/cases/conformance/es6/for-ofStatements/for-of44.ts ===
|
||||
var array: [number, string | boolean | symbol][] = [[0, ""], [0, true], [1, Symbol()]]
|
||||
>array : [number, string | boolean | symbol][]
|
||||
>[[0, ""], [0, true], [1, Symbol()]] : ([number, string] | [number, boolean] | [number, symbol])[]
|
||||
>[[0, ""], [0, true], [1, Symbol()]] : ([number, string] | [number, true] | [number, symbol])[]
|
||||
>[0, ""] : [number, string]
|
||||
>0 : number
|
||||
>"" : string
|
||||
>[0, true] : [number, boolean]
|
||||
>[0, true] : [number, true]
|
||||
>0 : number
|
||||
>true : boolean
|
||||
>true : true
|
||||
>[1, Symbol()] : [number, symbol]
|
||||
>1 : number
|
||||
>Symbol() : symbol
|
||||
|
||||
@@ -7,19 +7,19 @@ var map = new Map([["", true]]);
|
||||
>map : Map<string, boolean>
|
||||
>new Map([["", true]]) : Map<string, boolean>
|
||||
>Map : MapConstructor
|
||||
>[["", true]] : [string, boolean][]
|
||||
>["", true] : [string, boolean]
|
||||
>[["", true]] : [string, true][]
|
||||
>["", true] : [string, true]
|
||||
>"" : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
for ([k = "", v = false] of map) {
|
||||
>[k = "", v = false] : [string, boolean]
|
||||
>[k = "", v = false] : [string, false]
|
||||
>k = "" : string
|
||||
>k : string
|
||||
>"" : string
|
||||
>v = false : boolean
|
||||
>v = false : false
|
||||
>v : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
>map : Map<string, boolean>
|
||||
|
||||
k;
|
||||
|
||||
@@ -3,10 +3,10 @@ var map = new Map([["", true]]);
|
||||
>map : Map<string, boolean>
|
||||
>new Map([["", true]]) : Map<string, boolean>
|
||||
>Map : MapConstructor
|
||||
>[["", true]] : [string, boolean][]
|
||||
>["", true] : [string, boolean]
|
||||
>[["", true]] : [string, true][]
|
||||
>["", true] : [string, true]
|
||||
>"" : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
for (const [k, v] of map) {
|
||||
>k : string
|
||||
|
||||
@@ -19,8 +19,8 @@ var x = foo([{a:true}]);
|
||||
>x : number
|
||||
>foo([{a:true}]) : number
|
||||
>foo : { (bar: { a: number; }[]): string; (bar: { a: boolean; }[]): number; }
|
||||
>[{a:true}] : { a: boolean; }[]
|
||||
>{a:true} : { a: boolean; }
|
||||
>a : boolean
|
||||
>true : boolean
|
||||
>[{a:true}] : { a: true; }[]
|
||||
>{a:true} : { a: true; }
|
||||
>a : true
|
||||
>true : true
|
||||
|
||||
@@ -49,8 +49,8 @@ _.all([true, 1, null, 'yes'], _.identity);
|
||||
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => boolean
|
||||
>_ : Underscore.Static
|
||||
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => boolean
|
||||
>[true, 1, null, 'yes'] : (string | number | boolean)[]
|
||||
>true : boolean
|
||||
>[true, 1, null, 'yes'] : (string | number | true)[]
|
||||
>true : true
|
||||
>1 : number
|
||||
>null : null
|
||||
>'yes' : string
|
||||
@@ -64,8 +64,8 @@ _.all([true], _.identity);
|
||||
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => boolean
|
||||
>_ : Underscore.Static
|
||||
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => boolean
|
||||
>[true] : boolean[]
|
||||
>true : boolean
|
||||
>[true] : true[]
|
||||
>true : true
|
||||
>_.identity : <T>(value: T) => T
|
||||
>_ : Underscore.Static
|
||||
>identity : <T>(value: T) => T
|
||||
|
||||
@@ -202,7 +202,7 @@ var r6 = c.foo3(true, 1); // boolean
|
||||
>c.foo3 : <T>(t: T, u: number) => T
|
||||
>c : C<string, number>
|
||||
>foo3 : <T>(t: T, u: number) => T
|
||||
>true : boolean
|
||||
>true : true
|
||||
>1 : number
|
||||
|
||||
var r7 = c.foo4('', true); // string
|
||||
@@ -212,7 +212,7 @@ var r7 = c.foo4('', true); // string
|
||||
>c : C<string, number>
|
||||
>foo4 : <U>(t: string, u: U) => string
|
||||
>'' : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
var r8 = c.foo5(true, 1); // boolean
|
||||
>r8 : boolean
|
||||
@@ -220,7 +220,7 @@ var r8 = c.foo5(true, 1); // boolean
|
||||
>c.foo5 : <T, U>(t: T, u: U) => T
|
||||
>c : C<string, number>
|
||||
>foo5 : <T, U>(t: T, u: U) => T
|
||||
>true : boolean
|
||||
>true : true
|
||||
>1 : number
|
||||
|
||||
var r9 = c.foo6(); // {}
|
||||
@@ -349,7 +349,7 @@ var r6 = i.foo3(true, 1); // boolean
|
||||
>i.foo3 : <T>(t: T, u: number) => T
|
||||
>i : I<string, number>
|
||||
>foo3 : <T>(t: T, u: number) => T
|
||||
>true : boolean
|
||||
>true : true
|
||||
>1 : number
|
||||
|
||||
var r7 = i.foo4('', true); // string
|
||||
@@ -359,7 +359,7 @@ var r7 = i.foo4('', true); // string
|
||||
>i : I<string, number>
|
||||
>foo4 : <U>(t: string, u: U) => string
|
||||
>'' : string
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
var r8 = i.foo5(true, 1); // boolean
|
||||
>r8 : boolean
|
||||
@@ -367,7 +367,7 @@ var r8 = i.foo5(true, 1); // boolean
|
||||
>i.foo5 : <T, U>(t: T, u: U) => T
|
||||
>i : I<string, number>
|
||||
>foo5 : <T, U>(t: T, u: U) => T
|
||||
>true : boolean
|
||||
>true : true
|
||||
>1 : number
|
||||
|
||||
var r9 = i.foo6(); // {}
|
||||
|
||||
@@ -175,11 +175,11 @@ module Editor {
|
||||
>T : T
|
||||
|
||||
entry.isHead = false;
|
||||
>entry.isHead = false : boolean
|
||||
>entry.isHead = false : false
|
||||
>entry.isHead : boolean
|
||||
>entry : List<T>
|
||||
>isHead : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
|
||||
entry.next = this.next;
|
||||
>entry.next = this.next : List<T>
|
||||
@@ -237,11 +237,11 @@ module Editor {
|
||||
>data : T
|
||||
|
||||
entry.isHead = false;
|
||||
>entry.isHead = false : boolean
|
||||
>entry.isHead = false : false
|
||||
>entry.isHead : boolean
|
||||
>entry : List<T>
|
||||
>isHead : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
|
||||
entry.next = this.next;
|
||||
>entry.next = this.next : List<T>
|
||||
@@ -317,11 +317,11 @@ module Editor {
|
||||
>T : T
|
||||
|
||||
entry.isHead = false;
|
||||
>entry.isHead = false : boolean
|
||||
>entry.isHead = false : false
|
||||
>entry.isHead : boolean
|
||||
>entry : List<T>
|
||||
>isHead : boolean
|
||||
>false : boolean
|
||||
>false : false
|
||||
|
||||
this.prev.next = entry;
|
||||
>this.prev.next = entry : List<T>
|
||||
@@ -501,7 +501,7 @@ module Editor {
|
||||
>new List<T>(true, null) : List<T>
|
||||
>List : typeof List
|
||||
>T : T
|
||||
>true : boolean
|
||||
>true : true
|
||||
>null : null
|
||||
|
||||
entry.prev = entry;
|
||||
@@ -537,7 +537,7 @@ module Editor {
|
||||
>new List<T>(false, data) : List<T>
|
||||
>List : typeof List
|
||||
>T : T
|
||||
>false : boolean
|
||||
>false : false
|
||||
>data : T
|
||||
|
||||
entry.prev = entry;
|
||||
|
||||
@@ -47,8 +47,8 @@ var r = _.all([true, 1, null, 'yes'], _.identity);
|
||||
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
||||
>_ : Underscore.Static
|
||||
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
||||
>[true, 1, null, 'yes'] : (string | number | boolean)[]
|
||||
>true : boolean
|
||||
>[true, 1, null, 'yes'] : (string | number | true)[]
|
||||
>true : true
|
||||
>1 : number
|
||||
>null : null
|
||||
>'yes' : string
|
||||
@@ -62,8 +62,8 @@ var r2 = _.all([true], _.identity);
|
||||
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
||||
>_ : Underscore.Static
|
||||
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
||||
>[true] : boolean[]
|
||||
>true : boolean
|
||||
>[true] : true[]
|
||||
>true : true
|
||||
>_.identity : <T>(value: T) => T
|
||||
>_ : Underscore.Static
|
||||
>identity : <T>(value: T) => T
|
||||
|
||||
@@ -18,5 +18,5 @@ var x: B<boolean>;
|
||||
x(true); // was error
|
||||
>x(true) : void
|
||||
>x : B<boolean>
|
||||
>true : boolean
|
||||
>true : true
|
||||
|
||||
@@ -16,8 +16,8 @@ Object.defineProperty({}, "0", <PropertyDescriptor>({
|
||||
>"0" : string
|
||||
><PropertyDescriptor>({ get: getFunc, set: setFunc, configurable: true }) : PropertyDescriptor
|
||||
>PropertyDescriptor : PropertyDescriptor
|
||||
>({ get: getFunc, set: setFunc, configurable: true }) : { get: () => any; set: (v: any) => void; configurable: boolean; }
|
||||
>{ get: getFunc, set: setFunc, configurable: true } : { get: () => any; set: (v: any) => void; configurable: boolean; }
|
||||
>({ get: getFunc, set: setFunc, configurable: true }) : { get: () => any; set: (v: any) => void; configurable: true; }
|
||||
>{ get: getFunc, set: setFunc, configurable: true } : { get: () => any; set: (v: any) => void; configurable: true; }
|
||||
|
||||
get: getFunc,
|
||||
>get : () => any
|
||||
@@ -28,8 +28,8 @@ Object.defineProperty({}, "0", <PropertyDescriptor>({
|
||||
>setFunc : (v: any) => void
|
||||
|
||||
configurable: true
|
||||
>configurable : boolean
|
||||
>true : boolean
|
||||
>configurable : true
|
||||
>true : true
|
||||
|
||||
}));
|
||||
|
||||
@@ -21,8 +21,8 @@ var unionTuple1: [number, string| number] = [10, "foo"];
|
||||
|
||||
var unionTuple2: [boolean, string| number] = [true, "foo"];
|
||||
>unionTuple2 : [boolean, string | number]
|
||||
>[true, "foo"] : [boolean, string]
|
||||
>true : boolean
|
||||
>[true, "foo"] : [true, string]
|
||||
>true : true
|
||||
>"foo" : string
|
||||
|
||||
// no error
|
||||
|
||||
@@ -34,31 +34,31 @@ class Bug {
|
||||
>{} : {}
|
||||
|
||||
this.values['comments'] = { italic: true };
|
||||
>this.values['comments'] = { italic: true } : { italic: boolean; }
|
||||
>this.values['comments'] = { italic: true } : { italic: true; }
|
||||
>this.values['comments'] : IOptions
|
||||
>this.values : IMap
|
||||
>this : this
|
||||
>values : IMap
|
||||
>'comments' : string
|
||||
>{ italic: true } : { italic: boolean; }
|
||||
>italic : boolean
|
||||
>true : boolean
|
||||
>{ italic: true } : { italic: true; }
|
||||
>italic : true
|
||||
>true : true
|
||||
}
|
||||
shouldBeOK() {
|
||||
>shouldBeOK : () => void
|
||||
|
||||
this.values = {
|
||||
>this.values = { comments: { italic: true } } : { comments: { italic: boolean; }; }
|
||||
>this.values = { comments: { italic: true } } : { comments: { italic: true; }; }
|
||||
>this.values : IMap
|
||||
>this : this
|
||||
>values : IMap
|
||||
>{ comments: { italic: true } } : { comments: { italic: boolean; }; }
|
||||
>{ comments: { italic: true } } : { comments: { italic: true; }; }
|
||||
|
||||
comments: { italic: true }
|
||||
>comments : { italic: boolean; }
|
||||
>{ italic: true } : { italic: boolean; }
|
||||
>italic : boolean
|
||||
>true : boolean
|
||||
>comments : { italic: true; }
|
||||
>{ italic: true } : { italic: true; }
|
||||
>italic : true
|
||||
>true : true
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ interface Foo {
|
||||
var a: Foo = {
|
||||
>a : Foo
|
||||
>Foo : Foo
|
||||
>{ a: 1, b: '', c: true, d: {}, e: null , f: [1], g: {}, h: (x: number) => 1, i: <T>(x: T) => x, j: <Foo>null, k: new C(), l: f1, m: M, n: {}, o: E.A} : { a: number; b: string; c: boolean; d: {}; e: null; f: number[]; g: {}; h: (x: number) => number; i: <T>(x: T) => T; j: Foo; k: C; l: () => void; m: typeof M; n: {}; o: E; }
|
||||
>{ a: 1, b: '', c: true, d: {}, e: null , f: [1], g: {}, h: (x: number) => 1, i: <T>(x: T) => x, j: <Foo>null, k: new C(), l: f1, m: M, n: {}, o: E.A} : { a: number; b: string; c: true; d: {}; e: null; f: number[]; g: {}; h: (x: number) => number; i: <T>(x: T) => T; j: Foo; k: C; l: () => void; m: typeof M; n: {}; o: E; }
|
||||
|
||||
a: 1,
|
||||
>a : number
|
||||
@@ -91,8 +91,8 @@ var a: Foo = {
|
||||
>'' : string
|
||||
|
||||
c: true,
|
||||
>c : boolean
|
||||
>true : boolean
|
||||
>c : true
|
||||
>true : true
|
||||
|
||||
d: {},
|
||||
>d : {}
|
||||
|
||||
Loaded 100 of 161 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user