typescript 5.6.0-dev.20240812 → 5.6.0-dev.20240814
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 +76 -55
- package/lib/tsserver.js +2 -2
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +122 -79
- package/lib/typingsInstaller.js +1 -1
- package/package.json +14 -12
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240814`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -1688,7 +1688,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1688
1688
|
Object.defineProperties(array, {
|
|
1689
1689
|
__tsDebuggerDisplay: {
|
|
1690
1690
|
value(defaultValue) {
|
|
1691
|
-
defaultValue = String(defaultValue).replace(/(?:,[\s\w
|
|
1691
|
+
defaultValue = String(defaultValue).replace(/(?:,[\s\w]+:[^,]+)+\]$/, "]");
|
|
1692
1692
|
return `NodeArray ${defaultValue}`;
|
|
1693
1693
|
}
|
|
1694
1694
|
}
|
|
@@ -2231,7 +2231,7 @@ var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-
|
|
|
2231
2231
|
var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i;
|
|
2232
2232
|
var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i;
|
|
2233
2233
|
var buildPartRegExp = /^[a-z0-9-]+$/i;
|
|
2234
|
-
var numericIdentifierRegExp = /^(0|[1-9]\d*)$/;
|
|
2234
|
+
var numericIdentifierRegExp = /^(?:0|[1-9]\d*)$/;
|
|
2235
2235
|
var _Version = class _Version {
|
|
2236
2236
|
constructor(major, minor = 0, patch = 0, prerelease = "", build2 = "") {
|
|
2237
2237
|
if (typeof major === "string") {
|
|
@@ -2354,11 +2354,11 @@ var VersionRange = class _VersionRange {
|
|
|
2354
2354
|
return formatDisjunction(this._alternatives);
|
|
2355
2355
|
}
|
|
2356
2356
|
};
|
|
2357
|
-
var logicalOrRegExp =
|
|
2358
|
-
var whitespaceRegExp = /\s
|
|
2359
|
-
var partialRegExp = /^([
|
|
2357
|
+
var logicalOrRegExp = /\|\|/;
|
|
2358
|
+
var whitespaceRegExp = /\s+/;
|
|
2359
|
+
var partialRegExp = /^([x*0]|[1-9]\d*)(?:\.([x*0]|[1-9]\d*)(?:\.([x*0]|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i;
|
|
2360
2360
|
var hyphenRegExp = /^\s*([a-z0-9-+.*]+)\s+-\s+([a-z0-9-+.*]+)\s*$/i;
|
|
2361
|
-
var rangeRegExp = /^(
|
|
2361
|
+
var rangeRegExp = /^([~^<>=]|<=|>=)?\s*([a-z0-9-+.*]+)$/i;
|
|
2362
2362
|
function parseRange(text) {
|
|
2363
2363
|
const alternatives = [];
|
|
2364
2364
|
for (let range of text.trim().split(logicalOrRegExp)) {
|
|
@@ -4843,7 +4843,7 @@ function patchWriteFileEnsuringDirectory(sys2) {
|
|
|
4843
4843
|
var sys = (() => {
|
|
4844
4844
|
const byteOrderMarkIndicator = "\uFEFF";
|
|
4845
4845
|
function getNodeSystem() {
|
|
4846
|
-
const nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[
|
|
4846
|
+
const nativePattern = /^native |^\([^)]+\)$|^(?:internal[\\/]|[\w\s]+(?:\.js)?$)/;
|
|
4847
4847
|
const _fs = require("fs");
|
|
4848
4848
|
const _path = require("path");
|
|
4849
4849
|
const _os = require("os");
|
|
@@ -4954,7 +4954,7 @@ var sys = (() => {
|
|
|
4954
4954
|
disableCPUProfiler,
|
|
4955
4955
|
cpuProfilingEnabled: () => !!activeSession || contains(process.execArgv, "--cpu-prof") || contains(process.execArgv, "--prof"),
|
|
4956
4956
|
realpath,
|
|
4957
|
-
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(inspect|debug)(
|
|
4957
|
+
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(?:inspect|debug)(?:-brk)?(?:=\d+)?$/i.test(arg)) || !!process.recordreplay,
|
|
4958
4958
|
tryEnableSourceMapsForHost() {
|
|
4959
4959
|
try {
|
|
4960
4960
|
require("source-map-support").install();
|
|
@@ -5109,7 +5109,7 @@ var sys = (() => {
|
|
|
5109
5109
|
let buffer;
|
|
5110
5110
|
try {
|
|
5111
5111
|
buffer = _fs.readFileSync(fileName);
|
|
5112
|
-
} catch
|
|
5112
|
+
} catch {
|
|
5113
5113
|
return void 0;
|
|
5114
5114
|
}
|
|
5115
5115
|
let len = buffer.length;
|
|
@@ -5168,7 +5168,7 @@ var sys = (() => {
|
|
|
5168
5168
|
if (!stat) {
|
|
5169
5169
|
continue;
|
|
5170
5170
|
}
|
|
5171
|
-
} catch
|
|
5171
|
+
} catch {
|
|
5172
5172
|
continue;
|
|
5173
5173
|
}
|
|
5174
5174
|
} else {
|
|
@@ -5183,7 +5183,7 @@ var sys = (() => {
|
|
|
5183
5183
|
files.sort();
|
|
5184
5184
|
directories.sort();
|
|
5185
5185
|
return { files, directories };
|
|
5186
|
-
} catch
|
|
5186
|
+
} catch {
|
|
5187
5187
|
return emptyFileSystemEntries;
|
|
5188
5188
|
}
|
|
5189
5189
|
}
|
|
@@ -5206,7 +5206,7 @@ var sys = (() => {
|
|
|
5206
5206
|
default:
|
|
5207
5207
|
return false;
|
|
5208
5208
|
}
|
|
5209
|
-
} catch
|
|
5209
|
+
} catch {
|
|
5210
5210
|
return false;
|
|
5211
5211
|
} finally {
|
|
5212
5212
|
Error.stackTraceLimit = originalStackTraceLimit;
|
|
@@ -5237,7 +5237,7 @@ var sys = (() => {
|
|
|
5237
5237
|
Error.stackTraceLimit = 0;
|
|
5238
5238
|
try {
|
|
5239
5239
|
return (_a = statSync(path)) == null ? void 0 : _a.mtime;
|
|
5240
|
-
} catch
|
|
5240
|
+
} catch {
|
|
5241
5241
|
return void 0;
|
|
5242
5242
|
} finally {
|
|
5243
5243
|
Error.stackTraceLimit = originalStackTraceLimit;
|
|
@@ -5246,14 +5246,14 @@ var sys = (() => {
|
|
|
5246
5246
|
function setModifiedTime(path, time) {
|
|
5247
5247
|
try {
|
|
5248
5248
|
_fs.utimesSync(path, time, time);
|
|
5249
|
-
} catch
|
|
5249
|
+
} catch {
|
|
5250
5250
|
return;
|
|
5251
5251
|
}
|
|
5252
5252
|
}
|
|
5253
5253
|
function deleteFile(path) {
|
|
5254
5254
|
try {
|
|
5255
5255
|
return _fs.unlinkSync(path);
|
|
5256
|
-
} catch
|
|
5256
|
+
} catch {
|
|
5257
5257
|
return;
|
|
5258
5258
|
}
|
|
5259
5259
|
}
|
|
@@ -5301,7 +5301,7 @@ function pathIsAbsolute(path) {
|
|
|
5301
5301
|
return getEncodedRootLength(path) !== 0;
|
|
5302
5302
|
}
|
|
5303
5303
|
function pathIsRelative(path) {
|
|
5304
|
-
return /^\.\.?(
|
|
5304
|
+
return /^\.\.?(?:$|[\\/])/.test(path);
|
|
5305
5305
|
}
|
|
5306
5306
|
function pathIsBareSpecifier(path) {
|
|
5307
5307
|
return !pathIsAbsolute(path) && !pathIsRelative(path);
|
|
@@ -5534,7 +5534,7 @@ function changeFullExtension(path, newExtension) {
|
|
|
5534
5534
|
}
|
|
5535
5535
|
return changeAnyExtension(path, newExtension);
|
|
5536
5536
|
}
|
|
5537
|
-
var relativePathSegmentRegExp =
|
|
5537
|
+
var relativePathSegmentRegExp = /\/\/|(?:^|\/)\.\.?(?:$|\/)/;
|
|
5538
5538
|
function comparePathsWorker(a, b, componentComparer) {
|
|
5539
5539
|
if (a === b) return 0 /* EqualTo */;
|
|
5540
5540
|
if (a === void 0) return -1 /* LessThan */;
|
|
@@ -11186,7 +11186,7 @@ function getNodeFlags(node) {
|
|
|
11186
11186
|
var supportedLocaleDirectories = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"];
|
|
11187
11187
|
function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
11188
11188
|
const lowerCaseLocale = locale.toLowerCase();
|
|
11189
|
-
const matchResult = /^([a-z]+)([_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
11189
|
+
const matchResult = /^([a-z]+)(?:[_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
11190
11190
|
if (!matchResult) {
|
|
11191
11191
|
if (errors) {
|
|
11192
11192
|
errors.push(createCompilerDiagnostic(Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
|
|
@@ -11194,7 +11194,7 @@ function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
|
11194
11194
|
return;
|
|
11195
11195
|
}
|
|
11196
11196
|
const language = matchResult[1];
|
|
11197
|
-
const territory = matchResult[
|
|
11197
|
+
const territory = matchResult[2];
|
|
11198
11198
|
if (contains(supportedLocaleDirectories, lowerCaseLocale) && !trySetLanguageAndTerritory(language, territory, errors)) {
|
|
11199
11199
|
trySetLanguageAndTerritory(
|
|
11200
11200
|
language,
|
|
@@ -11218,7 +11218,7 @@ function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
|
11218
11218
|
let fileContents = "";
|
|
11219
11219
|
try {
|
|
11220
11220
|
fileContents = sys2.readFile(filePath);
|
|
11221
|
-
} catch
|
|
11221
|
+
} catch {
|
|
11222
11222
|
if (errors2) {
|
|
11223
11223
|
errors2.push(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, filePath));
|
|
11224
11224
|
}
|
|
@@ -13870,12 +13870,12 @@ function getJSDocCommentRanges(node, text) {
|
|
|
13870
13870
|
return filter(commentRanges, (comment) => comment.end <= node.end && // Due to parse errors sometime empty parameter may get comments assigned to it that end up not in parameter range
|
|
13871
13871
|
text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
|
|
13872
13872
|
}
|
|
13873
|
-
var fullTripleSlashReferencePathRegEx =
|
|
13874
|
-
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx =
|
|
13875
|
-
var fullTripleSlashLibReferenceRegEx =
|
|
13876
|
-
var fullTripleSlashAMDReferencePathRegEx =
|
|
13877
|
-
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s
|
|
13878
|
-
var defaultLibReferenceRegEx =
|
|
13873
|
+
var fullTripleSlashReferencePathRegEx = /^\/\/\/\s*<reference\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13874
|
+
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^\/\/\/\s*<reference\s+types\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13875
|
+
var fullTripleSlashLibReferenceRegEx = /^\/\/\/\s*<reference\s+lib\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13876
|
+
var fullTripleSlashAMDReferencePathRegEx = /^\/\/\/\s*<amd-dependency\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13877
|
+
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s+(?:\S.*?)??\/>/;
|
|
13878
|
+
var defaultLibReferenceRegEx = /^\/\/\/\s*<reference\s+no-default-lib\s*=\s*(?:'[^']*'|"[^"]*")\s*\/>/;
|
|
13879
13879
|
function isPartOfTypeNode(node) {
|
|
13880
13880
|
if (182 /* FirstTypeNode */ <= node.kind && node.kind <= 205 /* LastTypeNode */) {
|
|
13881
13881
|
return true;
|
|
@@ -15926,9 +15926,9 @@ function containsInvalidEscapeFlag(node) {
|
|
|
15926
15926
|
function hasInvalidEscape(template) {
|
|
15927
15927
|
return template && !!(isNoSubstitutionTemplateLiteral(template) ? containsInvalidEscapeFlag(template) : containsInvalidEscapeFlag(template.head) || some(template.templateSpans, (span) => containsInvalidEscapeFlag(span.literal)));
|
|
15928
15928
|
}
|
|
15929
|
-
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\
|
|
15930
|
-
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\
|
|
15931
|
-
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\
|
|
15929
|
+
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
15930
|
+
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
15931
|
+
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
15932
15932
|
var escapedCharsMap = new Map(Object.entries({
|
|
15933
15933
|
" ": "\\t",
|
|
15934
15934
|
"\v": "\\v",
|
|
@@ -17331,7 +17331,7 @@ var objectAllocator = {
|
|
|
17331
17331
|
getSourceMapSourceConstructor: () => SourceMapSource
|
|
17332
17332
|
};
|
|
17333
17333
|
function formatStringFromArgs(text, args) {
|
|
17334
|
-
return text.replace(
|
|
17334
|
+
return text.replace(/\{(\d+)\}/g, (_match, index) => "" + Debug.checkDefined(args[+index]));
|
|
17335
17335
|
}
|
|
17336
17336
|
var localizedDiagnosticMessages;
|
|
17337
17337
|
function setLocalizedDiagnosticMessages(messages) {
|
|
@@ -35462,8 +35462,8 @@ function getNamedArgRegEx(name) {
|
|
|
35462
35462
|
namedArgRegExCache.set(name, result);
|
|
35463
35463
|
return result;
|
|
35464
35464
|
}
|
|
35465
|
-
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/
|
|
35466
|
-
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)
|
|
35465
|
+
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/m;
|
|
35466
|
+
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)((?:[^\S\r\n]|:).*)?$/m;
|
|
35467
35467
|
function extractPragmas(pragmas, range, text) {
|
|
35468
35468
|
const tripleSlash = range.kind === 2 /* SingleLineCommentTrivia */ && tripleSlashXMLCommentStartRegEx.exec(text);
|
|
35469
35469
|
if (tripleSlash) {
|
|
@@ -35504,7 +35504,7 @@ function extractPragmas(pragmas, range, text) {
|
|
|
35504
35504
|
return addPragmaForMatch(pragmas, range, 2 /* SingleLine */, singleLine);
|
|
35505
35505
|
}
|
|
35506
35506
|
if (range.kind === 3 /* MultiLineCommentTrivia */) {
|
|
35507
|
-
const multiLinePragmaRegEx = /@(\S+)(\s
|
|
35507
|
+
const multiLinePragmaRegEx = /@(\S+)(\s+(?:\S.*)?)?$/gm;
|
|
35508
35508
|
let multiLineMatch;
|
|
35509
35509
|
while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
|
|
35510
35510
|
addPragmaForMatch(pragmas, range, 4 /* MultiLine */, multiLineMatch);
|
|
@@ -38576,7 +38576,7 @@ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sour
|
|
|
38576
38576
|
function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
38577
38577
|
return filter(map(values, (v, index) => convertJsonOption(option.element, v, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile)), (v) => option.listPreserveFalsyValues ? true : !!v);
|
|
38578
38578
|
}
|
|
38579
|
-
var invalidTrailingRecursionPattern = /(
|
|
38579
|
+
var invalidTrailingRecursionPattern = /(?:^|\/)\*\*\/?$/;
|
|
38580
38580
|
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
|
38581
38581
|
function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions = emptyArray) {
|
|
38582
38582
|
basePath = normalizePath(basePath);
|
|
@@ -42682,6 +42682,8 @@ function createBinder() {
|
|
|
42682
42682
|
}
|
|
42683
42683
|
function bindJSDocImportTag(node) {
|
|
42684
42684
|
bind(node.tagName);
|
|
42685
|
+
bind(node.moduleSpecifier);
|
|
42686
|
+
bind(node.attributes);
|
|
42685
42687
|
if (typeof node.comment !== "string") {
|
|
42686
42688
|
bindEach(node.comment);
|
|
42687
42689
|
}
|
|
@@ -51650,7 +51652,7 @@ function createTypeChecker(host) {
|
|
|
51650
51652
|
}
|
|
51651
51653
|
function serializeTypeForDeclaration(context, declaration, type, symbol) {
|
|
51652
51654
|
var _a, _b;
|
|
51653
|
-
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
51655
|
+
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
|
51654
51656
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
51655
51657
|
const restoreFlags = saveRestoreFlags(context);
|
|
51656
51658
|
if (declaration && hasInferredType(declaration) && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
@@ -53906,7 +53908,7 @@ function createTypeChecker(host) {
|
|
|
53906
53908
|
} else if (localName === "export=" /* ExportEquals */) {
|
|
53907
53909
|
localName = "_exports";
|
|
53908
53910
|
}
|
|
53909
|
-
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-
|
|
53911
|
+
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-z0-9]/gi, "_");
|
|
53910
53912
|
return localName;
|
|
53911
53913
|
}
|
|
53912
53914
|
function getInternalSymbolName(symbol, localName) {
|
|
@@ -73591,7 +73593,7 @@ function createTypeChecker(host) {
|
|
|
73591
73593
|
addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
|
|
73592
73594
|
}
|
|
73593
73595
|
function containerSeemsToBeEmptyDomElement(containingType) {
|
|
73594
|
-
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(EventTarget|Node|(
|
|
73596
|
+
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(?:EventTarget|Node|(?:HTML[a-zA-Z]*)?Element)$/.test(unescapeLeadingUnderscores(type.symbol.escapedName))) && isEmptyObjectType(containingType);
|
|
73595
73597
|
}
|
|
73596
73598
|
function typeHasStaticProperty(propName, containingType) {
|
|
73597
73599
|
const prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName);
|
|
@@ -81450,7 +81452,7 @@ function createTypeChecker(host) {
|
|
|
81450
81452
|
);
|
|
81451
81453
|
if (globalAsyncDisposableType !== emptyObjectType && globalDisposableType !== emptyObjectType) {
|
|
81452
81454
|
const optionalDisposableType = getUnionType([globalAsyncDisposableType, globalDisposableType, nullType, undefinedType]);
|
|
81453
|
-
checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined);
|
|
81455
|
+
checkTypeAssignableTo(widenTypeForVariableLikeDeclaration(initializerType, node), optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined);
|
|
81454
81456
|
}
|
|
81455
81457
|
} else if (blockScopeKind === 4 /* Using */) {
|
|
81456
81458
|
const globalDisposableType = getGlobalDisposableType(
|
|
@@ -81459,7 +81461,7 @@ function createTypeChecker(host) {
|
|
|
81459
81461
|
);
|
|
81460
81462
|
if (globalDisposableType !== emptyObjectType) {
|
|
81461
81463
|
const optionalDisposableType = getUnionType([globalDisposableType, nullType, undefinedType]);
|
|
81462
|
-
checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined);
|
|
81464
|
+
checkTypeAssignableTo(widenTypeForVariableLikeDeclaration(initializerType, node), optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined);
|
|
81463
81465
|
}
|
|
81464
81466
|
}
|
|
81465
81467
|
}
|
|
@@ -85791,11 +85793,17 @@ function createTypeChecker(host) {
|
|
|
85791
85793
|
const type = getTypeFromTypeNode(typeNode);
|
|
85792
85794
|
return containsUndefinedType(type);
|
|
85793
85795
|
}
|
|
85794
|
-
function requiresAddingImplicitUndefined(parameter) {
|
|
85795
|
-
return (isRequiredInitializedParameter(parameter) || isOptionalUninitializedParameterProperty(parameter)) && !declaredParameterTypeContainsUndefined(parameter);
|
|
85796
|
+
function requiresAddingImplicitUndefined(parameter, enclosingDeclaration) {
|
|
85797
|
+
return (isRequiredInitializedParameter(parameter, enclosingDeclaration) || isOptionalUninitializedParameterProperty(parameter)) && !declaredParameterTypeContainsUndefined(parameter);
|
|
85796
85798
|
}
|
|
85797
|
-
function isRequiredInitializedParameter(parameter) {
|
|
85798
|
-
|
|
85799
|
+
function isRequiredInitializedParameter(parameter, enclosingDeclaration) {
|
|
85800
|
+
if (!strictNullChecks || isOptionalParameter(parameter) || isJSDocParameterTag(parameter) || !parameter.initializer) {
|
|
85801
|
+
return false;
|
|
85802
|
+
}
|
|
85803
|
+
if (hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */)) {
|
|
85804
|
+
return !!enclosingDeclaration && isFunctionLikeDeclaration(enclosingDeclaration);
|
|
85805
|
+
}
|
|
85806
|
+
return true;
|
|
85799
85807
|
}
|
|
85800
85808
|
function isOptionalUninitializedParameterProperty(parameter) {
|
|
85801
85809
|
return strictNullChecks && isOptionalParameter(parameter) && (isJSDocParameterTag(parameter) || !parameter.initializer) && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
@@ -101716,7 +101724,7 @@ function transformJsx(context) {
|
|
|
101716
101724
|
const name = node.name;
|
|
101717
101725
|
if (isIdentifier(name)) {
|
|
101718
101726
|
const text = idText(name);
|
|
101719
|
-
return /^[A-
|
|
101727
|
+
return /^[A-Z_]\w*$/i.test(text) ? name : factory2.createStringLiteral(text);
|
|
101720
101728
|
}
|
|
101721
101729
|
return factory2.createStringLiteral(idText(name.namespace) + ":" + idText(name.name));
|
|
101722
101730
|
}
|
|
@@ -111417,7 +111425,11 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
|
111417
111425
|
if (isSetAccessor(node.parent)) {
|
|
111418
111426
|
return createAccessorTypeError(node.parent);
|
|
111419
111427
|
}
|
|
111420
|
-
const addUndefined = resolver.requiresAddingImplicitUndefined(
|
|
111428
|
+
const addUndefined = resolver.requiresAddingImplicitUndefined(
|
|
111429
|
+
node,
|
|
111430
|
+
/*enclosingDeclaration*/
|
|
111431
|
+
void 0
|
|
111432
|
+
);
|
|
111421
111433
|
if (!addUndefined && node.initializer) {
|
|
111422
111434
|
return createExpressionError(node.initializer);
|
|
111423
111435
|
}
|
|
@@ -111893,7 +111905,7 @@ function transformDeclarations(context) {
|
|
|
111893
111905
|
if (shouldPrintWithInitializer(node)) {
|
|
111894
111906
|
return;
|
|
111895
111907
|
}
|
|
111896
|
-
const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node);
|
|
111908
|
+
const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node, enclosingDeclaration);
|
|
111897
111909
|
if (type && !shouldAddImplicitUndefined) {
|
|
111898
111910
|
return visitNode(type, visitDeclarationSubtree, isTypeNode);
|
|
111899
111911
|
}
|
|
@@ -116675,7 +116687,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116675
116687
|
if (node.comment) {
|
|
116676
116688
|
const text = getTextOfJSDocComment(node.comment);
|
|
116677
116689
|
if (text) {
|
|
116678
|
-
const lines = text.split(/\r\n?|\n/
|
|
116690
|
+
const lines = text.split(/\r\n?|\n/);
|
|
116679
116691
|
for (const line of lines) {
|
|
116680
116692
|
writeLine();
|
|
116681
116693
|
writeSpace();
|
|
@@ -117102,7 +117114,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
117102
117114
|
if (isFunctionLike(parentNode) && parentNode.typeArguments) {
|
|
117103
117115
|
return emitTypeArguments(parentNode, parentNode.typeArguments);
|
|
117104
117116
|
}
|
|
117105
|
-
emitList(parentNode, typeParameters, 53776 /* TypeParameters */);
|
|
117117
|
+
emitList(parentNode, typeParameters, 53776 /* TypeParameters */ | (isArrowFunction(parentNode) ? 64 /* AllowTrailingComma */ : 0 /* None */));
|
|
117106
117118
|
}
|
|
117107
117119
|
function emitParameters(parentNode, parameters) {
|
|
117108
117120
|
emitList(parentNode, parameters, 2576 /* Parameters */);
|
|
@@ -117370,7 +117382,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
117370
117382
|
}
|
|
117371
117383
|
}
|
|
117372
117384
|
function writeLines(text) {
|
|
117373
|
-
const lines = text.split(/\r\n?|\n/
|
|
117385
|
+
const lines = text.split(/\r\n?|\n/);
|
|
117374
117386
|
const indentation = guessIndentation(lines);
|
|
117375
117387
|
for (const lineText of lines) {
|
|
117376
117388
|
const line = indentation ? lineText.slice(indentation) : lineText;
|
|
@@ -118607,7 +118619,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118607
118619
|
}
|
|
118608
118620
|
try {
|
|
118609
118621
|
return createCachedFileSystemEntries(rootDir, rootDirPath);
|
|
118610
|
-
} catch
|
|
118622
|
+
} catch {
|
|
118611
118623
|
Debug.assert(!cachedReadDirectoryResult.has(ensureTrailingDirectorySeparator(rootDirPath)));
|
|
118612
118624
|
return void 0;
|
|
118613
118625
|
}
|
|
@@ -118696,6 +118708,12 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118696
118708
|
function realpath(s) {
|
|
118697
118709
|
return host.realpath ? host.realpath(s) : s;
|
|
118698
118710
|
}
|
|
118711
|
+
function clearFirstAncestorEntry(fileOrDirectoryPath) {
|
|
118712
|
+
forEachAncestorDirectory(
|
|
118713
|
+
getDirectoryPath(fileOrDirectoryPath),
|
|
118714
|
+
(ancestor) => cachedReadDirectoryResult.delete(ensureTrailingDirectorySeparator(ancestor)) ? true : void 0
|
|
118715
|
+
);
|
|
118716
|
+
}
|
|
118699
118717
|
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
|
118700
118718
|
const existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
|
118701
118719
|
if (existingResult !== void 0) {
|
|
@@ -118704,6 +118722,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118704
118722
|
}
|
|
118705
118723
|
const parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath);
|
|
118706
118724
|
if (!parentResult) {
|
|
118725
|
+
clearFirstAncestorEntry(fileOrDirectoryPath);
|
|
118707
118726
|
return void 0;
|
|
118708
118727
|
}
|
|
118709
118728
|
if (!host.directoryExists) {
|
|
@@ -118729,6 +118748,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118729
118748
|
const parentResult = getCachedFileSystemEntriesForBaseDir(filePath);
|
|
118730
118749
|
if (parentResult) {
|
|
118731
118750
|
updateFilesOfFileSystemEntry(parentResult, getBaseNameOfFileName(fileName), eventKind === 0 /* Created */);
|
|
118751
|
+
} else {
|
|
118752
|
+
clearFirstAncestorEntry(filePath);
|
|
118732
118753
|
}
|
|
118733
118754
|
}
|
|
118734
118755
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists2) {
|
|
@@ -121000,7 +121021,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121000
121021
|
return line;
|
|
121001
121022
|
}
|
|
121002
121023
|
const lineText = file.text.slice(lineStarts[line], lineStarts[line + 1]).trim();
|
|
121003
|
-
if (lineText !== "" &&
|
|
121024
|
+
if (lineText !== "" && !/^\s*\/\/.*$/.test(lineText)) {
|
|
121004
121025
|
return -1;
|
|
121005
121026
|
}
|
|
121006
121027
|
line--;
|
|
@@ -125001,9 +125022,9 @@ function removeIgnoredPath(path) {
|
|
|
125001
125022
|
function perceivedOsRootLengthForWatching(pathComponents2, length2) {
|
|
125002
125023
|
if (length2 <= 1) return 1;
|
|
125003
125024
|
let indexAfterOsRoot = 1;
|
|
125004
|
-
let isDosStyle = pathComponents2[0].search(/[a-
|
|
125025
|
+
let isDosStyle = pathComponents2[0].search(/[a-z]:/i) === 0;
|
|
125005
125026
|
if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
|
|
125006
|
-
pathComponents2[1].search(/[a-
|
|
125027
|
+
pathComponents2[1].search(/[a-z]\$$/i) === 0) {
|
|
125007
125028
|
if (length2 === 2) return 2;
|
|
125008
125029
|
indexAfterOsRoot = 2;
|
|
125009
125030
|
isDosStyle = true;
|
|
@@ -130355,7 +130376,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
|
130355
130376
|
return typeFromAccessor(parent, context);
|
|
130356
130377
|
}
|
|
130357
130378
|
const declaredType = getEffectiveTypeAnnotationNode(node);
|
|
130358
|
-
const addUndefined = resolver.requiresAddingImplicitUndefined(node);
|
|
130379
|
+
const addUndefined = resolver.requiresAddingImplicitUndefined(node, context.enclosingDeclaration);
|
|
130359
130380
|
let resultType;
|
|
130360
130381
|
if (declaredType) {
|
|
130361
130382
|
resultType = serializeExistingTypeAnnotation(declaredType, addUndefined);
|
package/lib/tsserver.js
CHANGED
|
@@ -139,7 +139,7 @@ function initializeNodeSystem() {
|
|
|
139
139
|
if (this.logFilename) {
|
|
140
140
|
try {
|
|
141
141
|
this.fd = import_fs.default.openSync(this.logFilename, "w");
|
|
142
|
-
} catch
|
|
142
|
+
} catch {
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -287,7 +287,7 @@ function initializeNodeSystem() {
|
|
|
287
287
|
try {
|
|
288
288
|
const factory = require("./cancellationToken.js");
|
|
289
289
|
cancellationToken = factory(sys4.args);
|
|
290
|
-
} catch
|
|
290
|
+
} catch {
|
|
291
291
|
cancellationToken = typescript_exports.server.nullCancellationToken;
|
|
292
292
|
}
|
|
293
293
|
const localeStr = typescript_exports.server.findArgument("--locale");
|
package/lib/typescript.d.ts
CHANGED
|
@@ -3318,6 +3318,7 @@ declare namespace ts {
|
|
|
3318
3318
|
setHostConfiguration(args: protocol.ConfigureRequestArguments): void;
|
|
3319
3319
|
private getWatchOptionsFromProjectWatchOptions;
|
|
3320
3320
|
closeLog(): void;
|
|
3321
|
+
private sendSourceFileChange;
|
|
3321
3322
|
/**
|
|
3322
3323
|
* This function rebuilds the project for every file opened by the client
|
|
3323
3324
|
* This does not reload contents of open files from disk. But we could do that if needed
|
package/lib/typescript.js
CHANGED
|
@@ -2262,7 +2262,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2262
2262
|
|
|
2263
2263
|
// src/compiler/corePublic.ts
|
|
2264
2264
|
var versionMajorMinor = "5.6";
|
|
2265
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2265
|
+
var version = `${versionMajorMinor}.0-dev.20240814`;
|
|
2266
2266
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2267
2267
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2268
2268
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4235,7 +4235,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
4235
4235
|
Object.defineProperties(array, {
|
|
4236
4236
|
__tsDebuggerDisplay: {
|
|
4237
4237
|
value(defaultValue) {
|
|
4238
|
-
defaultValue = String(defaultValue).replace(/(?:,[\s\w
|
|
4238
|
+
defaultValue = String(defaultValue).replace(/(?:,[\s\w]+:[^,]+)+\]$/, "]");
|
|
4239
4239
|
return `NodeArray ${defaultValue}`;
|
|
4240
4240
|
}
|
|
4241
4241
|
}
|
|
@@ -4778,7 +4778,7 @@ var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-
|
|
|
4778
4778
|
var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i;
|
|
4779
4779
|
var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i;
|
|
4780
4780
|
var buildPartRegExp = /^[a-z0-9-]+$/i;
|
|
4781
|
-
var numericIdentifierRegExp = /^(0|[1-9]\d*)$/;
|
|
4781
|
+
var numericIdentifierRegExp = /^(?:0|[1-9]\d*)$/;
|
|
4782
4782
|
var _Version = class _Version {
|
|
4783
4783
|
constructor(major, minor = 0, patch = 0, prerelease = "", build2 = "") {
|
|
4784
4784
|
if (typeof major === "string") {
|
|
@@ -4901,11 +4901,11 @@ var VersionRange = class _VersionRange {
|
|
|
4901
4901
|
return formatDisjunction(this._alternatives);
|
|
4902
4902
|
}
|
|
4903
4903
|
};
|
|
4904
|
-
var logicalOrRegExp =
|
|
4905
|
-
var whitespaceRegExp = /\s
|
|
4906
|
-
var partialRegExp = /^([
|
|
4904
|
+
var logicalOrRegExp = /\|\|/;
|
|
4905
|
+
var whitespaceRegExp = /\s+/;
|
|
4906
|
+
var partialRegExp = /^([x*0]|[1-9]\d*)(?:\.([x*0]|[1-9]\d*)(?:\.([x*0]|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i;
|
|
4907
4907
|
var hyphenRegExp = /^\s*([a-z0-9-+.*]+)\s+-\s+([a-z0-9-+.*]+)\s*$/i;
|
|
4908
|
-
var rangeRegExp = /^(
|
|
4908
|
+
var rangeRegExp = /^([~^<>=]|<=|>=)?\s*([a-z0-9-+.*]+)$/i;
|
|
4909
4909
|
function parseRange(text) {
|
|
4910
4910
|
const alternatives = [];
|
|
4911
4911
|
for (let range of text.trim().split(logicalOrRegExp)) {
|
|
@@ -8228,7 +8228,7 @@ function patchWriteFileEnsuringDirectory(sys2) {
|
|
|
8228
8228
|
var sys = (() => {
|
|
8229
8229
|
const byteOrderMarkIndicator = "\uFEFF";
|
|
8230
8230
|
function getNodeSystem() {
|
|
8231
|
-
const nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[
|
|
8231
|
+
const nativePattern = /^native |^\([^)]+\)$|^(?:internal[\\/]|[\w\s]+(?:\.js)?$)/;
|
|
8232
8232
|
const _fs = require("fs");
|
|
8233
8233
|
const _path = require("path");
|
|
8234
8234
|
const _os = require("os");
|
|
@@ -8339,7 +8339,7 @@ var sys = (() => {
|
|
|
8339
8339
|
disableCPUProfiler,
|
|
8340
8340
|
cpuProfilingEnabled: () => !!activeSession || contains(process.execArgv, "--cpu-prof") || contains(process.execArgv, "--prof"),
|
|
8341
8341
|
realpath,
|
|
8342
|
-
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(inspect|debug)(
|
|
8342
|
+
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(?:inspect|debug)(?:-brk)?(?:=\d+)?$/i.test(arg)) || !!process.recordreplay,
|
|
8343
8343
|
tryEnableSourceMapsForHost() {
|
|
8344
8344
|
try {
|
|
8345
8345
|
require("source-map-support").install();
|
|
@@ -8494,7 +8494,7 @@ var sys = (() => {
|
|
|
8494
8494
|
let buffer;
|
|
8495
8495
|
try {
|
|
8496
8496
|
buffer = _fs.readFileSync(fileName);
|
|
8497
|
-
} catch
|
|
8497
|
+
} catch {
|
|
8498
8498
|
return void 0;
|
|
8499
8499
|
}
|
|
8500
8500
|
let len = buffer.length;
|
|
@@ -8553,7 +8553,7 @@ var sys = (() => {
|
|
|
8553
8553
|
if (!stat) {
|
|
8554
8554
|
continue;
|
|
8555
8555
|
}
|
|
8556
|
-
} catch
|
|
8556
|
+
} catch {
|
|
8557
8557
|
continue;
|
|
8558
8558
|
}
|
|
8559
8559
|
} else {
|
|
@@ -8568,7 +8568,7 @@ var sys = (() => {
|
|
|
8568
8568
|
files.sort();
|
|
8569
8569
|
directories.sort();
|
|
8570
8570
|
return { files, directories };
|
|
8571
|
-
} catch
|
|
8571
|
+
} catch {
|
|
8572
8572
|
return emptyFileSystemEntries;
|
|
8573
8573
|
}
|
|
8574
8574
|
}
|
|
@@ -8591,7 +8591,7 @@ var sys = (() => {
|
|
|
8591
8591
|
default:
|
|
8592
8592
|
return false;
|
|
8593
8593
|
}
|
|
8594
|
-
} catch
|
|
8594
|
+
} catch {
|
|
8595
8595
|
return false;
|
|
8596
8596
|
} finally {
|
|
8597
8597
|
Error.stackTraceLimit = originalStackTraceLimit;
|
|
@@ -8622,7 +8622,7 @@ var sys = (() => {
|
|
|
8622
8622
|
Error.stackTraceLimit = 0;
|
|
8623
8623
|
try {
|
|
8624
8624
|
return (_a = statSync(path)) == null ? void 0 : _a.mtime;
|
|
8625
|
-
} catch
|
|
8625
|
+
} catch {
|
|
8626
8626
|
return void 0;
|
|
8627
8627
|
} finally {
|
|
8628
8628
|
Error.stackTraceLimit = originalStackTraceLimit;
|
|
@@ -8631,14 +8631,14 @@ var sys = (() => {
|
|
|
8631
8631
|
function setModifiedTime(path, time) {
|
|
8632
8632
|
try {
|
|
8633
8633
|
_fs.utimesSync(path, time, time);
|
|
8634
|
-
} catch
|
|
8634
|
+
} catch {
|
|
8635
8635
|
return;
|
|
8636
8636
|
}
|
|
8637
8637
|
}
|
|
8638
8638
|
function deleteFile(path) {
|
|
8639
8639
|
try {
|
|
8640
8640
|
return _fs.unlinkSync(path);
|
|
8641
|
-
} catch
|
|
8641
|
+
} catch {
|
|
8642
8642
|
return;
|
|
8643
8643
|
}
|
|
8644
8644
|
}
|
|
@@ -8692,7 +8692,7 @@ function pathIsAbsolute(path) {
|
|
|
8692
8692
|
return getEncodedRootLength(path) !== 0;
|
|
8693
8693
|
}
|
|
8694
8694
|
function pathIsRelative(path) {
|
|
8695
|
-
return /^\.\.?(
|
|
8695
|
+
return /^\.\.?(?:$|[\\/])/.test(path);
|
|
8696
8696
|
}
|
|
8697
8697
|
function pathIsBareSpecifier(path) {
|
|
8698
8698
|
return !pathIsAbsolute(path) && !pathIsRelative(path);
|
|
@@ -8925,7 +8925,7 @@ function changeFullExtension(path, newExtension) {
|
|
|
8925
8925
|
}
|
|
8926
8926
|
return changeAnyExtension(path, newExtension);
|
|
8927
8927
|
}
|
|
8928
|
-
var relativePathSegmentRegExp =
|
|
8928
|
+
var relativePathSegmentRegExp = /\/\/|(?:^|\/)\.\.?(?:$|\/)/;
|
|
8929
8929
|
function comparePathsWorker(a, b, componentComparer) {
|
|
8930
8930
|
if (a === b) return 0 /* EqualTo */;
|
|
8931
8931
|
if (a === void 0) return -1 /* LessThan */;
|
|
@@ -14718,7 +14718,7 @@ function getNodeFlags(node) {
|
|
|
14718
14718
|
var supportedLocaleDirectories = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"];
|
|
14719
14719
|
function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
14720
14720
|
const lowerCaseLocale = locale.toLowerCase();
|
|
14721
|
-
const matchResult = /^([a-z]+)([_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
14721
|
+
const matchResult = /^([a-z]+)(?:[_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
14722
14722
|
if (!matchResult) {
|
|
14723
14723
|
if (errors) {
|
|
14724
14724
|
errors.push(createCompilerDiagnostic(Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
|
|
@@ -14726,7 +14726,7 @@ function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
|
14726
14726
|
return;
|
|
14727
14727
|
}
|
|
14728
14728
|
const language = matchResult[1];
|
|
14729
|
-
const territory = matchResult[
|
|
14729
|
+
const territory = matchResult[2];
|
|
14730
14730
|
if (contains(supportedLocaleDirectories, lowerCaseLocale) && !trySetLanguageAndTerritory(language, territory, errors)) {
|
|
14731
14731
|
trySetLanguageAndTerritory(
|
|
14732
14732
|
language,
|
|
@@ -14750,7 +14750,7 @@ function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
|
14750
14750
|
let fileContents = "";
|
|
14751
14751
|
try {
|
|
14752
14752
|
fileContents = sys2.readFile(filePath);
|
|
14753
|
-
} catch
|
|
14753
|
+
} catch {
|
|
14754
14754
|
if (errors2) {
|
|
14755
14755
|
errors2.push(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, filePath));
|
|
14756
14756
|
}
|
|
@@ -17565,12 +17565,12 @@ function getJSDocCommentRanges(node, text) {
|
|
|
17565
17565
|
return filter(commentRanges, (comment) => comment.end <= node.end && // Due to parse errors sometime empty parameter may get comments assigned to it that end up not in parameter range
|
|
17566
17566
|
text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
|
|
17567
17567
|
}
|
|
17568
|
-
var fullTripleSlashReferencePathRegEx =
|
|
17569
|
-
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx =
|
|
17570
|
-
var fullTripleSlashLibReferenceRegEx =
|
|
17571
|
-
var fullTripleSlashAMDReferencePathRegEx =
|
|
17572
|
-
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s
|
|
17573
|
-
var defaultLibReferenceRegEx =
|
|
17568
|
+
var fullTripleSlashReferencePathRegEx = /^\/\/\/\s*<reference\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
17569
|
+
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^\/\/\/\s*<reference\s+types\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
17570
|
+
var fullTripleSlashLibReferenceRegEx = /^\/\/\/\s*<reference\s+lib\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
17571
|
+
var fullTripleSlashAMDReferencePathRegEx = /^\/\/\/\s*<amd-dependency\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
17572
|
+
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s+(?:\S.*?)??\/>/;
|
|
17573
|
+
var defaultLibReferenceRegEx = /^\/\/\/\s*<reference\s+no-default-lib\s*=\s*(?:'[^']*'|"[^"]*")\s*\/>/;
|
|
17574
17574
|
function isPartOfTypeNode(node) {
|
|
17575
17575
|
if (182 /* FirstTypeNode */ <= node.kind && node.kind <= 205 /* LastTypeNode */) {
|
|
17576
17576
|
return true;
|
|
@@ -19740,9 +19740,9 @@ function containsInvalidEscapeFlag(node) {
|
|
|
19740
19740
|
function hasInvalidEscape(template) {
|
|
19741
19741
|
return template && !!(isNoSubstitutionTemplateLiteral(template) ? containsInvalidEscapeFlag(template) : containsInvalidEscapeFlag(template.head) || some(template.templateSpans, (span) => containsInvalidEscapeFlag(span.literal)));
|
|
19742
19742
|
}
|
|
19743
|
-
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\
|
|
19744
|
-
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\
|
|
19745
|
-
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\
|
|
19743
|
+
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
19744
|
+
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
19745
|
+
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
19746
19746
|
var escapedCharsMap = new Map(Object.entries({
|
|
19747
19747
|
" ": "\\t",
|
|
19748
19748
|
"\v": "\\v",
|
|
@@ -21290,7 +21290,7 @@ function setObjectAllocator(alloc) {
|
|
|
21290
21290
|
forEach(objectAllocatorPatchers, (fn) => fn(objectAllocator));
|
|
21291
21291
|
}
|
|
21292
21292
|
function formatStringFromArgs(text, args) {
|
|
21293
|
-
return text.replace(
|
|
21293
|
+
return text.replace(/\{(\d+)\}/g, (_match, index) => "" + Debug.checkDefined(args[+index]));
|
|
21294
21294
|
}
|
|
21295
21295
|
var localizedDiagnosticMessages;
|
|
21296
21296
|
function setLocalizedDiagnosticMessages(messages) {
|
|
@@ -22786,7 +22786,7 @@ function isFunctionExpressionOrArrowFunction(node) {
|
|
|
22786
22786
|
return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
|
|
22787
22787
|
}
|
|
22788
22788
|
function escapeSnippetText(text) {
|
|
22789
|
-
return text.replace(/\$/
|
|
22789
|
+
return text.replace(/\$/g, () => "\\$");
|
|
22790
22790
|
}
|
|
22791
22791
|
function isNumericLiteralName(name) {
|
|
22792
22792
|
return (+name).toString() === name;
|
|
@@ -39732,8 +39732,8 @@ function getNamedArgRegEx(name) {
|
|
|
39732
39732
|
namedArgRegExCache.set(name, result);
|
|
39733
39733
|
return result;
|
|
39734
39734
|
}
|
|
39735
|
-
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/
|
|
39736
|
-
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)
|
|
39735
|
+
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/m;
|
|
39736
|
+
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)((?:[^\S\r\n]|:).*)?$/m;
|
|
39737
39737
|
function extractPragmas(pragmas, range, text) {
|
|
39738
39738
|
const tripleSlash = range.kind === 2 /* SingleLineCommentTrivia */ && tripleSlashXMLCommentStartRegEx.exec(text);
|
|
39739
39739
|
if (tripleSlash) {
|
|
@@ -39774,7 +39774,7 @@ function extractPragmas(pragmas, range, text) {
|
|
|
39774
39774
|
return addPragmaForMatch(pragmas, range, 2 /* SingleLine */, singleLine);
|
|
39775
39775
|
}
|
|
39776
39776
|
if (range.kind === 3 /* MultiLineCommentTrivia */) {
|
|
39777
|
-
const multiLinePragmaRegEx = /@(\S+)(\s
|
|
39777
|
+
const multiLinePragmaRegEx = /@(\S+)(\s+(?:\S.*)?)?$/gm;
|
|
39778
39778
|
let multiLineMatch;
|
|
39779
39779
|
while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
|
|
39780
39780
|
addPragmaForMatch(pragmas, range, 4 /* MultiLine */, multiLineMatch);
|
|
@@ -42881,7 +42881,7 @@ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sour
|
|
|
42881
42881
|
function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
42882
42882
|
return filter(map(values, (v, index) => convertJsonOption(option.element, v, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile)), (v) => option.listPreserveFalsyValues ? true : !!v);
|
|
42883
42883
|
}
|
|
42884
|
-
var invalidTrailingRecursionPattern = /(
|
|
42884
|
+
var invalidTrailingRecursionPattern = /(?:^|\/)\*\*\/?$/;
|
|
42885
42885
|
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
|
42886
42886
|
function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions = emptyArray) {
|
|
42887
42887
|
basePath = normalizePath(basePath);
|
|
@@ -47201,6 +47201,8 @@ function createBinder() {
|
|
|
47201
47201
|
}
|
|
47202
47202
|
function bindJSDocImportTag(node) {
|
|
47203
47203
|
bind(node.tagName);
|
|
47204
|
+
bind(node.moduleSpecifier);
|
|
47205
|
+
bind(node.attributes);
|
|
47204
47206
|
if (typeof node.comment !== "string") {
|
|
47205
47207
|
bindEach(node.comment);
|
|
47206
47208
|
}
|
|
@@ -56269,7 +56271,7 @@ function createTypeChecker(host) {
|
|
|
56269
56271
|
}
|
|
56270
56272
|
function serializeTypeForDeclaration(context, declaration, type, symbol) {
|
|
56271
56273
|
var _a, _b;
|
|
56272
|
-
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
56274
|
+
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
|
56273
56275
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
56274
56276
|
const restoreFlags = saveRestoreFlags(context);
|
|
56275
56277
|
if (declaration && hasInferredType(declaration) && !(context.internalFlags & 2 /* NoSyntacticPrinter */)) {
|
|
@@ -58525,7 +58527,7 @@ function createTypeChecker(host) {
|
|
|
58525
58527
|
} else if (localName === "export=" /* ExportEquals */) {
|
|
58526
58528
|
localName = "_exports";
|
|
58527
58529
|
}
|
|
58528
|
-
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-
|
|
58530
|
+
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-z0-9]/gi, "_");
|
|
58529
58531
|
return localName;
|
|
58530
58532
|
}
|
|
58531
58533
|
function getInternalSymbolName(symbol, localName) {
|
|
@@ -78210,7 +78212,7 @@ function createTypeChecker(host) {
|
|
|
78210
78212
|
addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
|
|
78211
78213
|
}
|
|
78212
78214
|
function containerSeemsToBeEmptyDomElement(containingType) {
|
|
78213
|
-
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(EventTarget|Node|(
|
|
78215
|
+
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(?:EventTarget|Node|(?:HTML[a-zA-Z]*)?Element)$/.test(unescapeLeadingUnderscores(type.symbol.escapedName))) && isEmptyObjectType(containingType);
|
|
78214
78216
|
}
|
|
78215
78217
|
function typeHasStaticProperty(propName, containingType) {
|
|
78216
78218
|
const prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName);
|
|
@@ -86069,7 +86071,7 @@ function createTypeChecker(host) {
|
|
|
86069
86071
|
);
|
|
86070
86072
|
if (globalAsyncDisposableType !== emptyObjectType && globalDisposableType !== emptyObjectType) {
|
|
86071
86073
|
const optionalDisposableType = getUnionType([globalAsyncDisposableType, globalDisposableType, nullType, undefinedType]);
|
|
86072
|
-
checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined);
|
|
86074
|
+
checkTypeAssignableTo(widenTypeForVariableLikeDeclaration(initializerType, node), optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined);
|
|
86073
86075
|
}
|
|
86074
86076
|
} else if (blockScopeKind === 4 /* Using */) {
|
|
86075
86077
|
const globalDisposableType = getGlobalDisposableType(
|
|
@@ -86078,7 +86080,7 @@ function createTypeChecker(host) {
|
|
|
86078
86080
|
);
|
|
86079
86081
|
if (globalDisposableType !== emptyObjectType) {
|
|
86080
86082
|
const optionalDisposableType = getUnionType([globalDisposableType, nullType, undefinedType]);
|
|
86081
|
-
checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined);
|
|
86083
|
+
checkTypeAssignableTo(widenTypeForVariableLikeDeclaration(initializerType, node), optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined);
|
|
86082
86084
|
}
|
|
86083
86085
|
}
|
|
86084
86086
|
}
|
|
@@ -90410,11 +90412,17 @@ function createTypeChecker(host) {
|
|
|
90410
90412
|
const type = getTypeFromTypeNode(typeNode);
|
|
90411
90413
|
return containsUndefinedType(type);
|
|
90412
90414
|
}
|
|
90413
|
-
function requiresAddingImplicitUndefined(parameter) {
|
|
90414
|
-
return (isRequiredInitializedParameter(parameter) || isOptionalUninitializedParameterProperty(parameter)) && !declaredParameterTypeContainsUndefined(parameter);
|
|
90415
|
+
function requiresAddingImplicitUndefined(parameter, enclosingDeclaration) {
|
|
90416
|
+
return (isRequiredInitializedParameter(parameter, enclosingDeclaration) || isOptionalUninitializedParameterProperty(parameter)) && !declaredParameterTypeContainsUndefined(parameter);
|
|
90415
90417
|
}
|
|
90416
|
-
function isRequiredInitializedParameter(parameter) {
|
|
90417
|
-
|
|
90418
|
+
function isRequiredInitializedParameter(parameter, enclosingDeclaration) {
|
|
90419
|
+
if (!strictNullChecks || isOptionalParameter(parameter) || isJSDocParameterTag(parameter) || !parameter.initializer) {
|
|
90420
|
+
return false;
|
|
90421
|
+
}
|
|
90422
|
+
if (hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */)) {
|
|
90423
|
+
return !!enclosingDeclaration && isFunctionLikeDeclaration(enclosingDeclaration);
|
|
90424
|
+
}
|
|
90425
|
+
return true;
|
|
90418
90426
|
}
|
|
90419
90427
|
function isOptionalUninitializedParameterProperty(parameter) {
|
|
90420
90428
|
return strictNullChecks && isOptionalParameter(parameter) && (isJSDocParameterTag(parameter) || !parameter.initializer) && hasSyntacticModifier(parameter, 31 /* ParameterPropertyModifier */);
|
|
@@ -106517,7 +106525,7 @@ function transformJsx(context) {
|
|
|
106517
106525
|
const name = node.name;
|
|
106518
106526
|
if (isIdentifier(name)) {
|
|
106519
106527
|
const text = idText(name);
|
|
106520
|
-
return /^[A-
|
|
106528
|
+
return /^[A-Z_]\w*$/i.test(text) ? name : factory2.createStringLiteral(text);
|
|
106521
106529
|
}
|
|
106522
106530
|
return factory2.createStringLiteral(idText(name.namespace) + ":" + idText(name.name));
|
|
106523
106531
|
}
|
|
@@ -116218,7 +116226,11 @@ function createGetIsolatedDeclarationErrors(resolver) {
|
|
|
116218
116226
|
if (isSetAccessor(node.parent)) {
|
|
116219
116227
|
return createAccessorTypeError(node.parent);
|
|
116220
116228
|
}
|
|
116221
|
-
const addUndefined = resolver.requiresAddingImplicitUndefined(
|
|
116229
|
+
const addUndefined = resolver.requiresAddingImplicitUndefined(
|
|
116230
|
+
node,
|
|
116231
|
+
/*enclosingDeclaration*/
|
|
116232
|
+
void 0
|
|
116233
|
+
);
|
|
116222
116234
|
if (!addUndefined && node.initializer) {
|
|
116223
116235
|
return createExpressionError(node.initializer);
|
|
116224
116236
|
}
|
|
@@ -116694,7 +116706,7 @@ function transformDeclarations(context) {
|
|
|
116694
116706
|
if (shouldPrintWithInitializer(node)) {
|
|
116695
116707
|
return;
|
|
116696
116708
|
}
|
|
116697
|
-
const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node);
|
|
116709
|
+
const shouldAddImplicitUndefined = node.kind === 169 /* Parameter */ && resolver.requiresAddingImplicitUndefined(node, enclosingDeclaration);
|
|
116698
116710
|
if (type && !shouldAddImplicitUndefined) {
|
|
116699
116711
|
return visitNode(type, visitDeclarationSubtree, isTypeNode);
|
|
116700
116712
|
}
|
|
@@ -121487,7 +121499,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
121487
121499
|
if (node.comment) {
|
|
121488
121500
|
const text = getTextOfJSDocComment(node.comment);
|
|
121489
121501
|
if (text) {
|
|
121490
|
-
const lines = text.split(/\r\n?|\n/
|
|
121502
|
+
const lines = text.split(/\r\n?|\n/);
|
|
121491
121503
|
for (const line of lines) {
|
|
121492
121504
|
writeLine();
|
|
121493
121505
|
writeSpace();
|
|
@@ -121914,7 +121926,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
121914
121926
|
if (isFunctionLike(parentNode) && parentNode.typeArguments) {
|
|
121915
121927
|
return emitTypeArguments(parentNode, parentNode.typeArguments);
|
|
121916
121928
|
}
|
|
121917
|
-
emitList(parentNode, typeParameters, 53776 /* TypeParameters */);
|
|
121929
|
+
emitList(parentNode, typeParameters, 53776 /* TypeParameters */ | (isArrowFunction(parentNode) ? 64 /* AllowTrailingComma */ : 0 /* None */));
|
|
121918
121930
|
}
|
|
121919
121931
|
function emitParameters(parentNode, parameters) {
|
|
121920
121932
|
emitList(parentNode, parameters, 2576 /* Parameters */);
|
|
@@ -122182,7 +122194,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
122182
122194
|
}
|
|
122183
122195
|
}
|
|
122184
122196
|
function writeLines(text) {
|
|
122185
|
-
const lines = text.split(/\r\n?|\n/
|
|
122197
|
+
const lines = text.split(/\r\n?|\n/);
|
|
122186
122198
|
const indentation = guessIndentation(lines);
|
|
122187
122199
|
for (const lineText of lines) {
|
|
122188
122200
|
const line = indentation ? lineText.slice(indentation) : lineText;
|
|
@@ -123419,7 +123431,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
123419
123431
|
}
|
|
123420
123432
|
try {
|
|
123421
123433
|
return createCachedFileSystemEntries(rootDir, rootDirPath);
|
|
123422
|
-
} catch
|
|
123434
|
+
} catch {
|
|
123423
123435
|
Debug.assert(!cachedReadDirectoryResult.has(ensureTrailingDirectorySeparator(rootDirPath)));
|
|
123424
123436
|
return void 0;
|
|
123425
123437
|
}
|
|
@@ -123508,6 +123520,12 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
123508
123520
|
function realpath(s) {
|
|
123509
123521
|
return host.realpath ? host.realpath(s) : s;
|
|
123510
123522
|
}
|
|
123523
|
+
function clearFirstAncestorEntry(fileOrDirectoryPath) {
|
|
123524
|
+
forEachAncestorDirectory(
|
|
123525
|
+
getDirectoryPath(fileOrDirectoryPath),
|
|
123526
|
+
(ancestor) => cachedReadDirectoryResult.delete(ensureTrailingDirectorySeparator(ancestor)) ? true : void 0
|
|
123527
|
+
);
|
|
123528
|
+
}
|
|
123511
123529
|
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
|
123512
123530
|
const existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
|
123513
123531
|
if (existingResult !== void 0) {
|
|
@@ -123516,6 +123534,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
123516
123534
|
}
|
|
123517
123535
|
const parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath);
|
|
123518
123536
|
if (!parentResult) {
|
|
123537
|
+
clearFirstAncestorEntry(fileOrDirectoryPath);
|
|
123519
123538
|
return void 0;
|
|
123520
123539
|
}
|
|
123521
123540
|
if (!host.directoryExists) {
|
|
@@ -123541,6 +123560,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
123541
123560
|
const parentResult = getCachedFileSystemEntriesForBaseDir(filePath);
|
|
123542
123561
|
if (parentResult) {
|
|
123543
123562
|
updateFilesOfFileSystemEntry(parentResult, getBaseNameOfFileName(fileName), eventKind === 0 /* Created */);
|
|
123563
|
+
} else {
|
|
123564
|
+
clearFirstAncestorEntry(filePath);
|
|
123544
123565
|
}
|
|
123545
123566
|
}
|
|
123546
123567
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists2) {
|
|
@@ -125858,7 +125879,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125858
125879
|
return line;
|
|
125859
125880
|
}
|
|
125860
125881
|
const lineText = file.text.slice(lineStarts[line], lineStarts[line + 1]).trim();
|
|
125861
|
-
if (lineText !== "" &&
|
|
125882
|
+
if (lineText !== "" && !/^\s*\/\/.*$/.test(lineText)) {
|
|
125862
125883
|
return -1;
|
|
125863
125884
|
}
|
|
125864
125885
|
line--;
|
|
@@ -129920,9 +129941,9 @@ function removeIgnoredPath(path) {
|
|
|
129920
129941
|
function perceivedOsRootLengthForWatching(pathComponents2, length2) {
|
|
129921
129942
|
if (length2 <= 1) return 1;
|
|
129922
129943
|
let indexAfterOsRoot = 1;
|
|
129923
|
-
let isDosStyle = pathComponents2[0].search(/[a-
|
|
129944
|
+
let isDosStyle = pathComponents2[0].search(/[a-z]:/i) === 0;
|
|
129924
129945
|
if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
|
|
129925
|
-
pathComponents2[1].search(/[a-
|
|
129946
|
+
pathComponents2[1].search(/[a-z]\$$/i) === 0) {
|
|
129926
129947
|
if (length2 === 2) return 2;
|
|
129927
129948
|
indexAfterOsRoot = 2;
|
|
129928
129949
|
isDosStyle = true;
|
|
@@ -135330,7 +135351,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
|
135330
135351
|
return typeFromAccessor(parent2, context);
|
|
135331
135352
|
}
|
|
135332
135353
|
const declaredType = getEffectiveTypeAnnotationNode(node);
|
|
135333
|
-
const addUndefined = resolver.requiresAddingImplicitUndefined(node);
|
|
135354
|
+
const addUndefined = resolver.requiresAddingImplicitUndefined(node, context.enclosingDeclaration);
|
|
135334
135355
|
let resultType;
|
|
135335
135356
|
if (declaredType) {
|
|
135336
135357
|
resultType = serializeExistingTypeAnnotation(declaredType, addUndefined);
|
|
@@ -140163,8 +140184,8 @@ function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span)
|
|
|
140163
140184
|
}
|
|
140164
140185
|
}
|
|
140165
140186
|
function tryClassifyTripleSlashComment(start, width) {
|
|
140166
|
-
const tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/
|
|
140167
|
-
const attributeRegex = /(\s)(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/
|
|
140187
|
+
const tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/m;
|
|
140188
|
+
const attributeRegex = /(\s)(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/g;
|
|
140168
140189
|
const text = sourceFile.text.substr(start, width);
|
|
140169
140190
|
const match = tripleSlashXMLCommentRegEx.exec(text);
|
|
140170
140191
|
if (!match) {
|
|
@@ -141877,7 +141898,7 @@ function preProcessFile(sourceText, readImportFiles = true, detectJavaScriptImpo
|
|
|
141877
141898
|
}
|
|
141878
141899
|
|
|
141879
141900
|
// src/services/sourcemaps.ts
|
|
141880
|
-
var base64UrlRegExp = /^data:(?:application\/json
|
|
141901
|
+
var base64UrlRegExp = /^data:(?:application\/json;charset=[uU][tT][fF]-8;base64,([A-Za-z0-9+/=]+)$)?/;
|
|
141881
141902
|
function getSourceMapper(host) {
|
|
141882
141903
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
141883
141904
|
const currentDirectory = host.getCurrentDirectory();
|
|
@@ -143263,7 +143284,7 @@ function isFunctionOrClassExpression(node) {
|
|
|
143263
143284
|
}
|
|
143264
143285
|
function cleanText(text) {
|
|
143265
143286
|
text = text.length > maxLength ? text.substring(0, maxLength) + "..." : text;
|
|
143266
|
-
return text.replace(/\\?(
|
|
143287
|
+
return text.replace(/\\?(?:\r?\n|[\r\u2028\u2029])/g, "");
|
|
143267
143288
|
}
|
|
143268
143289
|
|
|
143269
143290
|
// src/services/_namespaces/ts.refactor.ts
|
|
@@ -150699,7 +150720,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
150699
150720
|
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
150700
150721
|
}
|
|
150701
150722
|
function getTodoCommentsRegExp() {
|
|
150702
|
-
const singleLineCommentStart = /(
|
|
150723
|
+
const singleLineCommentStart = /(?:\/{2,}\s*)/.source;
|
|
150703
150724
|
const multiLineCommentStart = /(?:\/\*+\s*)/.source;
|
|
150704
150725
|
const anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source;
|
|
150705
150726
|
const preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")";
|
|
@@ -154748,7 +154769,7 @@ function getLeftAndRightSiblings(typedefNode) {
|
|
|
154748
154769
|
function findEndOfTextBetween(jsDocComment, from, to) {
|
|
154749
154770
|
const comment = jsDocComment.getText().substring(from - jsDocComment.getStart(), to - jsDocComment.getStart());
|
|
154750
154771
|
for (let i = comment.length; i > 0; i--) {
|
|
154751
|
-
if (!/[*/\s]
|
|
154772
|
+
if (!/[*/\s]/.test(comment.substring(i - 1, i))) {
|
|
154752
154773
|
return from + i;
|
|
154753
154774
|
}
|
|
154754
154775
|
}
|
|
@@ -160131,11 +160152,12 @@ function withContext(context, typePrintMode, cb) {
|
|
|
160131
160152
|
}
|
|
160132
160153
|
type = widenedType;
|
|
160133
160154
|
}
|
|
160134
|
-
|
|
160155
|
+
const enclosingDeclaration = findAncestor(node, isDeclaration) ?? sourceFile;
|
|
160156
|
+
if (isParameter(node) && typeChecker.requiresAddingImplicitUndefined(node, enclosingDeclaration)) {
|
|
160135
160157
|
type = typeChecker.getUnionType([typeChecker.getUndefinedType(), type], 0 /* None */);
|
|
160136
160158
|
}
|
|
160137
160159
|
return {
|
|
160138
|
-
typeNode: typeToTypeNode2(type,
|
|
160160
|
+
typeNode: typeToTypeNode2(type, enclosingDeclaration, getFlags(type)),
|
|
160139
160161
|
mutatedTarget: false
|
|
160140
160162
|
};
|
|
160141
160163
|
function getFlags(type2) {
|
|
@@ -173351,11 +173373,11 @@ function addRegionOutliningSpans(sourceFile, out) {
|
|
|
173351
173373
|
for (const currentLineStart of lineStarts) {
|
|
173352
173374
|
const lineEnd = sourceFile.getLineEndOfPosition(currentLineStart);
|
|
173353
173375
|
const lineText = sourceFile.text.substring(currentLineStart, lineEnd);
|
|
173354
|
-
const result =
|
|
173376
|
+
const result = parseRegionDelimiter(lineText);
|
|
173355
173377
|
if (!result || isInComment(sourceFile, currentLineStart)) {
|
|
173356
173378
|
continue;
|
|
173357
173379
|
}
|
|
173358
|
-
if (
|
|
173380
|
+
if (result.isStart) {
|
|
173359
173381
|
const span = createTextSpanFromBounds(sourceFile.text.indexOf("//", currentLineStart), lineEnd);
|
|
173360
173382
|
regions.push(createOutliningSpan(
|
|
173361
173383
|
span,
|
|
@@ -173363,7 +173385,7 @@ function addRegionOutliningSpans(sourceFile, out) {
|
|
|
173363
173385
|
span,
|
|
173364
173386
|
/*autoCollapse*/
|
|
173365
173387
|
false,
|
|
173366
|
-
result
|
|
173388
|
+
result.name || "#region"
|
|
173367
173389
|
));
|
|
173368
173390
|
} else {
|
|
173369
173391
|
const region = regions.pop();
|
|
@@ -173375,14 +173397,18 @@ function addRegionOutliningSpans(sourceFile, out) {
|
|
|
173375
173397
|
}
|
|
173376
173398
|
}
|
|
173377
173399
|
}
|
|
173378
|
-
var regionDelimiterRegExp = /^#(end)?region(
|
|
173379
|
-
function
|
|
173400
|
+
var regionDelimiterRegExp = /^#(end)?region(.*)\r?$/;
|
|
173401
|
+
function parseRegionDelimiter(lineText) {
|
|
173380
173402
|
lineText = lineText.trimStart();
|
|
173381
173403
|
if (!startsWith(lineText, "//")) {
|
|
173382
173404
|
return null;
|
|
173383
173405
|
}
|
|
173384
173406
|
lineText = lineText.slice(2).trim();
|
|
173385
|
-
|
|
173407
|
+
const result = regionDelimiterRegExp.exec(lineText);
|
|
173408
|
+
if (result) {
|
|
173409
|
+
return { isStart: !result[1], name: result[2].trim() };
|
|
173410
|
+
}
|
|
173411
|
+
return void 0;
|
|
173386
173412
|
}
|
|
173387
173413
|
function addOutliningForLeadingCommentsForPos(pos, sourceFile, cancellationToken, out) {
|
|
173388
173414
|
const comments = getLeadingCommentRanges(sourceFile.text, pos);
|
|
@@ -173396,7 +173422,7 @@ function addOutliningForLeadingCommentsForPos(pos, sourceFile, cancellationToken
|
|
|
173396
173422
|
switch (kind) {
|
|
173397
173423
|
case 2 /* SingleLineCommentTrivia */:
|
|
173398
173424
|
const commentText = sourceText.slice(pos2, end);
|
|
173399
|
-
if (
|
|
173425
|
+
if (parseRegionDelimiter(commentText)) {
|
|
173400
173426
|
combineAndAddMultipleSingleLineComments();
|
|
173401
173427
|
singleLineCommentCount = 0;
|
|
173402
173428
|
break;
|
|
@@ -186486,6 +186512,9 @@ var _ProjectService = class _ProjectService {
|
|
|
186486
186512
|
this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
|
|
186487
186513
|
this.watchPackageJsonFile(file, fileOrDirectoryPath, wildCardWatcher);
|
|
186488
186514
|
}
|
|
186515
|
+
if (!(fsResult == null ? void 0 : fsResult.fileExists)) {
|
|
186516
|
+
this.sendSourceFileChange(fileOrDirectoryPath);
|
|
186517
|
+
}
|
|
186489
186518
|
const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
|
|
186490
186519
|
if (isIgnoredFileFromWildCardWatching({
|
|
186491
186520
|
watchedDirPath: this.toPath(directory),
|
|
@@ -188017,20 +188046,34 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
188017
188046
|
closeLog() {
|
|
188018
188047
|
this.logger.close();
|
|
188019
188048
|
}
|
|
188020
|
-
|
|
188021
|
-
* This function rebuilds the project for every file opened by the client
|
|
188022
|
-
* This does not reload contents of open files from disk. But we could do that if needed
|
|
188023
|
-
*/
|
|
188024
|
-
reloadProjects() {
|
|
188025
|
-
this.logger.info("reload projects.");
|
|
188049
|
+
sendSourceFileChange(inPath) {
|
|
188026
188050
|
this.filenameToScriptInfo.forEach((info) => {
|
|
188027
188051
|
if (this.openFiles.has(info.path)) return;
|
|
188028
188052
|
if (!info.fileWatcher) return;
|
|
188053
|
+
const eventKind = memoize(
|
|
188054
|
+
() => this.host.fileExists(info.fileName) ? info.deferredDelete ? 0 /* Created */ : 1 /* Changed */ : 2 /* Deleted */
|
|
188055
|
+
);
|
|
188056
|
+
if (inPath) {
|
|
188057
|
+
if (isScriptInfoWatchedFromNodeModules(info) || !info.path.startsWith(inPath)) return;
|
|
188058
|
+
if (eventKind() === 2 /* Deleted */ && info.deferredDelete) return;
|
|
188059
|
+
this.logger.info(`Invoking sourceFileChange on ${info.fileName}:: ${eventKind()}`);
|
|
188060
|
+
}
|
|
188029
188061
|
this.onSourceFileChanged(
|
|
188030
188062
|
info,
|
|
188031
|
-
|
|
188063
|
+
eventKind()
|
|
188032
188064
|
);
|
|
188033
188065
|
});
|
|
188066
|
+
}
|
|
188067
|
+
/**
|
|
188068
|
+
* This function rebuilds the project for every file opened by the client
|
|
188069
|
+
* This does not reload contents of open files from disk. But we could do that if needed
|
|
188070
|
+
*/
|
|
188071
|
+
reloadProjects() {
|
|
188072
|
+
this.logger.info("reload projects.");
|
|
188073
|
+
this.sendSourceFileChange(
|
|
188074
|
+
/*inPath*/
|
|
188075
|
+
void 0
|
|
188076
|
+
);
|
|
188034
188077
|
this.pendingProjectUpdates.forEach((_project, projectName) => {
|
|
188035
188078
|
this.throttledOperations.cancel(projectName);
|
|
188036
188079
|
this.pendingProjectUpdates.delete(projectName);
|
|
@@ -188907,7 +188950,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
188907
188950
|
return;
|
|
188908
188951
|
}
|
|
188909
188952
|
this.logger.info(`Enabling plugin ${pluginConfigEntry.name} from candidate paths: ${searchPaths.join(",")}`);
|
|
188910
|
-
if (!pluginConfigEntry.name || isExternalModuleNameRelative(pluginConfigEntry.name) || /[\\/]\.\.?(
|
|
188953
|
+
if (!pluginConfigEntry.name || isExternalModuleNameRelative(pluginConfigEntry.name) || /[\\/]\.\.?(?:$|[\\/])/.test(pluginConfigEntry.name)) {
|
|
188911
188954
|
this.logger.info(`Skipped loading plugin ${pluginConfigEntry.name || JSON.stringify(pluginConfigEntry)} because only package name is allowed plugin name`);
|
|
188912
188955
|
return;
|
|
188913
188956
|
}
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -69,7 +69,7 @@ var FileLog = class {
|
|
|
69
69
|
if (typeof this.logFile !== "string") return;
|
|
70
70
|
try {
|
|
71
71
|
fs.appendFileSync(this.logFile, `[${typescript_exports.server.nowString()}] ${text}${typescript_exports.sys.newLine}`);
|
|
72
|
-
} catch
|
|
72
|
+
} catch {
|
|
73
73
|
this.logFile = void 0;
|
|
74
74
|
}
|
|
75
75
|
};
|
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.6.0-dev.
|
|
5
|
+
"version": "5.6.0-dev.20240814",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@dprint/formatter": "^0.4.1",
|
|
43
43
|
"@dprint/typescript": "0.91.6",
|
|
44
44
|
"@esfx/canceltoken": "^1.0.0",
|
|
45
|
-
"@eslint/js": "^
|
|
45
|
+
"@eslint/js": "^9.9.0",
|
|
46
46
|
"@octokit/rest": "^21.0.1",
|
|
47
47
|
"@types/chai": "^4.3.17",
|
|
48
48
|
"@types/diff": "^5.2.1",
|
|
@@ -52,8 +52,9 @@
|
|
|
52
52
|
"@types/node": "latest",
|
|
53
53
|
"@types/source-map-support": "^0.5.10",
|
|
54
54
|
"@types/which": "^3.0.4",
|
|
55
|
-
"@typescript-eslint/
|
|
56
|
-
"
|
|
55
|
+
"@typescript-eslint/rule-tester": "^8.1.0",
|
|
56
|
+
"@typescript-eslint/utils": "^8.1.0",
|
|
57
|
+
"azure-devops-node-api": "^14.0.2",
|
|
57
58
|
"c8": "^10.1.2",
|
|
58
59
|
"chai": "^4.5.0",
|
|
59
60
|
"chalk": "^4.1.2",
|
|
@@ -61,25 +62,26 @@
|
|
|
61
62
|
"diff": "^5.2.0",
|
|
62
63
|
"dprint": "^0.47.2",
|
|
63
64
|
"esbuild": "^0.23.0",
|
|
64
|
-
"eslint": "^
|
|
65
|
-
"eslint-formatter-autolinkable-stylish": "^1.
|
|
65
|
+
"eslint": "^9.9.0",
|
|
66
|
+
"eslint-formatter-autolinkable-stylish": "^1.4.0",
|
|
67
|
+
"eslint-plugin-regexp": "^2.6.0",
|
|
66
68
|
"fast-xml-parser": "^4.4.1",
|
|
67
69
|
"glob": "^10.4.5",
|
|
68
70
|
"globals": "^15.9.0",
|
|
69
71
|
"hereby": "^1.9.0",
|
|
70
72
|
"jsonc-parser": "^3.3.1",
|
|
71
|
-
"knip": "^5.27.
|
|
73
|
+
"knip": "^5.27.2",
|
|
72
74
|
"minimist": "^1.2.8",
|
|
73
|
-
"mocha": "^10.7.
|
|
75
|
+
"mocha": "^10.7.3",
|
|
74
76
|
"mocha-fivemat-progress-reporter": "^0.1.0",
|
|
75
|
-
"monocart-coverage-reports": "^2.10.
|
|
77
|
+
"monocart-coverage-reports": "^2.10.2",
|
|
76
78
|
"ms": "^2.1.3",
|
|
77
79
|
"node-fetch": "^3.3.2",
|
|
78
|
-
"playwright": "^1.
|
|
80
|
+
"playwright": "^1.46.0",
|
|
79
81
|
"source-map-support": "^0.5.21",
|
|
80
82
|
"tslib": "^2.6.3",
|
|
81
83
|
"typescript": "^5.5.4",
|
|
82
|
-
"typescript-eslint": "^
|
|
84
|
+
"typescript-eslint": "^8.1.0",
|
|
83
85
|
"which": "^3.0.1"
|
|
84
86
|
},
|
|
85
87
|
"overrides": {
|
|
@@ -114,5 +116,5 @@
|
|
|
114
116
|
"node": "20.1.0",
|
|
115
117
|
"npm": "8.19.4"
|
|
116
118
|
},
|
|
117
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "77534875918d98c75006123a910ebf89fd4fb1be"
|
|
118
120
|
}
|