@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/tsserverlibrary.js
CHANGED
|
@@ -108,7 +108,7 @@ var ts;
|
|
|
108
108
|
// The following is baselined as a literal template type without intervention
|
|
109
109
|
/** The version of the TypeScript compiler release */
|
|
110
110
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
111
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
111
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220817";
|
|
112
112
|
/* @internal */
|
|
113
113
|
var Comparison;
|
|
114
114
|
(function (Comparison) {
|
|
@@ -7036,7 +7036,6 @@ var ts;
|
|
|
7036
7036
|
// not actually work.
|
|
7037
7037
|
var byteOrderMarkIndicator = "\uFEFF";
|
|
7038
7038
|
function getNodeSystem() {
|
|
7039
|
-
var _a;
|
|
7040
7039
|
var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
|
|
7041
7040
|
var _fs = require("fs");
|
|
7042
7041
|
var _path = require("path");
|
|
@@ -7046,7 +7045,7 @@ var ts;
|
|
|
7046
7045
|
try {
|
|
7047
7046
|
_crypto = require("crypto");
|
|
7048
7047
|
}
|
|
7049
|
-
catch (
|
|
7048
|
+
catch (_a) {
|
|
7050
7049
|
_crypto = undefined;
|
|
7051
7050
|
}
|
|
7052
7051
|
var activeSession;
|
|
@@ -7057,10 +7056,10 @@ var ts;
|
|
|
7057
7056
|
var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
7058
7057
|
var platform = _os.platform();
|
|
7059
7058
|
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
|
7060
|
-
var
|
|
7059
|
+
var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
7061
7060
|
var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
|
|
7062
7061
|
var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
|
|
7063
|
-
var
|
|
7062
|
+
var _b = createSystemWatchFunctions({
|
|
7064
7063
|
pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
|
|
7065
7064
|
getModifiedTime: getModifiedTime,
|
|
7066
7065
|
setTimeout: setTimeout,
|
|
@@ -7080,7 +7079,7 @@ var ts;
|
|
|
7080
7079
|
defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
|
7081
7080
|
inodeWatching: isLinuxOrMacOs,
|
|
7082
7081
|
sysLog: sysLog,
|
|
7083
|
-
}), watchFile =
|
|
7082
|
+
}), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory;
|
|
7084
7083
|
var nodeSystem = {
|
|
7085
7084
|
args: process.argv.slice(2),
|
|
7086
7085
|
newLine: _os.EOL,
|
|
@@ -7473,9 +7472,12 @@ var ts;
|
|
|
7473
7472
|
function getDirectories(path) {
|
|
7474
7473
|
return getAccessibleFileSystemEntries(path).directories.slice();
|
|
7475
7474
|
}
|
|
7475
|
+
function fsRealPathHandlingLongPath(path) {
|
|
7476
|
+
return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path);
|
|
7477
|
+
}
|
|
7476
7478
|
function realpath(path) {
|
|
7477
7479
|
try {
|
|
7478
|
-
return
|
|
7480
|
+
return fsRealpath(path);
|
|
7479
7481
|
}
|
|
7480
7482
|
catch (_a) {
|
|
7481
7483
|
return path;
|
|
@@ -65682,6 +65684,38 @@ var ts;
|
|
|
65682
65684
|
}
|
|
65683
65685
|
return 0 /* False */;
|
|
65684
65686
|
}
|
|
65687
|
+
// Before normalization: Intersections applied to unions create an explosion of types when normalized -
|
|
65688
|
+
// handling those inner intersections can be very costly, so it can be beneficial to factor them out early.
|
|
65689
|
+
// If both the source and target are intersections, we can remove the common types from them before formal normalization,
|
|
65690
|
+
// and run a simplified comparison without those common members.
|
|
65691
|
+
if (originalSource.flags & originalTarget.flags & 2097152 /* Intersection */) {
|
|
65692
|
+
var combinedTypeSet_1 = new ts.Map();
|
|
65693
|
+
ts.forEach(originalSource.types, function (t) { return combinedTypeSet_1.set(getTypeId(t), 1); });
|
|
65694
|
+
var hasOverlap_1 = false;
|
|
65695
|
+
ts.forEach(originalTarget.types, function (t) {
|
|
65696
|
+
var id = getTypeId(t);
|
|
65697
|
+
if (combinedTypeSet_1.has(id)) {
|
|
65698
|
+
combinedTypeSet_1.set(getTypeId(t), 2);
|
|
65699
|
+
hasOverlap_1 = true;
|
|
65700
|
+
}
|
|
65701
|
+
});
|
|
65702
|
+
if (hasOverlap_1) {
|
|
65703
|
+
var filteredSource = ts.filter(originalSource.types, function (t) { return combinedTypeSet_1.get(getTypeId(t)) !== 2; });
|
|
65704
|
+
var filteredTarget = ts.filter(originalTarget.types, function (t) { return combinedTypeSet_1.get(getTypeId(t)) !== 2; });
|
|
65705
|
+
if (!ts.length(filteredTarget)) {
|
|
65706
|
+
return -1 /* True */; // Source has all parts of target
|
|
65707
|
+
}
|
|
65708
|
+
if (ts.length(filteredSource)) {
|
|
65709
|
+
var result_7;
|
|
65710
|
+
if (result_7 = isRelatedTo(getIntersectionType(filteredSource), getIntersectionType(filteredTarget), recursionFlags, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
65711
|
+
return result_7;
|
|
65712
|
+
}
|
|
65713
|
+
// In the false case, we may still be assignable at the structural level, rather than the algebraic level
|
|
65714
|
+
}
|
|
65715
|
+
// Even if every member of the source is in the target but the target still has members left, the source may still be assignable
|
|
65716
|
+
// 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
|
|
65717
|
+
}
|
|
65718
|
+
}
|
|
65685
65719
|
// Normalize the source and target types: Turn fresh literal types into regular literal types,
|
|
65686
65720
|
// turn deferred type references into regular type references, simplify indexed access and
|
|
65687
65721
|
// conditional types, and resolve substitution types to either the substitution (on the source
|
|
@@ -65732,7 +65766,8 @@ var ts;
|
|
|
65732
65766
|
return 0 /* False */;
|
|
65733
65767
|
}
|
|
65734
65768
|
}
|
|
65735
|
-
var isPerformingCommonPropertyChecks = relation !== comparableRelation
|
|
65769
|
+
var isPerformingCommonPropertyChecks = (relation !== comparableRelation || relation === comparableRelation && isLiteralType(source)) &&
|
|
65770
|
+
!(intersectionState & 2 /* Target */) &&
|
|
65736
65771
|
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
|
|
65737
65772
|
target.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target) &&
|
|
65738
65773
|
(getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
|
|
@@ -65756,7 +65791,7 @@ var ts;
|
|
|
65756
65791
|
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
65757
65792
|
var skipCaching = source.flags & 1048576 /* Union */ && source.types.length < 4 && !(target.flags & 1048576 /* Union */) ||
|
|
65758
65793
|
target.flags & 1048576 /* Union */ && target.types.length < 4 && !(source.flags & 469499904 /* StructuredOrInstantiable */);
|
|
65759
|
-
var
|
|
65794
|
+
var result_8 = skipCaching ?
|
|
65760
65795
|
unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
|
|
65761
65796
|
recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
|
|
65762
65797
|
// For certain combinations involving intersections and optional, excess, or mismatched properties we need
|
|
@@ -65774,14 +65809,14 @@ var ts;
|
|
|
65774
65809
|
//
|
|
65775
65810
|
// We suppress recursive intersection property checks because they can generate lots of work when relating
|
|
65776
65811
|
// recursive intersections that are structurally similar but not exactly identical. See #37854.
|
|
65777
|
-
if (
|
|
65812
|
+
if (result_8 && !inPropertyCheck && (target.flags & 2097152 /* Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
|
|
65778
65813
|
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 */); }))) {
|
|
65779
65814
|
inPropertyCheck = true;
|
|
65780
|
-
|
|
65815
|
+
result_8 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* PropertyCheck */, recursionFlags);
|
|
65781
65816
|
inPropertyCheck = false;
|
|
65782
65817
|
}
|
|
65783
|
-
if (
|
|
65784
|
-
return
|
|
65818
|
+
if (result_8) {
|
|
65819
|
+
return result_8;
|
|
65785
65820
|
}
|
|
65786
65821
|
}
|
|
65787
65822
|
if (reportErrors) {
|
|
@@ -66170,6 +66205,9 @@ var ts;
|
|
|
66170
66205
|
// equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion
|
|
66171
66206
|
// and issue an error. Otherwise, actually compare the structure of the two types.
|
|
66172
66207
|
function recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags) {
|
|
66208
|
+
if (relation.size > Math.pow(2, 20)) {
|
|
66209
|
+
debugger;
|
|
66210
|
+
}
|
|
66173
66211
|
if (overflow) {
|
|
66174
66212
|
return 0 /* False */;
|
|
66175
66213
|
}
|
|
@@ -66328,11 +66366,11 @@ var ts;
|
|
|
66328
66366
|
if (relation === identityRelation) {
|
|
66329
66367
|
// We've already checked that source.flags and target.flags are identical
|
|
66330
66368
|
if (sourceFlags & 3145728 /* UnionOrIntersection */) {
|
|
66331
|
-
var
|
|
66332
|
-
if (
|
|
66333
|
-
|
|
66369
|
+
var result_9 = eachTypeRelatedToSomeType(source, target);
|
|
66370
|
+
if (result_9) {
|
|
66371
|
+
result_9 &= eachTypeRelatedToSomeType(target, source);
|
|
66334
66372
|
}
|
|
66335
|
-
return
|
|
66373
|
+
return result_9;
|
|
66336
66374
|
}
|
|
66337
66375
|
if (sourceFlags & 4194304 /* Index */) {
|
|
66338
66376
|
return isRelatedTo(source.type, target.type, 3 /* Both */, /*reportErrors*/ false);
|
|
@@ -66509,7 +66547,7 @@ var ts;
|
|
|
66509
66547
|
// create a new chain for the constraint error
|
|
66510
66548
|
resetErrorInfo(saveErrorInfo);
|
|
66511
66549
|
}
|
|
66512
|
-
if (result = isRelatedTo(source, constraint, 2 /* Target */, reportErrors)) {
|
|
66550
|
+
if (result = isRelatedTo(source, constraint, 2 /* Target */, reportErrors, /* headMessage */ undefined, intersectionState)) {
|
|
66513
66551
|
return result;
|
|
66514
66552
|
}
|
|
66515
66553
|
// prefer the shorter chain of the constraint comparison chain, and the direct comparison chain
|
|
@@ -66821,9 +66859,9 @@ var ts;
|
|
|
66821
66859
|
if (sourceFlags & (524288 /* Object */ | 2097152 /* Intersection */) && targetFlags & 1048576 /* Union */) {
|
|
66822
66860
|
var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */ | 2097152 /* Intersection */ | 33554432 /* Substitution */);
|
|
66823
66861
|
if (objectOnlyTarget.flags & 1048576 /* Union */) {
|
|
66824
|
-
var
|
|
66825
|
-
if (
|
|
66826
|
-
return
|
|
66862
|
+
var result_10 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
|
|
66863
|
+
if (result_10) {
|
|
66864
|
+
return result_10;
|
|
66827
66865
|
}
|
|
66828
66866
|
}
|
|
66829
66867
|
}
|
|
@@ -66883,13 +66921,13 @@ var ts;
|
|
|
66883
66921
|
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
|
|
66884
66922
|
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
|
|
66885
66923
|
if (modifiersRelated) {
|
|
66886
|
-
var
|
|
66924
|
+
var result_11;
|
|
66887
66925
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
66888
66926
|
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
66889
|
-
if (
|
|
66927
|
+
if (result_11 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
66890
66928
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
66891
66929
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
66892
|
-
return
|
|
66930
|
+
return result_11 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
|
|
66893
66931
|
}
|
|
66894
66932
|
}
|
|
66895
66933
|
}
|
|
@@ -68215,7 +68253,7 @@ var ts;
|
|
|
68215
68253
|
if (!isLiteralOfContextualType(type, contextualType)) {
|
|
68216
68254
|
type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type));
|
|
68217
68255
|
}
|
|
68218
|
-
return type;
|
|
68256
|
+
return getRegularTypeOfLiteralType(type);
|
|
68219
68257
|
}
|
|
68220
68258
|
function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) {
|
|
68221
68259
|
if (type && isUnitType(type)) {
|
|
@@ -78240,10 +78278,10 @@ var ts;
|
|
|
78240
78278
|
hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
|
|
78241
78279
|
hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
|
|
78242
78280
|
if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
|
|
78243
|
-
var
|
|
78244
|
-
|
|
78245
|
-
|
|
78246
|
-
return
|
|
78281
|
+
var result_12 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
|
|
78282
|
+
result_12.objectFlags |= 8388608 /* InstantiationExpressionType */;
|
|
78283
|
+
result_12.node = node;
|
|
78284
|
+
return result_12;
|
|
78247
78285
|
}
|
|
78248
78286
|
}
|
|
78249
78287
|
else if (type.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
@@ -82078,12 +82116,12 @@ var ts;
|
|
|
82078
82116
|
case 265 /* ImportEqualsDeclaration */:
|
|
82079
82117
|
case 268 /* NamespaceImport */:
|
|
82080
82118
|
case 267 /* ImportClause */:
|
|
82081
|
-
var
|
|
82119
|
+
var result_13 = 0 /* None */;
|
|
82082
82120
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
82083
82121
|
ts.forEach(target.declarations, function (d) {
|
|
82084
|
-
|
|
82122
|
+
result_13 |= getDeclarationSpaces(d);
|
|
82085
82123
|
});
|
|
82086
|
-
return
|
|
82124
|
+
return result_13;
|
|
82087
82125
|
case 254 /* VariableDeclaration */:
|
|
82088
82126
|
case 203 /* BindingElement */:
|
|
82089
82127
|
case 256 /* FunctionDeclaration */:
|
|
@@ -99264,8 +99302,8 @@ var ts;
|
|
|
99264
99302
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
99265
99303
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
99266
99304
|
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
99267
|
-
var
|
|
99268
|
-
return
|
|
99305
|
+
var result_14 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
99306
|
+
return result_14 && factory.createPropertyAssignment("children", result_14);
|
|
99269
99307
|
}
|
|
99270
99308
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
99271
99309
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -118520,15 +118558,15 @@ var ts;
|
|
|
118520
118558
|
// which per above occurred during the current program creation.
|
|
118521
118559
|
// Since we assume the filesystem does not change during program creation,
|
|
118522
118560
|
// it is safe to reuse resolutions from the earlier call.
|
|
118523
|
-
var
|
|
118561
|
+
var result_15 = [];
|
|
118524
118562
|
var i = 0;
|
|
118525
118563
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
118526
118564
|
var moduleName = moduleNames_1[_i];
|
|
118527
118565
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
118528
118566
|
i++;
|
|
118529
|
-
|
|
118567
|
+
result_15.push(resolvedModule);
|
|
118530
118568
|
}
|
|
118531
|
-
return
|
|
118569
|
+
return result_15;
|
|
118532
118570
|
}
|
|
118533
118571
|
// At this point, we know at least one of the following hold:
|
|
118534
118572
|
// - file has local declarations for ambient modules
|
|
@@ -121988,14 +122026,14 @@ var ts;
|
|
|
121988
122026
|
fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
|
|
121989
122027
|
fileInfos_1.push(sourceFile.version);
|
|
121990
122028
|
});
|
|
121991
|
-
var
|
|
122029
|
+
var result_16 = {
|
|
121992
122030
|
fileNames: fileNames_1,
|
|
121993
122031
|
fileInfos: fileInfos_1,
|
|
121994
122032
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
121995
122033
|
outSignature: state.outSignature,
|
|
121996
122034
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
121997
122035
|
};
|
|
121998
|
-
return
|
|
122036
|
+
return result_16;
|
|
121999
122037
|
}
|
|
122000
122038
|
var fileNames = [];
|
|
122001
122039
|
var fileNameToFileId = new ts.Map();
|
|
@@ -123933,9 +123971,9 @@ var ts;
|
|
|
123933
123971
|
if (!preferSymlinks) {
|
|
123934
123972
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
123935
123973
|
// so we only need to remove them from the realpath filenames.
|
|
123936
|
-
var
|
|
123937
|
-
if (
|
|
123938
|
-
return
|
|
123974
|
+
var result_17 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
123975
|
+
if (result_17)
|
|
123976
|
+
return result_17;
|
|
123939
123977
|
}
|
|
123940
123978
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
123941
123979
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -123955,10 +123993,10 @@ var ts;
|
|
|
123955
123993
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
123956
123994
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
123957
123995
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
123958
|
-
var
|
|
123996
|
+
var result_18 = cb(option, target === referenceRedirect);
|
|
123959
123997
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
123960
|
-
if (
|
|
123961
|
-
return
|
|
123998
|
+
if (result_18)
|
|
123999
|
+
return result_18;
|
|
123962
124000
|
}
|
|
123963
124001
|
});
|
|
123964
124002
|
});
|
|
@@ -160163,23 +160201,36 @@ var ts;
|
|
|
160163
160201
|
* @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub.
|
|
160164
160202
|
*/
|
|
160165
160203
|
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) {
|
|
160204
|
+
var _a;
|
|
160166
160205
|
if (preserveOptional === void 0) { preserveOptional = 3 /* All */; }
|
|
160167
160206
|
if (isAmbient === void 0) { isAmbient = false; }
|
|
160168
160207
|
var declarations = symbol.getDeclarations();
|
|
160169
|
-
|
|
160170
|
-
return undefined;
|
|
160171
|
-
}
|
|
160208
|
+
var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0];
|
|
160172
160209
|
var checker = context.program.getTypeChecker();
|
|
160173
160210
|
var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions());
|
|
160174
|
-
|
|
160211
|
+
/**
|
|
160212
|
+
* (#49811)
|
|
160213
|
+
* Note that there are cases in which the symbol declaration is not present. For example, in the code below both
|
|
160214
|
+
* `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type
|
|
160215
|
+
* parent):
|
|
160216
|
+
*
|
|
160217
|
+
* >>> ```ts
|
|
160218
|
+
* >>> type Base = { ax: number; ay: string };
|
|
160219
|
+
* >>> type BaseKeys = keyof Base;
|
|
160220
|
+
* >>> type MappedIndirect = { [K in BaseKeys]: boolean };
|
|
160221
|
+
* >>> ```
|
|
160222
|
+
*
|
|
160223
|
+
* In such cases, we assume the declaration to be a `PropertySignature`.
|
|
160224
|
+
*/
|
|
160225
|
+
var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 166 /* PropertySignature */;
|
|
160175
160226
|
var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false);
|
|
160176
|
-
var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration));
|
|
160227
|
+
var visibilityModifier = createVisibilityModifier(declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* None */);
|
|
160177
160228
|
var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined;
|
|
160178
160229
|
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
160179
160230
|
var optional = !!(symbol.flags & 16777216 /* Optional */);
|
|
160180
160231
|
var ambient = !!(enclosingDeclaration.flags & 16777216 /* Ambient */) || isAmbient;
|
|
160181
160232
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
160182
|
-
switch (
|
|
160233
|
+
switch (kind) {
|
|
160183
160234
|
case 166 /* PropertySignature */:
|
|
160184
160235
|
case 167 /* PropertyDeclaration */:
|
|
160185
160236
|
var flags = quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : undefined;
|
|
@@ -160191,11 +160242,12 @@ var ts;
|
|
|
160191
160242
|
importSymbols(importAdder, importableReference.symbols);
|
|
160192
160243
|
}
|
|
160193
160244
|
}
|
|
160194
|
-
addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* Property */) ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeNode,
|
|
160245
|
+
addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? name : symbol.getName(), optional && (preserveOptional & 2 /* Property */) ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeNode,
|
|
160195
160246
|
/*initializer*/ undefined));
|
|
160196
160247
|
break;
|
|
160197
160248
|
case 172 /* GetAccessor */:
|
|
160198
160249
|
case 173 /* SetAccessor */: {
|
|
160250
|
+
ts.Debug.assertIsDefined(declarations);
|
|
160199
160251
|
var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
|
|
160200
160252
|
var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration);
|
|
160201
160253
|
var orderedAccessors = allAccessors.secondAccessor
|
|
@@ -160231,6 +160283,7 @@ var ts;
|
|
|
160231
160283
|
// If there is more than one overload but no implementation signature
|
|
160232
160284
|
// (eg: an abstract method or interface declaration), there is a 1-1
|
|
160233
160285
|
// correspondence of declarations and signatures.
|
|
160286
|
+
ts.Debug.assertIsDefined(declarations);
|
|
160234
160287
|
var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures();
|
|
160235
160288
|
if (!ts.some(signatures)) {
|
|
160236
160289
|
break;
|
|
@@ -160241,8 +160294,8 @@ var ts;
|
|
|
160241
160294
|
outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference));
|
|
160242
160295
|
break;
|
|
160243
160296
|
}
|
|
160244
|
-
for (var
|
|
160245
|
-
var signature = signatures_1[
|
|
160297
|
+
for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) {
|
|
160298
|
+
var signature = signatures_1[_b];
|
|
160246
160299
|
// Ensure nodes are fresh so they can have different positions when going through formatting.
|
|
160247
160300
|
outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false));
|
|
160248
160301
|
}
|