typescript 5.0.2 → 5.0.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/lib.decorators.legacy.d.ts +1 -1
- package/lib/tsc.js +55 -34
- package/lib/tsserver.js +59 -35
- package/lib/tsserverlibrary.js +58 -35
- package/lib/typescript.js +57 -35
- package/lib/typingsInstaller.js +15 -5
- package/package.json +1 -1
|
@@ -19,4 +19,4 @@ and limitations under the License.
|
|
|
19
19
|
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
|
|
20
20
|
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
|
|
21
21
|
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
|
22
|
-
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
22
|
+
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = "5.0.
|
|
26
|
+
var version = "5.0.4";
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -16192,6 +16192,9 @@ function getAllowSyntheticDefaultImports(compilerOptions) {
|
|
|
16192
16192
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
|
16193
16193
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
16194
16194
|
}
|
|
16195
|
+
function shouldResolveJsRequire(compilerOptions) {
|
|
16196
|
+
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
|
|
16197
|
+
}
|
|
16195
16198
|
function getResolvePackageJsonExports(compilerOptions) {
|
|
16196
16199
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
16197
16200
|
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
@@ -29242,6 +29245,12 @@ var Parser;
|
|
|
29242
29245
|
if (languageVariant === 1 /* JSX */) {
|
|
29243
29246
|
return parseJsxElementOrSelfClosingElementOrFragment(
|
|
29244
29247
|
/*inExpressionContext*/
|
|
29248
|
+
true,
|
|
29249
|
+
/*topInvalidNodePosition*/
|
|
29250
|
+
void 0,
|
|
29251
|
+
/*openingTag*/
|
|
29252
|
+
void 0,
|
|
29253
|
+
/*mustBeUnary*/
|
|
29245
29254
|
true
|
|
29246
29255
|
);
|
|
29247
29256
|
}
|
|
@@ -29346,7 +29355,7 @@ var Parser;
|
|
|
29346
29355
|
true
|
|
29347
29356
|
)), pos);
|
|
29348
29357
|
}
|
|
29349
|
-
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
|
|
29358
|
+
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
|
|
29350
29359
|
const pos = getNodePos();
|
|
29351
29360
|
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
|
|
29352
29361
|
let result;
|
|
@@ -29384,7 +29393,7 @@ var Parser;
|
|
|
29384
29393
|
Debug.assert(opening.kind === 282 /* JsxSelfClosingElement */);
|
|
29385
29394
|
result = opening;
|
|
29386
29395
|
}
|
|
29387
|
-
if (inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
29396
|
+
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
29388
29397
|
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
|
|
29389
29398
|
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
|
|
29390
29399
|
/*inExpressionContext*/
|
|
@@ -34074,7 +34083,8 @@ var commandOptionsWithoutBuild = [
|
|
|
34074
34083
|
affectsSemanticDiagnostics: true,
|
|
34075
34084
|
category: Diagnostics.Modules,
|
|
34076
34085
|
description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
|
|
34077
|
-
defaultValueDescription: false
|
|
34086
|
+
defaultValueDescription: false,
|
|
34087
|
+
transpileOptionValue: void 0
|
|
34078
34088
|
},
|
|
34079
34089
|
{
|
|
34080
34090
|
name: "resolvePackageJsonExports",
|
|
@@ -37424,7 +37434,7 @@ function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, hos
|
|
|
37424
37434
|
}
|
|
37425
37435
|
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
37426
37436
|
return nodeModuleNameResolverWorker(
|
|
37427
|
-
|
|
37437
|
+
30 /* NodeNextDefault */,
|
|
37428
37438
|
moduleName,
|
|
37429
37439
|
getDirectoryPath(containingFile),
|
|
37430
37440
|
{ moduleResolution: 99 /* NodeNext */ },
|
|
@@ -41311,7 +41321,7 @@ function createBinder() {
|
|
|
41311
41321
|
}
|
|
41312
41322
|
if (!isBindingPattern(node.name)) {
|
|
41313
41323
|
const possibleVariableDecl = node.kind === 257 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
41314
|
-
if (isInJSFile(node) &&
|
|
41324
|
+
if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
|
|
41315
41325
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
41316
41326
|
} else if (isBlockOrCatchScoped(node)) {
|
|
41317
41327
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
|
@@ -44849,7 +44859,7 @@ function createTypeChecker(host) {
|
|
|
44849
44859
|
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
44850
44860
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
44851
44861
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
44852
|
-
if (hasExportAssignmentSymbol(moduleSymbol) && !
|
|
44862
|
+
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
44853
44863
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
44854
44864
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
44855
44865
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
@@ -45017,7 +45027,7 @@ function createTypeChecker(host) {
|
|
|
45017
45027
|
if (!isIdentifier(name)) {
|
|
45018
45028
|
return void 0;
|
|
45019
45029
|
}
|
|
45020
|
-
const suppressInteropError = name.escapedText === "default" /* Default */ &&
|
|
45030
|
+
const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
|
|
45021
45031
|
const targetSymbol = resolveESModuleSymbol(
|
|
45022
45032
|
moduleSymbol,
|
|
45023
45033
|
moduleSpecifier,
|
|
@@ -49646,7 +49656,7 @@ function createTypeChecker(host) {
|
|
|
49646
49656
|
return;
|
|
49647
49657
|
}
|
|
49648
49658
|
let verbatimTargetName = isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || unescapeLeadingUnderscores(target.escapedName);
|
|
49649
|
-
if (verbatimTargetName === "export=" /* ExportEquals */ &&
|
|
49659
|
+
if (verbatimTargetName === "export=" /* ExportEquals */ && allowSyntheticDefaultImports) {
|
|
49650
49660
|
verbatimTargetName = "default" /* Default */;
|
|
49651
49661
|
}
|
|
49652
49662
|
const targetName = getInternalSymbolName(target, verbatimTargetName);
|
|
@@ -53129,9 +53139,10 @@ function createTypeChecker(host) {
|
|
|
53129
53139
|
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, emptyArray);
|
|
53130
53140
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
53131
53141
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
53132
|
-
const
|
|
53133
|
-
const
|
|
53134
|
-
const
|
|
53142
|
+
const mappedType = type.target || type;
|
|
53143
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
53144
|
+
const shouldLinkPropDeclarations = !nameType || isFilteringMappedType(mappedType);
|
|
53145
|
+
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
53135
53146
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
53136
53147
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
53137
53148
|
const include = keyofStringsOnly ? 128 /* StringLiteral */ : 8576 /* StringOrNumberLiteralOrUnique */;
|
|
@@ -53168,7 +53179,7 @@ function createTypeChecker(host) {
|
|
|
53168
53179
|
prop.links.keyType = keyType;
|
|
53169
53180
|
if (modifiersProp) {
|
|
53170
53181
|
prop.links.syntheticOrigin = modifiersProp;
|
|
53171
|
-
prop.declarations =
|
|
53182
|
+
prop.declarations = shouldLinkPropDeclarations ? modifiersProp.declarations : void 0;
|
|
53172
53183
|
}
|
|
53173
53184
|
members.set(propName, prop);
|
|
53174
53185
|
}
|
|
@@ -53274,6 +53285,10 @@ function createTypeChecker(host) {
|
|
|
53274
53285
|
}
|
|
53275
53286
|
return false;
|
|
53276
53287
|
}
|
|
53288
|
+
function isFilteringMappedType(type) {
|
|
53289
|
+
const nameType = getNameTypeFromMappedType(type);
|
|
53290
|
+
return !!nameType && isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type));
|
|
53291
|
+
}
|
|
53277
53292
|
function resolveStructuredTypeMembers(type) {
|
|
53278
53293
|
if (!type.members) {
|
|
53279
53294
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -55778,6 +55793,12 @@ function createTypeChecker(host) {
|
|
|
55778
55793
|
i--;
|
|
55779
55794
|
const source = types[i];
|
|
55780
55795
|
if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
55796
|
+
if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
|
|
55797
|
+
if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
|
|
55798
|
+
orderedRemoveItemAt(types, i);
|
|
55799
|
+
}
|
|
55800
|
+
continue;
|
|
55801
|
+
}
|
|
55781
55802
|
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
|
|
55782
55803
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
55783
55804
|
for (const target of types) {
|
|
@@ -56815,8 +56836,7 @@ function createTypeChecker(host) {
|
|
|
56815
56836
|
}
|
|
56816
56837
|
}
|
|
56817
56838
|
if (isGenericMappedType(objectType)) {
|
|
56818
|
-
|
|
56819
|
-
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
56839
|
+
if (!getNameTypeFromMappedType(objectType) || isFilteringMappedType(objectType)) {
|
|
56820
56840
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
56821
56841
|
}
|
|
56822
56842
|
}
|
|
@@ -61315,7 +61335,7 @@ function createTypeChecker(host) {
|
|
|
61315
61335
|
const targetHasStringIndex = some(indexInfos, (info) => info.keyType === stringType);
|
|
61316
61336
|
let result2 = -1 /* True */;
|
|
61317
61337
|
for (const targetInfo of indexInfos) {
|
|
61318
|
-
const related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
61338
|
+
const related = relation !== strictSubtypeRelation && !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
61319
61339
|
if (!related) {
|
|
61320
61340
|
return 0 /* False */;
|
|
61321
61341
|
}
|
|
@@ -70727,7 +70747,7 @@ function createTypeChecker(host) {
|
|
|
70727
70747
|
return anyType;
|
|
70728
70748
|
}
|
|
70729
70749
|
}
|
|
70730
|
-
if (isInJSFile(node) &&
|
|
70750
|
+
if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) {
|
|
70731
70751
|
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
|
|
70732
70752
|
}
|
|
70733
70753
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -78983,14 +79003,14 @@ function createTypeChecker(host) {
|
|
|
78983
79003
|
markAliasReferenced(sym, id);
|
|
78984
79004
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
78985
79005
|
checkExpressionCached(id);
|
|
78986
|
-
if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
79006
|
+
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
78987
79007
|
error(
|
|
78988
79008
|
id,
|
|
78989
79009
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration : Diagnostics.An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration,
|
|
78990
79010
|
idText(id)
|
|
78991
79011
|
);
|
|
78992
79012
|
}
|
|
78993
|
-
} else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
|
|
79013
|
+
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
78994
79014
|
error(
|
|
78995
79015
|
id,
|
|
78996
79016
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type : Diagnostics.An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type,
|
|
@@ -89230,11 +89250,12 @@ function transformClassFields(context) {
|
|
|
89230
89250
|
return visitEachChild(node, visitor, context);
|
|
89231
89251
|
}
|
|
89232
89252
|
function visitArrayAssignmentElement(node) {
|
|
89233
|
-
|
|
89234
|
-
|
|
89235
|
-
|
|
89236
|
-
|
|
89237
|
-
|
|
89253
|
+
if (isArrayBindingOrAssignmentElement(node)) {
|
|
89254
|
+
if (isSpreadElement(node))
|
|
89255
|
+
return visitAssignmentRestElement(node);
|
|
89256
|
+
if (!isOmittedExpression(node))
|
|
89257
|
+
return visitAssignmentElement(node);
|
|
89258
|
+
}
|
|
89238
89259
|
return visitEachChild(node, visitor, context);
|
|
89239
89260
|
}
|
|
89240
89261
|
function visitAssignmentProperty(node) {
|
|
@@ -91030,10 +91051,14 @@ function transformESDecorators(context) {
|
|
|
91030
91051
|
visitor
|
|
91031
91052
|
);
|
|
91032
91053
|
const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
|
|
91033
|
-
|
|
91034
|
-
|
|
91035
|
-
|
|
91036
|
-
|
|
91054
|
+
if (superStatementIndex >= 0) {
|
|
91055
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, superStatementIndex + 1 - nonPrologueStart));
|
|
91056
|
+
addRange(statements, initializerStatements);
|
|
91057
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, superStatementIndex + 1));
|
|
91058
|
+
} else {
|
|
91059
|
+
addRange(statements, initializerStatements);
|
|
91060
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement));
|
|
91061
|
+
}
|
|
91037
91062
|
body = factory2.createBlock(
|
|
91038
91063
|
statements,
|
|
91039
91064
|
/*multiLine*/
|
|
@@ -114343,7 +114368,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114343
114368
|
false
|
|
114344
114369
|
);
|
|
114345
114370
|
}
|
|
114346
|
-
const shouldProcessRequires = isJavaScriptFile &&
|
|
114371
|
+
const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options);
|
|
114347
114372
|
if (file.flags & 2097152 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
|
|
114348
114373
|
collectDynamicImportOrRequireCalls(file);
|
|
114349
114374
|
}
|
|
@@ -115271,9 +115296,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115271
115296
|
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
|
|
115272
115297
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
115273
115298
|
}
|
|
115274
|
-
if (options.isolatedModules) {
|
|
115275
|
-
createRedundantOptionDiagnostic("isolatedModules", "verbatimModuleSyntax");
|
|
115276
|
-
}
|
|
115277
115299
|
if (options.preserveValueImports) {
|
|
115278
115300
|
createRedundantOptionDiagnostic("preserveValueImports", "verbatimModuleSyntax");
|
|
115279
115301
|
}
|
|
@@ -119815,7 +119837,6 @@ function createWatchProgram(host) {
|
|
|
119815
119837
|
);
|
|
119816
119838
|
}
|
|
119817
119839
|
function updateExtendedConfigFilesWatches(forProjectPath, options, watchOptions2, watchType) {
|
|
119818
|
-
Debug.assert(configFileName);
|
|
119819
119840
|
updateSharedExtendedConfigFileWatcher(
|
|
119820
119841
|
forProjectPath,
|
|
119821
119842
|
options,
|
|
@@ -119831,7 +119852,7 @@ function createWatchProgram(host) {
|
|
|
119831
119852
|
if (!(projects == null ? void 0 : projects.size))
|
|
119832
119853
|
return;
|
|
119833
119854
|
projects.forEach((projectPath) => {
|
|
119834
|
-
if (toPath3(configFileName) === projectPath) {
|
|
119855
|
+
if (configFileName && toPath3(configFileName) === projectPath) {
|
|
119835
119856
|
reloadLevel = 2 /* Full */;
|
|
119836
119857
|
} else {
|
|
119837
119858
|
const config = parsedConfigs == null ? void 0 : parsedConfigs.get(projectPath);
|
package/lib/tsserver.js
CHANGED
|
@@ -2070,6 +2070,7 @@ __export(server_exports, {
|
|
|
2070
2070
|
setValueDeclaration: () => setValueDeclaration,
|
|
2071
2071
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
2072
2072
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
2073
|
+
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
2073
2074
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
2074
2075
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
2075
2076
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
|
@@ -2286,7 +2287,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2286
2287
|
|
|
2287
2288
|
// src/compiler/corePublic.ts
|
|
2288
2289
|
var versionMajorMinor = "5.0";
|
|
2289
|
-
var version = "5.0.
|
|
2290
|
+
var version = "5.0.4";
|
|
2290
2291
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2291
2292
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2292
2293
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20263,6 +20264,9 @@ function getAllowSyntheticDefaultImports(compilerOptions) {
|
|
|
20263
20264
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
|
20264
20265
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
20265
20266
|
}
|
|
20267
|
+
function shouldResolveJsRequire(compilerOptions) {
|
|
20268
|
+
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
|
|
20269
|
+
}
|
|
20266
20270
|
function getResolvePackageJsonExports(compilerOptions) {
|
|
20267
20271
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
20268
20272
|
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
@@ -33580,6 +33584,12 @@ var Parser;
|
|
|
33580
33584
|
if (languageVariant === 1 /* JSX */) {
|
|
33581
33585
|
return parseJsxElementOrSelfClosingElementOrFragment(
|
|
33582
33586
|
/*inExpressionContext*/
|
|
33587
|
+
true,
|
|
33588
|
+
/*topInvalidNodePosition*/
|
|
33589
|
+
void 0,
|
|
33590
|
+
/*openingTag*/
|
|
33591
|
+
void 0,
|
|
33592
|
+
/*mustBeUnary*/
|
|
33583
33593
|
true
|
|
33584
33594
|
);
|
|
33585
33595
|
}
|
|
@@ -33684,7 +33694,7 @@ var Parser;
|
|
|
33684
33694
|
true
|
|
33685
33695
|
)), pos);
|
|
33686
33696
|
}
|
|
33687
|
-
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
|
|
33697
|
+
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
|
|
33688
33698
|
const pos = getNodePos();
|
|
33689
33699
|
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
|
|
33690
33700
|
let result;
|
|
@@ -33722,7 +33732,7 @@ var Parser;
|
|
|
33722
33732
|
Debug.assert(opening.kind === 282 /* JsxSelfClosingElement */);
|
|
33723
33733
|
result = opening;
|
|
33724
33734
|
}
|
|
33725
|
-
if (inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
33735
|
+
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
33726
33736
|
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
|
|
33727
33737
|
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
|
|
33728
33738
|
/*inExpressionContext*/
|
|
@@ -38412,7 +38422,8 @@ var commandOptionsWithoutBuild = [
|
|
|
38412
38422
|
affectsSemanticDiagnostics: true,
|
|
38413
38423
|
category: Diagnostics.Modules,
|
|
38414
38424
|
description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
|
|
38415
|
-
defaultValueDescription: false
|
|
38425
|
+
defaultValueDescription: false,
|
|
38426
|
+
transpileOptionValue: void 0
|
|
38416
38427
|
},
|
|
38417
38428
|
{
|
|
38418
38429
|
name: "resolvePackageJsonExports",
|
|
@@ -41868,7 +41879,7 @@ function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, hos
|
|
|
41868
41879
|
}
|
|
41869
41880
|
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
41870
41881
|
return nodeModuleNameResolverWorker(
|
|
41871
|
-
|
|
41882
|
+
30 /* NodeNextDefault */,
|
|
41872
41883
|
moduleName,
|
|
41873
41884
|
getDirectoryPath(containingFile),
|
|
41874
41885
|
{ moduleResolution: 99 /* NodeNext */ },
|
|
@@ -45862,7 +45873,7 @@ function createBinder() {
|
|
|
45862
45873
|
}
|
|
45863
45874
|
if (!isBindingPattern(node.name)) {
|
|
45864
45875
|
const possibleVariableDecl = node.kind === 257 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
45865
|
-
if (isInJSFile(node) &&
|
|
45876
|
+
if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
|
|
45866
45877
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
45867
45878
|
} else if (isBlockOrCatchScoped(node)) {
|
|
45868
45879
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
|
@@ -49448,7 +49459,7 @@ function createTypeChecker(host) {
|
|
|
49448
49459
|
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
49449
49460
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
49450
49461
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
49451
|
-
if (hasExportAssignmentSymbol(moduleSymbol) && !
|
|
49462
|
+
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
49452
49463
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
49453
49464
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
49454
49465
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
@@ -49616,7 +49627,7 @@ function createTypeChecker(host) {
|
|
|
49616
49627
|
if (!isIdentifier(name)) {
|
|
49617
49628
|
return void 0;
|
|
49618
49629
|
}
|
|
49619
|
-
const suppressInteropError = name.escapedText === "default" /* Default */ &&
|
|
49630
|
+
const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
|
|
49620
49631
|
const targetSymbol = resolveESModuleSymbol(
|
|
49621
49632
|
moduleSymbol,
|
|
49622
49633
|
moduleSpecifier,
|
|
@@ -54245,7 +54256,7 @@ function createTypeChecker(host) {
|
|
|
54245
54256
|
return;
|
|
54246
54257
|
}
|
|
54247
54258
|
let verbatimTargetName = isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || unescapeLeadingUnderscores(target.escapedName);
|
|
54248
|
-
if (verbatimTargetName === "export=" /* ExportEquals */ &&
|
|
54259
|
+
if (verbatimTargetName === "export=" /* ExportEquals */ && allowSyntheticDefaultImports) {
|
|
54249
54260
|
verbatimTargetName = "default" /* Default */;
|
|
54250
54261
|
}
|
|
54251
54262
|
const targetName = getInternalSymbolName(target, verbatimTargetName);
|
|
@@ -57728,9 +57739,10 @@ function createTypeChecker(host) {
|
|
|
57728
57739
|
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, emptyArray);
|
|
57729
57740
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
57730
57741
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
57731
|
-
const
|
|
57732
|
-
const
|
|
57733
|
-
const
|
|
57742
|
+
const mappedType = type.target || type;
|
|
57743
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
57744
|
+
const shouldLinkPropDeclarations = !nameType || isFilteringMappedType(mappedType);
|
|
57745
|
+
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
57734
57746
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
57735
57747
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
57736
57748
|
const include = keyofStringsOnly ? 128 /* StringLiteral */ : 8576 /* StringOrNumberLiteralOrUnique */;
|
|
@@ -57767,7 +57779,7 @@ function createTypeChecker(host) {
|
|
|
57767
57779
|
prop.links.keyType = keyType;
|
|
57768
57780
|
if (modifiersProp) {
|
|
57769
57781
|
prop.links.syntheticOrigin = modifiersProp;
|
|
57770
|
-
prop.declarations =
|
|
57782
|
+
prop.declarations = shouldLinkPropDeclarations ? modifiersProp.declarations : void 0;
|
|
57771
57783
|
}
|
|
57772
57784
|
members.set(propName, prop);
|
|
57773
57785
|
}
|
|
@@ -57873,6 +57885,10 @@ function createTypeChecker(host) {
|
|
|
57873
57885
|
}
|
|
57874
57886
|
return false;
|
|
57875
57887
|
}
|
|
57888
|
+
function isFilteringMappedType(type) {
|
|
57889
|
+
const nameType = getNameTypeFromMappedType(type);
|
|
57890
|
+
return !!nameType && isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type));
|
|
57891
|
+
}
|
|
57876
57892
|
function resolveStructuredTypeMembers(type) {
|
|
57877
57893
|
if (!type.members) {
|
|
57878
57894
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -60377,6 +60393,12 @@ function createTypeChecker(host) {
|
|
|
60377
60393
|
i--;
|
|
60378
60394
|
const source = types[i];
|
|
60379
60395
|
if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
60396
|
+
if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
|
|
60397
|
+
if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
|
|
60398
|
+
orderedRemoveItemAt(types, i);
|
|
60399
|
+
}
|
|
60400
|
+
continue;
|
|
60401
|
+
}
|
|
60380
60402
|
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
|
|
60381
60403
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
60382
60404
|
for (const target of types) {
|
|
@@ -61414,8 +61436,7 @@ function createTypeChecker(host) {
|
|
|
61414
61436
|
}
|
|
61415
61437
|
}
|
|
61416
61438
|
if (isGenericMappedType(objectType)) {
|
|
61417
|
-
|
|
61418
|
-
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
61439
|
+
if (!getNameTypeFromMappedType(objectType) || isFilteringMappedType(objectType)) {
|
|
61419
61440
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
61420
61441
|
}
|
|
61421
61442
|
}
|
|
@@ -65914,7 +65935,7 @@ function createTypeChecker(host) {
|
|
|
65914
65935
|
const targetHasStringIndex = some(indexInfos, (info) => info.keyType === stringType);
|
|
65915
65936
|
let result2 = -1 /* True */;
|
|
65916
65937
|
for (const targetInfo of indexInfos) {
|
|
65917
|
-
const related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
65938
|
+
const related = relation !== strictSubtypeRelation && !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
65918
65939
|
if (!related) {
|
|
65919
65940
|
return 0 /* False */;
|
|
65920
65941
|
}
|
|
@@ -75326,7 +75347,7 @@ function createTypeChecker(host) {
|
|
|
75326
75347
|
return anyType;
|
|
75327
75348
|
}
|
|
75328
75349
|
}
|
|
75329
|
-
if (isInJSFile(node) &&
|
|
75350
|
+
if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) {
|
|
75330
75351
|
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
|
|
75331
75352
|
}
|
|
75332
75353
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -83582,14 +83603,14 @@ function createTypeChecker(host) {
|
|
|
83582
83603
|
markAliasReferenced(sym, id);
|
|
83583
83604
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
83584
83605
|
checkExpressionCached(id);
|
|
83585
|
-
if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
83606
|
+
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
83586
83607
|
error(
|
|
83587
83608
|
id,
|
|
83588
83609
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration : Diagnostics.An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration,
|
|
83589
83610
|
idText(id)
|
|
83590
83611
|
);
|
|
83591
83612
|
}
|
|
83592
|
-
} else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
|
|
83613
|
+
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
83593
83614
|
error(
|
|
83594
83615
|
id,
|
|
83595
83616
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type : Diagnostics.An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type,
|
|
@@ -94000,11 +94021,12 @@ function transformClassFields(context) {
|
|
|
94000
94021
|
return visitEachChild(node, visitor, context);
|
|
94001
94022
|
}
|
|
94002
94023
|
function visitArrayAssignmentElement(node) {
|
|
94003
|
-
|
|
94004
|
-
|
|
94005
|
-
|
|
94006
|
-
|
|
94007
|
-
|
|
94024
|
+
if (isArrayBindingOrAssignmentElement(node)) {
|
|
94025
|
+
if (isSpreadElement(node))
|
|
94026
|
+
return visitAssignmentRestElement(node);
|
|
94027
|
+
if (!isOmittedExpression(node))
|
|
94028
|
+
return visitAssignmentElement(node);
|
|
94029
|
+
}
|
|
94008
94030
|
return visitEachChild(node, visitor, context);
|
|
94009
94031
|
}
|
|
94010
94032
|
function visitAssignmentProperty(node) {
|
|
@@ -95800,10 +95822,14 @@ function transformESDecorators(context) {
|
|
|
95800
95822
|
visitor
|
|
95801
95823
|
);
|
|
95802
95824
|
const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
|
|
95803
|
-
|
|
95804
|
-
|
|
95805
|
-
|
|
95806
|
-
|
|
95825
|
+
if (superStatementIndex >= 0) {
|
|
95826
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, superStatementIndex + 1 - nonPrologueStart));
|
|
95827
|
+
addRange(statements, initializerStatements);
|
|
95828
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, superStatementIndex + 1));
|
|
95829
|
+
} else {
|
|
95830
|
+
addRange(statements, initializerStatements);
|
|
95831
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement));
|
|
95832
|
+
}
|
|
95807
95833
|
body = factory2.createBlock(
|
|
95808
95834
|
statements,
|
|
95809
95835
|
/*multiLine*/
|
|
@@ -119178,7 +119204,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119178
119204
|
false
|
|
119179
119205
|
);
|
|
119180
119206
|
}
|
|
119181
|
-
const shouldProcessRequires = isJavaScriptFile &&
|
|
119207
|
+
const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options);
|
|
119182
119208
|
if (file.flags & 2097152 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
|
|
119183
119209
|
collectDynamicImportOrRequireCalls(file);
|
|
119184
119210
|
}
|
|
@@ -120106,9 +120132,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120106
120132
|
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
|
|
120107
120133
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
120108
120134
|
}
|
|
120109
|
-
if (options.isolatedModules) {
|
|
120110
|
-
createRedundantOptionDiagnostic("isolatedModules", "verbatimModuleSyntax");
|
|
120111
|
-
}
|
|
120112
120135
|
if (options.preserveValueImports) {
|
|
120113
120136
|
createRedundantOptionDiagnostic("preserveValueImports", "verbatimModuleSyntax");
|
|
120114
120137
|
}
|
|
@@ -124707,7 +124730,6 @@ function createWatchProgram(host) {
|
|
|
124707
124730
|
);
|
|
124708
124731
|
}
|
|
124709
124732
|
function updateExtendedConfigFilesWatches(forProjectPath, options, watchOptions2, watchType) {
|
|
124710
|
-
Debug.assert(configFileName);
|
|
124711
124733
|
updateSharedExtendedConfigFileWatcher(
|
|
124712
124734
|
forProjectPath,
|
|
124713
124735
|
options,
|
|
@@ -124723,7 +124745,7 @@ function createWatchProgram(host) {
|
|
|
124723
124745
|
if (!(projects == null ? void 0 : projects.size))
|
|
124724
124746
|
return;
|
|
124725
124747
|
projects.forEach((projectPath) => {
|
|
124726
|
-
if (toPath3(configFileName) === projectPath) {
|
|
124748
|
+
if (configFileName && toPath3(configFileName) === projectPath) {
|
|
124727
124749
|
reloadLevel = 2 /* Full */;
|
|
124728
124750
|
} else {
|
|
124729
124751
|
const config = parsedConfigs == null ? void 0 : parsedConfigs.get(projectPath);
|
|
@@ -152027,7 +152049,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
|
|
|
152027
152049
|
const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
|
|
152028
152050
|
return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
|
|
152029
152051
|
default:
|
|
152030
|
-
return fromContextualType();
|
|
152052
|
+
return fromContextualType() || fromContextualType(0 /* None */);
|
|
152031
152053
|
}
|
|
152032
152054
|
function fromContextualType(contextFlags = 4 /* Completions */) {
|
|
152033
152055
|
const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
|
|
@@ -169767,6 +169789,7 @@ __export(ts_exports3, {
|
|
|
169767
169789
|
setValueDeclaration: () => setValueDeclaration,
|
|
169768
169790
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
169769
169791
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
169792
|
+
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
169770
169793
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
169771
169794
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
169772
169795
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
|
@@ -183714,6 +183737,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
183714
183737
|
setValueDeclaration,
|
|
183715
183738
|
shouldAllowImportingTsExtension,
|
|
183716
183739
|
shouldPreserveConstEnums,
|
|
183740
|
+
shouldResolveJsRequire,
|
|
183717
183741
|
shouldUseUriStyleNodeCoreModules,
|
|
183718
183742
|
showModuleSpecifier,
|
|
183719
183743
|
signatureHasLiteralTypes,
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.0";
|
|
38
|
-
version = "5.0.
|
|
38
|
+
version = "5.0.4";
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -17991,6 +17991,9 @@ ${lanes.join("\n")}
|
|
|
17991
17991
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
|
17992
17992
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
17993
17993
|
}
|
|
17994
|
+
function shouldResolveJsRequire(compilerOptions) {
|
|
17995
|
+
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
|
|
17996
|
+
}
|
|
17994
17997
|
function getResolvePackageJsonExports(compilerOptions) {
|
|
17995
17998
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
17996
17999
|
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
@@ -31692,6 +31695,12 @@ ${lanes.join("\n")}
|
|
|
31692
31695
|
if (languageVariant === 1 /* JSX */) {
|
|
31693
31696
|
return parseJsxElementOrSelfClosingElementOrFragment(
|
|
31694
31697
|
/*inExpressionContext*/
|
|
31698
|
+
true,
|
|
31699
|
+
/*topInvalidNodePosition*/
|
|
31700
|
+
void 0,
|
|
31701
|
+
/*openingTag*/
|
|
31702
|
+
void 0,
|
|
31703
|
+
/*mustBeUnary*/
|
|
31695
31704
|
true
|
|
31696
31705
|
);
|
|
31697
31706
|
}
|
|
@@ -31796,7 +31805,7 @@ ${lanes.join("\n")}
|
|
|
31796
31805
|
true
|
|
31797
31806
|
)), pos);
|
|
31798
31807
|
}
|
|
31799
|
-
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
|
|
31808
|
+
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
|
|
31800
31809
|
const pos = getNodePos();
|
|
31801
31810
|
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
|
|
31802
31811
|
let result;
|
|
@@ -31834,7 +31843,7 @@ ${lanes.join("\n")}
|
|
|
31834
31843
|
Debug.assert(opening.kind === 282 /* JsxSelfClosingElement */);
|
|
31835
31844
|
result = opening;
|
|
31836
31845
|
}
|
|
31837
|
-
if (inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
31846
|
+
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
31838
31847
|
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
|
|
31839
31848
|
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
|
|
31840
31849
|
/*inExpressionContext*/
|
|
@@ -38066,7 +38075,8 @@ ${lanes.join("\n")}
|
|
|
38066
38075
|
affectsSemanticDiagnostics: true,
|
|
38067
38076
|
category: Diagnostics.Modules,
|
|
38068
38077
|
description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
|
|
38069
|
-
defaultValueDescription: false
|
|
38078
|
+
defaultValueDescription: false,
|
|
38079
|
+
transpileOptionValue: void 0
|
|
38070
38080
|
},
|
|
38071
38081
|
{
|
|
38072
38082
|
name: "resolvePackageJsonExports",
|
|
@@ -39756,7 +39766,7 @@ ${lanes.join("\n")}
|
|
|
39756
39766
|
}
|
|
39757
39767
|
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
39758
39768
|
return nodeModuleNameResolverWorker(
|
|
39759
|
-
|
|
39769
|
+
30 /* NodeNextDefault */,
|
|
39760
39770
|
moduleName,
|
|
39761
39771
|
getDirectoryPath(containingFile),
|
|
39762
39772
|
{ moduleResolution: 99 /* NodeNext */ },
|
|
@@ -43764,7 +43774,7 @@ ${lanes.join("\n")}
|
|
|
43764
43774
|
}
|
|
43765
43775
|
if (!isBindingPattern(node.name)) {
|
|
43766
43776
|
const possibleVariableDecl = node.kind === 257 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
43767
|
-
if (isInJSFile(node) &&
|
|
43777
|
+
if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
|
|
43768
43778
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
43769
43779
|
} else if (isBlockOrCatchScoped(node)) {
|
|
43770
43780
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
|
@@ -47258,7 +47268,7 @@ ${lanes.join("\n")}
|
|
|
47258
47268
|
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
47259
47269
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
47260
47270
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
47261
|
-
if (hasExportAssignmentSymbol(moduleSymbol) && !
|
|
47271
|
+
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
47262
47272
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
47263
47273
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
47264
47274
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
@@ -47426,7 +47436,7 @@ ${lanes.join("\n")}
|
|
|
47426
47436
|
if (!isIdentifier(name)) {
|
|
47427
47437
|
return void 0;
|
|
47428
47438
|
}
|
|
47429
|
-
const suppressInteropError = name.escapedText === "default" /* Default */ &&
|
|
47439
|
+
const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
|
|
47430
47440
|
const targetSymbol = resolveESModuleSymbol(
|
|
47431
47441
|
moduleSymbol,
|
|
47432
47442
|
moduleSpecifier,
|
|
@@ -52055,7 +52065,7 @@ ${lanes.join("\n")}
|
|
|
52055
52065
|
return;
|
|
52056
52066
|
}
|
|
52057
52067
|
let verbatimTargetName = isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || unescapeLeadingUnderscores(target.escapedName);
|
|
52058
|
-
if (verbatimTargetName === "export=" /* ExportEquals */ &&
|
|
52068
|
+
if (verbatimTargetName === "export=" /* ExportEquals */ && allowSyntheticDefaultImports) {
|
|
52059
52069
|
verbatimTargetName = "default" /* Default */;
|
|
52060
52070
|
}
|
|
52061
52071
|
const targetName = getInternalSymbolName(target, verbatimTargetName);
|
|
@@ -55538,9 +55548,10 @@ ${lanes.join("\n")}
|
|
|
55538
55548
|
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, emptyArray);
|
|
55539
55549
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
55540
55550
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
55541
|
-
const
|
|
55542
|
-
const
|
|
55543
|
-
const
|
|
55551
|
+
const mappedType = type.target || type;
|
|
55552
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
55553
|
+
const shouldLinkPropDeclarations = !nameType || isFilteringMappedType(mappedType);
|
|
55554
|
+
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
55544
55555
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
55545
55556
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
55546
55557
|
const include = keyofStringsOnly ? 128 /* StringLiteral */ : 8576 /* StringOrNumberLiteralOrUnique */;
|
|
@@ -55577,7 +55588,7 @@ ${lanes.join("\n")}
|
|
|
55577
55588
|
prop.links.keyType = keyType;
|
|
55578
55589
|
if (modifiersProp) {
|
|
55579
55590
|
prop.links.syntheticOrigin = modifiersProp;
|
|
55580
|
-
prop.declarations =
|
|
55591
|
+
prop.declarations = shouldLinkPropDeclarations ? modifiersProp.declarations : void 0;
|
|
55581
55592
|
}
|
|
55582
55593
|
members.set(propName, prop);
|
|
55583
55594
|
}
|
|
@@ -55683,6 +55694,10 @@ ${lanes.join("\n")}
|
|
|
55683
55694
|
}
|
|
55684
55695
|
return false;
|
|
55685
55696
|
}
|
|
55697
|
+
function isFilteringMappedType(type) {
|
|
55698
|
+
const nameType = getNameTypeFromMappedType(type);
|
|
55699
|
+
return !!nameType && isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type));
|
|
55700
|
+
}
|
|
55686
55701
|
function resolveStructuredTypeMembers(type) {
|
|
55687
55702
|
if (!type.members) {
|
|
55688
55703
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -58187,6 +58202,12 @@ ${lanes.join("\n")}
|
|
|
58187
58202
|
i--;
|
|
58188
58203
|
const source = types[i];
|
|
58189
58204
|
if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
58205
|
+
if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
|
|
58206
|
+
if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
|
|
58207
|
+
orderedRemoveItemAt(types, i);
|
|
58208
|
+
}
|
|
58209
|
+
continue;
|
|
58210
|
+
}
|
|
58190
58211
|
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
|
|
58191
58212
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
58192
58213
|
for (const target of types) {
|
|
@@ -59224,8 +59245,7 @@ ${lanes.join("\n")}
|
|
|
59224
59245
|
}
|
|
59225
59246
|
}
|
|
59226
59247
|
if (isGenericMappedType(objectType)) {
|
|
59227
|
-
|
|
59228
|
-
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
59248
|
+
if (!getNameTypeFromMappedType(objectType) || isFilteringMappedType(objectType)) {
|
|
59229
59249
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
59230
59250
|
}
|
|
59231
59251
|
}
|
|
@@ -63724,7 +63744,7 @@ ${lanes.join("\n")}
|
|
|
63724
63744
|
const targetHasStringIndex = some(indexInfos, (info) => info.keyType === stringType);
|
|
63725
63745
|
let result2 = -1 /* True */;
|
|
63726
63746
|
for (const targetInfo of indexInfos) {
|
|
63727
|
-
const related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
63747
|
+
const related = relation !== strictSubtypeRelation && !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
63728
63748
|
if (!related) {
|
|
63729
63749
|
return 0 /* False */;
|
|
63730
63750
|
}
|
|
@@ -73136,7 +73156,7 @@ ${lanes.join("\n")}
|
|
|
73136
73156
|
return anyType;
|
|
73137
73157
|
}
|
|
73138
73158
|
}
|
|
73139
|
-
if (isInJSFile(node) &&
|
|
73159
|
+
if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) {
|
|
73140
73160
|
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
|
|
73141
73161
|
}
|
|
73142
73162
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -81392,14 +81412,14 @@ ${lanes.join("\n")}
|
|
|
81392
81412
|
markAliasReferenced(sym, id);
|
|
81393
81413
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
81394
81414
|
checkExpressionCached(id);
|
|
81395
|
-
if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81415
|
+
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81396
81416
|
error(
|
|
81397
81417
|
id,
|
|
81398
81418
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration : Diagnostics.An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration,
|
|
81399
81419
|
idText(id)
|
|
81400
81420
|
);
|
|
81401
81421
|
}
|
|
81402
|
-
} else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
|
|
81422
|
+
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
81403
81423
|
error(
|
|
81404
81424
|
id,
|
|
81405
81425
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type : Diagnostics.An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type,
|
|
@@ -91985,11 +92005,12 @@ ${lanes.join("\n")}
|
|
|
91985
92005
|
return visitEachChild(node, visitor, context);
|
|
91986
92006
|
}
|
|
91987
92007
|
function visitArrayAssignmentElement(node) {
|
|
91988
|
-
|
|
91989
|
-
|
|
91990
|
-
|
|
91991
|
-
|
|
91992
|
-
|
|
92008
|
+
if (isArrayBindingOrAssignmentElement(node)) {
|
|
92009
|
+
if (isSpreadElement(node))
|
|
92010
|
+
return visitAssignmentRestElement(node);
|
|
92011
|
+
if (!isOmittedExpression(node))
|
|
92012
|
+
return visitAssignmentElement(node);
|
|
92013
|
+
}
|
|
91993
92014
|
return visitEachChild(node, visitor, context);
|
|
91994
92015
|
}
|
|
91995
92016
|
function visitAssignmentProperty(node) {
|
|
@@ -93803,10 +93824,14 @@ ${lanes.join("\n")}
|
|
|
93803
93824
|
visitor
|
|
93804
93825
|
);
|
|
93805
93826
|
const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
|
|
93806
|
-
|
|
93807
|
-
|
|
93808
|
-
|
|
93809
|
-
|
|
93827
|
+
if (superStatementIndex >= 0) {
|
|
93828
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, superStatementIndex + 1 - nonPrologueStart));
|
|
93829
|
+
addRange(statements, initializerStatements);
|
|
93830
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, superStatementIndex + 1));
|
|
93831
|
+
} else {
|
|
93832
|
+
addRange(statements, initializerStatements);
|
|
93833
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement));
|
|
93834
|
+
}
|
|
93810
93835
|
body = factory2.createBlock(
|
|
93811
93836
|
statements,
|
|
93812
93837
|
/*multiLine*/
|
|
@@ -117196,7 +117221,7 @@ ${lanes.join("\n")}
|
|
|
117196
117221
|
false
|
|
117197
117222
|
);
|
|
117198
117223
|
}
|
|
117199
|
-
const shouldProcessRequires = isJavaScriptFile &&
|
|
117224
|
+
const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options);
|
|
117200
117225
|
if (file.flags & 2097152 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
|
|
117201
117226
|
collectDynamicImportOrRequireCalls(file);
|
|
117202
117227
|
}
|
|
@@ -118124,9 +118149,6 @@ ${lanes.join("\n")}
|
|
|
118124
118149
|
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
|
|
118125
118150
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
118126
118151
|
}
|
|
118127
|
-
if (options.isolatedModules) {
|
|
118128
|
-
createRedundantOptionDiagnostic("isolatedModules", "verbatimModuleSyntax");
|
|
118129
|
-
}
|
|
118130
118152
|
if (options.preserveValueImports) {
|
|
118131
118153
|
createRedundantOptionDiagnostic("preserveValueImports", "verbatimModuleSyntax");
|
|
118132
118154
|
}
|
|
@@ -122897,7 +122919,6 @@ ${lanes.join("\n")}
|
|
|
122897
122919
|
);
|
|
122898
122920
|
}
|
|
122899
122921
|
function updateExtendedConfigFilesWatches(forProjectPath, options, watchOptions2, watchType) {
|
|
122900
|
-
Debug.assert(configFileName);
|
|
122901
122922
|
updateSharedExtendedConfigFileWatcher(
|
|
122902
122923
|
forProjectPath,
|
|
122903
122924
|
options,
|
|
@@ -122913,7 +122934,7 @@ ${lanes.join("\n")}
|
|
|
122913
122934
|
if (!(projects == null ? void 0 : projects.size))
|
|
122914
122935
|
return;
|
|
122915
122936
|
projects.forEach((projectPath) => {
|
|
122916
|
-
if (toPath3(configFileName) === projectPath) {
|
|
122937
|
+
if (configFileName && toPath3(configFileName) === projectPath) {
|
|
122917
122938
|
reloadLevel = 2 /* Full */;
|
|
122918
122939
|
} else {
|
|
122919
122940
|
const config = parsedConfigs == null ? void 0 : parsedConfigs.get(projectPath);
|
|
@@ -151124,7 +151145,7 @@ ${lanes.join("\n")}
|
|
|
151124
151145
|
const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
|
|
151125
151146
|
return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
|
|
151126
151147
|
default:
|
|
151127
|
-
return fromContextualType();
|
|
151148
|
+
return fromContextualType() || fromContextualType(0 /* None */);
|
|
151128
151149
|
}
|
|
151129
151150
|
function fromContextualType(contextFlags = 4 /* Completions */) {
|
|
151130
151151
|
const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
|
|
@@ -180354,6 +180375,7 @@ ${e.message}`;
|
|
|
180354
180375
|
setValueDeclaration: () => setValueDeclaration,
|
|
180355
180376
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
180356
180377
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
180378
|
+
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
180357
180379
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
180358
180380
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
180359
180381
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
|
@@ -182712,6 +182734,7 @@ ${e.message}`;
|
|
|
182712
182734
|
setValueDeclaration: () => setValueDeclaration,
|
|
182713
182735
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
182714
182736
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
182737
|
+
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
182715
182738
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
182716
182739
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
182717
182740
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.0";
|
|
38
|
-
version = "5.0.
|
|
38
|
+
version = "5.0.4";
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -17991,6 +17991,9 @@ ${lanes.join("\n")}
|
|
|
17991
17991
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
|
17992
17992
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
17993
17993
|
}
|
|
17994
|
+
function shouldResolveJsRequire(compilerOptions) {
|
|
17995
|
+
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
|
|
17996
|
+
}
|
|
17994
17997
|
function getResolvePackageJsonExports(compilerOptions) {
|
|
17995
17998
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
17996
17999
|
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
@@ -31692,6 +31695,12 @@ ${lanes.join("\n")}
|
|
|
31692
31695
|
if (languageVariant === 1 /* JSX */) {
|
|
31693
31696
|
return parseJsxElementOrSelfClosingElementOrFragment(
|
|
31694
31697
|
/*inExpressionContext*/
|
|
31698
|
+
true,
|
|
31699
|
+
/*topInvalidNodePosition*/
|
|
31700
|
+
void 0,
|
|
31701
|
+
/*openingTag*/
|
|
31702
|
+
void 0,
|
|
31703
|
+
/*mustBeUnary*/
|
|
31695
31704
|
true
|
|
31696
31705
|
);
|
|
31697
31706
|
}
|
|
@@ -31796,7 +31805,7 @@ ${lanes.join("\n")}
|
|
|
31796
31805
|
true
|
|
31797
31806
|
)), pos);
|
|
31798
31807
|
}
|
|
31799
|
-
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
|
|
31808
|
+
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
|
|
31800
31809
|
const pos = getNodePos();
|
|
31801
31810
|
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
|
|
31802
31811
|
let result;
|
|
@@ -31834,7 +31843,7 @@ ${lanes.join("\n")}
|
|
|
31834
31843
|
Debug.assert(opening.kind === 282 /* JsxSelfClosingElement */);
|
|
31835
31844
|
result = opening;
|
|
31836
31845
|
}
|
|
31837
|
-
if (inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
31846
|
+
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
31838
31847
|
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
|
|
31839
31848
|
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
|
|
31840
31849
|
/*inExpressionContext*/
|
|
@@ -38066,7 +38075,8 @@ ${lanes.join("\n")}
|
|
|
38066
38075
|
affectsSemanticDiagnostics: true,
|
|
38067
38076
|
category: Diagnostics.Modules,
|
|
38068
38077
|
description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
|
|
38069
|
-
defaultValueDescription: false
|
|
38078
|
+
defaultValueDescription: false,
|
|
38079
|
+
transpileOptionValue: void 0
|
|
38070
38080
|
},
|
|
38071
38081
|
{
|
|
38072
38082
|
name: "resolvePackageJsonExports",
|
|
@@ -39756,7 +39766,7 @@ ${lanes.join("\n")}
|
|
|
39756
39766
|
}
|
|
39757
39767
|
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
39758
39768
|
return nodeModuleNameResolverWorker(
|
|
39759
|
-
|
|
39769
|
+
30 /* NodeNextDefault */,
|
|
39760
39770
|
moduleName,
|
|
39761
39771
|
getDirectoryPath(containingFile),
|
|
39762
39772
|
{ moduleResolution: 99 /* NodeNext */ },
|
|
@@ -43764,7 +43774,7 @@ ${lanes.join("\n")}
|
|
|
43764
43774
|
}
|
|
43765
43775
|
if (!isBindingPattern(node.name)) {
|
|
43766
43776
|
const possibleVariableDecl = node.kind === 257 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
43767
|
-
if (isInJSFile(node) &&
|
|
43777
|
+
if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
|
|
43768
43778
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
43769
43779
|
} else if (isBlockOrCatchScoped(node)) {
|
|
43770
43780
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
|
@@ -47258,7 +47268,7 @@ ${lanes.join("\n")}
|
|
|
47258
47268
|
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
47259
47269
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
47260
47270
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
47261
|
-
if (hasExportAssignmentSymbol(moduleSymbol) && !
|
|
47271
|
+
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
47262
47272
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
47263
47273
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
47264
47274
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
@@ -47426,7 +47436,7 @@ ${lanes.join("\n")}
|
|
|
47426
47436
|
if (!isIdentifier(name)) {
|
|
47427
47437
|
return void 0;
|
|
47428
47438
|
}
|
|
47429
|
-
const suppressInteropError = name.escapedText === "default" /* Default */ &&
|
|
47439
|
+
const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
|
|
47430
47440
|
const targetSymbol = resolveESModuleSymbol(
|
|
47431
47441
|
moduleSymbol,
|
|
47432
47442
|
moduleSpecifier,
|
|
@@ -52055,7 +52065,7 @@ ${lanes.join("\n")}
|
|
|
52055
52065
|
return;
|
|
52056
52066
|
}
|
|
52057
52067
|
let verbatimTargetName = isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || unescapeLeadingUnderscores(target.escapedName);
|
|
52058
|
-
if (verbatimTargetName === "export=" /* ExportEquals */ &&
|
|
52068
|
+
if (verbatimTargetName === "export=" /* ExportEquals */ && allowSyntheticDefaultImports) {
|
|
52059
52069
|
verbatimTargetName = "default" /* Default */;
|
|
52060
52070
|
}
|
|
52061
52071
|
const targetName = getInternalSymbolName(target, verbatimTargetName);
|
|
@@ -55538,9 +55548,10 @@ ${lanes.join("\n")}
|
|
|
55538
55548
|
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, emptyArray);
|
|
55539
55549
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
55540
55550
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
55541
|
-
const
|
|
55542
|
-
const
|
|
55543
|
-
const
|
|
55551
|
+
const mappedType = type.target || type;
|
|
55552
|
+
const nameType = getNameTypeFromMappedType(mappedType);
|
|
55553
|
+
const shouldLinkPropDeclarations = !nameType || isFilteringMappedType(mappedType);
|
|
55554
|
+
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
55544
55555
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
55545
55556
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
55546
55557
|
const include = keyofStringsOnly ? 128 /* StringLiteral */ : 8576 /* StringOrNumberLiteralOrUnique */;
|
|
@@ -55577,7 +55588,7 @@ ${lanes.join("\n")}
|
|
|
55577
55588
|
prop.links.keyType = keyType;
|
|
55578
55589
|
if (modifiersProp) {
|
|
55579
55590
|
prop.links.syntheticOrigin = modifiersProp;
|
|
55580
|
-
prop.declarations =
|
|
55591
|
+
prop.declarations = shouldLinkPropDeclarations ? modifiersProp.declarations : void 0;
|
|
55581
55592
|
}
|
|
55582
55593
|
members.set(propName, prop);
|
|
55583
55594
|
}
|
|
@@ -55683,6 +55694,10 @@ ${lanes.join("\n")}
|
|
|
55683
55694
|
}
|
|
55684
55695
|
return false;
|
|
55685
55696
|
}
|
|
55697
|
+
function isFilteringMappedType(type) {
|
|
55698
|
+
const nameType = getNameTypeFromMappedType(type);
|
|
55699
|
+
return !!nameType && isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type));
|
|
55700
|
+
}
|
|
55686
55701
|
function resolveStructuredTypeMembers(type) {
|
|
55687
55702
|
if (!type.members) {
|
|
55688
55703
|
if (type.flags & 524288 /* Object */) {
|
|
@@ -58187,6 +58202,12 @@ ${lanes.join("\n")}
|
|
|
58187
58202
|
i--;
|
|
58188
58203
|
const source = types[i];
|
|
58189
58204
|
if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
58205
|
+
if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
|
|
58206
|
+
if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
|
|
58207
|
+
orderedRemoveItemAt(types, i);
|
|
58208
|
+
}
|
|
58209
|
+
continue;
|
|
58210
|
+
}
|
|
58190
58211
|
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
|
|
58191
58212
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
58192
58213
|
for (const target of types) {
|
|
@@ -59224,8 +59245,7 @@ ${lanes.join("\n")}
|
|
|
59224
59245
|
}
|
|
59225
59246
|
}
|
|
59226
59247
|
if (isGenericMappedType(objectType)) {
|
|
59227
|
-
|
|
59228
|
-
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
59248
|
+
if (!getNameTypeFromMappedType(objectType) || isFilteringMappedType(objectType)) {
|
|
59229
59249
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
59230
59250
|
}
|
|
59231
59251
|
}
|
|
@@ -63724,7 +63744,7 @@ ${lanes.join("\n")}
|
|
|
63724
63744
|
const targetHasStringIndex = some(indexInfos, (info) => info.keyType === stringType);
|
|
63725
63745
|
let result2 = -1 /* True */;
|
|
63726
63746
|
for (const targetInfo of indexInfos) {
|
|
63727
|
-
const related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
63747
|
+
const related = relation !== strictSubtypeRelation && !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
63728
63748
|
if (!related) {
|
|
63729
63749
|
return 0 /* False */;
|
|
63730
63750
|
}
|
|
@@ -73136,7 +73156,7 @@ ${lanes.join("\n")}
|
|
|
73136
73156
|
return anyType;
|
|
73137
73157
|
}
|
|
73138
73158
|
}
|
|
73139
|
-
if (isInJSFile(node) &&
|
|
73159
|
+
if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) {
|
|
73140
73160
|
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
|
|
73141
73161
|
}
|
|
73142
73162
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -81392,14 +81412,14 @@ ${lanes.join("\n")}
|
|
|
81392
81412
|
markAliasReferenced(sym, id);
|
|
81393
81413
|
if (getAllSymbolFlags(sym) & 111551 /* Value */) {
|
|
81394
81414
|
checkExpressionCached(id);
|
|
81395
|
-
if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81415
|
+
if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, 111551 /* Value */)) {
|
|
81396
81416
|
error(
|
|
81397
81417
|
id,
|
|
81398
81418
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration : Diagnostics.An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration,
|
|
81399
81419
|
idText(id)
|
|
81400
81420
|
);
|
|
81401
81421
|
}
|
|
81402
|
-
} else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
|
|
81422
|
+
} else if (!isIllegalExportDefaultInCJS && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax) {
|
|
81403
81423
|
error(
|
|
81404
81424
|
id,
|
|
81405
81425
|
node.isExportEquals ? Diagnostics.An_export_declaration_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type : Diagnostics.An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type,
|
|
@@ -91985,11 +92005,12 @@ ${lanes.join("\n")}
|
|
|
91985
92005
|
return visitEachChild(node, visitor, context);
|
|
91986
92006
|
}
|
|
91987
92007
|
function visitArrayAssignmentElement(node) {
|
|
91988
|
-
|
|
91989
|
-
|
|
91990
|
-
|
|
91991
|
-
|
|
91992
|
-
|
|
92008
|
+
if (isArrayBindingOrAssignmentElement(node)) {
|
|
92009
|
+
if (isSpreadElement(node))
|
|
92010
|
+
return visitAssignmentRestElement(node);
|
|
92011
|
+
if (!isOmittedExpression(node))
|
|
92012
|
+
return visitAssignmentElement(node);
|
|
92013
|
+
}
|
|
91993
92014
|
return visitEachChild(node, visitor, context);
|
|
91994
92015
|
}
|
|
91995
92016
|
function visitAssignmentProperty(node) {
|
|
@@ -93803,10 +93824,14 @@ ${lanes.join("\n")}
|
|
|
93803
93824
|
visitor
|
|
93804
93825
|
);
|
|
93805
93826
|
const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
|
|
93806
|
-
|
|
93807
|
-
|
|
93808
|
-
|
|
93809
|
-
|
|
93827
|
+
if (superStatementIndex >= 0) {
|
|
93828
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, superStatementIndex + 1 - nonPrologueStart));
|
|
93829
|
+
addRange(statements, initializerStatements);
|
|
93830
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, superStatementIndex + 1));
|
|
93831
|
+
} else {
|
|
93832
|
+
addRange(statements, initializerStatements);
|
|
93833
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement));
|
|
93834
|
+
}
|
|
93810
93835
|
body = factory2.createBlock(
|
|
93811
93836
|
statements,
|
|
93812
93837
|
/*multiLine*/
|
|
@@ -117196,7 +117221,7 @@ ${lanes.join("\n")}
|
|
|
117196
117221
|
false
|
|
117197
117222
|
);
|
|
117198
117223
|
}
|
|
117199
|
-
const shouldProcessRequires = isJavaScriptFile &&
|
|
117224
|
+
const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options);
|
|
117200
117225
|
if (file.flags & 2097152 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
|
|
117201
117226
|
collectDynamicImportOrRequireCalls(file);
|
|
117202
117227
|
}
|
|
@@ -118124,9 +118149,6 @@ ${lanes.join("\n")}
|
|
|
118124
118149
|
if (moduleKind === 2 /* AMD */ || moduleKind === 3 /* UMD */ || moduleKind === 4 /* System */) {
|
|
118125
118150
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
118126
118151
|
}
|
|
118127
|
-
if (options.isolatedModules) {
|
|
118128
|
-
createRedundantOptionDiagnostic("isolatedModules", "verbatimModuleSyntax");
|
|
118129
|
-
}
|
|
118130
118152
|
if (options.preserveValueImports) {
|
|
118131
118153
|
createRedundantOptionDiagnostic("preserveValueImports", "verbatimModuleSyntax");
|
|
118132
118154
|
}
|
|
@@ -122897,7 +122919,6 @@ ${lanes.join("\n")}
|
|
|
122897
122919
|
);
|
|
122898
122920
|
}
|
|
122899
122921
|
function updateExtendedConfigFilesWatches(forProjectPath, options, watchOptions2, watchType) {
|
|
122900
|
-
Debug.assert(configFileName);
|
|
122901
122922
|
updateSharedExtendedConfigFileWatcher(
|
|
122902
122923
|
forProjectPath,
|
|
122903
122924
|
options,
|
|
@@ -122913,7 +122934,7 @@ ${lanes.join("\n")}
|
|
|
122913
122934
|
if (!(projects == null ? void 0 : projects.size))
|
|
122914
122935
|
return;
|
|
122915
122936
|
projects.forEach((projectPath) => {
|
|
122916
|
-
if (toPath3(configFileName) === projectPath) {
|
|
122937
|
+
if (configFileName && toPath3(configFileName) === projectPath) {
|
|
122917
122938
|
reloadLevel = 2 /* Full */;
|
|
122918
122939
|
} else {
|
|
122919
122940
|
const config = parsedConfigs == null ? void 0 : parsedConfigs.get(projectPath);
|
|
@@ -151138,7 +151159,7 @@ ${lanes.join("\n")}
|
|
|
151138
151159
|
const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
|
|
151139
151160
|
return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
|
|
151140
151161
|
default:
|
|
151141
|
-
return fromContextualType();
|
|
151162
|
+
return fromContextualType() || fromContextualType(0 /* None */);
|
|
151142
151163
|
}
|
|
151143
151164
|
function fromContextualType(contextFlags = 4 /* Completions */) {
|
|
151144
151165
|
const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags));
|
|
@@ -169535,6 +169556,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169535
169556
|
setValueDeclaration: () => setValueDeclaration,
|
|
169536
169557
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
169537
169558
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
169559
|
+
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
169538
169560
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
169539
169561
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
169540
169562
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.0";
|
|
57
|
-
var version = "5.0.
|
|
57
|
+
var version = "5.0.4";
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -11947,6 +11947,9 @@ function unusedLabelIsError(options) {
|
|
|
11947
11947
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
|
11948
11948
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
11949
11949
|
}
|
|
11950
|
+
function shouldResolveJsRequire(compilerOptions) {
|
|
11951
|
+
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
|
|
11952
|
+
}
|
|
11950
11953
|
function getResolveJsonModule(compilerOptions) {
|
|
11951
11954
|
if (compilerOptions.resolveJsonModule !== void 0) {
|
|
11952
11955
|
return compilerOptions.resolveJsonModule;
|
|
@@ -22092,6 +22095,12 @@ var Parser;
|
|
|
22092
22095
|
if (languageVariant === 1 /* JSX */) {
|
|
22093
22096
|
return parseJsxElementOrSelfClosingElementOrFragment(
|
|
22094
22097
|
/*inExpressionContext*/
|
|
22098
|
+
true,
|
|
22099
|
+
/*topInvalidNodePosition*/
|
|
22100
|
+
void 0,
|
|
22101
|
+
/*openingTag*/
|
|
22102
|
+
void 0,
|
|
22103
|
+
/*mustBeUnary*/
|
|
22095
22104
|
true
|
|
22096
22105
|
);
|
|
22097
22106
|
}
|
|
@@ -22196,7 +22205,7 @@ var Parser;
|
|
|
22196
22205
|
true
|
|
22197
22206
|
)), pos);
|
|
22198
22207
|
}
|
|
22199
|
-
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag) {
|
|
22208
|
+
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext, topInvalidNodePosition, openingTag, mustBeUnary = false) {
|
|
22200
22209
|
const pos = getNodePos();
|
|
22201
22210
|
const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
|
|
22202
22211
|
let result;
|
|
@@ -22234,7 +22243,7 @@ var Parser;
|
|
|
22234
22243
|
Debug.assert(opening.kind === 282 /* JsxSelfClosingElement */);
|
|
22235
22244
|
result = opening;
|
|
22236
22245
|
}
|
|
22237
|
-
if (inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
22246
|
+
if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) {
|
|
22238
22247
|
const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition;
|
|
22239
22248
|
const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment(
|
|
22240
22249
|
/*inExpressionContext*/
|
|
@@ -26924,7 +26933,8 @@ var commandOptionsWithoutBuild = [
|
|
|
26924
26933
|
affectsSemanticDiagnostics: true,
|
|
26925
26934
|
category: Diagnostics.Modules,
|
|
26926
26935
|
description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
|
|
26927
|
-
defaultValueDescription: false
|
|
26936
|
+
defaultValueDescription: false,
|
|
26937
|
+
transpileOptionValue: void 0
|
|
26928
26938
|
},
|
|
26929
26939
|
{
|
|
26930
26940
|
name: "resolvePackageJsonExports",
|
|
@@ -32226,7 +32236,7 @@ function createBinder() {
|
|
|
32226
32236
|
}
|
|
32227
32237
|
if (!isBindingPattern(node.name)) {
|
|
32228
32238
|
const possibleVariableDecl = node.kind === 257 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
32229
|
-
if (isInJSFile(node) &&
|
|
32239
|
+
if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
|
|
32230
32240
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
32231
32241
|
} else if (isBlockOrCatchScoped(node)) {
|
|
32232
32242
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.0.
|
|
5
|
+
"version": "5.0.4",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|