@typescript-deploys/pr-build 5.0.0-pr-52217-7 → 5.0.0-pr-52213-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +29 -70
- package/lib/tsserver.js +35 -82
- package/lib/tsserverlibrary.d.ts +4 -14
- package/lib/tsserverlibrary.js +35 -80
- package/lib/typescript.d.ts +4 -14
- package/lib/typescript.js +35 -78
- package/lib/typingsInstaller.js +1 -0
- package/package.json +5 -2
package/lib/tsc.js
CHANGED
|
@@ -6058,6 +6058,7 @@ var Diagnostics = {
|
|
|
6058
6058
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, 1 /* Error */, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
|
|
6059
6059
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, 1 /* Error */, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
6060
6060
|
Unexpected_token_Did_you_mean_or_gt: diag(1382, 1 /* Error */, "Unexpected_token_Did_you_mean_or_gt_1382", "Unexpected token. Did you mean `{'>'}` or `>`?"),
|
|
6061
|
+
Only_named_exports_may_use_export_type: diag(1383, 1 /* Error */, "Only_named_exports_may_use_export_type_1383", "Only named exports may use 'export type'."),
|
|
6061
6062
|
Function_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1385, 1 /* Error */, "Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385", "Function type notation must be parenthesized when used in a union type."),
|
|
6062
6063
|
Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1386, 1 /* Error */, "Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386", "Constructor type notation must be parenthesized when used in a union type."),
|
|
6063
6064
|
Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, 1 /* Error */, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
|
|
@@ -10576,31 +10577,19 @@ function isTemplateMiddleOrTemplateTail(node) {
|
|
|
10576
10577
|
function isImportOrExportSpecifier(node) {
|
|
10577
10578
|
return isImportSpecifier(node) || isExportSpecifier(node);
|
|
10578
10579
|
}
|
|
10579
|
-
function
|
|
10580
|
+
function isTypeOnlyImportOrExportDeclaration(node) {
|
|
10580
10581
|
switch (node.kind) {
|
|
10581
10582
|
case 273 /* ImportSpecifier */:
|
|
10583
|
+
case 278 /* ExportSpecifier */:
|
|
10582
10584
|
return node.isTypeOnly || node.parent.parent.isTypeOnly;
|
|
10583
10585
|
case 271 /* NamespaceImport */:
|
|
10584
10586
|
return node.parent.isTypeOnly;
|
|
10585
10587
|
case 270 /* ImportClause */:
|
|
10586
10588
|
case 268 /* ImportEqualsDeclaration */:
|
|
10587
10589
|
return node.isTypeOnly;
|
|
10590
|
+
default:
|
|
10591
|
+
return false;
|
|
10588
10592
|
}
|
|
10589
|
-
return false;
|
|
10590
|
-
}
|
|
10591
|
-
function isTypeOnlyExportDeclaration(node) {
|
|
10592
|
-
switch (node.kind) {
|
|
10593
|
-
case 278 /* ExportSpecifier */:
|
|
10594
|
-
return node.isTypeOnly || node.parent.parent.isTypeOnly;
|
|
10595
|
-
case 275 /* ExportDeclaration */:
|
|
10596
|
-
return node.isTypeOnly && !!node.moduleSpecifier && !node.exportClause;
|
|
10597
|
-
case 277 /* NamespaceExport */:
|
|
10598
|
-
return node.parent.isTypeOnly;
|
|
10599
|
-
}
|
|
10600
|
-
return false;
|
|
10601
|
-
}
|
|
10602
|
-
function isTypeOnlyImportOrExportDeclaration(node) {
|
|
10603
|
-
return isTypeOnlyImportDeclaration(node) || isTypeOnlyExportDeclaration(node);
|
|
10604
10593
|
}
|
|
10605
10594
|
function isAssertionKey(node) {
|
|
10606
10595
|
return isStringLiteral(node) || isIdentifier(node);
|
|
@@ -43430,7 +43419,7 @@ function createTypeChecker(host) {
|
|
|
43430
43419
|
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
43431
43420
|
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
|
|
43432
43421
|
if (typeOnlyDeclaration) {
|
|
43433
|
-
const message = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */
|
|
43422
|
+
const message = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
43434
43423
|
const unescapedName = unescapeLeadingUnderscores(name);
|
|
43435
43424
|
addTypeOnlyDeclarationRelatedInfo(
|
|
43436
43425
|
error(errorLocation, message, unescapedName),
|
|
@@ -43450,7 +43439,7 @@ function createTypeChecker(host) {
|
|
|
43450
43439
|
diagnostic,
|
|
43451
43440
|
createDiagnosticForNode(
|
|
43452
43441
|
typeOnlyDeclaration,
|
|
43453
|
-
typeOnlyDeclaration.kind === 278 /* ExportSpecifier */
|
|
43442
|
+
typeOnlyDeclaration.kind === 278 /* ExportSpecifier */ ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here,
|
|
43454
43443
|
unescapedName
|
|
43455
43444
|
)
|
|
43456
43445
|
);
|
|
@@ -43829,10 +43818,10 @@ function createTypeChecker(host) {
|
|
|
43829
43818
|
false
|
|
43830
43819
|
) && !node.isTypeOnly) {
|
|
43831
43820
|
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfDeclaration(node));
|
|
43832
|
-
const isExport = typeOnlyDeclaration.kind === 278 /* ExportSpecifier
|
|
43821
|
+
const isExport = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */;
|
|
43833
43822
|
const message = isExport ? Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type;
|
|
43834
43823
|
const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
|
|
43835
|
-
const name =
|
|
43824
|
+
const name = unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
|
|
43836
43825
|
addRelatedInfo(error(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
|
|
43837
43826
|
}
|
|
43838
43827
|
}
|
|
@@ -44063,19 +44052,15 @@ function createTypeChecker(host) {
|
|
|
44063
44052
|
return result;
|
|
44064
44053
|
}
|
|
44065
44054
|
function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
|
|
44066
|
-
var _a2;
|
|
44067
44055
|
if (symbol.flags & 1536 /* Module */) {
|
|
44068
44056
|
const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
|
|
44069
44057
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
44070
|
-
const exportStarDeclaration = (_a2 = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a2.get(name.escapedText);
|
|
44071
44058
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
44072
44059
|
specifier,
|
|
44073
44060
|
exportSymbol,
|
|
44074
44061
|
resolved,
|
|
44075
44062
|
/*overwriteEmpty*/
|
|
44076
|
-
false
|
|
44077
|
-
exportStarDeclaration,
|
|
44078
|
-
name.escapedText
|
|
44063
|
+
false
|
|
44079
44064
|
);
|
|
44080
44065
|
return resolved;
|
|
44081
44066
|
}
|
|
@@ -44402,7 +44387,7 @@ function createTypeChecker(host) {
|
|
|
44402
44387
|
}
|
|
44403
44388
|
return flags;
|
|
44404
44389
|
}
|
|
44405
|
-
function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty
|
|
44390
|
+
function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty) {
|
|
44406
44391
|
if (!aliasDeclaration || isPropertyAccessExpression(aliasDeclaration))
|
|
44407
44392
|
return false;
|
|
44408
44393
|
const sourceSymbol = getSymbolOfDeclaration(aliasDeclaration);
|
|
@@ -44411,14 +44396,6 @@ function createTypeChecker(host) {
|
|
|
44411
44396
|
links2.typeOnlyDeclaration = aliasDeclaration;
|
|
44412
44397
|
return true;
|
|
44413
44398
|
}
|
|
44414
|
-
if (exportStarDeclaration) {
|
|
44415
|
-
const links2 = getSymbolLinks(sourceSymbol);
|
|
44416
|
-
links2.typeOnlyDeclaration = exportStarDeclaration;
|
|
44417
|
-
if (sourceSymbol.escapedName !== exportStarName) {
|
|
44418
|
-
links2.typeOnlyExportStarName = exportStarName;
|
|
44419
|
-
}
|
|
44420
|
-
return true;
|
|
44421
|
-
}
|
|
44422
44399
|
const links = getSymbolLinks(sourceSymbol);
|
|
44423
44400
|
return markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, immediateTarget, overwriteEmpty) || markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, finalTarget, overwriteEmpty);
|
|
44424
44401
|
}
|
|
@@ -44440,8 +44417,7 @@ function createTypeChecker(host) {
|
|
|
44440
44417
|
return links.typeOnlyDeclaration || void 0;
|
|
44441
44418
|
}
|
|
44442
44419
|
if (links.typeOnlyDeclaration) {
|
|
44443
|
-
|
|
44444
|
-
return getAllSymbolFlags(resolved) & include ? links.typeOnlyDeclaration : void 0;
|
|
44420
|
+
return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : void 0;
|
|
44445
44421
|
}
|
|
44446
44422
|
return void 0;
|
|
44447
44423
|
}
|
|
@@ -45095,12 +45071,7 @@ function createTypeChecker(host) {
|
|
|
45095
45071
|
}
|
|
45096
45072
|
function getExportsOfModule(moduleSymbol) {
|
|
45097
45073
|
const links = getSymbolLinks(moduleSymbol);
|
|
45098
|
-
|
|
45099
|
-
const { exports, typeOnlyExportStarMap } = getExportsOfModuleWorker(moduleSymbol);
|
|
45100
|
-
links.resolvedExports = exports;
|
|
45101
|
-
links.typeOnlyExportStarMap = typeOnlyExportStarMap;
|
|
45102
|
-
}
|
|
45103
|
-
return links.resolvedExports;
|
|
45074
|
+
return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol));
|
|
45104
45075
|
}
|
|
45105
45076
|
function extendExportSymbols(target, source, lookupTable, exportNode) {
|
|
45106
45077
|
if (!source)
|
|
@@ -45128,21 +45099,9 @@ function createTypeChecker(host) {
|
|
|
45128
45099
|
}
|
|
45129
45100
|
function getExportsOfModuleWorker(moduleSymbol) {
|
|
45130
45101
|
const visitedSymbols = [];
|
|
45131
|
-
let typeOnlyExportStarMap;
|
|
45132
|
-
const nonTypeOnlyNames = /* @__PURE__ */ new Set();
|
|
45133
45102
|
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
|
|
45134
|
-
|
|
45135
|
-
|
|
45136
|
-
nonTypeOnlyNames.forEach((name) => typeOnlyExportStarMap.delete(name));
|
|
45137
|
-
}
|
|
45138
|
-
return {
|
|
45139
|
-
exports,
|
|
45140
|
-
typeOnlyExportStarMap
|
|
45141
|
-
};
|
|
45142
|
-
function visit(symbol, exportStar, isTypeOnly) {
|
|
45143
|
-
if (!isTypeOnly && (symbol == null ? void 0 : symbol.exports)) {
|
|
45144
|
-
symbol.exports.forEach((_, name) => nonTypeOnlyNames.add(name));
|
|
45145
|
-
}
|
|
45103
|
+
return visit(moduleSymbol) || emptySymbols;
|
|
45104
|
+
function visit(symbol) {
|
|
45146
45105
|
if (!(symbol && symbol.exports && pushIfUnique(visitedSymbols, symbol))) {
|
|
45147
45106
|
return;
|
|
45148
45107
|
}
|
|
@@ -45154,7 +45113,7 @@ function createTypeChecker(host) {
|
|
|
45154
45113
|
if (exportStars.declarations) {
|
|
45155
45114
|
for (const node of exportStars.declarations) {
|
|
45156
45115
|
const resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
45157
|
-
const exportedSymbols = visit(resolvedModule
|
|
45116
|
+
const exportedSymbols = visit(resolvedModule);
|
|
45158
45117
|
extendExportSymbols(
|
|
45159
45118
|
nestedSymbols,
|
|
45160
45119
|
exportedSymbols,
|
|
@@ -45178,13 +45137,6 @@ function createTypeChecker(host) {
|
|
|
45178
45137
|
});
|
|
45179
45138
|
extendExportSymbols(symbols, nestedSymbols);
|
|
45180
45139
|
}
|
|
45181
|
-
if (exportStar == null ? void 0 : exportStar.isTypeOnly) {
|
|
45182
|
-
typeOnlyExportStarMap != null ? typeOnlyExportStarMap : typeOnlyExportStarMap = /* @__PURE__ */ new Map();
|
|
45183
|
-
symbols.forEach((_, escapedName) => typeOnlyExportStarMap.set(
|
|
45184
|
-
escapedName,
|
|
45185
|
-
exportStar
|
|
45186
|
-
));
|
|
45187
|
-
}
|
|
45188
45140
|
return symbols;
|
|
45189
45141
|
}
|
|
45190
45142
|
}
|
|
@@ -51413,7 +51365,7 @@ function createTypeChecker(host) {
|
|
|
51413
51365
|
const links = getSymbolLinks(symbol);
|
|
51414
51366
|
if (!links[resolutionKind]) {
|
|
51415
51367
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
51416
|
-
const earlySymbols = !isStatic2 ? symbol.members : symbol.flags & 1536 /* Module */ ? getExportsOfModuleWorker(symbol)
|
|
51368
|
+
const earlySymbols = !isStatic2 ? symbol.members : symbol.flags & 1536 /* Module */ ? getExportsOfModuleWorker(symbol) : symbol.exports;
|
|
51417
51369
|
links[resolutionKind] = earlySymbols || emptySymbols;
|
|
51418
51370
|
const lateSymbols = createSymbolTable();
|
|
51419
51371
|
for (const decl of symbol.declarations || emptyArray) {
|
|
@@ -52402,7 +52354,7 @@ function createTypeChecker(host) {
|
|
|
52402
52354
|
}
|
|
52403
52355
|
function isConstTypeVariable(type) {
|
|
52404
52356
|
var _a2;
|
|
52405
|
-
return !!(type.flags & 262144 /* TypeParameter */ && some((_a2 = type.symbol) == null ? void 0 : _a2.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType));
|
|
52357
|
+
return !!(type.flags & 262144 /* TypeParameter */ && some((_a2 = type.symbol) == null ? void 0 : _a2.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || isGenericTupleType(type) && findIndex(getTypeArguments(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t)) >= 0 || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType));
|
|
52406
52358
|
}
|
|
52407
52359
|
function getConstraintOfIndexedAccess(type) {
|
|
52408
52360
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -64318,6 +64270,7 @@ function createTypeChecker(host) {
|
|
|
64318
64270
|
}
|
|
64319
64271
|
}
|
|
64320
64272
|
function getNarrowedTypeOfSymbol(symbol, location) {
|
|
64273
|
+
var _a2;
|
|
64321
64274
|
const type = getTypeOfSymbol(symbol);
|
|
64322
64275
|
const declaration = symbol.valueDeclaration;
|
|
64323
64276
|
if (declaration) {
|
|
@@ -64353,7 +64306,7 @@ function createTypeChecker(host) {
|
|
|
64353
64306
|
if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
|
|
64354
64307
|
const contextualSignature = getContextualSignature(func);
|
|
64355
64308
|
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
64356
|
-
const restType = getReducedApparentType(getTypeOfSymbol(contextualSignature.parameters[0]));
|
|
64309
|
+
const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a2 = getInferenceContext(func)) == null ? void 0 : _a2.nonFixingMapper));
|
|
64357
64310
|
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) {
|
|
64358
64311
|
const narrowedType = getFlowTypeOfReference(
|
|
64359
64312
|
func,
|
|
@@ -65574,7 +65527,9 @@ function createTypeChecker(host) {
|
|
|
65574
65527
|
}
|
|
65575
65528
|
const index = findContextualNode(node);
|
|
65576
65529
|
if (index >= 0) {
|
|
65577
|
-
|
|
65530
|
+
const cached = contextualTypes[index];
|
|
65531
|
+
if (cached || !contextFlags)
|
|
65532
|
+
return cached;
|
|
65578
65533
|
}
|
|
65579
65534
|
const { parent } = node;
|
|
65580
65535
|
switch (parent.kind) {
|
|
@@ -77163,8 +77118,12 @@ function createTypeChecker(host) {
|
|
|
77163
77118
|
}
|
|
77164
77119
|
function checkGrammarExportDeclaration(node) {
|
|
77165
77120
|
var _a2;
|
|
77166
|
-
if (node.isTypeOnly
|
|
77167
|
-
|
|
77121
|
+
if (node.isTypeOnly) {
|
|
77122
|
+
if (((_a2 = node.exportClause) == null ? void 0 : _a2.kind) === 276 /* NamedExports */) {
|
|
77123
|
+
return checkGrammarNamedImportsOrExports(node.exportClause);
|
|
77124
|
+
} else {
|
|
77125
|
+
return grammarErrorOnNode(node, Diagnostics.Only_named_exports_may_use_export_type);
|
|
77126
|
+
}
|
|
77168
77127
|
}
|
|
77169
77128
|
return false;
|
|
77170
77129
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -1929,8 +1929,6 @@ __export(server_exports, {
|
|
|
1929
1929
|
isTypeNodeKind: () => isTypeNodeKind,
|
|
1930
1930
|
isTypeNodeOrTypeParameterDeclaration: () => isTypeNodeOrTypeParameterDeclaration,
|
|
1931
1931
|
isTypeOfExpression: () => isTypeOfExpression,
|
|
1932
|
-
isTypeOnlyExportDeclaration: () => isTypeOnlyExportDeclaration,
|
|
1933
|
-
isTypeOnlyImportDeclaration: () => isTypeOnlyImportDeclaration,
|
|
1934
1932
|
isTypeOnlyImportOrExportDeclaration: () => isTypeOnlyImportOrExportDeclaration,
|
|
1935
1933
|
isTypeOperatorNode: () => isTypeOperatorNode,
|
|
1936
1934
|
isTypeParameterDeclaration: () => isTypeParameterDeclaration,
|
|
@@ -9874,6 +9872,7 @@ var Diagnostics = {
|
|
|
9874
9872
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, 1 /* Error */, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
|
|
9875
9873
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, 1 /* Error */, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
9876
9874
|
Unexpected_token_Did_you_mean_or_gt: diag(1382, 1 /* Error */, "Unexpected_token_Did_you_mean_or_gt_1382", "Unexpected token. Did you mean `{'>'}` or `>`?"),
|
|
9875
|
+
Only_named_exports_may_use_export_type: diag(1383, 1 /* Error */, "Only_named_exports_may_use_export_type_1383", "Only named exports may use 'export type'."),
|
|
9877
9876
|
Function_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1385, 1 /* Error */, "Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385", "Function type notation must be parenthesized when used in a union type."),
|
|
9878
9877
|
Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1386, 1 /* Error */, "Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386", "Constructor type notation must be parenthesized when used in a union type."),
|
|
9879
9878
|
Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, 1 /* Error */, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
|
|
@@ -14529,31 +14528,19 @@ function isTemplateMiddleOrTemplateTail(node) {
|
|
|
14529
14528
|
function isImportOrExportSpecifier(node) {
|
|
14530
14529
|
return isImportSpecifier(node) || isExportSpecifier(node);
|
|
14531
14530
|
}
|
|
14532
|
-
function
|
|
14531
|
+
function isTypeOnlyImportOrExportDeclaration(node) {
|
|
14533
14532
|
switch (node.kind) {
|
|
14534
14533
|
case 273 /* ImportSpecifier */:
|
|
14534
|
+
case 278 /* ExportSpecifier */:
|
|
14535
14535
|
return node.isTypeOnly || node.parent.parent.isTypeOnly;
|
|
14536
14536
|
case 271 /* NamespaceImport */:
|
|
14537
14537
|
return node.parent.isTypeOnly;
|
|
14538
14538
|
case 270 /* ImportClause */:
|
|
14539
14539
|
case 268 /* ImportEqualsDeclaration */:
|
|
14540
14540
|
return node.isTypeOnly;
|
|
14541
|
+
default:
|
|
14542
|
+
return false;
|
|
14541
14543
|
}
|
|
14542
|
-
return false;
|
|
14543
|
-
}
|
|
14544
|
-
function isTypeOnlyExportDeclaration(node) {
|
|
14545
|
-
switch (node.kind) {
|
|
14546
|
-
case 278 /* ExportSpecifier */:
|
|
14547
|
-
return node.isTypeOnly || node.parent.parent.isTypeOnly;
|
|
14548
|
-
case 275 /* ExportDeclaration */:
|
|
14549
|
-
return node.isTypeOnly && !!node.moduleSpecifier && !node.exportClause;
|
|
14550
|
-
case 277 /* NamespaceExport */:
|
|
14551
|
-
return node.parent.isTypeOnly;
|
|
14552
|
-
}
|
|
14553
|
-
return false;
|
|
14554
|
-
}
|
|
14555
|
-
function isTypeOnlyImportOrExportDeclaration(node) {
|
|
14556
|
-
return isTypeOnlyImportDeclaration(node) || isTypeOnlyExportDeclaration(node);
|
|
14557
14544
|
}
|
|
14558
14545
|
function isAssertionKey(node) {
|
|
14559
14546
|
return isStringLiteral(node) || isIdentifier(node);
|
|
@@ -48358,7 +48345,7 @@ function createTypeChecker(host) {
|
|
|
48358
48345
|
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
48359
48346
|
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
|
|
48360
48347
|
if (typeOnlyDeclaration) {
|
|
48361
|
-
const message = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */
|
|
48348
|
+
const message = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
48362
48349
|
const unescapedName = unescapeLeadingUnderscores(name);
|
|
48363
48350
|
addTypeOnlyDeclarationRelatedInfo(
|
|
48364
48351
|
error(errorLocation, message, unescapedName),
|
|
@@ -48378,7 +48365,7 @@ function createTypeChecker(host) {
|
|
|
48378
48365
|
diagnostic,
|
|
48379
48366
|
createDiagnosticForNode(
|
|
48380
48367
|
typeOnlyDeclaration,
|
|
48381
|
-
typeOnlyDeclaration.kind === 278 /* ExportSpecifier */
|
|
48368
|
+
typeOnlyDeclaration.kind === 278 /* ExportSpecifier */ ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here,
|
|
48382
48369
|
unescapedName
|
|
48383
48370
|
)
|
|
48384
48371
|
);
|
|
@@ -48757,10 +48744,10 @@ function createTypeChecker(host) {
|
|
|
48757
48744
|
false
|
|
48758
48745
|
) && !node.isTypeOnly) {
|
|
48759
48746
|
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfDeclaration(node));
|
|
48760
|
-
const isExport = typeOnlyDeclaration.kind === 278 /* ExportSpecifier
|
|
48747
|
+
const isExport = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */;
|
|
48761
48748
|
const message = isExport ? Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type;
|
|
48762
48749
|
const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
|
|
48763
|
-
const name =
|
|
48750
|
+
const name = unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
|
|
48764
48751
|
addRelatedInfo(error(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
|
|
48765
48752
|
}
|
|
48766
48753
|
}
|
|
@@ -48991,19 +48978,15 @@ function createTypeChecker(host) {
|
|
|
48991
48978
|
return result;
|
|
48992
48979
|
}
|
|
48993
48980
|
function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
|
|
48994
|
-
var _a2;
|
|
48995
48981
|
if (symbol.flags & 1536 /* Module */) {
|
|
48996
48982
|
const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
|
|
48997
48983
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
48998
|
-
const exportStarDeclaration = (_a2 = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a2.get(name.escapedText);
|
|
48999
48984
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
49000
48985
|
specifier,
|
|
49001
48986
|
exportSymbol,
|
|
49002
48987
|
resolved,
|
|
49003
48988
|
/*overwriteEmpty*/
|
|
49004
|
-
false
|
|
49005
|
-
exportStarDeclaration,
|
|
49006
|
-
name.escapedText
|
|
48989
|
+
false
|
|
49007
48990
|
);
|
|
49008
48991
|
return resolved;
|
|
49009
48992
|
}
|
|
@@ -49330,7 +49313,7 @@ function createTypeChecker(host) {
|
|
|
49330
49313
|
}
|
|
49331
49314
|
return flags;
|
|
49332
49315
|
}
|
|
49333
|
-
function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty
|
|
49316
|
+
function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty) {
|
|
49334
49317
|
if (!aliasDeclaration || isPropertyAccessExpression(aliasDeclaration))
|
|
49335
49318
|
return false;
|
|
49336
49319
|
const sourceSymbol = getSymbolOfDeclaration(aliasDeclaration);
|
|
@@ -49339,14 +49322,6 @@ function createTypeChecker(host) {
|
|
|
49339
49322
|
links2.typeOnlyDeclaration = aliasDeclaration;
|
|
49340
49323
|
return true;
|
|
49341
49324
|
}
|
|
49342
|
-
if (exportStarDeclaration) {
|
|
49343
|
-
const links2 = getSymbolLinks(sourceSymbol);
|
|
49344
|
-
links2.typeOnlyDeclaration = exportStarDeclaration;
|
|
49345
|
-
if (sourceSymbol.escapedName !== exportStarName) {
|
|
49346
|
-
links2.typeOnlyExportStarName = exportStarName;
|
|
49347
|
-
}
|
|
49348
|
-
return true;
|
|
49349
|
-
}
|
|
49350
49325
|
const links = getSymbolLinks(sourceSymbol);
|
|
49351
49326
|
return markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, immediateTarget, overwriteEmpty) || markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, finalTarget, overwriteEmpty);
|
|
49352
49327
|
}
|
|
@@ -49368,8 +49343,7 @@ function createTypeChecker(host) {
|
|
|
49368
49343
|
return links.typeOnlyDeclaration || void 0;
|
|
49369
49344
|
}
|
|
49370
49345
|
if (links.typeOnlyDeclaration) {
|
|
49371
|
-
|
|
49372
|
-
return getAllSymbolFlags(resolved) & include ? links.typeOnlyDeclaration : void 0;
|
|
49346
|
+
return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : void 0;
|
|
49373
49347
|
}
|
|
49374
49348
|
return void 0;
|
|
49375
49349
|
}
|
|
@@ -50023,12 +49997,7 @@ function createTypeChecker(host) {
|
|
|
50023
49997
|
}
|
|
50024
49998
|
function getExportsOfModule(moduleSymbol) {
|
|
50025
49999
|
const links = getSymbolLinks(moduleSymbol);
|
|
50026
|
-
|
|
50027
|
-
const { exports, typeOnlyExportStarMap } = getExportsOfModuleWorker(moduleSymbol);
|
|
50028
|
-
links.resolvedExports = exports;
|
|
50029
|
-
links.typeOnlyExportStarMap = typeOnlyExportStarMap;
|
|
50030
|
-
}
|
|
50031
|
-
return links.resolvedExports;
|
|
50000
|
+
return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol));
|
|
50032
50001
|
}
|
|
50033
50002
|
function extendExportSymbols(target, source, lookupTable, exportNode) {
|
|
50034
50003
|
if (!source)
|
|
@@ -50056,21 +50025,9 @@ function createTypeChecker(host) {
|
|
|
50056
50025
|
}
|
|
50057
50026
|
function getExportsOfModuleWorker(moduleSymbol) {
|
|
50058
50027
|
const visitedSymbols = [];
|
|
50059
|
-
let typeOnlyExportStarMap;
|
|
50060
|
-
const nonTypeOnlyNames = /* @__PURE__ */ new Set();
|
|
50061
50028
|
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
|
|
50062
|
-
|
|
50063
|
-
|
|
50064
|
-
nonTypeOnlyNames.forEach((name) => typeOnlyExportStarMap.delete(name));
|
|
50065
|
-
}
|
|
50066
|
-
return {
|
|
50067
|
-
exports,
|
|
50068
|
-
typeOnlyExportStarMap
|
|
50069
|
-
};
|
|
50070
|
-
function visit(symbol, exportStar, isTypeOnly) {
|
|
50071
|
-
if (!isTypeOnly && (symbol == null ? void 0 : symbol.exports)) {
|
|
50072
|
-
symbol.exports.forEach((_, name) => nonTypeOnlyNames.add(name));
|
|
50073
|
-
}
|
|
50029
|
+
return visit(moduleSymbol) || emptySymbols;
|
|
50030
|
+
function visit(symbol) {
|
|
50074
50031
|
if (!(symbol && symbol.exports && pushIfUnique(visitedSymbols, symbol))) {
|
|
50075
50032
|
return;
|
|
50076
50033
|
}
|
|
@@ -50082,7 +50039,7 @@ function createTypeChecker(host) {
|
|
|
50082
50039
|
if (exportStars.declarations) {
|
|
50083
50040
|
for (const node of exportStars.declarations) {
|
|
50084
50041
|
const resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
50085
|
-
const exportedSymbols = visit(resolvedModule
|
|
50042
|
+
const exportedSymbols = visit(resolvedModule);
|
|
50086
50043
|
extendExportSymbols(
|
|
50087
50044
|
nestedSymbols,
|
|
50088
50045
|
exportedSymbols,
|
|
@@ -50106,13 +50063,6 @@ function createTypeChecker(host) {
|
|
|
50106
50063
|
});
|
|
50107
50064
|
extendExportSymbols(symbols, nestedSymbols);
|
|
50108
50065
|
}
|
|
50109
|
-
if (exportStar == null ? void 0 : exportStar.isTypeOnly) {
|
|
50110
|
-
typeOnlyExportStarMap != null ? typeOnlyExportStarMap : typeOnlyExportStarMap = /* @__PURE__ */ new Map();
|
|
50111
|
-
symbols.forEach((_, escapedName) => typeOnlyExportStarMap.set(
|
|
50112
|
-
escapedName,
|
|
50113
|
-
exportStar
|
|
50114
|
-
));
|
|
50115
|
-
}
|
|
50116
50066
|
return symbols;
|
|
50117
50067
|
}
|
|
50118
50068
|
}
|
|
@@ -56341,7 +56291,7 @@ function createTypeChecker(host) {
|
|
|
56341
56291
|
const links = getSymbolLinks(symbol);
|
|
56342
56292
|
if (!links[resolutionKind]) {
|
|
56343
56293
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
56344
|
-
const earlySymbols = !isStatic2 ? symbol.members : symbol.flags & 1536 /* Module */ ? getExportsOfModuleWorker(symbol)
|
|
56294
|
+
const earlySymbols = !isStatic2 ? symbol.members : symbol.flags & 1536 /* Module */ ? getExportsOfModuleWorker(symbol) : symbol.exports;
|
|
56345
56295
|
links[resolutionKind] = earlySymbols || emptySymbols;
|
|
56346
56296
|
const lateSymbols = createSymbolTable();
|
|
56347
56297
|
for (const decl of symbol.declarations || emptyArray) {
|
|
@@ -57330,7 +57280,7 @@ function createTypeChecker(host) {
|
|
|
57330
57280
|
}
|
|
57331
57281
|
function isConstTypeVariable(type) {
|
|
57332
57282
|
var _a2;
|
|
57333
|
-
return !!(type.flags & 262144 /* TypeParameter */ && some((_a2 = type.symbol) == null ? void 0 : _a2.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType));
|
|
57283
|
+
return !!(type.flags & 262144 /* TypeParameter */ && some((_a2 = type.symbol) == null ? void 0 : _a2.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || isGenericTupleType(type) && findIndex(getTypeArguments(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t)) >= 0 || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType));
|
|
57334
57284
|
}
|
|
57335
57285
|
function getConstraintOfIndexedAccess(type) {
|
|
57336
57286
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -69246,6 +69196,7 @@ function createTypeChecker(host) {
|
|
|
69246
69196
|
}
|
|
69247
69197
|
}
|
|
69248
69198
|
function getNarrowedTypeOfSymbol(symbol, location) {
|
|
69199
|
+
var _a2;
|
|
69249
69200
|
const type = getTypeOfSymbol(symbol);
|
|
69250
69201
|
const declaration = symbol.valueDeclaration;
|
|
69251
69202
|
if (declaration) {
|
|
@@ -69281,7 +69232,7 @@ function createTypeChecker(host) {
|
|
|
69281
69232
|
if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
|
|
69282
69233
|
const contextualSignature = getContextualSignature(func);
|
|
69283
69234
|
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
69284
|
-
const restType = getReducedApparentType(getTypeOfSymbol(contextualSignature.parameters[0]));
|
|
69235
|
+
const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a2 = getInferenceContext(func)) == null ? void 0 : _a2.nonFixingMapper));
|
|
69285
69236
|
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) {
|
|
69286
69237
|
const narrowedType = getFlowTypeOfReference(
|
|
69287
69238
|
func,
|
|
@@ -70502,7 +70453,9 @@ function createTypeChecker(host) {
|
|
|
70502
70453
|
}
|
|
70503
70454
|
const index = findContextualNode(node);
|
|
70504
70455
|
if (index >= 0) {
|
|
70505
|
-
|
|
70456
|
+
const cached = contextualTypes[index];
|
|
70457
|
+
if (cached || !contextFlags)
|
|
70458
|
+
return cached;
|
|
70506
70459
|
}
|
|
70507
70460
|
const { parent: parent2 } = node;
|
|
70508
70461
|
switch (parent2.kind) {
|
|
@@ -82091,8 +82044,12 @@ function createTypeChecker(host) {
|
|
|
82091
82044
|
}
|
|
82092
82045
|
function checkGrammarExportDeclaration(node) {
|
|
82093
82046
|
var _a2;
|
|
82094
|
-
if (node.isTypeOnly
|
|
82095
|
-
|
|
82047
|
+
if (node.isTypeOnly) {
|
|
82048
|
+
if (((_a2 = node.exportClause) == null ? void 0 : _a2.kind) === 276 /* NamedExports */) {
|
|
82049
|
+
return checkGrammarNamedImportsOrExports(node.exportClause);
|
|
82050
|
+
} else {
|
|
82051
|
+
return grammarErrorOnNode(node, Diagnostics.Only_named_exports_may_use_export_type);
|
|
82052
|
+
}
|
|
82096
82053
|
}
|
|
82097
82054
|
return false;
|
|
82098
82055
|
}
|
|
@@ -125219,8 +125176,6 @@ __export(ts_exports3, {
|
|
|
125219
125176
|
isTypeNodeKind: () => isTypeNodeKind,
|
|
125220
125177
|
isTypeNodeOrTypeParameterDeclaration: () => isTypeNodeOrTypeParameterDeclaration,
|
|
125221
125178
|
isTypeOfExpression: () => isTypeOfExpression,
|
|
125222
|
-
isTypeOnlyExportDeclaration: () => isTypeOnlyExportDeclaration,
|
|
125223
|
-
isTypeOnlyImportDeclaration: () => isTypeOnlyImportDeclaration,
|
|
125224
125179
|
isTypeOnlyImportOrExportDeclaration: () => isTypeOnlyImportOrExportDeclaration,
|
|
125225
125180
|
isTypeOperatorNode: () => isTypeOperatorNode,
|
|
125226
125181
|
isTypeParameterDeclaration: () => isTypeParameterDeclaration,
|
|
@@ -149007,7 +148962,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
149007
148962
|
symbolToSortTextMap[getSymbolId(symbol)] = SortText.GlobalsOrKeywords;
|
|
149008
148963
|
}
|
|
149009
148964
|
if (typeOnlyAliasNeedsPromotion && !(symbol.flags & 111551 /* Value */)) {
|
|
149010
|
-
const typeOnlyAliasDeclaration = symbol.declarations && find(symbol.declarations,
|
|
148965
|
+
const typeOnlyAliasDeclaration = symbol.declarations && find(symbol.declarations, isTypeOnlyImportOrExportDeclaration);
|
|
149011
148966
|
if (typeOnlyAliasDeclaration) {
|
|
149012
148967
|
const origin = { kind: 64 /* TypeOnlyAlias */, declaration: typeOnlyAliasDeclaration };
|
|
149013
148968
|
symbolToOriginInfoMap[i] = origin;
|
|
@@ -150065,14 +150020,14 @@ function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken
|
|
|
150065
150020
|
case 27 /* CommaToken */:
|
|
150066
150021
|
return tryCast(contextToken.parent, isObjectTypeDeclaration);
|
|
150067
150022
|
default:
|
|
150068
|
-
if (
|
|
150069
|
-
if (getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line
|
|
150023
|
+
if (isObjectTypeDeclaration(location)) {
|
|
150024
|
+
if (getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
|
|
150070
150025
|
return location;
|
|
150071
150026
|
}
|
|
150072
|
-
|
|
150027
|
+
const isValidKeyword = isClassLike(contextToken.parent.parent) ? isClassMemberCompletionKeyword : isInterfaceOrTypeLiteralCompletionKeyword;
|
|
150028
|
+
return isValidKeyword(contextToken.kind) || contextToken.kind === 41 /* AsteriskToken */ || isIdentifier(contextToken) && isValidKeyword((_a2 = identifierToKeywordKind(contextToken)) != null ? _a2 : 0 /* Unknown */) ? contextToken.parent.parent : void 0;
|
|
150073
150029
|
}
|
|
150074
|
-
|
|
150075
|
-
return isValidKeyword(contextToken.kind) || contextToken.kind === 41 /* AsteriskToken */ || isIdentifier(contextToken) && isValidKeyword((_a2 = identifierToKeywordKind(contextToken)) != null ? _a2 : 0 /* Unknown */) ? contextToken.parent.parent : void 0;
|
|
150030
|
+
return void 0;
|
|
150076
150031
|
}
|
|
150077
150032
|
}
|
|
150078
150033
|
function tryGetTypeLiteralNode(node) {
|
|
@@ -180858,8 +180813,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
180858
180813
|
isTypeNodeKind,
|
|
180859
180814
|
isTypeNodeOrTypeParameterDeclaration,
|
|
180860
180815
|
isTypeOfExpression,
|
|
180861
|
-
isTypeOnlyExportDeclaration,
|
|
180862
|
-
isTypeOnlyImportDeclaration,
|
|
180863
180816
|
isTypeOnlyImportOrExportDeclaration,
|
|
180864
180817
|
isTypeOperatorNode,
|
|
180865
180818
|
isTypeParameterDeclaration,
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -5717,8 +5717,8 @@ declare namespace ts {
|
|
|
5717
5717
|
readonly name: Identifier;
|
|
5718
5718
|
}
|
|
5719
5719
|
type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier;
|
|
5720
|
-
type TypeOnlyCompatibleAliasDeclaration = ImportClause | ImportEqualsDeclaration | NamespaceImport | ImportOrExportSpecifier
|
|
5721
|
-
type
|
|
5720
|
+
type TypeOnlyCompatibleAliasDeclaration = ImportClause | ImportEqualsDeclaration | NamespaceImport | ImportOrExportSpecifier;
|
|
5721
|
+
type TypeOnlyAliasDeclaration = ImportClause & {
|
|
5722
5722
|
readonly isTypeOnly: true;
|
|
5723
5723
|
readonly name: Identifier;
|
|
5724
5724
|
} | ImportEqualsDeclaration & {
|
|
@@ -5735,8 +5735,7 @@ declare namespace ts {
|
|
|
5735
5735
|
readonly isTypeOnly: true;
|
|
5736
5736
|
};
|
|
5737
5737
|
};
|
|
5738
|
-
})
|
|
5739
|
-
type TypeOnlyExportDeclaration = ExportSpecifier & ({
|
|
5738
|
+
}) | ExportSpecifier & ({
|
|
5740
5739
|
readonly isTypeOnly: true;
|
|
5741
5740
|
} | {
|
|
5742
5741
|
readonly parent: NamedExports & {
|
|
@@ -5744,14 +5743,7 @@ declare namespace ts {
|
|
|
5744
5743
|
readonly isTypeOnly: true;
|
|
5745
5744
|
};
|
|
5746
5745
|
};
|
|
5747
|
-
})
|
|
5748
|
-
readonly isTypeOnly: true;
|
|
5749
|
-
} | NamespaceExport & {
|
|
5750
|
-
readonly parent: ExportDeclaration & {
|
|
5751
|
-
readonly isTypeOnly: true;
|
|
5752
|
-
};
|
|
5753
|
-
};
|
|
5754
|
-
type TypeOnlyAliasDeclaration = TypeOnlyImportDeclaration | TypeOnlyExportDeclaration;
|
|
5746
|
+
});
|
|
5755
5747
|
/**
|
|
5756
5748
|
* This is either an `export =` or an `export default` declaration.
|
|
5757
5749
|
* Unless `isExportEquals` is set, this node was parsed as an `export default`.
|
|
@@ -8749,8 +8741,6 @@ declare namespace ts {
|
|
|
8749
8741
|
function isTemplateLiteralToken(node: Node): node is TemplateLiteralToken;
|
|
8750
8742
|
function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail;
|
|
8751
8743
|
function isImportOrExportSpecifier(node: Node): node is ImportSpecifier | ExportSpecifier;
|
|
8752
|
-
function isTypeOnlyImportDeclaration(node: Node): node is TypeOnlyImportDeclaration;
|
|
8753
|
-
function isTypeOnlyExportDeclaration(node: Node): node is TypeOnlyExportDeclaration;
|
|
8754
8744
|
function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnlyAliasDeclaration;
|
|
8755
8745
|
function isAssertionKey(node: Node): node is AssertionKey;
|
|
8756
8746
|
function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken;
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -7318,6 +7318,7 @@ ${lanes.join("\n")}
|
|
|
7318
7318
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, 1 /* Error */, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
|
|
7319
7319
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, 1 /* Error */, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
7320
7320
|
Unexpected_token_Did_you_mean_or_gt: diag(1382, 1 /* Error */, "Unexpected_token_Did_you_mean_or_gt_1382", "Unexpected token. Did you mean `{'>'}` or `>`?"),
|
|
7321
|
+
Only_named_exports_may_use_export_type: diag(1383, 1 /* Error */, "Only_named_exports_may_use_export_type_1383", "Only named exports may use 'export type'."),
|
|
7321
7322
|
Function_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1385, 1 /* Error */, "Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385", "Function type notation must be parenthesized when used in a union type."),
|
|
7322
7323
|
Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1386, 1 /* Error */, "Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386", "Constructor type notation must be parenthesized when used in a union type."),
|
|
7323
7324
|
Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, 1 /* Error */, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
|
|
@@ -11980,31 +11981,19 @@ ${lanes.join("\n")}
|
|
|
11980
11981
|
function isImportOrExportSpecifier(node) {
|
|
11981
11982
|
return isImportSpecifier(node) || isExportSpecifier(node);
|
|
11982
11983
|
}
|
|
11983
|
-
function
|
|
11984
|
+
function isTypeOnlyImportOrExportDeclaration(node) {
|
|
11984
11985
|
switch (node.kind) {
|
|
11985
11986
|
case 273 /* ImportSpecifier */:
|
|
11987
|
+
case 278 /* ExportSpecifier */:
|
|
11986
11988
|
return node.isTypeOnly || node.parent.parent.isTypeOnly;
|
|
11987
11989
|
case 271 /* NamespaceImport */:
|
|
11988
11990
|
return node.parent.isTypeOnly;
|
|
11989
11991
|
case 270 /* ImportClause */:
|
|
11990
11992
|
case 268 /* ImportEqualsDeclaration */:
|
|
11991
11993
|
return node.isTypeOnly;
|
|
11994
|
+
default:
|
|
11995
|
+
return false;
|
|
11992
11996
|
}
|
|
11993
|
-
return false;
|
|
11994
|
-
}
|
|
11995
|
-
function isTypeOnlyExportDeclaration(node) {
|
|
11996
|
-
switch (node.kind) {
|
|
11997
|
-
case 278 /* ExportSpecifier */:
|
|
11998
|
-
return node.isTypeOnly || node.parent.parent.isTypeOnly;
|
|
11999
|
-
case 275 /* ExportDeclaration */:
|
|
12000
|
-
return node.isTypeOnly && !!node.moduleSpecifier && !node.exportClause;
|
|
12001
|
-
case 277 /* NamespaceExport */:
|
|
12002
|
-
return node.parent.isTypeOnly;
|
|
12003
|
-
}
|
|
12004
|
-
return false;
|
|
12005
|
-
}
|
|
12006
|
-
function isTypeOnlyImportOrExportDeclaration(node) {
|
|
12007
|
-
return isTypeOnlyImportDeclaration(node) || isTypeOnlyExportDeclaration(node);
|
|
12008
11997
|
}
|
|
12009
11998
|
function isAssertionKey(node) {
|
|
12010
11999
|
return isStringLiteral(node) || isIdentifier(node);
|
|
@@ -45789,7 +45778,7 @@ ${lanes.join("\n")}
|
|
|
45789
45778
|
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
45790
45779
|
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
|
|
45791
45780
|
if (typeOnlyDeclaration) {
|
|
45792
|
-
const message = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */
|
|
45781
|
+
const message = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
45793
45782
|
const unescapedName = unescapeLeadingUnderscores(name);
|
|
45794
45783
|
addTypeOnlyDeclarationRelatedInfo(
|
|
45795
45784
|
error(errorLocation, message, unescapedName),
|
|
@@ -45809,7 +45798,7 @@ ${lanes.join("\n")}
|
|
|
45809
45798
|
diagnostic,
|
|
45810
45799
|
createDiagnosticForNode(
|
|
45811
45800
|
typeOnlyDeclaration,
|
|
45812
|
-
typeOnlyDeclaration.kind === 278 /* ExportSpecifier */
|
|
45801
|
+
typeOnlyDeclaration.kind === 278 /* ExportSpecifier */ ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here,
|
|
45813
45802
|
unescapedName
|
|
45814
45803
|
)
|
|
45815
45804
|
);
|
|
@@ -46188,10 +46177,10 @@ ${lanes.join("\n")}
|
|
|
46188
46177
|
false
|
|
46189
46178
|
) && !node.isTypeOnly) {
|
|
46190
46179
|
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfDeclaration(node));
|
|
46191
|
-
const isExport = typeOnlyDeclaration.kind === 278 /* ExportSpecifier
|
|
46180
|
+
const isExport = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */;
|
|
46192
46181
|
const message = isExport ? Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type;
|
|
46193
46182
|
const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
|
|
46194
|
-
const name =
|
|
46183
|
+
const name = unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
|
|
46195
46184
|
addRelatedInfo(error(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
|
|
46196
46185
|
}
|
|
46197
46186
|
}
|
|
@@ -46422,19 +46411,15 @@ ${lanes.join("\n")}
|
|
|
46422
46411
|
return result;
|
|
46423
46412
|
}
|
|
46424
46413
|
function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
|
|
46425
|
-
var _a2;
|
|
46426
46414
|
if (symbol.flags & 1536 /* Module */) {
|
|
46427
46415
|
const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
|
|
46428
46416
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
46429
|
-
const exportStarDeclaration = (_a2 = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a2.get(name.escapedText);
|
|
46430
46417
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
46431
46418
|
specifier,
|
|
46432
46419
|
exportSymbol,
|
|
46433
46420
|
resolved,
|
|
46434
46421
|
/*overwriteEmpty*/
|
|
46435
|
-
false
|
|
46436
|
-
exportStarDeclaration,
|
|
46437
|
-
name.escapedText
|
|
46422
|
+
false
|
|
46438
46423
|
);
|
|
46439
46424
|
return resolved;
|
|
46440
46425
|
}
|
|
@@ -46761,7 +46746,7 @@ ${lanes.join("\n")}
|
|
|
46761
46746
|
}
|
|
46762
46747
|
return flags;
|
|
46763
46748
|
}
|
|
46764
|
-
function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty
|
|
46749
|
+
function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty) {
|
|
46765
46750
|
if (!aliasDeclaration || isPropertyAccessExpression(aliasDeclaration))
|
|
46766
46751
|
return false;
|
|
46767
46752
|
const sourceSymbol = getSymbolOfDeclaration(aliasDeclaration);
|
|
@@ -46770,14 +46755,6 @@ ${lanes.join("\n")}
|
|
|
46770
46755
|
links2.typeOnlyDeclaration = aliasDeclaration;
|
|
46771
46756
|
return true;
|
|
46772
46757
|
}
|
|
46773
|
-
if (exportStarDeclaration) {
|
|
46774
|
-
const links2 = getSymbolLinks(sourceSymbol);
|
|
46775
|
-
links2.typeOnlyDeclaration = exportStarDeclaration;
|
|
46776
|
-
if (sourceSymbol.escapedName !== exportStarName) {
|
|
46777
|
-
links2.typeOnlyExportStarName = exportStarName;
|
|
46778
|
-
}
|
|
46779
|
-
return true;
|
|
46780
|
-
}
|
|
46781
46758
|
const links = getSymbolLinks(sourceSymbol);
|
|
46782
46759
|
return markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, immediateTarget, overwriteEmpty) || markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, finalTarget, overwriteEmpty);
|
|
46783
46760
|
}
|
|
@@ -46799,8 +46776,7 @@ ${lanes.join("\n")}
|
|
|
46799
46776
|
return links.typeOnlyDeclaration || void 0;
|
|
46800
46777
|
}
|
|
46801
46778
|
if (links.typeOnlyDeclaration) {
|
|
46802
|
-
|
|
46803
|
-
return getAllSymbolFlags(resolved) & include ? links.typeOnlyDeclaration : void 0;
|
|
46779
|
+
return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : void 0;
|
|
46804
46780
|
}
|
|
46805
46781
|
return void 0;
|
|
46806
46782
|
}
|
|
@@ -47454,12 +47430,7 @@ ${lanes.join("\n")}
|
|
|
47454
47430
|
}
|
|
47455
47431
|
function getExportsOfModule(moduleSymbol) {
|
|
47456
47432
|
const links = getSymbolLinks(moduleSymbol);
|
|
47457
|
-
|
|
47458
|
-
const { exports, typeOnlyExportStarMap } = getExportsOfModuleWorker(moduleSymbol);
|
|
47459
|
-
links.resolvedExports = exports;
|
|
47460
|
-
links.typeOnlyExportStarMap = typeOnlyExportStarMap;
|
|
47461
|
-
}
|
|
47462
|
-
return links.resolvedExports;
|
|
47433
|
+
return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol));
|
|
47463
47434
|
}
|
|
47464
47435
|
function extendExportSymbols(target, source, lookupTable, exportNode) {
|
|
47465
47436
|
if (!source)
|
|
@@ -47487,21 +47458,9 @@ ${lanes.join("\n")}
|
|
|
47487
47458
|
}
|
|
47488
47459
|
function getExportsOfModuleWorker(moduleSymbol) {
|
|
47489
47460
|
const visitedSymbols = [];
|
|
47490
|
-
let typeOnlyExportStarMap;
|
|
47491
|
-
const nonTypeOnlyNames = /* @__PURE__ */ new Set();
|
|
47492
47461
|
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
|
|
47493
|
-
|
|
47494
|
-
|
|
47495
|
-
nonTypeOnlyNames.forEach((name) => typeOnlyExportStarMap.delete(name));
|
|
47496
|
-
}
|
|
47497
|
-
return {
|
|
47498
|
-
exports,
|
|
47499
|
-
typeOnlyExportStarMap
|
|
47500
|
-
};
|
|
47501
|
-
function visit(symbol, exportStar, isTypeOnly) {
|
|
47502
|
-
if (!isTypeOnly && (symbol == null ? void 0 : symbol.exports)) {
|
|
47503
|
-
symbol.exports.forEach((_, name) => nonTypeOnlyNames.add(name));
|
|
47504
|
-
}
|
|
47462
|
+
return visit(moduleSymbol) || emptySymbols;
|
|
47463
|
+
function visit(symbol) {
|
|
47505
47464
|
if (!(symbol && symbol.exports && pushIfUnique(visitedSymbols, symbol))) {
|
|
47506
47465
|
return;
|
|
47507
47466
|
}
|
|
@@ -47513,7 +47472,7 @@ ${lanes.join("\n")}
|
|
|
47513
47472
|
if (exportStars.declarations) {
|
|
47514
47473
|
for (const node of exportStars.declarations) {
|
|
47515
47474
|
const resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
47516
|
-
const exportedSymbols = visit(resolvedModule
|
|
47475
|
+
const exportedSymbols = visit(resolvedModule);
|
|
47517
47476
|
extendExportSymbols(
|
|
47518
47477
|
nestedSymbols,
|
|
47519
47478
|
exportedSymbols,
|
|
@@ -47537,13 +47496,6 @@ ${lanes.join("\n")}
|
|
|
47537
47496
|
});
|
|
47538
47497
|
extendExportSymbols(symbols, nestedSymbols);
|
|
47539
47498
|
}
|
|
47540
|
-
if (exportStar == null ? void 0 : exportStar.isTypeOnly) {
|
|
47541
|
-
typeOnlyExportStarMap != null ? typeOnlyExportStarMap : typeOnlyExportStarMap = /* @__PURE__ */ new Map();
|
|
47542
|
-
symbols.forEach((_, escapedName) => typeOnlyExportStarMap.set(
|
|
47543
|
-
escapedName,
|
|
47544
|
-
exportStar
|
|
47545
|
-
));
|
|
47546
|
-
}
|
|
47547
47499
|
return symbols;
|
|
47548
47500
|
}
|
|
47549
47501
|
}
|
|
@@ -53772,7 +53724,7 @@ ${lanes.join("\n")}
|
|
|
53772
53724
|
const links = getSymbolLinks(symbol);
|
|
53773
53725
|
if (!links[resolutionKind]) {
|
|
53774
53726
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
53775
|
-
const earlySymbols = !isStatic2 ? symbol.members : symbol.flags & 1536 /* Module */ ? getExportsOfModuleWorker(symbol)
|
|
53727
|
+
const earlySymbols = !isStatic2 ? symbol.members : symbol.flags & 1536 /* Module */ ? getExportsOfModuleWorker(symbol) : symbol.exports;
|
|
53776
53728
|
links[resolutionKind] = earlySymbols || emptySymbols;
|
|
53777
53729
|
const lateSymbols = createSymbolTable();
|
|
53778
53730
|
for (const decl of symbol.declarations || emptyArray) {
|
|
@@ -54761,7 +54713,7 @@ ${lanes.join("\n")}
|
|
|
54761
54713
|
}
|
|
54762
54714
|
function isConstTypeVariable(type) {
|
|
54763
54715
|
var _a2;
|
|
54764
|
-
return !!(type.flags & 262144 /* TypeParameter */ && some((_a2 = type.symbol) == null ? void 0 : _a2.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType));
|
|
54716
|
+
return !!(type.flags & 262144 /* TypeParameter */ && some((_a2 = type.symbol) == null ? void 0 : _a2.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || isGenericTupleType(type) && findIndex(getTypeArguments(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t)) >= 0 || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType));
|
|
54765
54717
|
}
|
|
54766
54718
|
function getConstraintOfIndexedAccess(type) {
|
|
54767
54719
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -66677,6 +66629,7 @@ ${lanes.join("\n")}
|
|
|
66677
66629
|
}
|
|
66678
66630
|
}
|
|
66679
66631
|
function getNarrowedTypeOfSymbol(symbol, location) {
|
|
66632
|
+
var _a2;
|
|
66680
66633
|
const type = getTypeOfSymbol(symbol);
|
|
66681
66634
|
const declaration = symbol.valueDeclaration;
|
|
66682
66635
|
if (declaration) {
|
|
@@ -66712,7 +66665,7 @@ ${lanes.join("\n")}
|
|
|
66712
66665
|
if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
|
|
66713
66666
|
const contextualSignature = getContextualSignature(func);
|
|
66714
66667
|
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
66715
|
-
const restType = getReducedApparentType(getTypeOfSymbol(contextualSignature.parameters[0]));
|
|
66668
|
+
const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a2 = getInferenceContext(func)) == null ? void 0 : _a2.nonFixingMapper));
|
|
66716
66669
|
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) {
|
|
66717
66670
|
const narrowedType = getFlowTypeOfReference(
|
|
66718
66671
|
func,
|
|
@@ -67933,7 +67886,9 @@ ${lanes.join("\n")}
|
|
|
67933
67886
|
}
|
|
67934
67887
|
const index = findContextualNode(node);
|
|
67935
67888
|
if (index >= 0) {
|
|
67936
|
-
|
|
67889
|
+
const cached = contextualTypes[index];
|
|
67890
|
+
if (cached || !contextFlags)
|
|
67891
|
+
return cached;
|
|
67937
67892
|
}
|
|
67938
67893
|
const { parent: parent2 } = node;
|
|
67939
67894
|
switch (parent2.kind) {
|
|
@@ -79522,8 +79477,12 @@ ${lanes.join("\n")}
|
|
|
79522
79477
|
}
|
|
79523
79478
|
function checkGrammarExportDeclaration(node) {
|
|
79524
79479
|
var _a2;
|
|
79525
|
-
if (node.isTypeOnly
|
|
79526
|
-
|
|
79480
|
+
if (node.isTypeOnly) {
|
|
79481
|
+
if (((_a2 = node.exportClause) == null ? void 0 : _a2.kind) === 276 /* NamedExports */) {
|
|
79482
|
+
return checkGrammarNamedImportsOrExports(node.exportClause);
|
|
79483
|
+
} else {
|
|
79484
|
+
return grammarErrorOnNode(node, Diagnostics.Only_named_exports_may_use_export_type);
|
|
79485
|
+
}
|
|
79527
79486
|
}
|
|
79528
79487
|
return false;
|
|
79529
79488
|
}
|
|
@@ -145034,7 +144993,7 @@ ${lanes.join("\n")}
|
|
|
145034
144993
|
symbolToSortTextMap[getSymbolId(symbol)] = SortText.GlobalsOrKeywords;
|
|
145035
144994
|
}
|
|
145036
144995
|
if (typeOnlyAliasNeedsPromotion && !(symbol.flags & 111551 /* Value */)) {
|
|
145037
|
-
const typeOnlyAliasDeclaration = symbol.declarations && find(symbol.declarations,
|
|
144996
|
+
const typeOnlyAliasDeclaration = symbol.declarations && find(symbol.declarations, isTypeOnlyImportOrExportDeclaration);
|
|
145038
144997
|
if (typeOnlyAliasDeclaration) {
|
|
145039
144998
|
const origin = { kind: 64 /* TypeOnlyAlias */, declaration: typeOnlyAliasDeclaration };
|
|
145040
144999
|
symbolToOriginInfoMap[i] = origin;
|
|
@@ -146079,14 +146038,14 @@ ${lanes.join("\n")}
|
|
|
146079
146038
|
case 27 /* CommaToken */:
|
|
146080
146039
|
return tryCast(contextToken.parent, isObjectTypeDeclaration);
|
|
146081
146040
|
default:
|
|
146082
|
-
if (
|
|
146083
|
-
if (getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line
|
|
146041
|
+
if (isObjectTypeDeclaration(location)) {
|
|
146042
|
+
if (getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
|
|
146084
146043
|
return location;
|
|
146085
146044
|
}
|
|
146086
|
-
|
|
146045
|
+
const isValidKeyword = isClassLike(contextToken.parent.parent) ? isClassMemberCompletionKeyword : isInterfaceOrTypeLiteralCompletionKeyword;
|
|
146046
|
+
return isValidKeyword(contextToken.kind) || contextToken.kind === 41 /* AsteriskToken */ || isIdentifier(contextToken) && isValidKeyword((_a2 = identifierToKeywordKind(contextToken)) != null ? _a2 : 0 /* Unknown */) ? contextToken.parent.parent : void 0;
|
|
146087
146047
|
}
|
|
146088
|
-
|
|
146089
|
-
return isValidKeyword(contextToken.kind) || contextToken.kind === 41 /* AsteriskToken */ || isIdentifier(contextToken) && isValidKeyword((_a2 = identifierToKeywordKind(contextToken)) != null ? _a2 : 0 /* Unknown */) ? contextToken.parent.parent : void 0;
|
|
146048
|
+
return void 0;
|
|
146090
146049
|
}
|
|
146091
146050
|
}
|
|
146092
146051
|
function tryGetTypeLiteralNode(node) {
|
|
@@ -176973,8 +176932,6 @@ ${e.message}`;
|
|
|
176973
176932
|
isTypeNodeKind: () => isTypeNodeKind,
|
|
176974
176933
|
isTypeNodeOrTypeParameterDeclaration: () => isTypeNodeOrTypeParameterDeclaration,
|
|
176975
176934
|
isTypeOfExpression: () => isTypeOfExpression,
|
|
176976
|
-
isTypeOnlyExportDeclaration: () => isTypeOnlyExportDeclaration,
|
|
176977
|
-
isTypeOnlyImportDeclaration: () => isTypeOnlyImportDeclaration,
|
|
176978
176935
|
isTypeOnlyImportOrExportDeclaration: () => isTypeOnlyImportOrExportDeclaration,
|
|
176979
176936
|
isTypeOperatorNode: () => isTypeOperatorNode,
|
|
176980
176937
|
isTypeParameterDeclaration: () => isTypeParameterDeclaration,
|
|
@@ -179625,8 +179582,6 @@ ${e.message}`;
|
|
|
179625
179582
|
isTypeNodeKind: () => isTypeNodeKind,
|
|
179626
179583
|
isTypeNodeOrTypeParameterDeclaration: () => isTypeNodeOrTypeParameterDeclaration,
|
|
179627
179584
|
isTypeOfExpression: () => isTypeOfExpression,
|
|
179628
|
-
isTypeOnlyExportDeclaration: () => isTypeOnlyExportDeclaration,
|
|
179629
|
-
isTypeOnlyImportDeclaration: () => isTypeOnlyImportDeclaration,
|
|
179630
179585
|
isTypeOnlyImportOrExportDeclaration: () => isTypeOnlyImportOrExportDeclaration,
|
|
179631
179586
|
isTypeOperatorNode: () => isTypeOperatorNode,
|
|
179632
179587
|
isTypeParameterDeclaration: () => isTypeParameterDeclaration,
|
package/lib/typescript.d.ts
CHANGED
|
@@ -1782,8 +1782,8 @@ declare namespace ts {
|
|
|
1782
1782
|
readonly name: Identifier;
|
|
1783
1783
|
}
|
|
1784
1784
|
type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier;
|
|
1785
|
-
type TypeOnlyCompatibleAliasDeclaration = ImportClause | ImportEqualsDeclaration | NamespaceImport | ImportOrExportSpecifier
|
|
1786
|
-
type
|
|
1785
|
+
type TypeOnlyCompatibleAliasDeclaration = ImportClause | ImportEqualsDeclaration | NamespaceImport | ImportOrExportSpecifier;
|
|
1786
|
+
type TypeOnlyAliasDeclaration = ImportClause & {
|
|
1787
1787
|
readonly isTypeOnly: true;
|
|
1788
1788
|
readonly name: Identifier;
|
|
1789
1789
|
} | ImportEqualsDeclaration & {
|
|
@@ -1800,8 +1800,7 @@ declare namespace ts {
|
|
|
1800
1800
|
readonly isTypeOnly: true;
|
|
1801
1801
|
};
|
|
1802
1802
|
};
|
|
1803
|
-
})
|
|
1804
|
-
type TypeOnlyExportDeclaration = ExportSpecifier & ({
|
|
1803
|
+
}) | ExportSpecifier & ({
|
|
1805
1804
|
readonly isTypeOnly: true;
|
|
1806
1805
|
} | {
|
|
1807
1806
|
readonly parent: NamedExports & {
|
|
@@ -1809,14 +1808,7 @@ declare namespace ts {
|
|
|
1809
1808
|
readonly isTypeOnly: true;
|
|
1810
1809
|
};
|
|
1811
1810
|
};
|
|
1812
|
-
})
|
|
1813
|
-
readonly isTypeOnly: true;
|
|
1814
|
-
} | NamespaceExport & {
|
|
1815
|
-
readonly parent: ExportDeclaration & {
|
|
1816
|
-
readonly isTypeOnly: true;
|
|
1817
|
-
};
|
|
1818
|
-
};
|
|
1819
|
-
type TypeOnlyAliasDeclaration = TypeOnlyImportDeclaration | TypeOnlyExportDeclaration;
|
|
1811
|
+
});
|
|
1820
1812
|
/**
|
|
1821
1813
|
* This is either an `export =` or an `export default` declaration.
|
|
1822
1814
|
* Unless `isExportEquals` is set, this node was parsed as an `export default`.
|
|
@@ -4814,8 +4806,6 @@ declare namespace ts {
|
|
|
4814
4806
|
function isTemplateLiteralToken(node: Node): node is TemplateLiteralToken;
|
|
4815
4807
|
function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail;
|
|
4816
4808
|
function isImportOrExportSpecifier(node: Node): node is ImportSpecifier | ExportSpecifier;
|
|
4817
|
-
function isTypeOnlyImportDeclaration(node: Node): node is TypeOnlyImportDeclaration;
|
|
4818
|
-
function isTypeOnlyExportDeclaration(node: Node): node is TypeOnlyExportDeclaration;
|
|
4819
4809
|
function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnlyAliasDeclaration;
|
|
4820
4810
|
function isAssertionKey(node: Node): node is AssertionKey;
|
|
4821
4811
|
function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken;
|
package/lib/typescript.js
CHANGED
|
@@ -7318,6 +7318,7 @@ ${lanes.join("\n")}
|
|
|
7318
7318
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, 1 /* Error */, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
|
|
7319
7319
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, 1 /* Error */, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
7320
7320
|
Unexpected_token_Did_you_mean_or_gt: diag(1382, 1 /* Error */, "Unexpected_token_Did_you_mean_or_gt_1382", "Unexpected token. Did you mean `{'>'}` or `>`?"),
|
|
7321
|
+
Only_named_exports_may_use_export_type: diag(1383, 1 /* Error */, "Only_named_exports_may_use_export_type_1383", "Only named exports may use 'export type'."),
|
|
7321
7322
|
Function_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1385, 1 /* Error */, "Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385", "Function type notation must be parenthesized when used in a union type."),
|
|
7322
7323
|
Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1386, 1 /* Error */, "Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386", "Constructor type notation must be parenthesized when used in a union type."),
|
|
7323
7324
|
Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, 1 /* Error */, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
|
|
@@ -11980,31 +11981,19 @@ ${lanes.join("\n")}
|
|
|
11980
11981
|
function isImportOrExportSpecifier(node) {
|
|
11981
11982
|
return isImportSpecifier(node) || isExportSpecifier(node);
|
|
11982
11983
|
}
|
|
11983
|
-
function
|
|
11984
|
+
function isTypeOnlyImportOrExportDeclaration(node) {
|
|
11984
11985
|
switch (node.kind) {
|
|
11985
11986
|
case 273 /* ImportSpecifier */:
|
|
11987
|
+
case 278 /* ExportSpecifier */:
|
|
11986
11988
|
return node.isTypeOnly || node.parent.parent.isTypeOnly;
|
|
11987
11989
|
case 271 /* NamespaceImport */:
|
|
11988
11990
|
return node.parent.isTypeOnly;
|
|
11989
11991
|
case 270 /* ImportClause */:
|
|
11990
11992
|
case 268 /* ImportEqualsDeclaration */:
|
|
11991
11993
|
return node.isTypeOnly;
|
|
11994
|
+
default:
|
|
11995
|
+
return false;
|
|
11992
11996
|
}
|
|
11993
|
-
return false;
|
|
11994
|
-
}
|
|
11995
|
-
function isTypeOnlyExportDeclaration(node) {
|
|
11996
|
-
switch (node.kind) {
|
|
11997
|
-
case 278 /* ExportSpecifier */:
|
|
11998
|
-
return node.isTypeOnly || node.parent.parent.isTypeOnly;
|
|
11999
|
-
case 275 /* ExportDeclaration */:
|
|
12000
|
-
return node.isTypeOnly && !!node.moduleSpecifier && !node.exportClause;
|
|
12001
|
-
case 277 /* NamespaceExport */:
|
|
12002
|
-
return node.parent.isTypeOnly;
|
|
12003
|
-
}
|
|
12004
|
-
return false;
|
|
12005
|
-
}
|
|
12006
|
-
function isTypeOnlyImportOrExportDeclaration(node) {
|
|
12007
|
-
return isTypeOnlyImportDeclaration(node) || isTypeOnlyExportDeclaration(node);
|
|
12008
11997
|
}
|
|
12009
11998
|
function isAssertionKey(node) {
|
|
12010
11999
|
return isStringLiteral(node) || isIdentifier(node);
|
|
@@ -45789,7 +45778,7 @@ ${lanes.join("\n")}
|
|
|
45789
45778
|
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
45790
45779
|
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
|
|
45791
45780
|
if (typeOnlyDeclaration) {
|
|
45792
|
-
const message = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */
|
|
45781
|
+
const message = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
45793
45782
|
const unescapedName = unescapeLeadingUnderscores(name);
|
|
45794
45783
|
addTypeOnlyDeclarationRelatedInfo(
|
|
45795
45784
|
error(errorLocation, message, unescapedName),
|
|
@@ -45809,7 +45798,7 @@ ${lanes.join("\n")}
|
|
|
45809
45798
|
diagnostic,
|
|
45810
45799
|
createDiagnosticForNode(
|
|
45811
45800
|
typeOnlyDeclaration,
|
|
45812
|
-
typeOnlyDeclaration.kind === 278 /* ExportSpecifier */
|
|
45801
|
+
typeOnlyDeclaration.kind === 278 /* ExportSpecifier */ ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here,
|
|
45813
45802
|
unescapedName
|
|
45814
45803
|
)
|
|
45815
45804
|
);
|
|
@@ -46188,10 +46177,10 @@ ${lanes.join("\n")}
|
|
|
46188
46177
|
false
|
|
46189
46178
|
) && !node.isTypeOnly) {
|
|
46190
46179
|
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfDeclaration(node));
|
|
46191
|
-
const isExport = typeOnlyDeclaration.kind === 278 /* ExportSpecifier
|
|
46180
|
+
const isExport = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */;
|
|
46192
46181
|
const message = isExport ? Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type;
|
|
46193
46182
|
const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
|
|
46194
|
-
const name =
|
|
46183
|
+
const name = unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
|
|
46195
46184
|
addRelatedInfo(error(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
|
|
46196
46185
|
}
|
|
46197
46186
|
}
|
|
@@ -46422,19 +46411,15 @@ ${lanes.join("\n")}
|
|
|
46422
46411
|
return result;
|
|
46423
46412
|
}
|
|
46424
46413
|
function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
|
|
46425
|
-
var _a2;
|
|
46426
46414
|
if (symbol.flags & 1536 /* Module */) {
|
|
46427
46415
|
const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
|
|
46428
46416
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
46429
|
-
const exportStarDeclaration = (_a2 = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a2.get(name.escapedText);
|
|
46430
46417
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
46431
46418
|
specifier,
|
|
46432
46419
|
exportSymbol,
|
|
46433
46420
|
resolved,
|
|
46434
46421
|
/*overwriteEmpty*/
|
|
46435
|
-
false
|
|
46436
|
-
exportStarDeclaration,
|
|
46437
|
-
name.escapedText
|
|
46422
|
+
false
|
|
46438
46423
|
);
|
|
46439
46424
|
return resolved;
|
|
46440
46425
|
}
|
|
@@ -46761,7 +46746,7 @@ ${lanes.join("\n")}
|
|
|
46761
46746
|
}
|
|
46762
46747
|
return flags;
|
|
46763
46748
|
}
|
|
46764
|
-
function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty
|
|
46749
|
+
function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty) {
|
|
46765
46750
|
if (!aliasDeclaration || isPropertyAccessExpression(aliasDeclaration))
|
|
46766
46751
|
return false;
|
|
46767
46752
|
const sourceSymbol = getSymbolOfDeclaration(aliasDeclaration);
|
|
@@ -46770,14 +46755,6 @@ ${lanes.join("\n")}
|
|
|
46770
46755
|
links2.typeOnlyDeclaration = aliasDeclaration;
|
|
46771
46756
|
return true;
|
|
46772
46757
|
}
|
|
46773
|
-
if (exportStarDeclaration) {
|
|
46774
|
-
const links2 = getSymbolLinks(sourceSymbol);
|
|
46775
|
-
links2.typeOnlyDeclaration = exportStarDeclaration;
|
|
46776
|
-
if (sourceSymbol.escapedName !== exportStarName) {
|
|
46777
|
-
links2.typeOnlyExportStarName = exportStarName;
|
|
46778
|
-
}
|
|
46779
|
-
return true;
|
|
46780
|
-
}
|
|
46781
46758
|
const links = getSymbolLinks(sourceSymbol);
|
|
46782
46759
|
return markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, immediateTarget, overwriteEmpty) || markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, finalTarget, overwriteEmpty);
|
|
46783
46760
|
}
|
|
@@ -46799,8 +46776,7 @@ ${lanes.join("\n")}
|
|
|
46799
46776
|
return links.typeOnlyDeclaration || void 0;
|
|
46800
46777
|
}
|
|
46801
46778
|
if (links.typeOnlyDeclaration) {
|
|
46802
|
-
|
|
46803
|
-
return getAllSymbolFlags(resolved) & include ? links.typeOnlyDeclaration : void 0;
|
|
46779
|
+
return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : void 0;
|
|
46804
46780
|
}
|
|
46805
46781
|
return void 0;
|
|
46806
46782
|
}
|
|
@@ -47454,12 +47430,7 @@ ${lanes.join("\n")}
|
|
|
47454
47430
|
}
|
|
47455
47431
|
function getExportsOfModule(moduleSymbol) {
|
|
47456
47432
|
const links = getSymbolLinks(moduleSymbol);
|
|
47457
|
-
|
|
47458
|
-
const { exports, typeOnlyExportStarMap } = getExportsOfModuleWorker(moduleSymbol);
|
|
47459
|
-
links.resolvedExports = exports;
|
|
47460
|
-
links.typeOnlyExportStarMap = typeOnlyExportStarMap;
|
|
47461
|
-
}
|
|
47462
|
-
return links.resolvedExports;
|
|
47433
|
+
return links.resolvedExports || (links.resolvedExports = getExportsOfModuleWorker(moduleSymbol));
|
|
47463
47434
|
}
|
|
47464
47435
|
function extendExportSymbols(target, source, lookupTable, exportNode) {
|
|
47465
47436
|
if (!source)
|
|
@@ -47487,21 +47458,9 @@ ${lanes.join("\n")}
|
|
|
47487
47458
|
}
|
|
47488
47459
|
function getExportsOfModuleWorker(moduleSymbol) {
|
|
47489
47460
|
const visitedSymbols = [];
|
|
47490
|
-
let typeOnlyExportStarMap;
|
|
47491
|
-
const nonTypeOnlyNames = /* @__PURE__ */ new Set();
|
|
47492
47461
|
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
|
|
47493
|
-
|
|
47494
|
-
|
|
47495
|
-
nonTypeOnlyNames.forEach((name) => typeOnlyExportStarMap.delete(name));
|
|
47496
|
-
}
|
|
47497
|
-
return {
|
|
47498
|
-
exports,
|
|
47499
|
-
typeOnlyExportStarMap
|
|
47500
|
-
};
|
|
47501
|
-
function visit(symbol, exportStar, isTypeOnly) {
|
|
47502
|
-
if (!isTypeOnly && (symbol == null ? void 0 : symbol.exports)) {
|
|
47503
|
-
symbol.exports.forEach((_, name) => nonTypeOnlyNames.add(name));
|
|
47504
|
-
}
|
|
47462
|
+
return visit(moduleSymbol) || emptySymbols;
|
|
47463
|
+
function visit(symbol) {
|
|
47505
47464
|
if (!(symbol && symbol.exports && pushIfUnique(visitedSymbols, symbol))) {
|
|
47506
47465
|
return;
|
|
47507
47466
|
}
|
|
@@ -47513,7 +47472,7 @@ ${lanes.join("\n")}
|
|
|
47513
47472
|
if (exportStars.declarations) {
|
|
47514
47473
|
for (const node of exportStars.declarations) {
|
|
47515
47474
|
const resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
47516
|
-
const exportedSymbols = visit(resolvedModule
|
|
47475
|
+
const exportedSymbols = visit(resolvedModule);
|
|
47517
47476
|
extendExportSymbols(
|
|
47518
47477
|
nestedSymbols,
|
|
47519
47478
|
exportedSymbols,
|
|
@@ -47537,13 +47496,6 @@ ${lanes.join("\n")}
|
|
|
47537
47496
|
});
|
|
47538
47497
|
extendExportSymbols(symbols, nestedSymbols);
|
|
47539
47498
|
}
|
|
47540
|
-
if (exportStar == null ? void 0 : exportStar.isTypeOnly) {
|
|
47541
|
-
typeOnlyExportStarMap != null ? typeOnlyExportStarMap : typeOnlyExportStarMap = /* @__PURE__ */ new Map();
|
|
47542
|
-
symbols.forEach((_, escapedName) => typeOnlyExportStarMap.set(
|
|
47543
|
-
escapedName,
|
|
47544
|
-
exportStar
|
|
47545
|
-
));
|
|
47546
|
-
}
|
|
47547
47499
|
return symbols;
|
|
47548
47500
|
}
|
|
47549
47501
|
}
|
|
@@ -53772,7 +53724,7 @@ ${lanes.join("\n")}
|
|
|
53772
53724
|
const links = getSymbolLinks(symbol);
|
|
53773
53725
|
if (!links[resolutionKind]) {
|
|
53774
53726
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
53775
|
-
const earlySymbols = !isStatic2 ? symbol.members : symbol.flags & 1536 /* Module */ ? getExportsOfModuleWorker(symbol)
|
|
53727
|
+
const earlySymbols = !isStatic2 ? symbol.members : symbol.flags & 1536 /* Module */ ? getExportsOfModuleWorker(symbol) : symbol.exports;
|
|
53776
53728
|
links[resolutionKind] = earlySymbols || emptySymbols;
|
|
53777
53729
|
const lateSymbols = createSymbolTable();
|
|
53778
53730
|
for (const decl of symbol.declarations || emptyArray) {
|
|
@@ -54761,7 +54713,7 @@ ${lanes.join("\n")}
|
|
|
54761
54713
|
}
|
|
54762
54714
|
function isConstTypeVariable(type) {
|
|
54763
54715
|
var _a2;
|
|
54764
|
-
return !!(type.flags & 262144 /* TypeParameter */ && some((_a2 = type.symbol) == null ? void 0 : _a2.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType));
|
|
54716
|
+
return !!(type.flags & 262144 /* TypeParameter */ && some((_a2 = type.symbol) == null ? void 0 : _a2.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || isGenericTupleType(type) && findIndex(getTypeArguments(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t)) >= 0 || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType));
|
|
54765
54717
|
}
|
|
54766
54718
|
function getConstraintOfIndexedAccess(type) {
|
|
54767
54719
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -66677,6 +66629,7 @@ ${lanes.join("\n")}
|
|
|
66677
66629
|
}
|
|
66678
66630
|
}
|
|
66679
66631
|
function getNarrowedTypeOfSymbol(symbol, location) {
|
|
66632
|
+
var _a2;
|
|
66680
66633
|
const type = getTypeOfSymbol(symbol);
|
|
66681
66634
|
const declaration = symbol.valueDeclaration;
|
|
66682
66635
|
if (declaration) {
|
|
@@ -66712,7 +66665,7 @@ ${lanes.join("\n")}
|
|
|
66712
66665
|
if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
|
|
66713
66666
|
const contextualSignature = getContextualSignature(func);
|
|
66714
66667
|
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
66715
|
-
const restType = getReducedApparentType(getTypeOfSymbol(contextualSignature.parameters[0]));
|
|
66668
|
+
const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a2 = getInferenceContext(func)) == null ? void 0 : _a2.nonFixingMapper));
|
|
66716
66669
|
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) {
|
|
66717
66670
|
const narrowedType = getFlowTypeOfReference(
|
|
66718
66671
|
func,
|
|
@@ -67933,7 +67886,9 @@ ${lanes.join("\n")}
|
|
|
67933
67886
|
}
|
|
67934
67887
|
const index = findContextualNode(node);
|
|
67935
67888
|
if (index >= 0) {
|
|
67936
|
-
|
|
67889
|
+
const cached = contextualTypes[index];
|
|
67890
|
+
if (cached || !contextFlags)
|
|
67891
|
+
return cached;
|
|
67937
67892
|
}
|
|
67938
67893
|
const { parent: parent2 } = node;
|
|
67939
67894
|
switch (parent2.kind) {
|
|
@@ -79522,8 +79477,12 @@ ${lanes.join("\n")}
|
|
|
79522
79477
|
}
|
|
79523
79478
|
function checkGrammarExportDeclaration(node) {
|
|
79524
79479
|
var _a2;
|
|
79525
|
-
if (node.isTypeOnly
|
|
79526
|
-
|
|
79480
|
+
if (node.isTypeOnly) {
|
|
79481
|
+
if (((_a2 = node.exportClause) == null ? void 0 : _a2.kind) === 276 /* NamedExports */) {
|
|
79482
|
+
return checkGrammarNamedImportsOrExports(node.exportClause);
|
|
79483
|
+
} else {
|
|
79484
|
+
return grammarErrorOnNode(node, Diagnostics.Only_named_exports_may_use_export_type);
|
|
79485
|
+
}
|
|
79527
79486
|
}
|
|
79528
79487
|
return false;
|
|
79529
79488
|
}
|
|
@@ -145048,7 +145007,7 @@ ${lanes.join("\n")}
|
|
|
145048
145007
|
symbolToSortTextMap[getSymbolId(symbol)] = SortText.GlobalsOrKeywords;
|
|
145049
145008
|
}
|
|
145050
145009
|
if (typeOnlyAliasNeedsPromotion && !(symbol.flags & 111551 /* Value */)) {
|
|
145051
|
-
const typeOnlyAliasDeclaration = symbol.declarations && find(symbol.declarations,
|
|
145010
|
+
const typeOnlyAliasDeclaration = symbol.declarations && find(symbol.declarations, isTypeOnlyImportOrExportDeclaration);
|
|
145052
145011
|
if (typeOnlyAliasDeclaration) {
|
|
145053
145012
|
const origin = { kind: 64 /* TypeOnlyAlias */, declaration: typeOnlyAliasDeclaration };
|
|
145054
145013
|
symbolToOriginInfoMap[i] = origin;
|
|
@@ -146093,14 +146052,14 @@ ${lanes.join("\n")}
|
|
|
146093
146052
|
case 27 /* CommaToken */:
|
|
146094
146053
|
return tryCast(contextToken.parent, isObjectTypeDeclaration);
|
|
146095
146054
|
default:
|
|
146096
|
-
if (
|
|
146097
|
-
if (getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line
|
|
146055
|
+
if (isObjectTypeDeclaration(location)) {
|
|
146056
|
+
if (getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
|
|
146098
146057
|
return location;
|
|
146099
146058
|
}
|
|
146100
|
-
|
|
146059
|
+
const isValidKeyword = isClassLike(contextToken.parent.parent) ? isClassMemberCompletionKeyword : isInterfaceOrTypeLiteralCompletionKeyword;
|
|
146060
|
+
return isValidKeyword(contextToken.kind) || contextToken.kind === 41 /* AsteriskToken */ || isIdentifier(contextToken) && isValidKeyword((_a2 = identifierToKeywordKind(contextToken)) != null ? _a2 : 0 /* Unknown */) ? contextToken.parent.parent : void 0;
|
|
146101
146061
|
}
|
|
146102
|
-
|
|
146103
|
-
return isValidKeyword(contextToken.kind) || contextToken.kind === 41 /* AsteriskToken */ || isIdentifier(contextToken) && isValidKeyword((_a2 = identifierToKeywordKind(contextToken)) != null ? _a2 : 0 /* Unknown */) ? contextToken.parent.parent : void 0;
|
|
146062
|
+
return void 0;
|
|
146104
146063
|
}
|
|
146105
146064
|
}
|
|
146106
146065
|
function tryGetTypeLiteralNode(node) {
|
|
@@ -166139,8 +166098,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
166139
166098
|
isTypeNodeKind: () => isTypeNodeKind,
|
|
166140
166099
|
isTypeNodeOrTypeParameterDeclaration: () => isTypeNodeOrTypeParameterDeclaration,
|
|
166141
166100
|
isTypeOfExpression: () => isTypeOfExpression,
|
|
166142
|
-
isTypeOnlyExportDeclaration: () => isTypeOnlyExportDeclaration,
|
|
166143
|
-
isTypeOnlyImportDeclaration: () => isTypeOnlyImportDeclaration,
|
|
166144
166101
|
isTypeOnlyImportOrExportDeclaration: () => isTypeOnlyImportOrExportDeclaration,
|
|
166145
166102
|
isTypeOperatorNode: () => isTypeOperatorNode,
|
|
166146
166103
|
isTypeParameterDeclaration: () => isTypeParameterDeclaration,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -5502,6 +5502,7 @@ var Diagnostics = {
|
|
|
5502
5502
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, 1 /* Error */, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
|
|
5503
5503
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, 1 /* Error */, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
5504
5504
|
Unexpected_token_Did_you_mean_or_gt: diag(1382, 1 /* Error */, "Unexpected_token_Did_you_mean_or_gt_1382", "Unexpected token. Did you mean `{'>'}` or `>`?"),
|
|
5505
|
+
Only_named_exports_may_use_export_type: diag(1383, 1 /* Error */, "Only_named_exports_may_use_export_type_1383", "Only named exports may use 'export type'."),
|
|
5505
5506
|
Function_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1385, 1 /* Error */, "Function_type_notation_must_be_parenthesized_when_used_in_a_union_type_1385", "Function type notation must be parenthesized when used in a union type."),
|
|
5506
5507
|
Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type: diag(1386, 1 /* Error */, "Constructor_type_notation_must_be_parenthesized_when_used_in_a_union_type_1386", "Constructor type notation must be parenthesized when used in a union type."),
|
|
5507
5508
|
Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type: diag(1387, 1 /* Error */, "Function_type_notation_must_be_parenthesized_when_used_in_an_intersection_type_1387", "Function type notation must be parenthesized when used in an intersection type."),
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.0.0-pr-
|
|
5
|
+
"version": "5.0.0-pr-52213-4",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -77,9 +77,12 @@
|
|
|
77
77
|
"ms": "^2.1.3",
|
|
78
78
|
"node-fetch": "^3.2.10",
|
|
79
79
|
"source-map-support": "latest",
|
|
80
|
-
"typescript": "
|
|
80
|
+
"typescript": "5.0.0-dev.20230112",
|
|
81
81
|
"which": "^2.0.2"
|
|
82
82
|
},
|
|
83
|
+
"overrides": {
|
|
84
|
+
"typescript@*": "$typescript"
|
|
85
|
+
},
|
|
83
86
|
"scripts": {
|
|
84
87
|
"test": "hereby runtests-parallel --light=false",
|
|
85
88
|
"test:eslint-rules": "hereby run-eslint-rules-tests",
|