typescript 4.2.0-dev.20210209 → 4.2.3
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.es2020.intl.d.ts +2 -235
- package/lib/protocol.d.ts +63 -0
- package/lib/tsc.js +38 -18
- package/lib/tsserver.js +141 -30
- package/lib/tsserverlibrary.d.ts +62 -0
- package/lib/tsserverlibrary.js +141 -30
- package/lib/typescript.js +109 -30
- package/lib/typescriptServices.js +109 -30
- package/lib/typingsInstaller.js +44 -21
- package/package.json +2 -2
|
@@ -290,7 +290,7 @@ var ts;
|
|
|
290
290
|
// The following is baselined as a literal template type without intervention
|
|
291
291
|
/** The version of the TypeScript compiler release */
|
|
292
292
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
293
|
-
ts.version =
|
|
293
|
+
ts.version = "4.2.3";
|
|
294
294
|
/* @internal */
|
|
295
295
|
var Comparison;
|
|
296
296
|
(function (Comparison) {
|
|
@@ -47238,13 +47238,17 @@ var ts;
|
|
|
47238
47238
|
return result || ts.emptyArray;
|
|
47239
47239
|
}
|
|
47240
47240
|
function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {
|
|
47241
|
-
|
|
47242
|
-
|
|
47243
|
-
|
|
47244
|
-
|
|
47245
|
-
|
|
47246
|
-
|
|
47247
|
-
|
|
47241
|
+
var resolved = type;
|
|
47242
|
+
resolved.members = members;
|
|
47243
|
+
resolved.properties = ts.emptyArray;
|
|
47244
|
+
resolved.callSignatures = callSignatures;
|
|
47245
|
+
resolved.constructSignatures = constructSignatures;
|
|
47246
|
+
resolved.stringIndexInfo = stringIndexInfo;
|
|
47247
|
+
resolved.numberIndexInfo = numberIndexInfo;
|
|
47248
|
+
// This can loop back to getPropertyOfType() which would crash if `callSignatures` & `constructSignatures` are not initialized.
|
|
47249
|
+
if (members !== emptySymbols)
|
|
47250
|
+
resolved.properties = getNamedMembers(members);
|
|
47251
|
+
return resolved;
|
|
47248
47252
|
}
|
|
47249
47253
|
function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {
|
|
47250
47254
|
return setStructuredTypeMembers(createObjectType(16 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);
|
|
@@ -55871,7 +55875,7 @@ var ts;
|
|
|
55871
55875
|
}
|
|
55872
55876
|
return true;
|
|
55873
55877
|
}
|
|
55874
|
-
function removeRedundantLiteralTypes(types, includes) {
|
|
55878
|
+
function removeRedundantLiteralTypes(types, includes, reduceVoidUndefined) {
|
|
55875
55879
|
var i = types.length;
|
|
55876
55880
|
while (i > 0) {
|
|
55877
55881
|
i--;
|
|
@@ -55881,7 +55885,7 @@ var ts;
|
|
|
55881
55885
|
flags & 256 /* NumberLiteral */ && includes & 8 /* Number */ ||
|
|
55882
55886
|
flags & 2048 /* BigIntLiteral */ && includes & 64 /* BigInt */ ||
|
|
55883
55887
|
flags & 8192 /* UniqueESSymbol */ && includes & 4096 /* ESSymbol */ ||
|
|
55884
|
-
flags & 32768 /* Undefined */ && includes & 16384 /* Void */ ||
|
|
55888
|
+
reduceVoidUndefined && flags & 32768 /* Undefined */ && includes & 16384 /* Void */ ||
|
|
55885
55889
|
isFreshLiteralType(t) && containsType(types, t.regularType);
|
|
55886
55890
|
if (remove) {
|
|
55887
55891
|
ts.orderedRemoveItemAt(types, i);
|
|
@@ -55913,7 +55917,7 @@ var ts;
|
|
|
55913
55917
|
if (t.flags & 1048576 /* Union */) {
|
|
55914
55918
|
var origin = t.origin;
|
|
55915
55919
|
if (t.aliasSymbol || origin && !(origin.flags & 1048576 /* Union */)) {
|
|
55916
|
-
|
|
55920
|
+
ts.pushIfUnique(namedUnions, t);
|
|
55917
55921
|
}
|
|
55918
55922
|
else if (origin && origin.flags & 1048576 /* Union */) {
|
|
55919
55923
|
addNamedUnions(namedUnions, origin.types);
|
|
@@ -55949,7 +55953,7 @@ var ts;
|
|
|
55949
55953
|
}
|
|
55950
55954
|
if (unionReduction & (1 /* Literal */ | 2 /* Subtype */)) {
|
|
55951
55955
|
if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
55952
|
-
removeRedundantLiteralTypes(typeSet, includes);
|
|
55956
|
+
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
|
|
55953
55957
|
}
|
|
55954
55958
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
55955
55959
|
removeStringLiteralsMatchedByTemplateLiterals(typeSet);
|
|
@@ -63970,7 +63974,16 @@ var ts;
|
|
|
63970
63974
|
var type = getTypeOfDottedName(node.expression, diagnostic);
|
|
63971
63975
|
if (type) {
|
|
63972
63976
|
var name = node.name;
|
|
63973
|
-
var prop =
|
|
63977
|
+
var prop = void 0;
|
|
63978
|
+
if (ts.isPrivateIdentifier(name)) {
|
|
63979
|
+
if (!type.symbol) {
|
|
63980
|
+
return undefined;
|
|
63981
|
+
}
|
|
63982
|
+
prop = getPropertyOfType(type, ts.getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText));
|
|
63983
|
+
}
|
|
63984
|
+
else {
|
|
63985
|
+
prop = getPropertyOfType(type, name.escapedText);
|
|
63986
|
+
}
|
|
63974
63987
|
return prop && getExplicitTypeOfSymbol(prop, diagnostic);
|
|
63975
63988
|
}
|
|
63976
63989
|
return undefined;
|
|
@@ -65036,10 +65049,15 @@ var ts;
|
|
|
65036
65049
|
return assignableType;
|
|
65037
65050
|
}
|
|
65038
65051
|
}
|
|
65039
|
-
// If the candidate type is a subtype of the target type, narrow to the candidate type
|
|
65040
|
-
// if the target type is
|
|
65041
|
-
//
|
|
65042
|
-
|
|
65052
|
+
// If the candidate type is a subtype of the target type, narrow to the candidate type.
|
|
65053
|
+
// Otherwise, if the target type is assignable to the candidate type, keep the target type.
|
|
65054
|
+
// Otherwise, if the candidate type is assignable to the target type, narrow to the candidate
|
|
65055
|
+
// type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
|
|
65056
|
+
// two types.
|
|
65057
|
+
return isTypeSubtypeOf(candidate, type) ? candidate :
|
|
65058
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
65059
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
65060
|
+
getIntersectionType([type, candidate]);
|
|
65043
65061
|
}
|
|
65044
65062
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
65045
65063
|
if (hasMatchingArgument(callExpression, reference)) {
|
|
@@ -75382,7 +75400,9 @@ var ts;
|
|
|
75382
75400
|
: ts.isPropertyAccessExpression(location) ? location.name
|
|
75383
75401
|
: ts.isBinaryExpression(location) && ts.isIdentifier(location.right) ? location.right
|
|
75384
75402
|
: undefined;
|
|
75385
|
-
|
|
75403
|
+
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location)
|
|
75404
|
+
&& ts.isAssertionExpression(ts.skipParentheses(location.expression));
|
|
75405
|
+
if (!testedNode || isPropertyExpressionCast) {
|
|
75386
75406
|
return;
|
|
75387
75407
|
}
|
|
75388
75408
|
var possiblyFalsy = getFalsyFlags(type);
|
|
@@ -77532,6 +77552,7 @@ var ts;
|
|
|
77532
77552
|
return true;
|
|
77533
77553
|
}
|
|
77534
77554
|
function checkAliasSymbol(node) {
|
|
77555
|
+
var _a;
|
|
77535
77556
|
var symbol = getSymbolOfNode(node);
|
|
77536
77557
|
var target = resolveAlias(symbol);
|
|
77537
77558
|
if (target !== unknownSymbol) {
|
|
@@ -77559,7 +77580,7 @@ var ts;
|
|
|
77559
77580
|
&& !(node.flags & 8388608 /* Ambient */)) {
|
|
77560
77581
|
error(node, ts.Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type);
|
|
77561
77582
|
}
|
|
77562
|
-
if (ts.isImportSpecifier(node) &&
|
|
77583
|
+
if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); }))) {
|
|
77563
77584
|
addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
|
|
77564
77585
|
}
|
|
77565
77586
|
}
|
|
@@ -111664,10 +111685,11 @@ var ts;
|
|
|
111664
111685
|
var redirects = host.redirectTargetsMap.get(importedPath) || ts.emptyArray;
|
|
111665
111686
|
var importedFileNames = __spreadArray(__spreadArray(__spreadArray([], (referenceRedirect ? [referenceRedirect] : ts.emptyArray)), [importedFileName]), redirects);
|
|
111666
111687
|
var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
|
|
111688
|
+
var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
|
|
111667
111689
|
if (!preferSymlinks) {
|
|
111668
111690
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
111669
111691
|
// so we only need to remove them from the realpath filenames.
|
|
111670
|
-
var result_15 = ts.forEach(targets, function (p) { return !ts.containsIgnoredPath(p) && cb(p, referenceRedirect === p); });
|
|
111692
|
+
var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
111671
111693
|
if (result_15)
|
|
111672
111694
|
return result_15;
|
|
111673
111695
|
}
|
|
@@ -111693,13 +111715,14 @@ var ts;
|
|
|
111693
111715
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
111694
111716
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
111695
111717
|
var result_16 = cb(option, target === referenceRedirect);
|
|
111718
|
+
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
111696
111719
|
if (result_16)
|
|
111697
111720
|
return result_16;
|
|
111698
111721
|
}
|
|
111699
111722
|
});
|
|
111700
111723
|
});
|
|
111701
111724
|
return result || (preferSymlinks
|
|
111702
|
-
? ts.forEach(targets, function (p) { return ts.containsIgnoredPath(p) ? undefined : cb(p, p === referenceRedirect); })
|
|
111725
|
+
? ts.forEach(targets, function (p) { return shouldFilterIgnoredPaths && ts.containsIgnoredPath(p) ? undefined : cb(p, p === referenceRedirect); })
|
|
111703
111726
|
: undefined);
|
|
111704
111727
|
}
|
|
111705
111728
|
moduleSpecifiers.forEachFileNameOfModule = forEachFileNameOfModule;
|
|
@@ -140149,7 +140172,7 @@ var ts;
|
|
|
140149
140172
|
}
|
|
140150
140173
|
function addFunctionDeclaration(changes, context, info) {
|
|
140151
140174
|
var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host);
|
|
140152
|
-
var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(251 /* FunctionDeclaration */, context, importAdder, info.call, info.token, info.modifierFlags, info.parentDeclaration);
|
|
140175
|
+
var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(251 /* FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration);
|
|
140153
140176
|
changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration);
|
|
140154
140177
|
}
|
|
140155
140178
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
@@ -147530,13 +147553,13 @@ var ts;
|
|
|
147530
147553
|
return { edits: [] }; // TODO: GH#30113
|
|
147531
147554
|
}
|
|
147532
147555
|
function doChange(sourceFile, program, host, changes, functionDeclaration, groupedReferences) {
|
|
147533
|
-
var
|
|
147534
|
-
|
|
147535
|
-
|
|
147536
|
-
|
|
147537
|
-
|
|
147538
|
-
|
|
147539
|
-
|
|
147556
|
+
var signature = groupedReferences.signature;
|
|
147557
|
+
var newFunctionDeclarationParams = ts.map(createNewParameters(functionDeclaration, program, host), function (param) { return ts.getSynthesizedDeepClone(param); });
|
|
147558
|
+
if (signature) {
|
|
147559
|
+
var newSignatureParams = ts.map(createNewParameters(signature, program, host), function (param) { return ts.getSynthesizedDeepClone(param); });
|
|
147560
|
+
replaceParameters(signature, newSignatureParams);
|
|
147561
|
+
}
|
|
147562
|
+
replaceParameters(functionDeclaration, newFunctionDeclarationParams);
|
|
147540
147563
|
var functionCalls = ts.sortAndDeduplicate(groupedReferences.functionCalls, /*comparer*/ function (a, b) { return ts.compareValues(a.pos, b.pos); });
|
|
147541
147564
|
for (var _i = 0, functionCalls_1 = functionCalls; _i < functionCalls_1.length; _i++) {
|
|
147542
147565
|
var call = functionCalls_1[_i];
|
|
@@ -147545,6 +147568,15 @@ var ts;
|
|
|
147545
147568
|
changes.replaceNodeRange(ts.getSourceFileOfNode(call), ts.first(call.arguments), ts.last(call.arguments), newArgument, { leadingTriviaOption: ts.textChanges.LeadingTriviaOption.IncludeAll, trailingTriviaOption: ts.textChanges.TrailingTriviaOption.Include });
|
|
147546
147569
|
}
|
|
147547
147570
|
}
|
|
147571
|
+
function replaceParameters(declarationOrSignature, parameterDeclarations) {
|
|
147572
|
+
changes.replaceNodeRangeWithNodes(sourceFile, ts.first(declarationOrSignature.parameters), ts.last(declarationOrSignature.parameters), parameterDeclarations, {
|
|
147573
|
+
joiner: ", ",
|
|
147574
|
+
// indentation is set to 0 because otherwise the object parameter will be indented if there is a `this` parameter
|
|
147575
|
+
indentation: 0,
|
|
147576
|
+
leadingTriviaOption: ts.textChanges.LeadingTriviaOption.IncludeAll,
|
|
147577
|
+
trailingTriviaOption: ts.textChanges.TrailingTriviaOption.Include
|
|
147578
|
+
});
|
|
147579
|
+
}
|
|
147548
147580
|
}
|
|
147549
147581
|
function getGroupedReferences(functionDeclaration, program, cancellationToken) {
|
|
147550
147582
|
var functionNames = getFunctionNames(functionDeclaration);
|
|
@@ -147563,12 +147595,38 @@ var ts;
|
|
|
147563
147595
|
var functionSymbols = ts.map(functionNames, getSymbolTargetAtLocation);
|
|
147564
147596
|
var classSymbols = ts.map(classNames, getSymbolTargetAtLocation);
|
|
147565
147597
|
var isConstructor = ts.isConstructorDeclaration(functionDeclaration);
|
|
147598
|
+
var contextualSymbols = ts.map(functionNames, function (name) { return getSymbolForContextualType(name, checker); });
|
|
147566
147599
|
for (var _i = 0, referenceEntries_1 = referenceEntries; _i < referenceEntries_1.length; _i++) {
|
|
147567
147600
|
var entry = referenceEntries_1[_i];
|
|
147568
|
-
if (entry.kind
|
|
147601
|
+
if (entry.kind === 0 /* Span */) {
|
|
147569
147602
|
groupedReferences.valid = false;
|
|
147570
147603
|
continue;
|
|
147571
147604
|
}
|
|
147605
|
+
/* Declarations in object literals may be implementations of method signatures which have a different symbol from the declaration
|
|
147606
|
+
For example:
|
|
147607
|
+
interface IFoo { m(a: number): void }
|
|
147608
|
+
const foo: IFoo = { m(a: number): void {} }
|
|
147609
|
+
In these cases we get the symbol for the signature from the contextual type.
|
|
147610
|
+
*/
|
|
147611
|
+
if (ts.contains(contextualSymbols, getSymbolTargetAtLocation(entry.node))) {
|
|
147612
|
+
if (isValidMethodSignature(entry.node.parent)) {
|
|
147613
|
+
groupedReferences.signature = entry.node.parent;
|
|
147614
|
+
continue;
|
|
147615
|
+
}
|
|
147616
|
+
var call = entryToFunctionCall(entry);
|
|
147617
|
+
if (call) {
|
|
147618
|
+
groupedReferences.functionCalls.push(call);
|
|
147619
|
+
continue;
|
|
147620
|
+
}
|
|
147621
|
+
}
|
|
147622
|
+
var contextualSymbol = getSymbolForContextualType(entry.node, checker);
|
|
147623
|
+
if (contextualSymbol && ts.contains(contextualSymbols, contextualSymbol)) {
|
|
147624
|
+
var decl = entryToDeclaration(entry);
|
|
147625
|
+
if (decl) {
|
|
147626
|
+
groupedReferences.declarations.push(decl);
|
|
147627
|
+
continue;
|
|
147628
|
+
}
|
|
147629
|
+
}
|
|
147572
147630
|
/* We compare symbols because in some cases find all references wil return a reference that may or may not be to the refactored function.
|
|
147573
147631
|
Example from the refactorConvertParamsToDestructuredObject_methodCallUnion.ts test:
|
|
147574
147632
|
class A { foo(a: number, b: number) { return a + b; } }
|
|
@@ -147631,6 +147689,19 @@ var ts;
|
|
|
147631
147689
|
return symbol && ts.getSymbolTarget(symbol, checker);
|
|
147632
147690
|
}
|
|
147633
147691
|
}
|
|
147692
|
+
/**
|
|
147693
|
+
* Gets the symbol for the contextual type of the node if it is not a union or intersection.
|
|
147694
|
+
*/
|
|
147695
|
+
function getSymbolForContextualType(node, checker) {
|
|
147696
|
+
var element = ts.getContainingObjectLiteralElement(node);
|
|
147697
|
+
if (element) {
|
|
147698
|
+
var contextualType = checker.getContextualTypeForObjectLiteralElement(element);
|
|
147699
|
+
var symbol = contextualType === null || contextualType === void 0 ? void 0 : contextualType.getSymbol();
|
|
147700
|
+
if (symbol && !(ts.getCheckFlags(symbol) & 6 /* Synthetic */)) {
|
|
147701
|
+
return symbol;
|
|
147702
|
+
}
|
|
147703
|
+
}
|
|
147704
|
+
}
|
|
147634
147705
|
function entryToImportOrExport(entry) {
|
|
147635
147706
|
var node = entry.node;
|
|
147636
147707
|
if (ts.isImportSpecifier(node.parent)
|
|
@@ -147738,6 +147809,9 @@ var ts;
|
|
|
147738
147809
|
}
|
|
147739
147810
|
return false;
|
|
147740
147811
|
}
|
|
147812
|
+
function isValidMethodSignature(node) {
|
|
147813
|
+
return ts.isMethodSignature(node) && (ts.isInterfaceDeclaration(node.parent) || ts.isTypeLiteralNode(node.parent));
|
|
147814
|
+
}
|
|
147741
147815
|
function isValidFunctionDeclaration(functionDeclaration, checker) {
|
|
147742
147816
|
if (!isValidParameterNodeArray(functionDeclaration.parameters, checker))
|
|
147743
147817
|
return false;
|
|
@@ -147745,6 +147819,11 @@ var ts;
|
|
|
147745
147819
|
case 251 /* FunctionDeclaration */:
|
|
147746
147820
|
return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker);
|
|
147747
147821
|
case 165 /* MethodDeclaration */:
|
|
147822
|
+
if (ts.isObjectLiteralExpression(functionDeclaration.parent)) {
|
|
147823
|
+
var contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker);
|
|
147824
|
+
// don't offer the refactor when there are multiple signatures since we won't know which ones the user wants to change
|
|
147825
|
+
return (contextualSymbol === null || contextualSymbol === void 0 ? void 0 : contextualSymbol.declarations.length) === 1 && isSingleImplementation(functionDeclaration, checker);
|
|
147826
|
+
}
|
|
147748
147827
|
return isSingleImplementation(functionDeclaration, checker);
|
|
147749
147828
|
case 166 /* Constructor */:
|
|
147750
147829
|
if (ts.isClassDeclaration(functionDeclaration.parent)) {
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -85,7 +85,7 @@ var ts;
|
|
|
85
85
|
// The following is baselined as a literal template type without intervention
|
|
86
86
|
/** The version of the TypeScript compiler release */
|
|
87
87
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
88
|
-
ts.version =
|
|
88
|
+
ts.version = "4.2.3";
|
|
89
89
|
/* @internal */
|
|
90
90
|
var Comparison;
|
|
91
91
|
(function (Comparison) {
|
|
@@ -47033,13 +47033,17 @@ var ts;
|
|
|
47033
47033
|
return result || ts.emptyArray;
|
|
47034
47034
|
}
|
|
47035
47035
|
function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {
|
|
47036
|
-
|
|
47037
|
-
|
|
47038
|
-
|
|
47039
|
-
|
|
47040
|
-
|
|
47041
|
-
|
|
47042
|
-
|
|
47036
|
+
var resolved = type;
|
|
47037
|
+
resolved.members = members;
|
|
47038
|
+
resolved.properties = ts.emptyArray;
|
|
47039
|
+
resolved.callSignatures = callSignatures;
|
|
47040
|
+
resolved.constructSignatures = constructSignatures;
|
|
47041
|
+
resolved.stringIndexInfo = stringIndexInfo;
|
|
47042
|
+
resolved.numberIndexInfo = numberIndexInfo;
|
|
47043
|
+
// This can loop back to getPropertyOfType() which would crash if `callSignatures` & `constructSignatures` are not initialized.
|
|
47044
|
+
if (members !== emptySymbols)
|
|
47045
|
+
resolved.properties = getNamedMembers(members);
|
|
47046
|
+
return resolved;
|
|
47043
47047
|
}
|
|
47044
47048
|
function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {
|
|
47045
47049
|
return setStructuredTypeMembers(createObjectType(16 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);
|
|
@@ -55666,7 +55670,7 @@ var ts;
|
|
|
55666
55670
|
}
|
|
55667
55671
|
return true;
|
|
55668
55672
|
}
|
|
55669
|
-
function removeRedundantLiteralTypes(types, includes) {
|
|
55673
|
+
function removeRedundantLiteralTypes(types, includes, reduceVoidUndefined) {
|
|
55670
55674
|
var i = types.length;
|
|
55671
55675
|
while (i > 0) {
|
|
55672
55676
|
i--;
|
|
@@ -55676,7 +55680,7 @@ var ts;
|
|
|
55676
55680
|
flags & 256 /* NumberLiteral */ && includes & 8 /* Number */ ||
|
|
55677
55681
|
flags & 2048 /* BigIntLiteral */ && includes & 64 /* BigInt */ ||
|
|
55678
55682
|
flags & 8192 /* UniqueESSymbol */ && includes & 4096 /* ESSymbol */ ||
|
|
55679
|
-
flags & 32768 /* Undefined */ && includes & 16384 /* Void */ ||
|
|
55683
|
+
reduceVoidUndefined && flags & 32768 /* Undefined */ && includes & 16384 /* Void */ ||
|
|
55680
55684
|
isFreshLiteralType(t) && containsType(types, t.regularType);
|
|
55681
55685
|
if (remove) {
|
|
55682
55686
|
ts.orderedRemoveItemAt(types, i);
|
|
@@ -55708,7 +55712,7 @@ var ts;
|
|
|
55708
55712
|
if (t.flags & 1048576 /* Union */) {
|
|
55709
55713
|
var origin = t.origin;
|
|
55710
55714
|
if (t.aliasSymbol || origin && !(origin.flags & 1048576 /* Union */)) {
|
|
55711
|
-
|
|
55715
|
+
ts.pushIfUnique(namedUnions, t);
|
|
55712
55716
|
}
|
|
55713
55717
|
else if (origin && origin.flags & 1048576 /* Union */) {
|
|
55714
55718
|
addNamedUnions(namedUnions, origin.types);
|
|
@@ -55744,7 +55748,7 @@ var ts;
|
|
|
55744
55748
|
}
|
|
55745
55749
|
if (unionReduction & (1 /* Literal */ | 2 /* Subtype */)) {
|
|
55746
55750
|
if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
55747
|
-
removeRedundantLiteralTypes(typeSet, includes);
|
|
55751
|
+
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
|
|
55748
55752
|
}
|
|
55749
55753
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
55750
55754
|
removeStringLiteralsMatchedByTemplateLiterals(typeSet);
|
|
@@ -63765,7 +63769,16 @@ var ts;
|
|
|
63765
63769
|
var type = getTypeOfDottedName(node.expression, diagnostic);
|
|
63766
63770
|
if (type) {
|
|
63767
63771
|
var name = node.name;
|
|
63768
|
-
var prop =
|
|
63772
|
+
var prop = void 0;
|
|
63773
|
+
if (ts.isPrivateIdentifier(name)) {
|
|
63774
|
+
if (!type.symbol) {
|
|
63775
|
+
return undefined;
|
|
63776
|
+
}
|
|
63777
|
+
prop = getPropertyOfType(type, ts.getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText));
|
|
63778
|
+
}
|
|
63779
|
+
else {
|
|
63780
|
+
prop = getPropertyOfType(type, name.escapedText);
|
|
63781
|
+
}
|
|
63769
63782
|
return prop && getExplicitTypeOfSymbol(prop, diagnostic);
|
|
63770
63783
|
}
|
|
63771
63784
|
return undefined;
|
|
@@ -64831,10 +64844,15 @@ var ts;
|
|
|
64831
64844
|
return assignableType;
|
|
64832
64845
|
}
|
|
64833
64846
|
}
|
|
64834
|
-
// If the candidate type is a subtype of the target type, narrow to the candidate type
|
|
64835
|
-
// if the target type is
|
|
64836
|
-
//
|
|
64837
|
-
|
|
64847
|
+
// If the candidate type is a subtype of the target type, narrow to the candidate type.
|
|
64848
|
+
// Otherwise, if the target type is assignable to the candidate type, keep the target type.
|
|
64849
|
+
// Otherwise, if the candidate type is assignable to the target type, narrow to the candidate
|
|
64850
|
+
// type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
|
|
64851
|
+
// two types.
|
|
64852
|
+
return isTypeSubtypeOf(candidate, type) ? candidate :
|
|
64853
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
64854
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
64855
|
+
getIntersectionType([type, candidate]);
|
|
64838
64856
|
}
|
|
64839
64857
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
64840
64858
|
if (hasMatchingArgument(callExpression, reference)) {
|
|
@@ -75177,7 +75195,9 @@ var ts;
|
|
|
75177
75195
|
: ts.isPropertyAccessExpression(location) ? location.name
|
|
75178
75196
|
: ts.isBinaryExpression(location) && ts.isIdentifier(location.right) ? location.right
|
|
75179
75197
|
: undefined;
|
|
75180
|
-
|
|
75198
|
+
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location)
|
|
75199
|
+
&& ts.isAssertionExpression(ts.skipParentheses(location.expression));
|
|
75200
|
+
if (!testedNode || isPropertyExpressionCast) {
|
|
75181
75201
|
return;
|
|
75182
75202
|
}
|
|
75183
75203
|
var possiblyFalsy = getFalsyFlags(type);
|
|
@@ -77327,6 +77347,7 @@ var ts;
|
|
|
77327
77347
|
return true;
|
|
77328
77348
|
}
|
|
77329
77349
|
function checkAliasSymbol(node) {
|
|
77350
|
+
var _a;
|
|
77330
77351
|
var symbol = getSymbolOfNode(node);
|
|
77331
77352
|
var target = resolveAlias(symbol);
|
|
77332
77353
|
if (target !== unknownSymbol) {
|
|
@@ -77354,7 +77375,7 @@ var ts;
|
|
|
77354
77375
|
&& !(node.flags & 8388608 /* Ambient */)) {
|
|
77355
77376
|
error(node, ts.Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type);
|
|
77356
77377
|
}
|
|
77357
|
-
if (ts.isImportSpecifier(node) &&
|
|
77378
|
+
if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); }))) {
|
|
77358
77379
|
addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
|
|
77359
77380
|
}
|
|
77360
77381
|
}
|
|
@@ -111459,10 +111480,11 @@ var ts;
|
|
|
111459
111480
|
var redirects = host.redirectTargetsMap.get(importedPath) || ts.emptyArray;
|
|
111460
111481
|
var importedFileNames = __spreadArray(__spreadArray(__spreadArray([], (referenceRedirect ? [referenceRedirect] : ts.emptyArray)), [importedFileName]), redirects);
|
|
111461
111482
|
var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
|
|
111483
|
+
var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
|
|
111462
111484
|
if (!preferSymlinks) {
|
|
111463
111485
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
111464
111486
|
// so we only need to remove them from the realpath filenames.
|
|
111465
|
-
var result_15 = ts.forEach(targets, function (p) { return !ts.containsIgnoredPath(p) && cb(p, referenceRedirect === p); });
|
|
111487
|
+
var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
111466
111488
|
if (result_15)
|
|
111467
111489
|
return result_15;
|
|
111468
111490
|
}
|
|
@@ -111488,13 +111510,14 @@ var ts;
|
|
|
111488
111510
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
111489
111511
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
111490
111512
|
var result_16 = cb(option, target === referenceRedirect);
|
|
111513
|
+
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
111491
111514
|
if (result_16)
|
|
111492
111515
|
return result_16;
|
|
111493
111516
|
}
|
|
111494
111517
|
});
|
|
111495
111518
|
});
|
|
111496
111519
|
return result || (preferSymlinks
|
|
111497
|
-
? ts.forEach(targets, function (p) { return ts.containsIgnoredPath(p) ? undefined : cb(p, p === referenceRedirect); })
|
|
111520
|
+
? ts.forEach(targets, function (p) { return shouldFilterIgnoredPaths && ts.containsIgnoredPath(p) ? undefined : cb(p, p === referenceRedirect); })
|
|
111498
111521
|
: undefined);
|
|
111499
111522
|
}
|
|
111500
111523
|
moduleSpecifiers.forEachFileNameOfModule = forEachFileNameOfModule;
|
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": "4.2.
|
|
5
|
+
"version": "4.2.3",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -128,4 +128,4 @@
|
|
|
128
128
|
"inspector": false
|
|
129
129
|
},
|
|
130
130
|
"dependencies": {}
|
|
131
|
-
}
|
|
131
|
+
}
|