typescript 5.4.0-dev.20240110 → 5.4.0-dev.20240112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.esnext.collection.d.ts +29 -0
- package/lib/lib.esnext.d.ts +2 -0
- package/lib/lib.esnext.object.d.ts +29 -0
- package/lib/tsc.js +173 -63
- package/lib/tsserver.js +259 -72
- package/lib/typescript.d.ts +6 -2
- package/lib/typescript.js +259 -72
- package/lib/typingsInstaller.js +4 -2
- package/package.json +2 -2
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
|
+
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/// <reference no-default-lib="true"/>
|
|
18
|
+
|
|
19
|
+
interface MapConstructor {
|
|
20
|
+
/**
|
|
21
|
+
* Groups members of an iterable according to the return value of the passed callback.
|
|
22
|
+
* @param items An iterable.
|
|
23
|
+
* @param keySelector A callback which will be invoked for each item in items.
|
|
24
|
+
*/
|
|
25
|
+
groupBy<K, T>(
|
|
26
|
+
items: Iterable<T>,
|
|
27
|
+
keySelector: (item: T, index: number) => K,
|
|
28
|
+
): Map<K, T[]>;
|
|
29
|
+
}
|
package/lib/lib.esnext.d.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
|
+
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/// <reference no-default-lib="true"/>
|
|
18
|
+
|
|
19
|
+
interface ObjectConstructor {
|
|
20
|
+
/**
|
|
21
|
+
* Groups members of an iterable according to the return value of the passed callback.
|
|
22
|
+
* @param items An iterable.
|
|
23
|
+
* @param keySelector A callback which will be invoked for each item in items.
|
|
24
|
+
*/
|
|
25
|
+
groupBy<K extends PropertyKey, T>(
|
|
26
|
+
items: Iterable<T>,
|
|
27
|
+
keySelector: (item: T, index: number) => K,
|
|
28
|
+
): Partial<Record<K, T[]>>;
|
|
29
|
+
}
|
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.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240112`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -4898,6 +4898,7 @@ var sys = (() => {
|
|
|
4898
4898
|
resolvePath: (path) => _path.resolve(path),
|
|
4899
4899
|
fileExists,
|
|
4900
4900
|
directoryExists,
|
|
4901
|
+
getAccessibleFileSystemEntries,
|
|
4901
4902
|
createDirectory(directoryName) {
|
|
4902
4903
|
if (!nodeSystem.directoryExists(directoryName)) {
|
|
4903
4904
|
try {
|
|
@@ -11372,6 +11373,45 @@ function isRestParameter(node) {
|
|
|
11372
11373
|
const type = isJSDocParameterTag(node) ? node.typeExpression && node.typeExpression.type : node.type;
|
|
11373
11374
|
return node.dotDotDotToken !== void 0 || !!type && type.kind === 325 /* JSDocVariadicType */;
|
|
11374
11375
|
}
|
|
11376
|
+
function hasInternalAnnotation(range, sourceFile) {
|
|
11377
|
+
const comment = sourceFile.text.substring(range.pos, range.end);
|
|
11378
|
+
return comment.includes("@internal");
|
|
11379
|
+
}
|
|
11380
|
+
function isInternalDeclaration(node, sourceFile) {
|
|
11381
|
+
sourceFile ?? (sourceFile = getSourceFileOfNode(node));
|
|
11382
|
+
const parseTreeNode = getParseTreeNode(node);
|
|
11383
|
+
if (parseTreeNode && parseTreeNode.kind === 169 /* Parameter */) {
|
|
11384
|
+
const paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
|
|
11385
|
+
const previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : void 0;
|
|
11386
|
+
const text = sourceFile.text;
|
|
11387
|
+
const commentRanges = previousSibling ? concatenate(
|
|
11388
|
+
// to handle
|
|
11389
|
+
// ... parameters, /** @internal */
|
|
11390
|
+
// public param: string
|
|
11391
|
+
getTrailingCommentRanges(text, skipTrivia(
|
|
11392
|
+
text,
|
|
11393
|
+
previousSibling.end + 1,
|
|
11394
|
+
/*stopAfterLineBreak*/
|
|
11395
|
+
false,
|
|
11396
|
+
/*stopAtComments*/
|
|
11397
|
+
true
|
|
11398
|
+
)),
|
|
11399
|
+
getLeadingCommentRanges(text, node.pos)
|
|
11400
|
+
) : getTrailingCommentRanges(text, skipTrivia(
|
|
11401
|
+
text,
|
|
11402
|
+
node.pos,
|
|
11403
|
+
/*stopAfterLineBreak*/
|
|
11404
|
+
false,
|
|
11405
|
+
/*stopAtComments*/
|
|
11406
|
+
true
|
|
11407
|
+
));
|
|
11408
|
+
return some(commentRanges) && hasInternalAnnotation(last(commentRanges), sourceFile);
|
|
11409
|
+
}
|
|
11410
|
+
const leadingCommentRanges = parseTreeNode && getLeadingCommentRangesOfNode(parseTreeNode, sourceFile);
|
|
11411
|
+
return !!forEach(leadingCommentRanges, (range) => {
|
|
11412
|
+
return hasInternalAnnotation(range, sourceFile);
|
|
11413
|
+
});
|
|
11414
|
+
}
|
|
11375
11415
|
|
|
11376
11416
|
// src/compiler/utilities.ts
|
|
11377
11417
|
var resolvingEmptyArray = [];
|
|
@@ -17671,6 +17711,9 @@ var stringReplace = String.prototype.replace;
|
|
|
17671
17711
|
function replaceFirstStar(s, replacement) {
|
|
17672
17712
|
return stringReplace.call(s, "*", replacement);
|
|
17673
17713
|
}
|
|
17714
|
+
function getNameFromImportAttribute(node) {
|
|
17715
|
+
return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
|
|
17716
|
+
}
|
|
17674
17717
|
|
|
17675
17718
|
// src/compiler/factory/baseNodeFactory.ts
|
|
17676
17719
|
function createBaseNodeFactory() {
|
|
@@ -34065,7 +34108,7 @@ var libEntries = [
|
|
|
34065
34108
|
["es2023.array", "lib.es2023.array.d.ts"],
|
|
34066
34109
|
["es2023.collection", "lib.es2023.collection.d.ts"],
|
|
34067
34110
|
["esnext.array", "lib.es2023.array.d.ts"],
|
|
34068
|
-
["esnext.collection", "lib.
|
|
34111
|
+
["esnext.collection", "lib.esnext.collection.d.ts"],
|
|
34069
34112
|
["esnext.symbol", "lib.es2019.symbol.d.ts"],
|
|
34070
34113
|
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
|
|
34071
34114
|
["esnext.intl", "lib.esnext.intl.d.ts"],
|
|
@@ -34075,6 +34118,7 @@ var libEntries = [
|
|
|
34075
34118
|
["esnext.promise", "lib.esnext.promise.d.ts"],
|
|
34076
34119
|
["esnext.weakref", "lib.es2021.weakref.d.ts"],
|
|
34077
34120
|
["esnext.decorators", "lib.esnext.decorators.d.ts"],
|
|
34121
|
+
["esnext.object", "lib.esnext.object.d.ts"],
|
|
34078
34122
|
["decorators", "lib.decorators.d.ts"],
|
|
34079
34123
|
["decorators.legacy", "lib.decorators.legacy.d.ts"]
|
|
34080
34124
|
];
|
|
@@ -44446,6 +44490,7 @@ function createTypeChecker(host) {
|
|
|
44446
44490
|
var deferredGlobalImportMetaType;
|
|
44447
44491
|
var deferredGlobalImportMetaExpressionType;
|
|
44448
44492
|
var deferredGlobalImportCallOptionsType;
|
|
44493
|
+
var deferredGlobalImportAttributesType;
|
|
44449
44494
|
var deferredGlobalDisposableType;
|
|
44450
44495
|
var deferredGlobalAsyncDisposableType;
|
|
44451
44496
|
var deferredGlobalExtractSymbol;
|
|
@@ -44602,7 +44647,12 @@ function createTypeChecker(host) {
|
|
|
44602
44647
|
}
|
|
44603
44648
|
function markAsSynthetic(node) {
|
|
44604
44649
|
setTextRangePosEnd(node, -1, -1);
|
|
44605
|
-
return visitEachChild(
|
|
44650
|
+
return visitEachChild(
|
|
44651
|
+
node,
|
|
44652
|
+
markAsSynthetic,
|
|
44653
|
+
/*context*/
|
|
44654
|
+
void 0
|
|
44655
|
+
);
|
|
44606
44656
|
}
|
|
44607
44657
|
function getEmitResolver(sourceFile, cancellationToken2) {
|
|
44608
44658
|
getDiagnostics(sourceFile, cancellationToken2);
|
|
@@ -48644,7 +48694,13 @@ function createTypeChecker(host) {
|
|
|
48644
48694
|
if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
|
|
48645
48695
|
return node;
|
|
48646
48696
|
}
|
|
48647
|
-
return setTextRange(factory.cloneNode(visitEachChild(
|
|
48697
|
+
return setTextRange(factory.cloneNode(visitEachChild(
|
|
48698
|
+
node,
|
|
48699
|
+
deepCloneOrReuseNode,
|
|
48700
|
+
/*context*/
|
|
48701
|
+
void 0,
|
|
48702
|
+
deepCloneOrReuseNodes
|
|
48703
|
+
)), node);
|
|
48648
48704
|
}
|
|
48649
48705
|
function deepCloneOrReuseNodes(nodes, visitor, test, start, count) {
|
|
48650
48706
|
if (nodes && nodes.length === 0) {
|
|
@@ -49366,7 +49422,8 @@ function createTypeChecker(host) {
|
|
|
49366
49422
|
let visited = visitEachChild(
|
|
49367
49423
|
node2,
|
|
49368
49424
|
elideInitializerAndSetEmitFlags,
|
|
49369
|
-
|
|
49425
|
+
/*context*/
|
|
49426
|
+
void 0,
|
|
49370
49427
|
/*nodesVisitor*/
|
|
49371
49428
|
void 0,
|
|
49372
49429
|
elideInitializerAndSetEmitFlags
|
|
@@ -50144,7 +50201,12 @@ function createTypeChecker(host) {
|
|
|
50144
50201
|
if (file && isTupleTypeNode(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
|
|
50145
50202
|
setEmitFlags(node, 1 /* SingleLine */);
|
|
50146
50203
|
}
|
|
50147
|
-
return visitEachChild(
|
|
50204
|
+
return visitEachChild(
|
|
50205
|
+
node,
|
|
50206
|
+
visitExistingNodeTreeSymbols,
|
|
50207
|
+
/*context*/
|
|
50208
|
+
void 0
|
|
50209
|
+
);
|
|
50148
50210
|
function getEffectiveDotDotDotForParameter(p) {
|
|
50149
50211
|
return p.dotDotDotToken || (p.type && isJSDocVariadicType(p.type) ? factory.createToken(26 /* DotDotDotToken */) : void 0);
|
|
50150
50212
|
}
|
|
@@ -50244,7 +50306,7 @@ function createTypeChecker(host) {
|
|
|
50244
50306
|
});
|
|
50245
50307
|
let addingDeclare = !bundled;
|
|
50246
50308
|
const exportEquals = symbolTable.get("export=" /* ExportEquals */);
|
|
50247
|
-
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & 2097152 /* Alias */) {
|
|
50309
|
+
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & (2097152 /* Alias */ | 1536 /* Module */)) {
|
|
50248
50310
|
symbolTable = createSymbolTable();
|
|
50249
50311
|
symbolTable.set("export=" /* ExportEquals */, exportEquals);
|
|
50250
50312
|
}
|
|
@@ -50701,8 +50763,18 @@ function createTypeChecker(host) {
|
|
|
50701
50763
|
);
|
|
50702
50764
|
}
|
|
50703
50765
|
function getNamespaceMembersForSerialization(symbol) {
|
|
50704
|
-
|
|
50705
|
-
|
|
50766
|
+
let exports2 = arrayFrom(getExportsOfSymbol(symbol).values());
|
|
50767
|
+
const merged = getMergedSymbol(symbol);
|
|
50768
|
+
if (merged !== symbol) {
|
|
50769
|
+
const membersSet = new Set(exports2);
|
|
50770
|
+
for (const exported of getExportsOfSymbol(merged).values()) {
|
|
50771
|
+
if (!(getSymbolFlags(resolveSymbol(exported)) & 111551 /* Value */)) {
|
|
50772
|
+
membersSet.add(exported);
|
|
50773
|
+
}
|
|
50774
|
+
}
|
|
50775
|
+
exports2 = arrayFrom(membersSet);
|
|
50776
|
+
}
|
|
50777
|
+
return filter(exports2, (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */));
|
|
50706
50778
|
}
|
|
50707
50779
|
function isTypeOnlyNamespace(symbol) {
|
|
50708
50780
|
return every(getNamespaceMembersForSerialization(symbol), (m) => !(getSymbolFlags(resolveSymbol(m)) & 111551 /* Value */));
|
|
@@ -52683,7 +52755,7 @@ function createTypeChecker(host) {
|
|
|
52683
52755
|
/*reportErrors*/
|
|
52684
52756
|
false
|
|
52685
52757
|
) : unknownType;
|
|
52686
|
-
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType)));
|
|
52758
|
+
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, reportErrors2 ? 0 /* Normal */ : 1 /* Contextual */, contextualType)));
|
|
52687
52759
|
}
|
|
52688
52760
|
if (isBindingPattern(element.name)) {
|
|
52689
52761
|
return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors2);
|
|
@@ -52764,6 +52836,24 @@ function createTypeChecker(host) {
|
|
|
52764
52836
|
0 /* Normal */
|
|
52765
52837
|
), declaration, reportErrors2);
|
|
52766
52838
|
}
|
|
52839
|
+
function getTypeFromImportAttributes(node) {
|
|
52840
|
+
const links = getNodeLinks(node);
|
|
52841
|
+
if (!links.resolvedType) {
|
|
52842
|
+
const symbol = createSymbol(4096 /* ObjectLiteral */, "__importAttributes" /* ImportAttributes */);
|
|
52843
|
+
const members = createSymbolTable();
|
|
52844
|
+
forEach(node.elements, (attr) => {
|
|
52845
|
+
const member = createSymbol(4 /* Property */, getNameFromImportAttribute(attr));
|
|
52846
|
+
member.parent = symbol;
|
|
52847
|
+
member.links.type = checkImportAttribute(attr);
|
|
52848
|
+
member.links.target = member;
|
|
52849
|
+
members.set(member.escapedName, member);
|
|
52850
|
+
});
|
|
52851
|
+
const type = createAnonymousType(symbol, members, emptyArray, emptyArray, emptyArray);
|
|
52852
|
+
type.objectFlags |= 128 /* ObjectLiteral */ | 262144 /* NonInferrableType */;
|
|
52853
|
+
links.resolvedType = type;
|
|
52854
|
+
}
|
|
52855
|
+
return links.resolvedType;
|
|
52856
|
+
}
|
|
52767
52857
|
function isGlobalSymbolConstructor(node) {
|
|
52768
52858
|
const symbol = getSymbolOfNode(node);
|
|
52769
52859
|
const globalSymbol = getGlobalESSymbolConstructorTypeSymbol(
|
|
@@ -52817,18 +52907,18 @@ function createTypeChecker(host) {
|
|
|
52817
52907
|
}
|
|
52818
52908
|
return false;
|
|
52819
52909
|
}
|
|
52820
|
-
function getTypeOfVariableOrParameterOrProperty(symbol) {
|
|
52910
|
+
function getTypeOfVariableOrParameterOrProperty(symbol, checkMode) {
|
|
52821
52911
|
const links = getSymbolLinks(symbol);
|
|
52822
52912
|
if (!links.type) {
|
|
52823
|
-
const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
|
|
52824
|
-
if (!links.type && !isParameterOfContextSensitiveSignature(symbol)) {
|
|
52913
|
+
const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol, checkMode);
|
|
52914
|
+
if (!links.type && !isParameterOfContextSensitiveSignature(symbol) && !checkMode) {
|
|
52825
52915
|
links.type = type;
|
|
52826
52916
|
}
|
|
52827
52917
|
return type;
|
|
52828
52918
|
}
|
|
52829
52919
|
return links.type;
|
|
52830
52920
|
}
|
|
52831
|
-
function getTypeOfVariableOrParameterOrPropertyWorker(symbol) {
|
|
52921
|
+
function getTypeOfVariableOrParameterOrPropertyWorker(symbol, checkMode) {
|
|
52832
52922
|
if (symbol.flags & 4194304 /* Prototype */) {
|
|
52833
52923
|
return getTypeOfPrototypeProperty(symbol);
|
|
52834
52924
|
}
|
|
@@ -52866,6 +52956,9 @@ function createTypeChecker(host) {
|
|
|
52866
52956
|
if (symbol.flags & 512 /* ValueModule */ && !(symbol.flags & 67108864 /* Assignment */)) {
|
|
52867
52957
|
return getTypeOfFuncClassEnumModule(symbol);
|
|
52868
52958
|
}
|
|
52959
|
+
if (isBindingElement(declaration) && checkMode === 1 /* Contextual */) {
|
|
52960
|
+
return errorType;
|
|
52961
|
+
}
|
|
52869
52962
|
return reportCircularityError(symbol);
|
|
52870
52963
|
}
|
|
52871
52964
|
let type;
|
|
@@ -52903,6 +52996,9 @@ function createTypeChecker(host) {
|
|
|
52903
52996
|
if (symbol.flags & 512 /* ValueModule */ && !(symbol.flags & 67108864 /* Assignment */)) {
|
|
52904
52997
|
return getTypeOfFuncClassEnumModule(symbol);
|
|
52905
52998
|
}
|
|
52999
|
+
if (isBindingElement(declaration) && checkMode === 1 /* Contextual */) {
|
|
53000
|
+
return type;
|
|
53001
|
+
}
|
|
52906
53002
|
return reportCircularityError(symbol);
|
|
52907
53003
|
}
|
|
52908
53004
|
return type;
|
|
@@ -53131,7 +53227,7 @@ function createTypeChecker(host) {
|
|
|
53131
53227
|
}
|
|
53132
53228
|
return getTypeOfSymbol(symbol);
|
|
53133
53229
|
}
|
|
53134
|
-
function getTypeOfSymbol(symbol) {
|
|
53230
|
+
function getTypeOfSymbol(symbol, checkMode) {
|
|
53135
53231
|
const checkFlags = getCheckFlags(symbol);
|
|
53136
53232
|
if (checkFlags & 65536 /* DeferredType */) {
|
|
53137
53233
|
return getTypeOfSymbolWithDeferredType(symbol);
|
|
@@ -53146,7 +53242,7 @@ function createTypeChecker(host) {
|
|
|
53146
53242
|
return getTypeOfReverseMappedSymbol(symbol);
|
|
53147
53243
|
}
|
|
53148
53244
|
if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {
|
|
53149
|
-
return getTypeOfVariableOrParameterOrProperty(symbol);
|
|
53245
|
+
return getTypeOfVariableOrParameterOrProperty(symbol, checkMode);
|
|
53150
53246
|
}
|
|
53151
53247
|
if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) {
|
|
53152
53248
|
return getTypeOfFuncClassEnumModule(symbol);
|
|
@@ -56762,6 +56858,14 @@ function createTypeChecker(host) {
|
|
|
56762
56858
|
reportErrors2
|
|
56763
56859
|
)) || emptyObjectType;
|
|
56764
56860
|
}
|
|
56861
|
+
function getGlobalImportAttributesType(reportErrors2) {
|
|
56862
|
+
return deferredGlobalImportAttributesType || (deferredGlobalImportAttributesType = getGlobalType(
|
|
56863
|
+
"ImportAttributes",
|
|
56864
|
+
/*arity*/
|
|
56865
|
+
0,
|
|
56866
|
+
reportErrors2
|
|
56867
|
+
)) || emptyObjectType;
|
|
56868
|
+
}
|
|
56765
56869
|
function getGlobalESSymbolConstructorSymbol(reportErrors2) {
|
|
56766
56870
|
return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors2));
|
|
56767
56871
|
}
|
|
@@ -67509,9 +67613,9 @@ function createTypeChecker(host) {
|
|
|
67509
67613
|
}
|
|
67510
67614
|
}
|
|
67511
67615
|
}
|
|
67512
|
-
function getNarrowedTypeOfSymbol(symbol, location) {
|
|
67616
|
+
function getNarrowedTypeOfSymbol(symbol, location, checkMode) {
|
|
67513
67617
|
var _a;
|
|
67514
|
-
const type = getTypeOfSymbol(symbol);
|
|
67618
|
+
const type = getTypeOfSymbol(symbol, checkMode);
|
|
67515
67619
|
const declaration = symbol.valueDeclaration;
|
|
67516
67620
|
if (declaration) {
|
|
67517
67621
|
if (isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
@@ -67638,7 +67742,7 @@ function createTypeChecker(host) {
|
|
|
67638
67742
|
}
|
|
67639
67743
|
}
|
|
67640
67744
|
checkNestedBlockScopedBinding(node, symbol);
|
|
67641
|
-
let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node);
|
|
67745
|
+
let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node, checkMode);
|
|
67642
67746
|
const assignmentKind = getAssignmentTargetKind(node);
|
|
67643
67747
|
if (assignmentKind) {
|
|
67644
67748
|
if (!(localOrExportSymbol.flags & 3 /* Variable */) && !(isInJSFile(node) && localOrExportSymbol.flags & 512 /* ValueModule */)) {
|
|
@@ -68948,6 +69052,8 @@ function createTypeChecker(host) {
|
|
|
68948
69052
|
case 286 /* JsxOpeningElement */:
|
|
68949
69053
|
case 285 /* JsxSelfClosingElement */:
|
|
68950
69054
|
return getContextualJsxElementAttributesType(parent, contextFlags);
|
|
69055
|
+
case 301 /* ImportAttribute */:
|
|
69056
|
+
return getContextualImportAttributeType(parent);
|
|
68951
69057
|
}
|
|
68952
69058
|
return void 0;
|
|
68953
69059
|
}
|
|
@@ -68995,6 +69101,12 @@ function createTypeChecker(host) {
|
|
|
68995
69101
|
}
|
|
68996
69102
|
}
|
|
68997
69103
|
}
|
|
69104
|
+
function getContextualImportAttributeType(node) {
|
|
69105
|
+
return getTypeOfPropertyOfContextualType(getGlobalImportAttributesType(
|
|
69106
|
+
/*reportErrors*/
|
|
69107
|
+
false
|
|
69108
|
+
), getNameFromImportAttribute(node));
|
|
69109
|
+
}
|
|
68998
69110
|
function getContextualJsxElementAttributesType(node, contextFlags) {
|
|
68999
69111
|
if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
|
|
69000
69112
|
const index = findContextualNode(
|
|
@@ -81080,6 +81192,13 @@ function createTypeChecker(host) {
|
|
|
81080
81192
|
var _a;
|
|
81081
81193
|
const node = declaration.attributes;
|
|
81082
81194
|
if (node) {
|
|
81195
|
+
const importAttributesType = getGlobalImportAttributesType(
|
|
81196
|
+
/*reportErrors*/
|
|
81197
|
+
true
|
|
81198
|
+
);
|
|
81199
|
+
if (importAttributesType !== emptyObjectType) {
|
|
81200
|
+
checkTypeAssignableTo(getTypeFromImportAttributes(node), getNullableType(importAttributesType, 32768 /* Undefined */), node);
|
|
81201
|
+
}
|
|
81083
81202
|
const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
81084
81203
|
const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : void 0);
|
|
81085
81204
|
const isImportAttributes2 = declaration.attributes.token === 118 /* WithKeyword */;
|
|
@@ -81099,6 +81218,9 @@ function createTypeChecker(host) {
|
|
|
81099
81218
|
}
|
|
81100
81219
|
}
|
|
81101
81220
|
}
|
|
81221
|
+
function checkImportAttribute(node) {
|
|
81222
|
+
return getRegularTypeOfLiteralType(checkExpressionCached(node.value));
|
|
81223
|
+
}
|
|
81102
81224
|
function checkImportDeclaration(node) {
|
|
81103
81225
|
if (checkGrammarModuleElementContext(node, isInJSFile(node) ? Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
81104
81226
|
return;
|
|
@@ -82514,6 +82636,12 @@ function createTypeChecker(host) {
|
|
|
82514
82636
|
if (isMetaProperty(node.parent) && node.parent.keywordToken === node.kind) {
|
|
82515
82637
|
return checkMetaPropertyKeyword(node.parent);
|
|
82516
82638
|
}
|
|
82639
|
+
if (isImportAttributes(node)) {
|
|
82640
|
+
return getGlobalImportAttributesType(
|
|
82641
|
+
/*reportErrors*/
|
|
82642
|
+
false
|
|
82643
|
+
);
|
|
82644
|
+
}
|
|
82517
82645
|
return errorType;
|
|
82518
82646
|
}
|
|
82519
82647
|
function getTypeOfAssignmentPattern(expr) {
|
|
@@ -85585,7 +85713,7 @@ function visitCommaListElements(elements, visitor, discardVisitor = visitor) {
|
|
|
85585
85713
|
return discarded ? discardVisitor(node) : visitor(node);
|
|
85586
85714
|
}, isExpression);
|
|
85587
85715
|
}
|
|
85588
|
-
function visitEachChild(node, visitor, context, nodesVisitor = visitNodes2, tokenVisitor, nodeVisitor = visitNode) {
|
|
85716
|
+
function visitEachChild(node, visitor, context = nullTransformationContext, nodesVisitor = visitNodes2, tokenVisitor, nodeVisitor = visitNode) {
|
|
85589
85717
|
if (node === void 0) {
|
|
85590
85718
|
return void 0;
|
|
85591
85719
|
}
|
|
@@ -99888,12 +100016,22 @@ function transformES2015(context) {
|
|
|
99888
100016
|
case 172 /* PropertyDeclaration */: {
|
|
99889
100017
|
const named = node;
|
|
99890
100018
|
if (isComputedPropertyName(named.name)) {
|
|
99891
|
-
return factory2.replacePropertyName(named, visitEachChild(
|
|
100019
|
+
return factory2.replacePropertyName(named, visitEachChild(
|
|
100020
|
+
named.name,
|
|
100021
|
+
elideUnusedThisCaptureWorker,
|
|
100022
|
+
/*context*/
|
|
100023
|
+
void 0
|
|
100024
|
+
));
|
|
99892
100025
|
}
|
|
99893
100026
|
return node;
|
|
99894
100027
|
}
|
|
99895
100028
|
}
|
|
99896
|
-
return visitEachChild(
|
|
100029
|
+
return visitEachChild(
|
|
100030
|
+
node,
|
|
100031
|
+
elideUnusedThisCaptureWorker,
|
|
100032
|
+
/*context*/
|
|
100033
|
+
void 0
|
|
100034
|
+
);
|
|
99897
100035
|
}
|
|
99898
100036
|
function simplifyConstructorElideUnusedThisCapture(body, original) {
|
|
99899
100037
|
if (original.transformFlags & 16384 /* ContainsLexicalThis */ || hierarchyFacts & 65536 /* LexicalThis */ || hierarchyFacts & 131072 /* CapturedLexicalThis */) {
|
|
@@ -99929,12 +100067,22 @@ function transformES2015(context) {
|
|
|
99929
100067
|
case 172 /* PropertyDeclaration */: {
|
|
99930
100068
|
const named = node;
|
|
99931
100069
|
if (isComputedPropertyName(named.name)) {
|
|
99932
|
-
return factory2.replacePropertyName(named, visitEachChild(
|
|
100070
|
+
return factory2.replacePropertyName(named, visitEachChild(
|
|
100071
|
+
named.name,
|
|
100072
|
+
injectSuperPresenceCheckWorker,
|
|
100073
|
+
/*context*/
|
|
100074
|
+
void 0
|
|
100075
|
+
));
|
|
99933
100076
|
}
|
|
99934
100077
|
return node;
|
|
99935
100078
|
}
|
|
99936
100079
|
}
|
|
99937
|
-
return visitEachChild(
|
|
100080
|
+
return visitEachChild(
|
|
100081
|
+
node,
|
|
100082
|
+
injectSuperPresenceCheckWorker,
|
|
100083
|
+
/*context*/
|
|
100084
|
+
void 0
|
|
100085
|
+
);
|
|
99938
100086
|
}
|
|
99939
100087
|
function complicateConstructorInjectSuperPresenceCheck(body) {
|
|
99940
100088
|
return factory2.updateBlock(body, visitNodes2(body.statements, injectSuperPresenceCheckWorker, isStatement));
|
|
@@ -108332,44 +108480,6 @@ function getDeclarationDiagnostics(host, resolver, file) {
|
|
|
108332
108480
|
);
|
|
108333
108481
|
return result.diagnostics;
|
|
108334
108482
|
}
|
|
108335
|
-
function hasInternalAnnotation(range, currentSourceFile) {
|
|
108336
|
-
const comment = currentSourceFile.text.substring(range.pos, range.end);
|
|
108337
|
-
return comment.includes("@internal");
|
|
108338
|
-
}
|
|
108339
|
-
function isInternalDeclaration(node, currentSourceFile) {
|
|
108340
|
-
const parseTreeNode = getParseTreeNode(node);
|
|
108341
|
-
if (parseTreeNode && parseTreeNode.kind === 169 /* Parameter */) {
|
|
108342
|
-
const paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
|
|
108343
|
-
const previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : void 0;
|
|
108344
|
-
const text = currentSourceFile.text;
|
|
108345
|
-
const commentRanges = previousSibling ? concatenate(
|
|
108346
|
-
// to handle
|
|
108347
|
-
// ... parameters, /** @internal */
|
|
108348
|
-
// public param: string
|
|
108349
|
-
getTrailingCommentRanges(text, skipTrivia(
|
|
108350
|
-
text,
|
|
108351
|
-
previousSibling.end + 1,
|
|
108352
|
-
/*stopAfterLineBreak*/
|
|
108353
|
-
false,
|
|
108354
|
-
/*stopAtComments*/
|
|
108355
|
-
true
|
|
108356
|
-
)),
|
|
108357
|
-
getLeadingCommentRanges(text, node.pos)
|
|
108358
|
-
) : getTrailingCommentRanges(text, skipTrivia(
|
|
108359
|
-
text,
|
|
108360
|
-
node.pos,
|
|
108361
|
-
/*stopAfterLineBreak*/
|
|
108362
|
-
false,
|
|
108363
|
-
/*stopAtComments*/
|
|
108364
|
-
true
|
|
108365
|
-
));
|
|
108366
|
-
return commentRanges && commentRanges.length && hasInternalAnnotation(last(commentRanges), currentSourceFile);
|
|
108367
|
-
}
|
|
108368
|
-
const leadingCommentRanges = parseTreeNode && getLeadingCommentRangesOfNode(parseTreeNode, currentSourceFile);
|
|
108369
|
-
return !!forEach(leadingCommentRanges, (range) => {
|
|
108370
|
-
return hasInternalAnnotation(range, currentSourceFile);
|
|
108371
|
-
});
|
|
108372
|
-
}
|
|
108373
108483
|
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
|
|
108374
108484
|
function transformDeclarations(context) {
|
|
108375
108485
|
const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
|
|
@@ -119601,7 +119711,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119601
119711
|
}
|
|
119602
119712
|
const isFromNodeModulesSearch = resolution.isExternalLibraryImport;
|
|
119603
119713
|
const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension);
|
|
119604
|
-
const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
|
|
119714
|
+
const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile && (!resolution.originalPath || pathContainsNodeModules(resolution.resolvedFileName));
|
|
119605
119715
|
const resolvedFileName = resolution.resolvedFileName;
|
|
119606
119716
|
if (isFromNodeModulesSearch) {
|
|
119607
119717
|
currentNodeModulesDepth++;
|