typescript 5.1.0-dev.20230309 → 5.1.0-dev.20230311
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/ThirdPartyNoticeText.txt +13 -13
- package/lib/lib.dom.d.ts +743 -16
- package/lib/lib.dom.iterable.d.ts +28 -0
- package/lib/lib.webworker.d.ts +577 -4
- package/lib/lib.webworker.iterable.d.ts +28 -0
- package/lib/tsc.js +40 -42
- package/lib/tsserver.js +44 -49
- package/lib/tsserverlibrary.d.ts +0 -1
- package/lib/tsserverlibrary.js +42 -45
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +42 -44
- package/lib/typingsInstaller.js +13 -23
- package/package.json +3 -3
|
@@ -20,6 +20,27 @@ and limitations under the License.
|
|
|
20
20
|
/// Worker Iterable APIs
|
|
21
21
|
/////////////////////////////
|
|
22
22
|
|
|
23
|
+
interface CSSNumericArray {
|
|
24
|
+
[Symbol.iterator](): IterableIterator<CSSNumericValue>;
|
|
25
|
+
entries(): IterableIterator<[number, CSSNumericValue]>;
|
|
26
|
+
keys(): IterableIterator<number>;
|
|
27
|
+
values(): IterableIterator<CSSNumericValue>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface CSSTransformValue {
|
|
31
|
+
[Symbol.iterator](): IterableIterator<CSSTransformComponent>;
|
|
32
|
+
entries(): IterableIterator<[number, CSSTransformComponent]>;
|
|
33
|
+
keys(): IterableIterator<number>;
|
|
34
|
+
values(): IterableIterator<CSSTransformComponent>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface CSSUnparsedValue {
|
|
38
|
+
[Symbol.iterator](): IterableIterator<CSSUnparsedSegment>;
|
|
39
|
+
entries(): IterableIterator<[number, CSSUnparsedSegment]>;
|
|
40
|
+
keys(): IterableIterator<number>;
|
|
41
|
+
values(): IterableIterator<CSSUnparsedSegment>;
|
|
42
|
+
}
|
|
43
|
+
|
|
23
44
|
interface Cache {
|
|
24
45
|
addAll(requests: Iterable<RequestInfo>): Promise<void>;
|
|
25
46
|
}
|
|
@@ -82,6 +103,13 @@ interface MessageEvent<T = any> {
|
|
|
82
103
|
initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: Iterable<MessagePort>): void;
|
|
83
104
|
}
|
|
84
105
|
|
|
106
|
+
interface StylePropertyMapReadOnly {
|
|
107
|
+
[Symbol.iterator](): IterableIterator<[string, Iterable<CSSStyleValue>]>;
|
|
108
|
+
entries(): IterableIterator<[string, Iterable<CSSStyleValue>]>;
|
|
109
|
+
keys(): IterableIterator<string>;
|
|
110
|
+
values(): IterableIterator<Iterable<CSSStyleValue>>;
|
|
111
|
+
}
|
|
112
|
+
|
|
85
113
|
interface SubtleCrypto {
|
|
86
114
|
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
|
|
87
115
|
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
|
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.1";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20230311`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -1306,7 +1306,7 @@ function trimEndImpl(s) {
|
|
|
1306
1306
|
return s.slice(0, end + 1);
|
|
1307
1307
|
}
|
|
1308
1308
|
function isNodeLikeSystem() {
|
|
1309
|
-
return typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object";
|
|
1309
|
+
return typeof process !== "undefined" && !!process.nextTick && !process.browser && typeof module === "object";
|
|
1310
1310
|
}
|
|
1311
1311
|
|
|
1312
1312
|
// src/compiler/debug.ts
|
|
@@ -4876,20 +4876,6 @@ function patchWriteFileEnsuringDirectory(sys2) {
|
|
|
4876
4876
|
(path2) => sys2.directoryExists(path2)
|
|
4877
4877
|
);
|
|
4878
4878
|
}
|
|
4879
|
-
function getNodeMajorVersion() {
|
|
4880
|
-
if (typeof process === "undefined") {
|
|
4881
|
-
return void 0;
|
|
4882
|
-
}
|
|
4883
|
-
const version2 = process.version;
|
|
4884
|
-
if (!version2) {
|
|
4885
|
-
return void 0;
|
|
4886
|
-
}
|
|
4887
|
-
const dot = version2.indexOf(".");
|
|
4888
|
-
if (dot === -1) {
|
|
4889
|
-
return void 0;
|
|
4890
|
-
}
|
|
4891
|
-
return parseInt(version2.substring(1, dot));
|
|
4892
|
-
}
|
|
4893
4879
|
var sys = (() => {
|
|
4894
4880
|
const byteOrderMarkIndicator = "\uFEFF";
|
|
4895
4881
|
function getNodeSystem() {
|
|
@@ -4906,14 +4892,12 @@ var sys = (() => {
|
|
|
4906
4892
|
let activeSession;
|
|
4907
4893
|
let profilePath = "./profile.cpuprofile";
|
|
4908
4894
|
const Buffer2 = require("buffer").Buffer;
|
|
4909
|
-
const nodeVersion = getNodeMajorVersion();
|
|
4910
|
-
const isNode4OrLater = nodeVersion >= 4;
|
|
4911
4895
|
const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
4912
4896
|
const platform = _os.platform();
|
|
4913
4897
|
const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
|
4914
4898
|
const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
4915
4899
|
const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
|
|
4916
|
-
const fsSupportsRecursiveFsWatch =
|
|
4900
|
+
const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
|
|
4917
4901
|
const getCurrentDirectory = memoize(() => process.cwd());
|
|
4918
4902
|
const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
|
|
4919
4903
|
pollingWatchFileWorker: fsWatchFileWorker,
|
|
@@ -4930,7 +4914,7 @@ var sys = (() => {
|
|
|
4930
4914
|
getAccessibleSortedChildDirectories: (path) => getAccessibleFileSystemEntries(path).directories,
|
|
4931
4915
|
realpath,
|
|
4932
4916
|
tscWatchFile: process.env.TSC_WATCHFILE,
|
|
4933
|
-
useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
|
|
4917
|
+
useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
|
|
4934
4918
|
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
|
|
4935
4919
|
inodeWatching: isLinuxOrMacOs,
|
|
4936
4920
|
sysLog
|
|
@@ -5016,8 +5000,10 @@ var sys = (() => {
|
|
|
5016
5000
|
process.stdout.write("\x1Bc");
|
|
5017
5001
|
},
|
|
5018
5002
|
setBlocking: () => {
|
|
5019
|
-
|
|
5020
|
-
|
|
5003
|
+
var _a2;
|
|
5004
|
+
const handle = (_a2 = process.stdout) == null ? void 0 : _a2._handle;
|
|
5005
|
+
if (handle && handle.setBlocking) {
|
|
5006
|
+
handle.setBlocking(true);
|
|
5021
5007
|
}
|
|
5022
5008
|
},
|
|
5023
5009
|
bufferFrom,
|
|
@@ -36590,6 +36576,10 @@ function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
|
|
|
36590
36576
|
originalPath: pathsAreEqual ? void 0 : fileName
|
|
36591
36577
|
};
|
|
36592
36578
|
}
|
|
36579
|
+
function getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState) {
|
|
36580
|
+
const nameForLookup = endsWith(typeRoot, "/node_modules/@types") || endsWith(typeRoot, "/node_modules/@types/") ? mangleScopedPackageNameWithTrace(typeReferenceDirectiveName, moduleResolutionState) : typeReferenceDirectiveName;
|
|
36581
|
+
return combinePaths(typeRoot, nameForLookup);
|
|
36582
|
+
}
|
|
36593
36583
|
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
|
|
36594
36584
|
Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
|
|
36595
36585
|
const traceEnabled = isTraceEnabled(options, host);
|
|
@@ -36708,7 +36698,7 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
36708
36698
|
trace(host, Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
|
|
36709
36699
|
}
|
|
36710
36700
|
return firstDefined(typeRoots, (typeRoot) => {
|
|
36711
|
-
const candidate =
|
|
36701
|
+
const candidate = getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState);
|
|
36712
36702
|
const directoryExists = directoryProbablyExists(typeRoot, host);
|
|
36713
36703
|
if (!directoryExists && traceEnabled) {
|
|
36714
36704
|
trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
@@ -38694,7 +38684,7 @@ function resolveFromTypeRoot(moduleName, state) {
|
|
|
38694
38684
|
if (!state.compilerOptions.typeRoots)
|
|
38695
38685
|
return;
|
|
38696
38686
|
for (const typeRoot of state.compilerOptions.typeRoots) {
|
|
38697
|
-
const candidate =
|
|
38687
|
+
const candidate = getCandidateFromTypeRoot(typeRoot, moduleName, state);
|
|
38698
38688
|
const directoryExists = directoryProbablyExists(typeRoot, state.host);
|
|
38699
38689
|
if (!directoryExists && state.traceEnabled) {
|
|
38700
38690
|
trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
@@ -52679,10 +52669,9 @@ function createTypeChecker(host) {
|
|
|
52679
52669
|
return [sig.parameters];
|
|
52680
52670
|
function expandSignatureParametersWithTupleMembers(restType, restIndex) {
|
|
52681
52671
|
const elementTypes = getTypeArguments(restType);
|
|
52682
|
-
const associatedNames = restType
|
|
52672
|
+
const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
|
|
52683
52673
|
const restParams = map(elementTypes, (t, i) => {
|
|
52684
|
-
const
|
|
52685
|
-
const name = tupleLabelName || getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
52674
|
+
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
52686
52675
|
const flags = restType.target.elementFlags[i];
|
|
52687
52676
|
const checkFlags = flags & 12 /* Variable */ ? 32768 /* RestParameter */ : flags & 2 /* Optional */ ? 16384 /* OptionalParameter */ : 0;
|
|
52688
52677
|
const symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
|
|
@@ -52691,6 +52680,20 @@ function createTypeChecker(host) {
|
|
|
52691
52680
|
});
|
|
52692
52681
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
52693
52682
|
}
|
|
52683
|
+
function getUniqAssociatedNamesFromTupleType(type) {
|
|
52684
|
+
const associatedNamesMap = /* @__PURE__ */ new Map();
|
|
52685
|
+
return map(type.target.labeledElementDeclarations, (labeledElement) => {
|
|
52686
|
+
const name = getTupleElementLabel(labeledElement);
|
|
52687
|
+
const prevCounter = associatedNamesMap.get(name);
|
|
52688
|
+
if (prevCounter === void 0) {
|
|
52689
|
+
associatedNamesMap.set(name, 1);
|
|
52690
|
+
return name;
|
|
52691
|
+
} else {
|
|
52692
|
+
associatedNamesMap.set(name, prevCounter + 1);
|
|
52693
|
+
return `${name}_${prevCounter}`;
|
|
52694
|
+
}
|
|
52695
|
+
});
|
|
52696
|
+
}
|
|
52694
52697
|
}
|
|
52695
52698
|
function getDefaultConstructSignatures(classType) {
|
|
52696
52699
|
const baseConstructorType = getBaseConstructorTypeOfClass(classType);
|
|
@@ -58648,20 +58651,8 @@ function createTypeChecker(host) {
|
|
|
58648
58651
|
return result;
|
|
58649
58652
|
}
|
|
58650
58653
|
const moreThanOneRealChildren = length(validChildren) > 1;
|
|
58651
|
-
|
|
58652
|
-
|
|
58653
|
-
const iterableType = getGlobalIterableType(
|
|
58654
|
-
/*reportErrors*/
|
|
58655
|
-
false
|
|
58656
|
-
);
|
|
58657
|
-
if (iterableType !== emptyGenericType) {
|
|
58658
|
-
const anyIterable = createIterableType(anyType);
|
|
58659
|
-
arrayLikeTargetParts = filterType(childrenTargetType, (t) => isTypeAssignableTo(t, anyIterable));
|
|
58660
|
-
nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isTypeAssignableTo(t, anyIterable));
|
|
58661
|
-
} else {
|
|
58662
|
-
arrayLikeTargetParts = filterType(childrenTargetType, isArrayOrTupleLikeType);
|
|
58663
|
-
nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isArrayOrTupleLikeType(t));
|
|
58664
|
-
}
|
|
58654
|
+
const arrayLikeTargetParts = filterType(childrenTargetType, isAssignableToAvailableAnyIterable);
|
|
58655
|
+
const nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isAssignableToAvailableAnyIterable(t));
|
|
58665
58656
|
if (moreThanOneRealChildren) {
|
|
58666
58657
|
if (arrayLikeTargetParts !== neverType) {
|
|
58667
58658
|
const realSource = createTupleType(checkJsxChildren(containingElement, 0 /* Normal */));
|
|
@@ -61947,6 +61938,13 @@ function createTypeChecker(host) {
|
|
|
61947
61938
|
function isArrayOrTupleLikeType(type) {
|
|
61948
61939
|
return isArrayLikeType(type) || isTupleLikeType(type);
|
|
61949
61940
|
}
|
|
61941
|
+
function isAssignableToAvailableAnyIterable(type) {
|
|
61942
|
+
const anyIterable = getGlobalIterableType(
|
|
61943
|
+
/*reportErrors*/
|
|
61944
|
+
false
|
|
61945
|
+
) !== emptyGenericType && createIterableType(anyType);
|
|
61946
|
+
return anyIterable ? isTypeAssignableTo(type, anyIterable) : isArrayOrTupleLikeType(type);
|
|
61947
|
+
}
|
|
61950
61948
|
function getTupleElementType(type, index) {
|
|
61951
61949
|
const propType = getTypeOfPropertyOfType(type, "" + index);
|
|
61952
61950
|
if (propType) {
|
|
@@ -66700,7 +66698,7 @@ function createTypeChecker(host) {
|
|
|
66700
66698
|
return void 0;
|
|
66701
66699
|
}
|
|
66702
66700
|
function getContextualTypeForElementExpression(arrayContextualType, index) {
|
|
66703
|
-
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
66701
|
+
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(filterType(arrayContextualType, (t) => !!getIndexTypeOfType(t, numberType) || isAssignableToAvailableAnyIterable(t)), "" + index) || mapType(
|
|
66704
66702
|
arrayContextualType,
|
|
66705
66703
|
(t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
|
|
66706
66704
|
t,
|
package/lib/tsserver.js
CHANGED
|
@@ -883,7 +883,6 @@ __export(server_exports, {
|
|
|
883
883
|
getNodeForGeneratedName: () => getNodeForGeneratedName,
|
|
884
884
|
getNodeId: () => getNodeId,
|
|
885
885
|
getNodeKind: () => getNodeKind,
|
|
886
|
-
getNodeMajorVersion: () => getNodeMajorVersion,
|
|
887
886
|
getNodeModifiers: () => getNodeModifiers,
|
|
888
887
|
getNodeModulePathParts: () => getNodeModulePathParts,
|
|
889
888
|
getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
|
|
@@ -2285,7 +2284,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2285
2284
|
|
|
2286
2285
|
// src/compiler/corePublic.ts
|
|
2287
2286
|
var versionMajorMinor = "5.1";
|
|
2288
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2287
|
+
var version = `${versionMajorMinor}.0-dev.20230311`;
|
|
2289
2288
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2290
2289
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2291
2290
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -3956,7 +3955,7 @@ function trimEndImpl(s) {
|
|
|
3956
3955
|
return s.slice(0, end + 1);
|
|
3957
3956
|
}
|
|
3958
3957
|
function isNodeLikeSystem() {
|
|
3959
|
-
return typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object";
|
|
3958
|
+
return typeof process !== "undefined" && !!process.nextTick && !process.browser && typeof module === "object";
|
|
3960
3959
|
}
|
|
3961
3960
|
|
|
3962
3961
|
// src/compiler/debug.ts
|
|
@@ -8315,20 +8314,6 @@ function patchWriteFileEnsuringDirectory(sys2) {
|
|
|
8315
8314
|
(path2) => sys2.directoryExists(path2)
|
|
8316
8315
|
);
|
|
8317
8316
|
}
|
|
8318
|
-
function getNodeMajorVersion() {
|
|
8319
|
-
if (typeof process === "undefined") {
|
|
8320
|
-
return void 0;
|
|
8321
|
-
}
|
|
8322
|
-
const version2 = process.version;
|
|
8323
|
-
if (!version2) {
|
|
8324
|
-
return void 0;
|
|
8325
|
-
}
|
|
8326
|
-
const dot = version2.indexOf(".");
|
|
8327
|
-
if (dot === -1) {
|
|
8328
|
-
return void 0;
|
|
8329
|
-
}
|
|
8330
|
-
return parseInt(version2.substring(1, dot));
|
|
8331
|
-
}
|
|
8332
8317
|
var sys = (() => {
|
|
8333
8318
|
const byteOrderMarkIndicator = "\uFEFF";
|
|
8334
8319
|
function getNodeSystem() {
|
|
@@ -8345,14 +8330,12 @@ var sys = (() => {
|
|
|
8345
8330
|
let activeSession;
|
|
8346
8331
|
let profilePath = "./profile.cpuprofile";
|
|
8347
8332
|
const Buffer2 = require("buffer").Buffer;
|
|
8348
|
-
const nodeVersion = getNodeMajorVersion();
|
|
8349
|
-
const isNode4OrLater = nodeVersion >= 4;
|
|
8350
8333
|
const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
8351
8334
|
const platform = _os.platform();
|
|
8352
8335
|
const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
|
8353
8336
|
const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
8354
8337
|
const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
|
|
8355
|
-
const fsSupportsRecursiveFsWatch =
|
|
8338
|
+
const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
|
|
8356
8339
|
const getCurrentDirectory = memoize(() => process.cwd());
|
|
8357
8340
|
const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
|
|
8358
8341
|
pollingWatchFileWorker: fsWatchFileWorker,
|
|
@@ -8369,7 +8352,7 @@ var sys = (() => {
|
|
|
8369
8352
|
getAccessibleSortedChildDirectories: (path) => getAccessibleFileSystemEntries(path).directories,
|
|
8370
8353
|
realpath,
|
|
8371
8354
|
tscWatchFile: process.env.TSC_WATCHFILE,
|
|
8372
|
-
useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER,
|
|
8355
|
+
useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
|
|
8373
8356
|
tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
|
|
8374
8357
|
inodeWatching: isLinuxOrMacOs,
|
|
8375
8358
|
sysLog
|
|
@@ -8455,8 +8438,10 @@ var sys = (() => {
|
|
|
8455
8438
|
process.stdout.write("\x1Bc");
|
|
8456
8439
|
},
|
|
8457
8440
|
setBlocking: () => {
|
|
8458
|
-
|
|
8459
|
-
|
|
8441
|
+
var _a2;
|
|
8442
|
+
const handle = (_a2 = process.stdout) == null ? void 0 : _a2._handle;
|
|
8443
|
+
if (handle && handle.setBlocking) {
|
|
8444
|
+
handle.setBlocking(true);
|
|
8460
8445
|
}
|
|
8461
8446
|
},
|
|
8462
8447
|
bufferFrom,
|
|
@@ -40987,6 +40972,10 @@ function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
|
|
|
40987
40972
|
originalPath: pathsAreEqual ? void 0 : fileName
|
|
40988
40973
|
};
|
|
40989
40974
|
}
|
|
40975
|
+
function getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState) {
|
|
40976
|
+
const nameForLookup = endsWith(typeRoot, "/node_modules/@types") || endsWith(typeRoot, "/node_modules/@types/") ? mangleScopedPackageNameWithTrace(typeReferenceDirectiveName, moduleResolutionState) : typeReferenceDirectiveName;
|
|
40977
|
+
return combinePaths(typeRoot, nameForLookup);
|
|
40978
|
+
}
|
|
40990
40979
|
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
|
|
40991
40980
|
Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
|
|
40992
40981
|
const traceEnabled = isTraceEnabled(options, host);
|
|
@@ -41105,7 +41094,7 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
41105
41094
|
trace(host, Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", "));
|
|
41106
41095
|
}
|
|
41107
41096
|
return firstDefined(typeRoots, (typeRoot) => {
|
|
41108
|
-
const candidate =
|
|
41097
|
+
const candidate = getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState);
|
|
41109
41098
|
const directoryExists = directoryProbablyExists(typeRoot, host);
|
|
41110
41099
|
if (!directoryExists && traceEnabled) {
|
|
41111
41100
|
trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
@@ -43230,7 +43219,7 @@ function resolveFromTypeRoot(moduleName, state) {
|
|
|
43230
43219
|
if (!state.compilerOptions.typeRoots)
|
|
43231
43220
|
return;
|
|
43232
43221
|
for (const typeRoot of state.compilerOptions.typeRoots) {
|
|
43233
|
-
const candidate =
|
|
43222
|
+
const candidate = getCandidateFromTypeRoot(typeRoot, moduleName, state);
|
|
43234
43223
|
const directoryExists = directoryProbablyExists(typeRoot, state.host);
|
|
43235
43224
|
if (!directoryExists && state.traceEnabled) {
|
|
43236
43225
|
trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
@@ -57269,10 +57258,9 @@ function createTypeChecker(host) {
|
|
|
57269
57258
|
return [sig.parameters];
|
|
57270
57259
|
function expandSignatureParametersWithTupleMembers(restType, restIndex) {
|
|
57271
57260
|
const elementTypes = getTypeArguments(restType);
|
|
57272
|
-
const associatedNames = restType
|
|
57261
|
+
const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
|
|
57273
57262
|
const restParams = map(elementTypes, (t, i) => {
|
|
57274
|
-
const
|
|
57275
|
-
const name = tupleLabelName || getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
57263
|
+
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
57276
57264
|
const flags = restType.target.elementFlags[i];
|
|
57277
57265
|
const checkFlags = flags & 12 /* Variable */ ? 32768 /* RestParameter */ : flags & 2 /* Optional */ ? 16384 /* OptionalParameter */ : 0;
|
|
57278
57266
|
const symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
|
|
@@ -57281,6 +57269,20 @@ function createTypeChecker(host) {
|
|
|
57281
57269
|
});
|
|
57282
57270
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
57283
57271
|
}
|
|
57272
|
+
function getUniqAssociatedNamesFromTupleType(type) {
|
|
57273
|
+
const associatedNamesMap = /* @__PURE__ */ new Map();
|
|
57274
|
+
return map(type.target.labeledElementDeclarations, (labeledElement) => {
|
|
57275
|
+
const name = getTupleElementLabel(labeledElement);
|
|
57276
|
+
const prevCounter = associatedNamesMap.get(name);
|
|
57277
|
+
if (prevCounter === void 0) {
|
|
57278
|
+
associatedNamesMap.set(name, 1);
|
|
57279
|
+
return name;
|
|
57280
|
+
} else {
|
|
57281
|
+
associatedNamesMap.set(name, prevCounter + 1);
|
|
57282
|
+
return `${name}_${prevCounter}`;
|
|
57283
|
+
}
|
|
57284
|
+
});
|
|
57285
|
+
}
|
|
57284
57286
|
}
|
|
57285
57287
|
function getDefaultConstructSignatures(classType) {
|
|
57286
57288
|
const baseConstructorType = getBaseConstructorTypeOfClass(classType);
|
|
@@ -63238,20 +63240,8 @@ function createTypeChecker(host) {
|
|
|
63238
63240
|
return result;
|
|
63239
63241
|
}
|
|
63240
63242
|
const moreThanOneRealChildren = length(validChildren) > 1;
|
|
63241
|
-
|
|
63242
|
-
|
|
63243
|
-
const iterableType = getGlobalIterableType(
|
|
63244
|
-
/*reportErrors*/
|
|
63245
|
-
false
|
|
63246
|
-
);
|
|
63247
|
-
if (iterableType !== emptyGenericType) {
|
|
63248
|
-
const anyIterable = createIterableType(anyType);
|
|
63249
|
-
arrayLikeTargetParts = filterType(childrenTargetType, (t) => isTypeAssignableTo(t, anyIterable));
|
|
63250
|
-
nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isTypeAssignableTo(t, anyIterable));
|
|
63251
|
-
} else {
|
|
63252
|
-
arrayLikeTargetParts = filterType(childrenTargetType, isArrayOrTupleLikeType);
|
|
63253
|
-
nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isArrayOrTupleLikeType(t));
|
|
63254
|
-
}
|
|
63243
|
+
const arrayLikeTargetParts = filterType(childrenTargetType, isAssignableToAvailableAnyIterable);
|
|
63244
|
+
const nonArrayLikeTargetParts = filterType(childrenTargetType, (t) => !isAssignableToAvailableAnyIterable(t));
|
|
63255
63245
|
if (moreThanOneRealChildren) {
|
|
63256
63246
|
if (arrayLikeTargetParts !== neverType) {
|
|
63257
63247
|
const realSource = createTupleType(checkJsxChildren(containingElement, 0 /* Normal */));
|
|
@@ -66537,6 +66527,13 @@ function createTypeChecker(host) {
|
|
|
66537
66527
|
function isArrayOrTupleLikeType(type) {
|
|
66538
66528
|
return isArrayLikeType(type) || isTupleLikeType(type);
|
|
66539
66529
|
}
|
|
66530
|
+
function isAssignableToAvailableAnyIterable(type) {
|
|
66531
|
+
const anyIterable = getGlobalIterableType(
|
|
66532
|
+
/*reportErrors*/
|
|
66533
|
+
false
|
|
66534
|
+
) !== emptyGenericType && createIterableType(anyType);
|
|
66535
|
+
return anyIterable ? isTypeAssignableTo(type, anyIterable) : isArrayOrTupleLikeType(type);
|
|
66536
|
+
}
|
|
66540
66537
|
function getTupleElementType(type, index) {
|
|
66541
66538
|
const propType = getTypeOfPropertyOfType(type, "" + index);
|
|
66542
66539
|
if (propType) {
|
|
@@ -71290,7 +71287,7 @@ function createTypeChecker(host) {
|
|
|
71290
71287
|
return void 0;
|
|
71291
71288
|
}
|
|
71292
71289
|
function getContextualTypeForElementExpression(arrayContextualType, index) {
|
|
71293
|
-
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
71290
|
+
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(filterType(arrayContextualType, (t) => !!getIndexTypeOfType(t, numberType) || isAssignableToAvailableAnyIterable(t)), "" + index) || mapType(
|
|
71294
71291
|
arrayContextualType,
|
|
71295
71292
|
(t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
|
|
71296
71293
|
t,
|
|
@@ -143985,9 +143982,10 @@ function getInfo7(sourceFile, tokenPos, errorCode, checker, program) {
|
|
|
143985
143982
|
if (!isMemberName(token))
|
|
143986
143983
|
return void 0;
|
|
143987
143984
|
if (isIdentifier(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression(parent2.initializer)) {
|
|
143985
|
+
const targetType = checker.getContextualType(token) || checker.getTypeAtLocation(token);
|
|
143988
143986
|
const properties = arrayFrom(checker.getUnmatchedProperties(
|
|
143989
143987
|
checker.getTypeAtLocation(parent2.initializer),
|
|
143990
|
-
|
|
143988
|
+
targetType,
|
|
143991
143989
|
/* requireOptionalProperties */
|
|
143992
143990
|
false,
|
|
143993
143991
|
/* matchDiscriminantProperties */
|
|
@@ -168867,7 +168865,6 @@ __export(ts_exports3, {
|
|
|
168867
168865
|
getNodeForGeneratedName: () => getNodeForGeneratedName,
|
|
168868
168866
|
getNodeId: () => getNodeId,
|
|
168869
168867
|
getNodeKind: () => getNodeKind,
|
|
168870
|
-
getNodeMajorVersion: () => getNodeMajorVersion,
|
|
168871
168868
|
getNodeModifiers: () => getNodeModifiers,
|
|
168872
168869
|
getNodeModulePathParts: () => getNodeModulePathParts,
|
|
168873
168870
|
getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
|
|
@@ -181393,8 +181390,7 @@ function initializeNodeSystem() {
|
|
|
181393
181390
|
}
|
|
181394
181391
|
}
|
|
181395
181392
|
const libDirectory = getDirectoryPath(normalizePath(sys2.getExecutingFilePath()));
|
|
181396
|
-
const
|
|
181397
|
-
const useWatchGuard = process.platform === "win32" && nodeVersion >= 4;
|
|
181393
|
+
const useWatchGuard = process.platform === "win32";
|
|
181398
181394
|
const originalWatchDirectory = sys2.watchDirectory.bind(sys2);
|
|
181399
181395
|
const logger = createLogger();
|
|
181400
181396
|
Debug.loggingHost = {
|
|
@@ -181949,7 +181945,7 @@ function start({ args, logger, cancellationToken, serverMode, unknownServerMode,
|
|
|
181949
181945
|
logger.info(`Starting TS Server`);
|
|
181950
181946
|
logger.info(`Version: ${version}`);
|
|
181951
181947
|
logger.info(`Arguments: ${args.join(" ")}`);
|
|
181952
|
-
logger.info(`Platform: ${platform} NodeVersion: ${
|
|
181948
|
+
logger.info(`Platform: ${platform} NodeVersion: ${process.version} CaseSensitive: ${sys.useCaseSensitiveFileNames}`);
|
|
181953
181949
|
logger.info(`ServerMode: ${serverMode} hasUnknownServerMode: ${unknownServerMode}`);
|
|
181954
181950
|
setStackTraceLimit();
|
|
181955
181951
|
if (Debug.isDebugging) {
|
|
@@ -182827,7 +182823,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
182827
182823
|
getNodeForGeneratedName,
|
|
182828
182824
|
getNodeId,
|
|
182829
182825
|
getNodeKind,
|
|
182830
|
-
getNodeMajorVersion,
|
|
182831
182826
|
getNodeModifiers,
|
|
182832
182827
|
getNodeModulePathParts,
|
|
182833
182828
|
getNonAssignedNameOfDeclaration,
|
package/lib/tsserverlibrary.d.ts
CHANGED