@@ -13316,6 +13316,7 @@ var ts;
1331613316 var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
1331713317 var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false);
1331813318 var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false);
13319+ var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false);
1331913320 var enumNumberIndexInfo = createIndexInfo(stringType, true);
1332013321 var globals = ts.createMap();
1332113322 var patternAmbientModules;
@@ -15483,7 +15484,9 @@ var ts;
1548315484 if (strictNullChecks && declaration.initializer && !(getFalsyFlags(checkExpressionCached(declaration.initializer)) & 2048)) {
1548415485 type = getTypeWithFacts(type, 131072);
1548515486 }
15486- return type;
15487+ return declaration.initializer ?
15488+ getUnionType([type, checkExpressionCached(declaration.initializer)], true) :
15489+ type;
1548715490 }
1548815491 function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) {
1548915492 var jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration);
@@ -20336,13 +20339,14 @@ var ts;
2033620339 var isParameter = ts.getRootDeclaration(declaration).kind === 142;
2033720340 var declarationContainer = getControlFlowContainer(declaration);
2033820341 var flowContainer = getControlFlowContainer(node);
20342+ var isOuterVariable = flowContainer !== declarationContainer;
2033920343 while (flowContainer !== declarationContainer &&
2034020344 (flowContainer.kind === 179 || flowContainer.kind === 180) &&
2034120345 (isReadonlySymbol(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
2034220346 flowContainer = getControlFlowContainer(flowContainer);
2034320347 }
2034420348 var assumeInitialized = !strictNullChecks || (type.flags & 1) !== 0 || isParameter ||
20345- flowContainer !== declarationContainer || ts.isInAmbientContext(declaration);
20349+ isOuterVariable || ts.isInAmbientContext(declaration);
2034620350 var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer);
2034720351 if (!assumeInitialized && !(getFalsyFlags(type) & 2048) && getFalsyFlags(flowType) & 2048) {
2034820352 error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
@@ -22572,16 +22576,16 @@ var ts;
2257222576 function getResolvedSignature(node, candidatesOutArray) {
2257322577 var links = getNodeLinks(node);
2257422578 var cached = links.resolvedSignature;
22575- if (cached && cached !== anySignature && !candidatesOutArray) {
22579+ if (cached && cached !== resolvingSignature && !candidatesOutArray) {
2257622580 return cached;
2257722581 }
22578- links.resolvedSignature = anySignature ;
22582+ links.resolvedSignature = resolvingSignature ;
2257922583 var result = resolveSignature(node, candidatesOutArray);
2258022584 links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;
2258122585 return result;
2258222586 }
2258322587 function getResolvedOrAnySignature(node) {
22584- return getNodeLinks(node).resolvedSignature === anySignature ? anySignature : getResolvedSignature(node);
22588+ return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node);
2258522589 }
2258622590 function getInferredClassType(symbol) {
2258722591 var links = getSymbolLinks(symbol);
@@ -23533,7 +23537,7 @@ var ts;
2353323537 return maybeTypeOfKind(contextualType, (64 | 256));
2353423538 }
2353523539 if (type.flags & 8) {
23536- return maybeTypeOfKind(contextualType, 128) && !isTypeAssignableTo(booleanType, contextualType) ;
23540+ return maybeTypeOfKind(contextualType, 128);
2353723541 }
2353823542 if (type.flags & 16) {
2353923543 return typeContainsLiteralFromEnum(contextualType, type);
@@ -36535,7 +36539,6 @@ var ts;
3653536539(function (ts) {
3653636540 ts.version = "2.0.2";
3653736541 var emptyArray = [];
36538- var defaultTypeRoots = ["node_modules/@types"];
3653936542 function findConfigFile(searchPath, fileExists) {
3654036543 while (true) {
3654136544 var fileName = ts.combinePaths(searchPath, "tsconfig.json");
@@ -36668,11 +36671,27 @@ var ts;
3666836671 else if (host.getCurrentDirectory) {
3666936672 currentDirectory = host.getCurrentDirectory();
3667036673 }
36671- if (!currentDirectory) {
36672- return undefined;
36674+ return currentDirectory && getDefaultTypeRoots(currentDirectory, host);
36675+ }
36676+ function getDefaultTypeRoots(currentDirectory, host) {
36677+ if (!host.directoryExists) {
36678+ return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];
36679+ }
36680+ var typeRoots;
36681+ while (true) {
36682+ var atTypes = ts.combinePaths(currentDirectory, nodeModulesAtTypes);
36683+ if (host.directoryExists(atTypes)) {
36684+ (typeRoots || (typeRoots = [])).push(atTypes);
36685+ }
36686+ var parent_15 = ts.getDirectoryPath(currentDirectory);
36687+ if (parent_15 === currentDirectory) {
36688+ break;
36689+ }
36690+ currentDirectory = parent_15;
3667336691 }
36674- return ts.map(defaultTypeRoots, function (d) { return ts.combinePaths(currentDirectory, d); }) ;
36692+ return typeRoots ;
3667536693 }
36694+ var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types");
3667636695 function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) {
3667736696 var traceEnabled = isTraceEnabled(options, host);
3667836697 var moduleResolutionState = {
0 commit comments