Skip to content

Commit b8759b3

Browse files
committed
Update LKG
1 parent 9986f81 commit b8759b3

6 files changed

Lines changed: 48 additions & 33 deletions

File tree

lib/tsc.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4271,10 +4271,13 @@ var ts;
42714271
(node.name.kind === 9 || isGlobalScopeAugmentation(node));
42724272
}
42734273
ts.isAmbientModule = isAmbientModule;
4274+
function isShorthandAmbientModuleSymbol(moduleSymbol) {
4275+
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
4276+
}
4277+
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
42744278
function isShorthandAmbientModule(node) {
42754279
return node.kind === 225 && (!node.body);
42764280
}
4277-
ts.isShorthandAmbientModule = isShorthandAmbientModule;
42784281
function isBlockScopedContainerTopLevel(node) {
42794282
return node.kind === 256 ||
42804283
node.kind === 225 ||
@@ -13944,7 +13947,7 @@ var ts;
1394413947
function getTargetOfImportClause(node) {
1394513948
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
1394613949
if (moduleSymbol) {
13947-
var exportDefaultSymbol = ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration) ?
13950+
var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?
1394813951
moduleSymbol :
1394913952
moduleSymbol.exports["export="] ?
1395013953
getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") :
@@ -13999,7 +14002,7 @@ var ts;
1399914002
if (targetSymbol) {
1400014003
var name_10 = specifier.propertyName || specifier.name;
1400114004
if (name_10.text) {
14002-
if (ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration)) {
14005+
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
1400314006
return moduleSymbol;
1400414007
}
1400514008
var symbolFromVariable = void 0;
@@ -15774,7 +15777,7 @@ var ts;
1577415777
function getTypeOfFuncClassEnumModule(symbol) {
1577515778
var links = getSymbolLinks(symbol);
1577615779
if (!links.type) {
15777-
if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModule(symbol.valueDeclaration)) {
15780+
if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModuleSymbol(symbol)) {
1577815781
links.type = anyType;
1577915782
}
1578015783
else {
@@ -20167,7 +20170,7 @@ var ts;
2016720170
}
2016820171
}
2016920172
var targetType = type.flags & 16384 ? getApparentType(type) : type;
20170-
return isTypeSubtypeOf(candidate, targetType) ? candidate :
20173+
return isTypeSubtypeOf(candidate, type) ? candidate :
2017120174
isTypeAssignableTo(type, candidate) ? type :
2017220175
isTypeAssignableTo(candidate, targetType) ? candidate :
2017320176
getIntersectionType([type, candidate]);
@@ -27123,7 +27126,7 @@ var ts;
2712327126
}
2712427127
function moduleExportsSomeValue(moduleReferenceExpression) {
2712527128
var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
27126-
if (!moduleSymbol) {
27129+
if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
2712727130
return true;
2712827131
}
2712927132
var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);

lib/tsserver.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5267,10 +5267,13 @@ var ts;
52675267
(node.name.kind === 9 || isGlobalScopeAugmentation(node));
52685268
}
52695269
ts.isAmbientModule = isAmbientModule;
5270+
function isShorthandAmbientModuleSymbol(moduleSymbol) {
5271+
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
5272+
}
5273+
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
52705274
function isShorthandAmbientModule(node) {
52715275
return node.kind === 225 && (!node.body);
52725276
}
5273-
ts.isShorthandAmbientModule = isShorthandAmbientModule;
52745277
function isBlockScopedContainerTopLevel(node) {
52755278
return node.kind === 256 ||
52765279
node.kind === 225 ||
@@ -14940,7 +14943,7 @@ var ts;
1494014943
function getTargetOfImportClause(node) {
1494114944
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
1494214945
if (moduleSymbol) {
14943-
var exportDefaultSymbol = ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration) ?
14946+
var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?
1494414947
moduleSymbol :
1494514948
moduleSymbol.exports["export="] ?
1494614949
getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") :
@@ -14995,7 +14998,7 @@ var ts;
1499514998
if (targetSymbol) {
1499614999
var name_12 = specifier.propertyName || specifier.name;
1499715000
if (name_12.text) {
14998-
if (ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration)) {
15001+
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
1499915002
return moduleSymbol;
1500015003
}
1500115004
var symbolFromVariable = void 0;
@@ -16770,7 +16773,7 @@ var ts;
1677016773
function getTypeOfFuncClassEnumModule(symbol) {
1677116774
var links = getSymbolLinks(symbol);
1677216775
if (!links.type) {
16773-
if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModule(symbol.valueDeclaration)) {
16776+
if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModuleSymbol(symbol)) {
1677416777
links.type = anyType;
1677516778
}
1677616779
else {
@@ -21163,7 +21166,7 @@ var ts;
2116321166
}
2116421167
}
2116521168
var targetType = type.flags & 16384 ? getApparentType(type) : type;
21166-
return isTypeSubtypeOf(candidate, targetType) ? candidate :
21169+
return isTypeSubtypeOf(candidate, type) ? candidate :
2116721170
isTypeAssignableTo(type, candidate) ? type :
2116821171
isTypeAssignableTo(candidate, targetType) ? candidate :
2116921172
getIntersectionType([type, candidate]);
@@ -28119,7 +28122,7 @@ var ts;
2811928122
}
2812028123
function moduleExportsSomeValue(moduleReferenceExpression) {
2812128124
var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
28122-
if (!moduleSymbol) {
28125+
if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
2812328126
return true;
2812428127
}
2812528128
var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);

lib/tsserverlibrary.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7043,7 +7043,7 @@ declare namespace ts {
70437043
function makeIdentifierFromModuleName(moduleName: string): string;
70447044
function isBlockOrCatchScoped(declaration: Declaration): boolean;
70457045
function isAmbientModule(node: Node): boolean;
7046-
function isShorthandAmbientModule(node: Node): boolean;
7046+
function isShorthandAmbientModuleSymbol(moduleSymbol: Symbol): boolean;
70477047
function isBlockScopedContainerTopLevel(node: Node): boolean;
70487048
function isGlobalScopeAugmentation(module: ModuleDeclaration): boolean;
70497049
function isExternalModuleAugmentation(node: Node): boolean;

lib/tsserverlibrary.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5267,10 +5267,13 @@ var ts;
52675267
(node.name.kind === 9 || isGlobalScopeAugmentation(node));
52685268
}
52695269
ts.isAmbientModule = isAmbientModule;
5270+
function isShorthandAmbientModuleSymbol(moduleSymbol) {
5271+
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
5272+
}
5273+
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
52705274
function isShorthandAmbientModule(node) {
52715275
return node.kind === 225 && (!node.body);
52725276
}
5273-
ts.isShorthandAmbientModule = isShorthandAmbientModule;
52745277
function isBlockScopedContainerTopLevel(node) {
52755278
return node.kind === 256 ||
52765279
node.kind === 225 ||
@@ -14940,7 +14943,7 @@ var ts;
1494014943
function getTargetOfImportClause(node) {
1494114944
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
1494214945
if (moduleSymbol) {
14943-
var exportDefaultSymbol = ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration) ?
14946+
var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?
1494414947
moduleSymbol :
1494514948
moduleSymbol.exports["export="] ?
1494614949
getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") :
@@ -14995,7 +14998,7 @@ var ts;
1499514998
if (targetSymbol) {
1499614999
var name_12 = specifier.propertyName || specifier.name;
1499715000
if (name_12.text) {
14998-
if (ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration)) {
15001+
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
1499915002
return moduleSymbol;
1500015003
}
1500115004
var symbolFromVariable = void 0;
@@ -16770,7 +16773,7 @@ var ts;
1677016773
function getTypeOfFuncClassEnumModule(symbol) {
1677116774
var links = getSymbolLinks(symbol);
1677216775
if (!links.type) {
16773-
if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModule(symbol.valueDeclaration)) {
16776+
if (symbol.valueDeclaration.kind === 225 && ts.isShorthandAmbientModuleSymbol(symbol)) {
1677416777
links.type = anyType;
1677516778
}
1677616779
else {
@@ -21163,7 +21166,7 @@ var ts;
2116321166
}
2116421167
}
2116521168
var targetType = type.flags & 16384 ? getApparentType(type) : type;
21166-
return isTypeSubtypeOf(candidate, targetType) ? candidate :
21169+
return isTypeSubtypeOf(candidate, type) ? candidate :
2116721170
isTypeAssignableTo(type, candidate) ? type :
2116821171
isTypeAssignableTo(candidate, targetType) ? candidate :
2116921172
getIntersectionType([type, candidate]);
@@ -28119,7 +28122,7 @@ var ts;
2811928122
}
2812028123
function moduleExportsSomeValue(moduleReferenceExpression) {
2812128124
var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
28122-
if (!moduleSymbol) {
28125+
if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
2812328126
return true;
2812428127
}
2812528128
var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);

lib/typescript.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5636,11 +5636,14 @@ var ts;
56365636
(node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node));
56375637
}
56385638
ts.isAmbientModule = isAmbientModule;
5639+
function isShorthandAmbientModuleSymbol(moduleSymbol) {
5640+
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
5641+
}
5642+
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
56395643
function isShorthandAmbientModule(node) {
56405644
// The only kind of module that can be missing a body is a shorthand ambient module.
56415645
return node.kind === 225 /* ModuleDeclaration */ && (!node.body);
56425646
}
5643-
ts.isShorthandAmbientModule = isShorthandAmbientModule;
56445647
function isBlockScopedContainerTopLevel(node) {
56455648
return node.kind === 256 /* SourceFile */ ||
56465649
node.kind === 225 /* ModuleDeclaration */ ||
@@ -17445,7 +17448,7 @@ var ts;
1744517448
function getTargetOfImportClause(node) {
1744617449
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
1744717450
if (moduleSymbol) {
17448-
var exportDefaultSymbol = ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration) ?
17451+
var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?
1744917452
moduleSymbol :
1745017453
moduleSymbol.exports["export="] ?
1745117454
getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") :
@@ -17518,7 +17521,7 @@ var ts;
1751817521
if (targetSymbol) {
1751917522
var name_10 = specifier.propertyName || specifier.name;
1752017523
if (name_10.text) {
17521-
if (ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration)) {
17524+
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
1752217525
return moduleSymbol;
1752317526
}
1752417527
var symbolFromVariable = void 0;
@@ -19549,7 +19552,7 @@ var ts;
1954919552
function getTypeOfFuncClassEnumModule(symbol) {
1955019553
var links = getSymbolLinks(symbol);
1955119554
if (!links.type) {
19552-
if (symbol.valueDeclaration.kind === 225 /* ModuleDeclaration */ && ts.isShorthandAmbientModule(symbol.valueDeclaration)) {
19555+
if (symbol.valueDeclaration.kind === 225 /* ModuleDeclaration */ && ts.isShorthandAmbientModuleSymbol(symbol)) {
1955319556
links.type = anyType;
1955419557
}
1955519558
else {
@@ -24454,7 +24457,7 @@ var ts;
2445424457
// type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
2445524458
// two types.
2445624459
var targetType = type.flags & 16384 /* TypeParameter */ ? getApparentType(type) : type;
24457-
return isTypeSubtypeOf(candidate, targetType) ? candidate :
24460+
return isTypeSubtypeOf(candidate, type) ? candidate :
2445824461
isTypeAssignableTo(type, candidate) ? type :
2445924462
isTypeAssignableTo(candidate, targetType) ? candidate :
2446024463
getIntersectionType([type, candidate]);
@@ -33082,8 +33085,8 @@ var ts;
3308233085
}
3308333086
function moduleExportsSomeValue(moduleReferenceExpression) {
3308433087
var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
33085-
if (!moduleSymbol) {
33086-
// module not found - be conservative
33088+
if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
33089+
// If the module is not found or is shorthand, assume that it may export a value.
3308733090
return true;
3308833091
}
3308933092
var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);

lib/typescriptServices.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5636,11 +5636,14 @@ var ts;
56365636
(node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node));
56375637
}
56385638
ts.isAmbientModule = isAmbientModule;
5639+
function isShorthandAmbientModuleSymbol(moduleSymbol) {
5640+
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
5641+
}
5642+
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
56395643
function isShorthandAmbientModule(node) {
56405644
// The only kind of module that can be missing a body is a shorthand ambient module.
56415645
return node.kind === 225 /* ModuleDeclaration */ && (!node.body);
56425646
}
5643-
ts.isShorthandAmbientModule = isShorthandAmbientModule;
56445647
function isBlockScopedContainerTopLevel(node) {
56455648
return node.kind === 256 /* SourceFile */ ||
56465649
node.kind === 225 /* ModuleDeclaration */ ||
@@ -17445,7 +17448,7 @@ var ts;
1744517448
function getTargetOfImportClause(node) {
1744617449
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
1744717450
if (moduleSymbol) {
17448-
var exportDefaultSymbol = ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration) ?
17451+
var exportDefaultSymbol = ts.isShorthandAmbientModuleSymbol(moduleSymbol) ?
1744917452
moduleSymbol :
1745017453
moduleSymbol.exports["export="] ?
1745117454
getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") :
@@ -17518,7 +17521,7 @@ var ts;
1751817521
if (targetSymbol) {
1751917522
var name_10 = specifier.propertyName || specifier.name;
1752017523
if (name_10.text) {
17521-
if (ts.isShorthandAmbientModule(moduleSymbol.valueDeclaration)) {
17524+
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
1752217525
return moduleSymbol;
1752317526
}
1752417527
var symbolFromVariable = void 0;
@@ -19549,7 +19552,7 @@ var ts;
1954919552
function getTypeOfFuncClassEnumModule(symbol) {
1955019553
var links = getSymbolLinks(symbol);
1955119554
if (!links.type) {
19552-
if (symbol.valueDeclaration.kind === 225 /* ModuleDeclaration */ && ts.isShorthandAmbientModule(symbol.valueDeclaration)) {
19555+
if (symbol.valueDeclaration.kind === 225 /* ModuleDeclaration */ && ts.isShorthandAmbientModuleSymbol(symbol)) {
1955319556
links.type = anyType;
1955419557
}
1955519558
else {
@@ -24454,7 +24457,7 @@ var ts;
2445424457
// type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
2445524458
// two types.
2445624459
var targetType = type.flags & 16384 /* TypeParameter */ ? getApparentType(type) : type;
24457-
return isTypeSubtypeOf(candidate, targetType) ? candidate :
24460+
return isTypeSubtypeOf(candidate, type) ? candidate :
2445824461
isTypeAssignableTo(type, candidate) ? type :
2445924462
isTypeAssignableTo(candidate, targetType) ? candidate :
2446024463
getIntersectionType([type, candidate]);
@@ -33082,8 +33085,8 @@ var ts;
3308233085
}
3308333086
function moduleExportsSomeValue(moduleReferenceExpression) {
3308433087
var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
33085-
if (!moduleSymbol) {
33086-
// module not found - be conservative
33088+
if (!moduleSymbol || ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
33089+
// If the module is not found or is shorthand, assume that it may export a value.
3308733090
return true;
3308833091
}
3308933092
var hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);

0 commit comments

Comments
 (0)