@typescript-deploys/pr-build 4.9.0-pr-50309-2 → 4.9.0-pr-50329-13
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.es5.d.ts +4 -6
- package/lib/tsc.js +76 -45
- package/lib/tsserver.js +107 -54
- package/lib/tsserverlibrary.js +107 -54
- package/lib/typescript.js +107 -54
- package/lib/typescriptServices.js +107 -54
- package/lib/typingsInstaller.js +83 -45
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -99,7 +99,7 @@ var ts;
|
|
|
99
99
|
// The following is baselined as a literal template type without intervention
|
|
100
100
|
/** The version of the TypeScript compiler release */
|
|
101
101
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
102
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
102
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220817";
|
|
103
103
|
/* @internal */
|
|
104
104
|
var Comparison;
|
|
105
105
|
(function (Comparison) {
|
|
@@ -7027,7 +7027,6 @@ var ts;
|
|
|
7027
7027
|
// not actually work.
|
|
7028
7028
|
var byteOrderMarkIndicator = "\uFEFF";
|
|
7029
7029
|
function getNodeSystem() {
|
|
7030
|
-
var _a;
|
|
7031
7030
|
var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
|
|
7032
7031
|
var _fs = require("fs");
|
|
7033
7032
|
var _path = require("path");
|
|
@@ -7037,7 +7036,7 @@ var ts;
|
|
|
7037
7036
|
try {
|
|
7038
7037
|
_crypto = require("crypto");
|
|
7039
7038
|
}
|
|
7040
|
-
catch (
|
|
7039
|
+
catch (_a) {
|
|
7041
7040
|
_crypto = undefined;
|
|
7042
7041
|
}
|
|
7043
7042
|
var activeSession;
|
|
@@ -7048,10 +7047,10 @@ var ts;
|
|
|
7048
7047
|
var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
7049
7048
|
var platform = _os.platform();
|
|
7050
7049
|
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
|
7051
|
-
var
|
|
7050
|
+
var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
7052
7051
|
var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
|
|
7053
7052
|
var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
|
|
7054
|
-
var
|
|
7053
|
+
var _b = createSystemWatchFunctions({
|
|
7055
7054
|
pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
|
|
7056
7055
|
getModifiedTime: getModifiedTime,
|
|
7057
7056
|
setTimeout: setTimeout,
|
|
@@ -7071,7 +7070,7 @@ var ts;
|
|
|
7071
7070
|
defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
|
7072
7071
|
inodeWatching: isLinuxOrMacOs,
|
|
7073
7072
|
sysLog: sysLog,
|
|
7074
|
-
}), watchFile =
|
|
7073
|
+
}), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory;
|
|
7075
7074
|
var nodeSystem = {
|
|
7076
7075
|
args: process.argv.slice(2),
|
|
7077
7076
|
newLine: _os.EOL,
|
|
@@ -7464,9 +7463,12 @@ var ts;
|
|
|
7464
7463
|
function getDirectories(path) {
|
|
7465
7464
|
return getAccessibleFileSystemEntries(path).directories.slice();
|
|
7466
7465
|
}
|
|
7466
|
+
function fsRealPathHandlingLongPath(path) {
|
|
7467
|
+
return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path);
|
|
7468
|
+
}
|
|
7467
7469
|
function realpath(path) {
|
|
7468
7470
|
try {
|
|
7469
|
-
return
|
|
7471
|
+
return fsRealpath(path);
|
|
7470
7472
|
}
|
|
7471
7473
|
catch (_a) {
|
|
7472
7474
|
return path;
|
|
@@ -65673,6 +65675,38 @@ var ts;
|
|
|
65673
65675
|
}
|
|
65674
65676
|
return 0 /* False */;
|
|
65675
65677
|
}
|
|
65678
|
+
// Before normalization: Intersections applied to unions create an explosion of types when normalized -
|
|
65679
|
+
// handling those inner intersections can be very costly, so it can be beneficial to factor them out early.
|
|
65680
|
+
// If both the source and target are intersections, we can remove the common types from them before formal normalization,
|
|
65681
|
+
// and run a simplified comparison without those common members.
|
|
65682
|
+
if (originalSource.flags & originalTarget.flags & 2097152 /* Intersection */) {
|
|
65683
|
+
var combinedTypeSet_1 = new ts.Map();
|
|
65684
|
+
ts.forEach(originalSource.types, function (t) { return combinedTypeSet_1.set(getTypeId(t), 1); });
|
|
65685
|
+
var hasOverlap_1 = false;
|
|
65686
|
+
ts.forEach(originalTarget.types, function (t) {
|
|
65687
|
+
var id = getTypeId(t);
|
|
65688
|
+
if (combinedTypeSet_1.has(id)) {
|
|
65689
|
+
combinedTypeSet_1.set(getTypeId(t), 2);
|
|
65690
|
+
hasOverlap_1 = true;
|
|
65691
|
+
}
|
|
65692
|
+
});
|
|
65693
|
+
if (hasOverlap_1) {
|
|
65694
|
+
var filteredSource = ts.filter(originalSource.types, function (t) { return combinedTypeSet_1.get(getTypeId(t)) !== 2; });
|
|
65695
|
+
var filteredTarget = ts.filter(originalTarget.types, function (t) { return combinedTypeSet_1.get(getTypeId(t)) !== 2; });
|
|
65696
|
+
if (!ts.length(filteredTarget)) {
|
|
65697
|
+
return -1 /* True */; // Source has all parts of target
|
|
65698
|
+
}
|
|
65699
|
+
if (ts.length(filteredSource)) {
|
|
65700
|
+
var result_7;
|
|
65701
|
+
if (result_7 = isRelatedTo(getIntersectionType(filteredSource), getIntersectionType(filteredTarget), recursionFlags, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
65702
|
+
return result_7;
|
|
65703
|
+
}
|
|
65704
|
+
// In the false case, we may still be assignable at the structural level, rather than the algebraic level
|
|
65705
|
+
}
|
|
65706
|
+
// Even if every member of the source is in the target but the target still has members left, the source may still be assignable
|
|
65707
|
+
// to the target, either if some member of the original source is assignable to the other members of the target, or if there is structural assignability
|
|
65708
|
+
}
|
|
65709
|
+
}
|
|
65676
65710
|
// Normalize the source and target types: Turn fresh literal types into regular literal types,
|
|
65677
65711
|
// turn deferred type references into regular type references, simplify indexed access and
|
|
65678
65712
|
// conditional types, and resolve substitution types to either the substitution (on the source
|
|
@@ -65723,7 +65757,8 @@ var ts;
|
|
|
65723
65757
|
return 0 /* False */;
|
|
65724
65758
|
}
|
|
65725
65759
|
}
|
|
65726
|
-
var isPerformingCommonPropertyChecks = relation !== comparableRelation
|
|
65760
|
+
var isPerformingCommonPropertyChecks = (relation !== comparableRelation || relation === comparableRelation && isLiteralType(source)) &&
|
|
65761
|
+
!(intersectionState & 2 /* Target */) &&
|
|
65727
65762
|
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
|
|
65728
65763
|
target.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target) &&
|
|
65729
65764
|
(getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
|
|
@@ -65747,7 +65782,7 @@ var ts;
|
|
|
65747
65782
|
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
65748
65783
|
var skipCaching = source.flags & 1048576 /* Union */ && source.types.length < 4 && !(target.flags & 1048576 /* Union */) ||
|
|
65749
65784
|
target.flags & 1048576 /* Union */ && target.types.length < 4 && !(source.flags & 469499904 /* StructuredOrInstantiable */);
|
|
65750
|
-
var
|
|
65785
|
+
var result_8 = skipCaching ?
|
|
65751
65786
|
unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
|
|
65752
65787
|
recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
|
|
65753
65788
|
// For certain combinations involving intersections and optional, excess, or mismatched properties we need
|
|
@@ -65765,14 +65800,14 @@ var ts;
|
|
|
65765
65800
|
//
|
|
65766
65801
|
// We suppress recursive intersection property checks because they can generate lots of work when relating
|
|
65767
65802
|
// recursive intersections that are structurally similar but not exactly identical. See #37854.
|
|
65768
|
-
if (
|
|
65803
|
+
if (result_8 && !inPropertyCheck && (target.flags & 2097152 /* Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
|
|
65769
65804
|
isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* Intersection */ && getApparentType(source).flags & 3670016 /* StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* NonInferrableType */); }))) {
|
|
65770
65805
|
inPropertyCheck = true;
|
|
65771
|
-
|
|
65806
|
+
result_8 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* PropertyCheck */, recursionFlags);
|
|
65772
65807
|
inPropertyCheck = false;
|
|
65773
65808
|
}
|
|
65774
|
-
if (
|
|
65775
|
-
return
|
|
65809
|
+
if (result_8) {
|
|
65810
|
+
return result_8;
|
|
65776
65811
|
}
|
|
65777
65812
|
}
|
|
65778
65813
|
if (reportErrors) {
|
|
@@ -66161,6 +66196,9 @@ var ts;
|
|
|
66161
66196
|
// equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion
|
|
66162
66197
|
// and issue an error. Otherwise, actually compare the structure of the two types.
|
|
66163
66198
|
function recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags) {
|
|
66199
|
+
if (relation.size > Math.pow(2, 20)) {
|
|
66200
|
+
debugger;
|
|
66201
|
+
}
|
|
66164
66202
|
if (overflow) {
|
|
66165
66203
|
return 0 /* False */;
|
|
66166
66204
|
}
|
|
@@ -66319,11 +66357,11 @@ var ts;
|
|
|
66319
66357
|
if (relation === identityRelation) {
|
|
66320
66358
|
// We've already checked that source.flags and target.flags are identical
|
|
66321
66359
|
if (sourceFlags & 3145728 /* UnionOrIntersection */) {
|
|
66322
|
-
var
|
|
66323
|
-
if (
|
|
66324
|
-
|
|
66360
|
+
var result_9 = eachTypeRelatedToSomeType(source, target);
|
|
66361
|
+
if (result_9) {
|
|
66362
|
+
result_9 &= eachTypeRelatedToSomeType(target, source);
|
|
66325
66363
|
}
|
|
66326
|
-
return
|
|
66364
|
+
return result_9;
|
|
66327
66365
|
}
|
|
66328
66366
|
if (sourceFlags & 4194304 /* Index */) {
|
|
66329
66367
|
return isRelatedTo(source.type, target.type, 3 /* Both */, /*reportErrors*/ false);
|
|
@@ -66500,7 +66538,7 @@ var ts;
|
|
|
66500
66538
|
// create a new chain for the constraint error
|
|
66501
66539
|
resetErrorInfo(saveErrorInfo);
|
|
66502
66540
|
}
|
|
66503
|
-
if (result = isRelatedTo(source, constraint, 2 /* Target */, reportErrors)) {
|
|
66541
|
+
if (result = isRelatedTo(source, constraint, 2 /* Target */, reportErrors, /* headMessage */ undefined, intersectionState)) {
|
|
66504
66542
|
return result;
|
|
66505
66543
|
}
|
|
66506
66544
|
// prefer the shorter chain of the constraint comparison chain, and the direct comparison chain
|
|
@@ -66812,9 +66850,9 @@ var ts;
|
|
|
66812
66850
|
if (sourceFlags & (524288 /* Object */ | 2097152 /* Intersection */) && targetFlags & 1048576 /* Union */) {
|
|
66813
66851
|
var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */ | 2097152 /* Intersection */ | 33554432 /* Substitution */);
|
|
66814
66852
|
if (objectOnlyTarget.flags & 1048576 /* Union */) {
|
|
66815
|
-
var
|
|
66816
|
-
if (
|
|
66817
|
-
return
|
|
66853
|
+
var result_10 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
|
|
66854
|
+
if (result_10) {
|
|
66855
|
+
return result_10;
|
|
66818
66856
|
}
|
|
66819
66857
|
}
|
|
66820
66858
|
}
|
|
@@ -66874,13 +66912,13 @@ var ts;
|
|
|
66874
66912
|
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
|
|
66875
66913
|
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
|
|
66876
66914
|
if (modifiersRelated) {
|
|
66877
|
-
var
|
|
66915
|
+
var result_11;
|
|
66878
66916
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
66879
66917
|
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
66880
|
-
if (
|
|
66918
|
+
if (result_11 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
66881
66919
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
66882
66920
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
66883
|
-
return
|
|
66921
|
+
return result_11 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
|
|
66884
66922
|
}
|
|
66885
66923
|
}
|
|
66886
66924
|
}
|
|
@@ -68206,7 +68244,7 @@ var ts;
|
|
|
68206
68244
|
if (!isLiteralOfContextualType(type, contextualType)) {
|
|
68207
68245
|
type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type));
|
|
68208
68246
|
}
|
|
68209
|
-
return type;
|
|
68247
|
+
return getRegularTypeOfLiteralType(type);
|
|
68210
68248
|
}
|
|
68211
68249
|
function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) {
|
|
68212
68250
|
if (type && isUnitType(type)) {
|
|
@@ -78231,10 +78269,10 @@ var ts;
|
|
|
78231
78269
|
hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
|
|
78232
78270
|
hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
|
|
78233
78271
|
if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
|
|
78234
|
-
var
|
|
78235
|
-
|
|
78236
|
-
|
|
78237
|
-
return
|
|
78272
|
+
var result_12 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
|
|
78273
|
+
result_12.objectFlags |= 8388608 /* InstantiationExpressionType */;
|
|
78274
|
+
result_12.node = node;
|
|
78275
|
+
return result_12;
|
|
78238
78276
|
}
|
|
78239
78277
|
}
|
|
78240
78278
|
else if (type.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
@@ -82069,12 +82107,12 @@ var ts;
|
|
|
82069
82107
|
case 265 /* ImportEqualsDeclaration */:
|
|
82070
82108
|
case 268 /* NamespaceImport */:
|
|
82071
82109
|
case 267 /* ImportClause */:
|
|
82072
|
-
var
|
|
82110
|
+
var result_13 = 0 /* None */;
|
|
82073
82111
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
82074
82112
|
ts.forEach(target.declarations, function (d) {
|
|
82075
|
-
|
|
82113
|
+
result_13 |= getDeclarationSpaces(d);
|
|
82076
82114
|
});
|
|
82077
|
-
return
|
|
82115
|
+
return result_13;
|
|
82078
82116
|
case 254 /* VariableDeclaration */:
|
|
82079
82117
|
case 203 /* BindingElement */:
|
|
82080
82118
|
case 256 /* FunctionDeclaration */:
|
|
@@ -99255,8 +99293,8 @@ var ts;
|
|
|
99255
99293
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
99256
99294
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
99257
99295
|
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
99258
|
-
var
|
|
99259
|
-
return
|
|
99296
|
+
var result_14 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
99297
|
+
return result_14 && factory.createPropertyAssignment("children", result_14);
|
|
99260
99298
|
}
|
|
99261
99299
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
99262
99300
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -118511,15 +118549,15 @@ var ts;
|
|
|
118511
118549
|
// which per above occurred during the current program creation.
|
|
118512
118550
|
// Since we assume the filesystem does not change during program creation,
|
|
118513
118551
|
// it is safe to reuse resolutions from the earlier call.
|
|
118514
|
-
var
|
|
118552
|
+
var result_15 = [];
|
|
118515
118553
|
var i = 0;
|
|
118516
118554
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
118517
118555
|
var moduleName = moduleNames_1[_i];
|
|
118518
118556
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
118519
118557
|
i++;
|
|
118520
|
-
|
|
118558
|
+
result_15.push(resolvedModule);
|
|
118521
118559
|
}
|
|
118522
|
-
return
|
|
118560
|
+
return result_15;
|
|
118523
118561
|
}
|
|
118524
118562
|
// At this point, we know at least one of the following hold:
|
|
118525
118563
|
// - file has local declarations for ambient modules
|
|
@@ -121979,14 +122017,14 @@ var ts;
|
|
|
121979
122017
|
fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
|
|
121980
122018
|
fileInfos_1.push(sourceFile.version);
|
|
121981
122019
|
});
|
|
121982
|
-
var
|
|
122020
|
+
var result_16 = {
|
|
121983
122021
|
fileNames: fileNames_1,
|
|
121984
122022
|
fileInfos: fileInfos_1,
|
|
121985
122023
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
121986
122024
|
outSignature: state.outSignature,
|
|
121987
122025
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
121988
122026
|
};
|
|
121989
|
-
return
|
|
122027
|
+
return result_16;
|
|
121990
122028
|
}
|
|
121991
122029
|
var fileNames = [];
|
|
121992
122030
|
var fileNameToFileId = new ts.Map();
|
|
@@ -123924,9 +123962,9 @@ var ts;
|
|
|
123924
123962
|
if (!preferSymlinks) {
|
|
123925
123963
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
123926
123964
|
// so we only need to remove them from the realpath filenames.
|
|
123927
|
-
var
|
|
123928
|
-
if (
|
|
123929
|
-
return
|
|
123965
|
+
var result_17 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
123966
|
+
if (result_17)
|
|
123967
|
+
return result_17;
|
|
123930
123968
|
}
|
|
123931
123969
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
123932
123970
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -123946,10 +123984,10 @@ var ts;
|
|
|
123946
123984
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
123947
123985
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
123948
123986
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
123949
|
-
var
|
|
123987
|
+
var result_18 = cb(option, target === referenceRedirect);
|
|
123950
123988
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
123951
|
-
if (
|
|
123952
|
-
return
|
|
123989
|
+
if (result_18)
|
|
123990
|
+
return result_18;
|
|
123953
123991
|
}
|
|
123954
123992
|
});
|
|
123955
123993
|
});
|
|
@@ -160154,23 +160192,36 @@ var ts;
|
|
|
160154
160192
|
* @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub.
|
|
160155
160193
|
*/
|
|
160156
160194
|
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) {
|
|
160195
|
+
var _a;
|
|
160157
160196
|
if (preserveOptional === void 0) { preserveOptional = 3 /* All */; }
|
|
160158
160197
|
if (isAmbient === void 0) { isAmbient = false; }
|
|
160159
160198
|
var declarations = symbol.getDeclarations();
|
|
160160
|
-
|
|
160161
|
-
return undefined;
|
|
160162
|
-
}
|
|
160199
|
+
var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0];
|
|
160163
160200
|
var checker = context.program.getTypeChecker();
|
|
160164
160201
|
var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions());
|
|
160165
|
-
|
|
160202
|
+
/**
|
|
160203
|
+
* (#49811)
|
|
160204
|
+
* Note that there are cases in which the symbol declaration is not present. For example, in the code below both
|
|
160205
|
+
* `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type
|
|
160206
|
+
* parent):
|
|
160207
|
+
*
|
|
160208
|
+
* >>> ```ts
|
|
160209
|
+
* >>> type Base = { ax: number; ay: string };
|
|
160210
|
+
* >>> type BaseKeys = keyof Base;
|
|
160211
|
+
* >>> type MappedIndirect = { [K in BaseKeys]: boolean };
|
|
160212
|
+
* >>> ```
|
|
160213
|
+
*
|
|
160214
|
+
* In such cases, we assume the declaration to be a `PropertySignature`.
|
|
160215
|
+
*/
|
|
160216
|
+
var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 166 /* PropertySignature */;
|
|
160166
160217
|
var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false);
|
|
160167
|
-
var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration));
|
|
160218
|
+
var visibilityModifier = createVisibilityModifier(declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* None */);
|
|
160168
160219
|
var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined;
|
|
160169
160220
|
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
160170
160221
|
var optional = !!(symbol.flags & 16777216 /* Optional */);
|
|
160171
160222
|
var ambient = !!(enclosingDeclaration.flags & 16777216 /* Ambient */) || isAmbient;
|
|
160172
160223
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
160173
|
-
switch (
|
|
160224
|
+
switch (kind) {
|
|
160174
160225
|
case 166 /* PropertySignature */:
|
|
160175
160226
|
case 167 /* PropertyDeclaration */:
|
|
160176
160227
|
var flags = quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : undefined;
|
|
@@ -160182,11 +160233,12 @@ var ts;
|
|
|
160182
160233
|
importSymbols(importAdder, importableReference.symbols);
|
|
160183
160234
|
}
|
|
160184
160235
|
}
|
|
160185
|
-
addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* Property */) ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeNode,
|
|
160236
|
+
addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? name : symbol.getName(), optional && (preserveOptional & 2 /* Property */) ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeNode,
|
|
160186
160237
|
/*initializer*/ undefined));
|
|
160187
160238
|
break;
|
|
160188
160239
|
case 172 /* GetAccessor */:
|
|
160189
160240
|
case 173 /* SetAccessor */: {
|
|
160241
|
+
ts.Debug.assertIsDefined(declarations);
|
|
160190
160242
|
var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
|
|
160191
160243
|
var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration);
|
|
160192
160244
|
var orderedAccessors = allAccessors.secondAccessor
|
|
@@ -160222,6 +160274,7 @@ var ts;
|
|
|
160222
160274
|
// If there is more than one overload but no implementation signature
|
|
160223
160275
|
// (eg: an abstract method or interface declaration), there is a 1-1
|
|
160224
160276
|
// correspondence of declarations and signatures.
|
|
160277
|
+
ts.Debug.assertIsDefined(declarations);
|
|
160225
160278
|
var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures();
|
|
160226
160279
|
if (!ts.some(signatures)) {
|
|
160227
160280
|
break;
|
|
@@ -160232,8 +160285,8 @@ var ts;
|
|
|
160232
160285
|
outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference));
|
|
160233
160286
|
break;
|
|
160234
160287
|
}
|
|
160235
|
-
for (var
|
|
160236
|
-
var signature = signatures_1[
|
|
160288
|
+
for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) {
|
|
160289
|
+
var signature = signatures_1[_b];
|
|
160237
160290
|
// Ensure nodes are fresh so they can have different positions when going through formatting.
|
|
160238
160291
|
outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false));
|
|
160239
160292
|
}
|