typescript 5.0.0-dev.20230213 → 5.0.0-dev.20230214
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 +41 -23
- package/lib/tsserver.js +46 -28
- package/lib/tsserverlibrary.js +46 -28
- package/lib/typescript.js +46 -28
- package/lib/typingsInstaller.js +6 -3
- package/package.json +1 -1
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 = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20230214`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -12158,7 +12158,7 @@ function isCommonJSContainingModuleKind(kind) {
|
|
|
12158
12158
|
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
|
|
12159
12159
|
}
|
|
12160
12160
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
12161
|
-
return isExternalModule(node) || compilerOptions
|
|
12161
|
+
return isExternalModule(node) || getIsolatedModules(compilerOptions) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
|
|
12162
12162
|
}
|
|
12163
12163
|
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
12164
12164
|
switch (node.scriptKind) {
|
|
@@ -12179,7 +12179,7 @@ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
|
12179
12179
|
if (startsWithUseStrict(node.statements)) {
|
|
12180
12180
|
return true;
|
|
12181
12181
|
}
|
|
12182
|
-
if (isExternalModule(node) || compilerOptions
|
|
12182
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
12183
12183
|
if (getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */) {
|
|
12184
12184
|
return true;
|
|
12185
12185
|
}
|
|
@@ -16235,7 +16235,7 @@ function getEmitDeclarations(compilerOptions) {
|
|
|
16235
16235
|
return !!(compilerOptions.declaration || compilerOptions.composite);
|
|
16236
16236
|
}
|
|
16237
16237
|
function shouldPreserveConstEnums(compilerOptions) {
|
|
16238
|
-
return !!(compilerOptions.preserveConstEnums || compilerOptions
|
|
16238
|
+
return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
|
|
16239
16239
|
}
|
|
16240
16240
|
function isIncrementalCompilation(options) {
|
|
16241
16241
|
return !!(options.incremental || options.composite);
|
|
@@ -50466,6 +50466,8 @@ function createTypeChecker(host) {
|
|
|
50466
50466
|
return !!target.baseTypesResolved;
|
|
50467
50467
|
case 8 /* WriteType */:
|
|
50468
50468
|
return !!getSymbolLinks(target).writeType;
|
|
50469
|
+
case 9 /* ParameterInitializerContainsUndefined */:
|
|
50470
|
+
return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
|
|
50469
50471
|
}
|
|
50470
50472
|
return Debug.assertNever(propertyName);
|
|
50471
50473
|
}
|
|
@@ -62490,10 +62492,10 @@ function createTypeChecker(host) {
|
|
|
62490
62492
|
return getBigIntLiteralType(parseValidBigInt(text));
|
|
62491
62493
|
}
|
|
62492
62494
|
function isMemberOfStringMapping(source, target) {
|
|
62493
|
-
if (target.flags &
|
|
62495
|
+
if (target.flags & 1 /* Any */) {
|
|
62494
62496
|
return true;
|
|
62495
62497
|
}
|
|
62496
|
-
if (target.flags & 134217728 /* TemplateLiteral */) {
|
|
62498
|
+
if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
|
|
62497
62499
|
return isTypeAssignableTo(source, target);
|
|
62498
62500
|
}
|
|
62499
62501
|
if (target.flags & 268435456 /* StringMapping */) {
|
|
@@ -65298,15 +65300,25 @@ function createTypeChecker(host) {
|
|
|
65298
65300
|
function isConstVariable(symbol) {
|
|
65299
65301
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
|
|
65300
65302
|
}
|
|
65301
|
-
function
|
|
65302
|
-
|
|
65303
|
-
|
|
65304
|
-
|
|
65305
|
-
|
|
65306
|
-
|
|
65307
|
-
|
|
65308
|
-
|
|
65303
|
+
function parameterInitializerContainsUndefined(declaration) {
|
|
65304
|
+
const links = getNodeLinks(declaration);
|
|
65305
|
+
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
65306
|
+
if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
|
|
65307
|
+
reportCircularityError(declaration.symbol);
|
|
65308
|
+
return true;
|
|
65309
|
+
}
|
|
65310
|
+
const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
|
|
65311
|
+
if (!popTypeResolution()) {
|
|
65312
|
+
reportCircularityError(declaration.symbol);
|
|
65313
|
+
return true;
|
|
65314
|
+
}
|
|
65315
|
+
links.parameterInitializerContainsUndefined = containsUndefined;
|
|
65309
65316
|
}
|
|
65317
|
+
return links.parameterInitializerContainsUndefined;
|
|
65318
|
+
}
|
|
65319
|
+
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
65320
|
+
const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
|
|
65321
|
+
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
65310
65322
|
}
|
|
65311
65323
|
function isConstraintPosition(type, node) {
|
|
65312
65324
|
const parent = node.parent;
|
|
@@ -74812,6 +74824,9 @@ function createTypeChecker(host) {
|
|
|
74812
74824
|
case 273 /* ImportSpecifier */:
|
|
74813
74825
|
case 79 /* Identifier */:
|
|
74814
74826
|
return 1 /* ExportValue */;
|
|
74827
|
+
case 170 /* MethodSignature */:
|
|
74828
|
+
case 168 /* PropertySignature */:
|
|
74829
|
+
return 2 /* ExportType */;
|
|
74815
74830
|
default:
|
|
74816
74831
|
return Debug.failBadSyntaxKind(d);
|
|
74817
74832
|
}
|
|
@@ -79195,6 +79210,8 @@ function createTypeChecker(host) {
|
|
|
79195
79210
|
if (!(links.flags & 1 /* TypeChecked */)) {
|
|
79196
79211
|
links.deferredNodes || (links.deferredNodes = /* @__PURE__ */ new Set());
|
|
79197
79212
|
links.deferredNodes.add(node);
|
|
79213
|
+
} else {
|
|
79214
|
+
Debug.assert(!links.deferredNodes, "A type-checked file should have no deferred nodes.");
|
|
79198
79215
|
}
|
|
79199
79216
|
}
|
|
79200
79217
|
function checkDeferredNodes(context) {
|
|
@@ -79202,6 +79219,7 @@ function createTypeChecker(host) {
|
|
|
79202
79219
|
if (links.deferredNodes) {
|
|
79203
79220
|
links.deferredNodes.forEach(checkDeferredNode);
|
|
79204
79221
|
}
|
|
79222
|
+
links.deferredNodes = void 0;
|
|
79205
79223
|
}
|
|
79206
79224
|
function checkDeferredNode(node) {
|
|
79207
79225
|
var _a2, _b;
|
|
@@ -87027,7 +87045,7 @@ function transformTypeScript(context) {
|
|
|
87027
87045
|
return node;
|
|
87028
87046
|
}
|
|
87029
87047
|
function tryGetConstEnumValue(node) {
|
|
87030
|
-
if (compilerOptions
|
|
87048
|
+
if (getIsolatedModules(compilerOptions)) {
|
|
87031
87049
|
return void 0;
|
|
87032
87050
|
}
|
|
87033
87051
|
return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0;
|
|
@@ -103357,7 +103375,7 @@ function transformECMAScriptModule(context) {
|
|
|
103357
103375
|
if (node.isDeclarationFile) {
|
|
103358
103376
|
return node;
|
|
103359
103377
|
}
|
|
103360
|
-
if (isExternalModule(node) || compilerOptions
|
|
103378
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
103361
103379
|
currentSourceFile = node;
|
|
103362
103380
|
importRequireStatements = void 0;
|
|
103363
103381
|
let result = updateExternalModule(node);
|
|
@@ -103564,7 +103582,7 @@ function transformECMAScriptModule(context) {
|
|
|
103564
103582
|
}
|
|
103565
103583
|
function onEmitNode(hint, node, emitCallback) {
|
|
103566
103584
|
if (isSourceFile(node)) {
|
|
103567
|
-
if ((isExternalModule(node) || compilerOptions
|
|
103585
|
+
if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
|
|
103568
103586
|
helperNameSubstitutions = /* @__PURE__ */ new Map();
|
|
103569
103587
|
}
|
|
103570
103588
|
previousOnEmitNode(hint, node, emitCallback);
|
|
@@ -114158,7 +114176,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114158
114176
|
let imports;
|
|
114159
114177
|
let moduleAugmentations;
|
|
114160
114178
|
let ambientModules;
|
|
114161
|
-
if ((options
|
|
114179
|
+
if ((getIsolatedModules(options) || isExternalModuleFile) && !file.isDeclarationFile) {
|
|
114162
114180
|
if (options.importHelpers) {
|
|
114163
114181
|
imports = [createSyntheticImport(externalHelpersModuleNameText, file)];
|
|
114164
114182
|
}
|
|
@@ -114879,12 +114897,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114879
114897
|
if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
|
|
114880
114898
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
|
|
114881
114899
|
}
|
|
114882
|
-
if (options.isolatedModules) {
|
|
114900
|
+
if (options.isolatedModules || options.verbatimModuleSyntax) {
|
|
114883
114901
|
if (options.out) {
|
|
114884
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
|
|
114902
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
114885
114903
|
}
|
|
114886
114904
|
if (options.outFile) {
|
|
114887
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
|
|
114905
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
114888
114906
|
}
|
|
114889
114907
|
}
|
|
114890
114908
|
if (options.inlineSourceMap) {
|
|
@@ -116291,7 +116309,7 @@ var BuilderState;
|
|
|
116291
116309
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
116292
116310
|
}
|
|
116293
116311
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
116294
|
-
if (compilerOptions && (compilerOptions
|
|
116312
|
+
if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
|
|
116295
116313
|
return [sourceFileWithUpdatedShape];
|
|
116296
116314
|
}
|
|
116297
116315
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
@@ -116704,7 +116722,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
116704
116722
|
return;
|
|
116705
116723
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
116706
116724
|
return;
|
|
116707
|
-
if (state.compilerOptions
|
|
116725
|
+
if (getIsolatedModules(state.compilerOptions)) {
|
|
116708
116726
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
116709
116727
|
seenFileNamesMap.set(affectedFile.resolvedPath, true);
|
|
116710
116728
|
const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);
|
package/lib/tsserver.js
CHANGED
|
@@ -2287,7 +2287,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2287
2287
|
|
|
2288
2288
|
// src/compiler/corePublic.ts
|
|
2289
2289
|
var versionMajorMinor = "5.0";
|
|
2290
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2290
|
+
var version = `${versionMajorMinor}.0-dev.20230214`;
|
|
2291
2291
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2292
2292
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2293
2293
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -15847,7 +15847,7 @@ function isCommonJSContainingModuleKind(kind) {
|
|
|
15847
15847
|
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
|
|
15848
15848
|
}
|
|
15849
15849
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
15850
|
-
return isExternalModule(node) || compilerOptions
|
|
15850
|
+
return isExternalModule(node) || getIsolatedModules(compilerOptions) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
|
|
15851
15851
|
}
|
|
15852
15852
|
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
15853
15853
|
switch (node.scriptKind) {
|
|
@@ -15868,7 +15868,7 @@ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
|
15868
15868
|
if (startsWithUseStrict(node.statements)) {
|
|
15869
15869
|
return true;
|
|
15870
15870
|
}
|
|
15871
|
-
if (isExternalModule(node) || compilerOptions
|
|
15871
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
15872
15872
|
if (getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */) {
|
|
15873
15873
|
return true;
|
|
15874
15874
|
}
|
|
@@ -20299,7 +20299,7 @@ function getEmitDeclarations(compilerOptions) {
|
|
|
20299
20299
|
return !!(compilerOptions.declaration || compilerOptions.composite);
|
|
20300
20300
|
}
|
|
20301
20301
|
function shouldPreserveConstEnums(compilerOptions) {
|
|
20302
|
-
return !!(compilerOptions.preserveConstEnums || compilerOptions
|
|
20302
|
+
return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
|
|
20303
20303
|
}
|
|
20304
20304
|
function isIncrementalCompilation(options) {
|
|
20305
20305
|
return !!(options.incremental || options.composite);
|
|
@@ -55042,6 +55042,8 @@ function createTypeChecker(host) {
|
|
|
55042
55042
|
return !!target.baseTypesResolved;
|
|
55043
55043
|
case 8 /* WriteType */:
|
|
55044
55044
|
return !!getSymbolLinks(target).writeType;
|
|
55045
|
+
case 9 /* ParameterInitializerContainsUndefined */:
|
|
55046
|
+
return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
|
|
55045
55047
|
}
|
|
55046
55048
|
return Debug.assertNever(propertyName);
|
|
55047
55049
|
}
|
|
@@ -67066,10 +67068,10 @@ function createTypeChecker(host) {
|
|
|
67066
67068
|
return getBigIntLiteralType(parseValidBigInt(text));
|
|
67067
67069
|
}
|
|
67068
67070
|
function isMemberOfStringMapping(source, target) {
|
|
67069
|
-
if (target.flags &
|
|
67071
|
+
if (target.flags & 1 /* Any */) {
|
|
67070
67072
|
return true;
|
|
67071
67073
|
}
|
|
67072
|
-
if (target.flags & 134217728 /* TemplateLiteral */) {
|
|
67074
|
+
if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
|
|
67073
67075
|
return isTypeAssignableTo(source, target);
|
|
67074
67076
|
}
|
|
67075
67077
|
if (target.flags & 268435456 /* StringMapping */) {
|
|
@@ -69874,15 +69876,25 @@ function createTypeChecker(host) {
|
|
|
69874
69876
|
function isConstVariable(symbol) {
|
|
69875
69877
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
|
|
69876
69878
|
}
|
|
69877
|
-
function
|
|
69878
|
-
|
|
69879
|
-
|
|
69880
|
-
|
|
69881
|
-
|
|
69882
|
-
|
|
69883
|
-
|
|
69884
|
-
|
|
69879
|
+
function parameterInitializerContainsUndefined(declaration) {
|
|
69880
|
+
const links = getNodeLinks(declaration);
|
|
69881
|
+
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
69882
|
+
if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
|
|
69883
|
+
reportCircularityError(declaration.symbol);
|
|
69884
|
+
return true;
|
|
69885
|
+
}
|
|
69886
|
+
const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
|
|
69887
|
+
if (!popTypeResolution()) {
|
|
69888
|
+
reportCircularityError(declaration.symbol);
|
|
69889
|
+
return true;
|
|
69890
|
+
}
|
|
69891
|
+
links.parameterInitializerContainsUndefined = containsUndefined;
|
|
69885
69892
|
}
|
|
69893
|
+
return links.parameterInitializerContainsUndefined;
|
|
69894
|
+
}
|
|
69895
|
+
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
69896
|
+
const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
|
|
69897
|
+
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
69886
69898
|
}
|
|
69887
69899
|
function isConstraintPosition(type, node) {
|
|
69888
69900
|
const parent2 = node.parent;
|
|
@@ -79388,6 +79400,9 @@ function createTypeChecker(host) {
|
|
|
79388
79400
|
case 273 /* ImportSpecifier */:
|
|
79389
79401
|
case 79 /* Identifier */:
|
|
79390
79402
|
return 1 /* ExportValue */;
|
|
79403
|
+
case 170 /* MethodSignature */:
|
|
79404
|
+
case 168 /* PropertySignature */:
|
|
79405
|
+
return 2 /* ExportType */;
|
|
79391
79406
|
default:
|
|
79392
79407
|
return Debug.failBadSyntaxKind(d);
|
|
79393
79408
|
}
|
|
@@ -83771,6 +83786,8 @@ function createTypeChecker(host) {
|
|
|
83771
83786
|
if (!(links.flags & 1 /* TypeChecked */)) {
|
|
83772
83787
|
links.deferredNodes || (links.deferredNodes = /* @__PURE__ */ new Set());
|
|
83773
83788
|
links.deferredNodes.add(node);
|
|
83789
|
+
} else {
|
|
83790
|
+
Debug.assert(!links.deferredNodes, "A type-checked file should have no deferred nodes.");
|
|
83774
83791
|
}
|
|
83775
83792
|
}
|
|
83776
83793
|
function checkDeferredNodes(context) {
|
|
@@ -83778,6 +83795,7 @@ function createTypeChecker(host) {
|
|
|
83778
83795
|
if (links.deferredNodes) {
|
|
83779
83796
|
links.deferredNodes.forEach(checkDeferredNode);
|
|
83780
83797
|
}
|
|
83798
|
+
links.deferredNodes = void 0;
|
|
83781
83799
|
}
|
|
83782
83800
|
function checkDeferredNode(node) {
|
|
83783
83801
|
var _a2, _b;
|
|
@@ -91774,7 +91792,7 @@ function transformTypeScript(context) {
|
|
|
91774
91792
|
return node;
|
|
91775
91793
|
}
|
|
91776
91794
|
function tryGetConstEnumValue(node) {
|
|
91777
|
-
if (compilerOptions
|
|
91795
|
+
if (getIsolatedModules(compilerOptions)) {
|
|
91778
91796
|
return void 0;
|
|
91779
91797
|
}
|
|
91780
91798
|
return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0;
|
|
@@ -108104,7 +108122,7 @@ function transformECMAScriptModule(context) {
|
|
|
108104
108122
|
if (node.isDeclarationFile) {
|
|
108105
108123
|
return node;
|
|
108106
108124
|
}
|
|
108107
|
-
if (isExternalModule(node) || compilerOptions
|
|
108125
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
108108
108126
|
currentSourceFile = node;
|
|
108109
108127
|
importRequireStatements = void 0;
|
|
108110
108128
|
let result = updateExternalModule(node);
|
|
@@ -108311,7 +108329,7 @@ function transformECMAScriptModule(context) {
|
|
|
108311
108329
|
}
|
|
108312
108330
|
function onEmitNode(hint, node, emitCallback) {
|
|
108313
108331
|
if (isSourceFile(node)) {
|
|
108314
|
-
if ((isExternalModule(node) || compilerOptions
|
|
108332
|
+
if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
|
|
108315
108333
|
helperNameSubstitutions = /* @__PURE__ */ new Map();
|
|
108316
108334
|
}
|
|
108317
108335
|
previousOnEmitNode(hint, node, emitCallback);
|
|
@@ -118970,7 +118988,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118970
118988
|
let imports;
|
|
118971
118989
|
let moduleAugmentations;
|
|
118972
118990
|
let ambientModules;
|
|
118973
|
-
if ((options
|
|
118991
|
+
if ((getIsolatedModules(options) || isExternalModuleFile) && !file.isDeclarationFile) {
|
|
118974
118992
|
if (options.importHelpers) {
|
|
118975
118993
|
imports = [createSyntheticImport(externalHelpersModuleNameText, file)];
|
|
118976
118994
|
}
|
|
@@ -119691,12 +119709,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119691
119709
|
if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
|
|
119692
119710
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
|
|
119693
119711
|
}
|
|
119694
|
-
if (options.isolatedModules) {
|
|
119712
|
+
if (options.isolatedModules || options.verbatimModuleSyntax) {
|
|
119695
119713
|
if (options.out) {
|
|
119696
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
|
|
119714
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
119697
119715
|
}
|
|
119698
119716
|
if (options.outFile) {
|
|
119699
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
|
|
119717
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
119700
119718
|
}
|
|
119701
119719
|
}
|
|
119702
119720
|
if (options.inlineSourceMap) {
|
|
@@ -121111,7 +121129,7 @@ var BuilderState;
|
|
|
121111
121129
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
121112
121130
|
}
|
|
121113
121131
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
121114
|
-
if (compilerOptions && (compilerOptions
|
|
121132
|
+
if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
|
|
121115
121133
|
return [sourceFileWithUpdatedShape];
|
|
121116
121134
|
}
|
|
121117
121135
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
@@ -121536,7 +121554,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
121536
121554
|
return;
|
|
121537
121555
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
121538
121556
|
return;
|
|
121539
|
-
if (state.compilerOptions
|
|
121557
|
+
if (getIsolatedModules(state.compilerOptions)) {
|
|
121540
121558
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
121541
121559
|
seenFileNamesMap.set(affectedFile.resolvedPath, true);
|
|
121542
121560
|
const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);
|
|
@@ -141589,7 +141607,7 @@ function getAddAsTypeOnly(isValidTypeOnlyUseSite, isForNewImportDeclaration, sym
|
|
|
141589
141607
|
if (isForNewImportDeclaration && compilerOptions.importsNotUsedAsValues === 2 /* Error */) {
|
|
141590
141608
|
return 2 /* Required */;
|
|
141591
141609
|
}
|
|
141592
|
-
if ((compilerOptions
|
|
141610
|
+
if (importNameElisionDisabled(compilerOptions) && (!(targetFlags & 111551 /* Value */) || !!checker.getTypeOnlyAliasDeclaration(symbol))) {
|
|
141593
141611
|
return 2 /* Required */;
|
|
141594
141612
|
}
|
|
141595
141613
|
return 1 /* Allowed */;
|
|
@@ -142097,7 +142115,7 @@ function getModuleSpecifierText(promotedDeclaration) {
|
|
|
142097
142115
|
return promotedDeclaration.kind === 268 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a2 = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a2.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text;
|
|
142098
142116
|
}
|
|
142099
142117
|
function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile, preferences) {
|
|
142100
|
-
const convertExistingToTypeOnly = compilerOptions
|
|
142118
|
+
const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions);
|
|
142101
142119
|
switch (aliasDeclaration.kind) {
|
|
142102
142120
|
case 273 /* ImportSpecifier */:
|
|
142103
142121
|
if (aliasDeclaration.isTypeOnly) {
|
|
@@ -142171,7 +142189,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
|
|
|
142171
142189
|
}
|
|
142172
142190
|
const promoteFromTypeOnly2 = clause.isTypeOnly && some([defaultImport, ...namedImports], (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */);
|
|
142173
142191
|
const existingSpecifiers = clause.namedBindings && ((_a2 = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a2.elements);
|
|
142174
|
-
const convertExistingToTypeOnly = promoteFromTypeOnly2 && (compilerOptions
|
|
142192
|
+
const convertExistingToTypeOnly = promoteFromTypeOnly2 && importNameElisionDisabled(compilerOptions);
|
|
142175
142193
|
if (defaultImport) {
|
|
142176
142194
|
Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one");
|
|
142177
142195
|
changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " });
|
|
@@ -142856,7 +142874,7 @@ function tryGetExportDeclaration(sourceFile, isTypeOnly) {
|
|
|
142856
142874
|
}
|
|
142857
142875
|
function updateExport(changes, program, sourceFile, node, names) {
|
|
142858
142876
|
const namedExports = node.exportClause && isNamedExports(node.exportClause) ? node.exportClause.elements : factory.createNodeArray([]);
|
|
142859
|
-
const allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions()
|
|
142877
|
+
const allowTypeModifier = !node.isTypeOnly && !!(getIsolatedModules(program.getCompilerOptions()) || find(namedExports, (e) => e.isTypeOnly));
|
|
142860
142878
|
changes.replaceNode(
|
|
142861
142879
|
sourceFile,
|
|
142862
142880
|
node,
|
|
@@ -142888,7 +142906,7 @@ function createExport(changes, program, sourceFile, names) {
|
|
|
142888
142906
|
factory.createNamedExports(createExportSpecifiers(
|
|
142889
142907
|
names,
|
|
142890
142908
|
/*allowTypeModifier*/
|
|
142891
|
-
|
|
142909
|
+
getIsolatedModules(program.getCompilerOptions())
|
|
142892
142910
|
)),
|
|
142893
142911
|
/*moduleSpecifier*/
|
|
142894
142912
|
void 0,
|
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 = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230214`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -13673,7 +13673,7 @@ ${lanes.join("\n")}
|
|
|
13673
13673
|
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
|
|
13674
13674
|
}
|
|
13675
13675
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
13676
|
-
return isExternalModule(node) || compilerOptions
|
|
13676
|
+
return isExternalModule(node) || getIsolatedModules(compilerOptions) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
|
|
13677
13677
|
}
|
|
13678
13678
|
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
13679
13679
|
switch (node.scriptKind) {
|
|
@@ -13694,7 +13694,7 @@ ${lanes.join("\n")}
|
|
|
13694
13694
|
if (startsWithUseStrict(node.statements)) {
|
|
13695
13695
|
return true;
|
|
13696
13696
|
}
|
|
13697
|
-
if (isExternalModule(node) || compilerOptions
|
|
13697
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
13698
13698
|
if (getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */) {
|
|
13699
13699
|
return true;
|
|
13700
13700
|
}
|
|
@@ -18026,7 +18026,7 @@ ${lanes.join("\n")}
|
|
|
18026
18026
|
return !!(compilerOptions.declaration || compilerOptions.composite);
|
|
18027
18027
|
}
|
|
18028
18028
|
function shouldPreserveConstEnums(compilerOptions) {
|
|
18029
|
-
return !!(compilerOptions.preserveConstEnums || compilerOptions
|
|
18029
|
+
return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
|
|
18030
18030
|
}
|
|
18031
18031
|
function isIncrementalCompilation(options) {
|
|
18032
18032
|
return !!(options.incremental || options.composite);
|
|
@@ -52852,6 +52852,8 @@ ${lanes.join("\n")}
|
|
|
52852
52852
|
return !!target.baseTypesResolved;
|
|
52853
52853
|
case 8 /* WriteType */:
|
|
52854
52854
|
return !!getSymbolLinks(target).writeType;
|
|
52855
|
+
case 9 /* ParameterInitializerContainsUndefined */:
|
|
52856
|
+
return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
|
|
52855
52857
|
}
|
|
52856
52858
|
return Debug.assertNever(propertyName);
|
|
52857
52859
|
}
|
|
@@ -64876,10 +64878,10 @@ ${lanes.join("\n")}
|
|
|
64876
64878
|
return getBigIntLiteralType(parseValidBigInt(text));
|
|
64877
64879
|
}
|
|
64878
64880
|
function isMemberOfStringMapping(source, target) {
|
|
64879
|
-
if (target.flags &
|
|
64881
|
+
if (target.flags & 1 /* Any */) {
|
|
64880
64882
|
return true;
|
|
64881
64883
|
}
|
|
64882
|
-
if (target.flags & 134217728 /* TemplateLiteral */) {
|
|
64884
|
+
if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
|
|
64883
64885
|
return isTypeAssignableTo(source, target);
|
|
64884
64886
|
}
|
|
64885
64887
|
if (target.flags & 268435456 /* StringMapping */) {
|
|
@@ -67684,15 +67686,25 @@ ${lanes.join("\n")}
|
|
|
67684
67686
|
function isConstVariable(symbol) {
|
|
67685
67687
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
|
|
67686
67688
|
}
|
|
67687
|
-
function
|
|
67688
|
-
|
|
67689
|
-
|
|
67690
|
-
|
|
67691
|
-
|
|
67692
|
-
|
|
67693
|
-
|
|
67694
|
-
|
|
67689
|
+
function parameterInitializerContainsUndefined(declaration) {
|
|
67690
|
+
const links = getNodeLinks(declaration);
|
|
67691
|
+
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
67692
|
+
if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
|
|
67693
|
+
reportCircularityError(declaration.symbol);
|
|
67694
|
+
return true;
|
|
67695
|
+
}
|
|
67696
|
+
const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
|
|
67697
|
+
if (!popTypeResolution()) {
|
|
67698
|
+
reportCircularityError(declaration.symbol);
|
|
67699
|
+
return true;
|
|
67700
|
+
}
|
|
67701
|
+
links.parameterInitializerContainsUndefined = containsUndefined;
|
|
67695
67702
|
}
|
|
67703
|
+
return links.parameterInitializerContainsUndefined;
|
|
67704
|
+
}
|
|
67705
|
+
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
67706
|
+
const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
|
|
67707
|
+
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
67696
67708
|
}
|
|
67697
67709
|
function isConstraintPosition(type, node) {
|
|
67698
67710
|
const parent2 = node.parent;
|
|
@@ -77198,6 +77210,9 @@ ${lanes.join("\n")}
|
|
|
77198
77210
|
case 273 /* ImportSpecifier */:
|
|
77199
77211
|
case 79 /* Identifier */:
|
|
77200
77212
|
return 1 /* ExportValue */;
|
|
77213
|
+
case 170 /* MethodSignature */:
|
|
77214
|
+
case 168 /* PropertySignature */:
|
|
77215
|
+
return 2 /* ExportType */;
|
|
77201
77216
|
default:
|
|
77202
77217
|
return Debug.failBadSyntaxKind(d);
|
|
77203
77218
|
}
|
|
@@ -81581,6 +81596,8 @@ ${lanes.join("\n")}
|
|
|
81581
81596
|
if (!(links.flags & 1 /* TypeChecked */)) {
|
|
81582
81597
|
links.deferredNodes || (links.deferredNodes = /* @__PURE__ */ new Set());
|
|
81583
81598
|
links.deferredNodes.add(node);
|
|
81599
|
+
} else {
|
|
81600
|
+
Debug.assert(!links.deferredNodes, "A type-checked file should have no deferred nodes.");
|
|
81584
81601
|
}
|
|
81585
81602
|
}
|
|
81586
81603
|
function checkDeferredNodes(context) {
|
|
@@ -81588,6 +81605,7 @@ ${lanes.join("\n")}
|
|
|
81588
81605
|
if (links.deferredNodes) {
|
|
81589
81606
|
links.deferredNodes.forEach(checkDeferredNode);
|
|
81590
81607
|
}
|
|
81608
|
+
links.deferredNodes = void 0;
|
|
81591
81609
|
}
|
|
81592
81610
|
function checkDeferredNode(node) {
|
|
81593
81611
|
var _a2, _b;
|
|
@@ -89751,7 +89769,7 @@ ${lanes.join("\n")}
|
|
|
89751
89769
|
return node;
|
|
89752
89770
|
}
|
|
89753
89771
|
function tryGetConstEnumValue(node) {
|
|
89754
|
-
if (compilerOptions
|
|
89772
|
+
if (getIsolatedModules(compilerOptions)) {
|
|
89755
89773
|
return void 0;
|
|
89756
89774
|
}
|
|
89757
89775
|
return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0;
|
|
@@ -106193,7 +106211,7 @@ ${lanes.join("\n")}
|
|
|
106193
106211
|
if (node.isDeclarationFile) {
|
|
106194
106212
|
return node;
|
|
106195
106213
|
}
|
|
106196
|
-
if (isExternalModule(node) || compilerOptions
|
|
106214
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
106197
106215
|
currentSourceFile = node;
|
|
106198
106216
|
importRequireStatements = void 0;
|
|
106199
106217
|
let result = updateExternalModule(node);
|
|
@@ -106400,7 +106418,7 @@ ${lanes.join("\n")}
|
|
|
106400
106418
|
}
|
|
106401
106419
|
function onEmitNode(hint, node, emitCallback) {
|
|
106402
106420
|
if (isSourceFile(node)) {
|
|
106403
|
-
if ((isExternalModule(node) || compilerOptions
|
|
106421
|
+
if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
|
|
106404
106422
|
helperNameSubstitutions = /* @__PURE__ */ new Map();
|
|
106405
106423
|
}
|
|
106406
106424
|
previousOnEmitNode(hint, node, emitCallback);
|
|
@@ -116988,7 +117006,7 @@ ${lanes.join("\n")}
|
|
|
116988
117006
|
let imports;
|
|
116989
117007
|
let moduleAugmentations;
|
|
116990
117008
|
let ambientModules;
|
|
116991
|
-
if ((options
|
|
117009
|
+
if ((getIsolatedModules(options) || isExternalModuleFile) && !file.isDeclarationFile) {
|
|
116992
117010
|
if (options.importHelpers) {
|
|
116993
117011
|
imports = [createSyntheticImport(externalHelpersModuleNameText, file)];
|
|
116994
117012
|
}
|
|
@@ -117709,12 +117727,12 @@ ${lanes.join("\n")}
|
|
|
117709
117727
|
if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
|
|
117710
117728
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
|
|
117711
117729
|
}
|
|
117712
|
-
if (options.isolatedModules) {
|
|
117730
|
+
if (options.isolatedModules || options.verbatimModuleSyntax) {
|
|
117713
117731
|
if (options.out) {
|
|
117714
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
|
|
117732
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
117715
117733
|
}
|
|
117716
117734
|
if (options.outFile) {
|
|
117717
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
|
|
117735
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
117718
117736
|
}
|
|
117719
117737
|
}
|
|
117720
117738
|
if (options.inlineSourceMap) {
|
|
@@ -119271,7 +119289,7 @@ ${lanes.join("\n")}
|
|
|
119271
119289
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
119272
119290
|
}
|
|
119273
119291
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
119274
|
-
if (compilerOptions && (compilerOptions
|
|
119292
|
+
if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
|
|
119275
119293
|
return [sourceFileWithUpdatedShape];
|
|
119276
119294
|
}
|
|
119277
119295
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
@@ -119686,7 +119704,7 @@ ${lanes.join("\n")}
|
|
|
119686
119704
|
return;
|
|
119687
119705
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
119688
119706
|
return;
|
|
119689
|
-
if (state.compilerOptions
|
|
119707
|
+
if (getIsolatedModules(state.compilerOptions)) {
|
|
119690
119708
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
119691
119709
|
seenFileNamesMap.set(affectedFile.resolvedPath, true);
|
|
119692
119710
|
const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);
|
|
@@ -140142,7 +140160,7 @@ ${lanes.join("\n")}
|
|
|
140142
140160
|
if (isForNewImportDeclaration && compilerOptions.importsNotUsedAsValues === 2 /* Error */) {
|
|
140143
140161
|
return 2 /* Required */;
|
|
140144
140162
|
}
|
|
140145
|
-
if ((compilerOptions
|
|
140163
|
+
if (importNameElisionDisabled(compilerOptions) && (!(targetFlags & 111551 /* Value */) || !!checker.getTypeOnlyAliasDeclaration(symbol))) {
|
|
140146
140164
|
return 2 /* Required */;
|
|
140147
140165
|
}
|
|
140148
140166
|
return 1 /* Allowed */;
|
|
@@ -140650,7 +140668,7 @@ ${lanes.join("\n")}
|
|
|
140650
140668
|
return promotedDeclaration.kind === 268 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a2 = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a2.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text;
|
|
140651
140669
|
}
|
|
140652
140670
|
function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile, preferences) {
|
|
140653
|
-
const convertExistingToTypeOnly = compilerOptions
|
|
140671
|
+
const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions);
|
|
140654
140672
|
switch (aliasDeclaration.kind) {
|
|
140655
140673
|
case 273 /* ImportSpecifier */:
|
|
140656
140674
|
if (aliasDeclaration.isTypeOnly) {
|
|
@@ -140724,7 +140742,7 @@ ${lanes.join("\n")}
|
|
|
140724
140742
|
}
|
|
140725
140743
|
const promoteFromTypeOnly2 = clause.isTypeOnly && some([defaultImport, ...namedImports], (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */);
|
|
140726
140744
|
const existingSpecifiers = clause.namedBindings && ((_a2 = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a2.elements);
|
|
140727
|
-
const convertExistingToTypeOnly = promoteFromTypeOnly2 && (compilerOptions
|
|
140745
|
+
const convertExistingToTypeOnly = promoteFromTypeOnly2 && importNameElisionDisabled(compilerOptions);
|
|
140728
140746
|
if (defaultImport) {
|
|
140729
140747
|
Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one");
|
|
140730
140748
|
changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " });
|
|
@@ -141446,7 +141464,7 @@ ${lanes.join("\n")}
|
|
|
141446
141464
|
}
|
|
141447
141465
|
function updateExport(changes, program, sourceFile, node, names) {
|
|
141448
141466
|
const namedExports = node.exportClause && isNamedExports(node.exportClause) ? node.exportClause.elements : factory.createNodeArray([]);
|
|
141449
|
-
const allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions()
|
|
141467
|
+
const allowTypeModifier = !node.isTypeOnly && !!(getIsolatedModules(program.getCompilerOptions()) || find(namedExports, (e) => e.isTypeOnly));
|
|
141450
141468
|
changes.replaceNode(
|
|
141451
141469
|
sourceFile,
|
|
141452
141470
|
node,
|
|
@@ -141478,7 +141496,7 @@ ${lanes.join("\n")}
|
|
|
141478
141496
|
factory.createNamedExports(createExportSpecifiers(
|
|
141479
141497
|
names,
|
|
141480
141498
|
/*allowTypeModifier*/
|
|
141481
|
-
|
|
141499
|
+
getIsolatedModules(program.getCompilerOptions())
|
|
141482
141500
|
)),
|
|
141483
141501
|
/*moduleSpecifier*/
|
|
141484
141502
|
void 0,
|
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 = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230214`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -13673,7 +13673,7 @@ ${lanes.join("\n")}
|
|
|
13673
13673
|
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
|
|
13674
13674
|
}
|
|
13675
13675
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
13676
|
-
return isExternalModule(node) || compilerOptions
|
|
13676
|
+
return isExternalModule(node) || getIsolatedModules(compilerOptions) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
|
|
13677
13677
|
}
|
|
13678
13678
|
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
13679
13679
|
switch (node.scriptKind) {
|
|
@@ -13694,7 +13694,7 @@ ${lanes.join("\n")}
|
|
|
13694
13694
|
if (startsWithUseStrict(node.statements)) {
|
|
13695
13695
|
return true;
|
|
13696
13696
|
}
|
|
13697
|
-
if (isExternalModule(node) || compilerOptions
|
|
13697
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
13698
13698
|
if (getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */) {
|
|
13699
13699
|
return true;
|
|
13700
13700
|
}
|
|
@@ -18026,7 +18026,7 @@ ${lanes.join("\n")}
|
|
|
18026
18026
|
return !!(compilerOptions.declaration || compilerOptions.composite);
|
|
18027
18027
|
}
|
|
18028
18028
|
function shouldPreserveConstEnums(compilerOptions) {
|
|
18029
|
-
return !!(compilerOptions.preserveConstEnums || compilerOptions
|
|
18029
|
+
return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
|
|
18030
18030
|
}
|
|
18031
18031
|
function isIncrementalCompilation(options) {
|
|
18032
18032
|
return !!(options.incremental || options.composite);
|
|
@@ -52852,6 +52852,8 @@ ${lanes.join("\n")}
|
|
|
52852
52852
|
return !!target.baseTypesResolved;
|
|
52853
52853
|
case 8 /* WriteType */:
|
|
52854
52854
|
return !!getSymbolLinks(target).writeType;
|
|
52855
|
+
case 9 /* ParameterInitializerContainsUndefined */:
|
|
52856
|
+
return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
|
|
52855
52857
|
}
|
|
52856
52858
|
return Debug.assertNever(propertyName);
|
|
52857
52859
|
}
|
|
@@ -64876,10 +64878,10 @@ ${lanes.join("\n")}
|
|
|
64876
64878
|
return getBigIntLiteralType(parseValidBigInt(text));
|
|
64877
64879
|
}
|
|
64878
64880
|
function isMemberOfStringMapping(source, target) {
|
|
64879
|
-
if (target.flags &
|
|
64881
|
+
if (target.flags & 1 /* Any */) {
|
|
64880
64882
|
return true;
|
|
64881
64883
|
}
|
|
64882
|
-
if (target.flags & 134217728 /* TemplateLiteral */) {
|
|
64884
|
+
if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
|
|
64883
64885
|
return isTypeAssignableTo(source, target);
|
|
64884
64886
|
}
|
|
64885
64887
|
if (target.flags & 268435456 /* StringMapping */) {
|
|
@@ -67684,15 +67686,25 @@ ${lanes.join("\n")}
|
|
|
67684
67686
|
function isConstVariable(symbol) {
|
|
67685
67687
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
|
|
67686
67688
|
}
|
|
67687
|
-
function
|
|
67688
|
-
|
|
67689
|
-
|
|
67690
|
-
|
|
67691
|
-
|
|
67692
|
-
|
|
67693
|
-
|
|
67694
|
-
|
|
67689
|
+
function parameterInitializerContainsUndefined(declaration) {
|
|
67690
|
+
const links = getNodeLinks(declaration);
|
|
67691
|
+
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
67692
|
+
if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
|
|
67693
|
+
reportCircularityError(declaration.symbol);
|
|
67694
|
+
return true;
|
|
67695
|
+
}
|
|
67696
|
+
const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
|
|
67697
|
+
if (!popTypeResolution()) {
|
|
67698
|
+
reportCircularityError(declaration.symbol);
|
|
67699
|
+
return true;
|
|
67700
|
+
}
|
|
67701
|
+
links.parameterInitializerContainsUndefined = containsUndefined;
|
|
67695
67702
|
}
|
|
67703
|
+
return links.parameterInitializerContainsUndefined;
|
|
67704
|
+
}
|
|
67705
|
+
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
67706
|
+
const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
|
|
67707
|
+
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
67696
67708
|
}
|
|
67697
67709
|
function isConstraintPosition(type, node) {
|
|
67698
67710
|
const parent2 = node.parent;
|
|
@@ -77198,6 +77210,9 @@ ${lanes.join("\n")}
|
|
|
77198
77210
|
case 273 /* ImportSpecifier */:
|
|
77199
77211
|
case 79 /* Identifier */:
|
|
77200
77212
|
return 1 /* ExportValue */;
|
|
77213
|
+
case 170 /* MethodSignature */:
|
|
77214
|
+
case 168 /* PropertySignature */:
|
|
77215
|
+
return 2 /* ExportType */;
|
|
77201
77216
|
default:
|
|
77202
77217
|
return Debug.failBadSyntaxKind(d);
|
|
77203
77218
|
}
|
|
@@ -81581,6 +81596,8 @@ ${lanes.join("\n")}
|
|
|
81581
81596
|
if (!(links.flags & 1 /* TypeChecked */)) {
|
|
81582
81597
|
links.deferredNodes || (links.deferredNodes = /* @__PURE__ */ new Set());
|
|
81583
81598
|
links.deferredNodes.add(node);
|
|
81599
|
+
} else {
|
|
81600
|
+
Debug.assert(!links.deferredNodes, "A type-checked file should have no deferred nodes.");
|
|
81584
81601
|
}
|
|
81585
81602
|
}
|
|
81586
81603
|
function checkDeferredNodes(context) {
|
|
@@ -81588,6 +81605,7 @@ ${lanes.join("\n")}
|
|
|
81588
81605
|
if (links.deferredNodes) {
|
|
81589
81606
|
links.deferredNodes.forEach(checkDeferredNode);
|
|
81590
81607
|
}
|
|
81608
|
+
links.deferredNodes = void 0;
|
|
81591
81609
|
}
|
|
81592
81610
|
function checkDeferredNode(node) {
|
|
81593
81611
|
var _a2, _b;
|
|
@@ -89751,7 +89769,7 @@ ${lanes.join("\n")}
|
|
|
89751
89769
|
return node;
|
|
89752
89770
|
}
|
|
89753
89771
|
function tryGetConstEnumValue(node) {
|
|
89754
|
-
if (compilerOptions
|
|
89772
|
+
if (getIsolatedModules(compilerOptions)) {
|
|
89755
89773
|
return void 0;
|
|
89756
89774
|
}
|
|
89757
89775
|
return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0;
|
|
@@ -106193,7 +106211,7 @@ ${lanes.join("\n")}
|
|
|
106193
106211
|
if (node.isDeclarationFile) {
|
|
106194
106212
|
return node;
|
|
106195
106213
|
}
|
|
106196
|
-
if (isExternalModule(node) || compilerOptions
|
|
106214
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
106197
106215
|
currentSourceFile = node;
|
|
106198
106216
|
importRequireStatements = void 0;
|
|
106199
106217
|
let result = updateExternalModule(node);
|
|
@@ -106400,7 +106418,7 @@ ${lanes.join("\n")}
|
|
|
106400
106418
|
}
|
|
106401
106419
|
function onEmitNode(hint, node, emitCallback) {
|
|
106402
106420
|
if (isSourceFile(node)) {
|
|
106403
|
-
if ((isExternalModule(node) || compilerOptions
|
|
106421
|
+
if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
|
|
106404
106422
|
helperNameSubstitutions = /* @__PURE__ */ new Map();
|
|
106405
106423
|
}
|
|
106406
106424
|
previousOnEmitNode(hint, node, emitCallback);
|
|
@@ -116988,7 +117006,7 @@ ${lanes.join("\n")}
|
|
|
116988
117006
|
let imports;
|
|
116989
117007
|
let moduleAugmentations;
|
|
116990
117008
|
let ambientModules;
|
|
116991
|
-
if ((options
|
|
117009
|
+
if ((getIsolatedModules(options) || isExternalModuleFile) && !file.isDeclarationFile) {
|
|
116992
117010
|
if (options.importHelpers) {
|
|
116993
117011
|
imports = [createSyntheticImport(externalHelpersModuleNameText, file)];
|
|
116994
117012
|
}
|
|
@@ -117709,12 +117727,12 @@ ${lanes.join("\n")}
|
|
|
117709
117727
|
if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
|
|
117710
117728
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
|
|
117711
117729
|
}
|
|
117712
|
-
if (options.isolatedModules) {
|
|
117730
|
+
if (options.isolatedModules || options.verbatimModuleSyntax) {
|
|
117713
117731
|
if (options.out) {
|
|
117714
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
|
|
117732
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
117715
117733
|
}
|
|
117716
117734
|
if (options.outFile) {
|
|
117717
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
|
|
117735
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
117718
117736
|
}
|
|
117719
117737
|
}
|
|
117720
117738
|
if (options.inlineSourceMap) {
|
|
@@ -119271,7 +119289,7 @@ ${lanes.join("\n")}
|
|
|
119271
119289
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
119272
119290
|
}
|
|
119273
119291
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
119274
|
-
if (compilerOptions && (compilerOptions
|
|
119292
|
+
if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
|
|
119275
119293
|
return [sourceFileWithUpdatedShape];
|
|
119276
119294
|
}
|
|
119277
119295
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
@@ -119686,7 +119704,7 @@ ${lanes.join("\n")}
|
|
|
119686
119704
|
return;
|
|
119687
119705
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
119688
119706
|
return;
|
|
119689
|
-
if (state.compilerOptions
|
|
119707
|
+
if (getIsolatedModules(state.compilerOptions)) {
|
|
119690
119708
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
119691
119709
|
seenFileNamesMap.set(affectedFile.resolvedPath, true);
|
|
119692
119710
|
const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);
|
|
@@ -140156,7 +140174,7 @@ ${lanes.join("\n")}
|
|
|
140156
140174
|
if (isForNewImportDeclaration && compilerOptions.importsNotUsedAsValues === 2 /* Error */) {
|
|
140157
140175
|
return 2 /* Required */;
|
|
140158
140176
|
}
|
|
140159
|
-
if ((compilerOptions
|
|
140177
|
+
if (importNameElisionDisabled(compilerOptions) && (!(targetFlags & 111551 /* Value */) || !!checker.getTypeOnlyAliasDeclaration(symbol))) {
|
|
140160
140178
|
return 2 /* Required */;
|
|
140161
140179
|
}
|
|
140162
140180
|
return 1 /* Allowed */;
|
|
@@ -140664,7 +140682,7 @@ ${lanes.join("\n")}
|
|
|
140664
140682
|
return promotedDeclaration.kind === 268 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a2 = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a2.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text;
|
|
140665
140683
|
}
|
|
140666
140684
|
function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile, preferences) {
|
|
140667
|
-
const convertExistingToTypeOnly = compilerOptions
|
|
140685
|
+
const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions);
|
|
140668
140686
|
switch (aliasDeclaration.kind) {
|
|
140669
140687
|
case 273 /* ImportSpecifier */:
|
|
140670
140688
|
if (aliasDeclaration.isTypeOnly) {
|
|
@@ -140738,7 +140756,7 @@ ${lanes.join("\n")}
|
|
|
140738
140756
|
}
|
|
140739
140757
|
const promoteFromTypeOnly2 = clause.isTypeOnly && some([defaultImport, ...namedImports], (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */);
|
|
140740
140758
|
const existingSpecifiers = clause.namedBindings && ((_a2 = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a2.elements);
|
|
140741
|
-
const convertExistingToTypeOnly = promoteFromTypeOnly2 && (compilerOptions
|
|
140759
|
+
const convertExistingToTypeOnly = promoteFromTypeOnly2 && importNameElisionDisabled(compilerOptions);
|
|
140742
140760
|
if (defaultImport) {
|
|
140743
140761
|
Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one");
|
|
140744
140762
|
changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " });
|
|
@@ -141460,7 +141478,7 @@ ${lanes.join("\n")}
|
|
|
141460
141478
|
}
|
|
141461
141479
|
function updateExport(changes, program, sourceFile, node, names) {
|
|
141462
141480
|
const namedExports = node.exportClause && isNamedExports(node.exportClause) ? node.exportClause.elements : factory.createNodeArray([]);
|
|
141463
|
-
const allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions()
|
|
141481
|
+
const allowTypeModifier = !node.isTypeOnly && !!(getIsolatedModules(program.getCompilerOptions()) || find(namedExports, (e) => e.isTypeOnly));
|
|
141464
141482
|
changes.replaceNode(
|
|
141465
141483
|
sourceFile,
|
|
141466
141484
|
node,
|
|
@@ -141492,7 +141510,7 @@ ${lanes.join("\n")}
|
|
|
141492
141510
|
factory.createNamedExports(createExportSpecifiers(
|
|
141493
141511
|
names,
|
|
141494
141512
|
/*allowTypeModifier*/
|
|
141495
|
-
|
|
141513
|
+
getIsolatedModules(program.getCompilerOptions())
|
|
141496
141514
|
)),
|
|
141497
141515
|
/*moduleSpecifier*/
|
|
141498
141516
|
void 0,
|
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 = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230214`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -11949,6 +11949,9 @@ function getEmitModuleResolutionKind(compilerOptions) {
|
|
|
11949
11949
|
}
|
|
11950
11950
|
return moduleResolution;
|
|
11951
11951
|
}
|
|
11952
|
+
function getIsolatedModules(options) {
|
|
11953
|
+
return !!(options.isolatedModules || options.verbatimModuleSyntax);
|
|
11954
|
+
}
|
|
11952
11955
|
function unreachableCodeIsError(options) {
|
|
11953
11956
|
return options.allowUnreachableCode === false;
|
|
11954
11957
|
}
|
|
@@ -11962,7 +11965,7 @@ function getResolveJsonModule(compilerOptions) {
|
|
|
11962
11965
|
return getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */;
|
|
11963
11966
|
}
|
|
11964
11967
|
function shouldPreserveConstEnums(compilerOptions) {
|
|
11965
|
-
return !!(compilerOptions.preserveConstEnums || compilerOptions
|
|
11968
|
+
return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
|
|
11966
11969
|
}
|
|
11967
11970
|
function getStrictOptionValue(compilerOptions, flag) {
|
|
11968
11971
|
return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
|
|
@@ -34775,7 +34778,7 @@ var BuilderState;
|
|
|
34775
34778
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
34776
34779
|
}
|
|
34777
34780
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
34778
|
-
if (compilerOptions && (compilerOptions
|
|
34781
|
+
if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
|
|
34779
34782
|
return [sourceFileWithUpdatedShape];
|
|
34780
34783
|
}
|
|
34781
34784
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
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.0-dev.
|
|
5
|
+
"version": "5.0.0-dev.20230214",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|