@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/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220817";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -7037,7 +7037,6 @@ var ts;
|
|
|
7037
7037
|
// not actually work.
|
|
7038
7038
|
var byteOrderMarkIndicator = "\uFEFF";
|
|
7039
7039
|
function getNodeSystem() {
|
|
7040
|
-
var _a;
|
|
7041
7040
|
var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
|
|
7042
7041
|
var _fs = require("fs");
|
|
7043
7042
|
var _path = require("path");
|
|
@@ -7047,7 +7046,7 @@ var ts;
|
|
|
7047
7046
|
try {
|
|
7048
7047
|
_crypto = require("crypto");
|
|
7049
7048
|
}
|
|
7050
|
-
catch (
|
|
7049
|
+
catch (_a) {
|
|
7051
7050
|
_crypto = undefined;
|
|
7052
7051
|
}
|
|
7053
7052
|
var activeSession;
|
|
@@ -7058,10 +7057,10 @@ var ts;
|
|
|
7058
7057
|
var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
7059
7058
|
var platform = _os.platform();
|
|
7060
7059
|
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
|
7061
|
-
var
|
|
7060
|
+
var fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
7062
7061
|
var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
|
|
7063
7062
|
var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
|
|
7064
|
-
var
|
|
7063
|
+
var _b = createSystemWatchFunctions({
|
|
7065
7064
|
pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
|
|
7066
7065
|
getModifiedTime: getModifiedTime,
|
|
7067
7066
|
setTimeout: setTimeout,
|
|
@@ -7081,7 +7080,7 @@ var ts;
|
|
|
7081
7080
|
defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); },
|
|
7082
7081
|
inodeWatching: isLinuxOrMacOs,
|
|
7083
7082
|
sysLog: sysLog,
|
|
7084
|
-
}), watchFile =
|
|
7083
|
+
}), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory;
|
|
7085
7084
|
var nodeSystem = {
|
|
7086
7085
|
args: process.argv.slice(2),
|
|
7087
7086
|
newLine: _os.EOL,
|
|
@@ -7474,9 +7473,12 @@ var ts;
|
|
|
7474
7473
|
function getDirectories(path) {
|
|
7475
7474
|
return getAccessibleFileSystemEntries(path).directories.slice();
|
|
7476
7475
|
}
|
|
7476
|
+
function fsRealPathHandlingLongPath(path) {
|
|
7477
|
+
return path.length < 260 ? _fs.realpathSync.native(path) : _fs.realpathSync(path);
|
|
7478
|
+
}
|
|
7477
7479
|
function realpath(path) {
|
|
7478
7480
|
try {
|
|
7479
|
-
return
|
|
7481
|
+
return fsRealpath(path);
|
|
7480
7482
|
}
|
|
7481
7483
|
catch (_a) {
|
|
7482
7484
|
return path;
|
|
@@ -65683,6 +65685,38 @@ var ts;
|
|
|
65683
65685
|
}
|
|
65684
65686
|
return 0 /* False */;
|
|
65685
65687
|
}
|
|
65688
|
+
// Before normalization: Intersections applied to unions create an explosion of types when normalized -
|
|
65689
|
+
// handling those inner intersections can be very costly, so it can be beneficial to factor them out early.
|
|
65690
|
+
// If both the source and target are intersections, we can remove the common types from them before formal normalization,
|
|
65691
|
+
// and run a simplified comparison without those common members.
|
|
65692
|
+
if (originalSource.flags & originalTarget.flags & 2097152 /* Intersection */) {
|
|
65693
|
+
var combinedTypeSet_1 = new ts.Map();
|
|
65694
|
+
ts.forEach(originalSource.types, function (t) { return combinedTypeSet_1.set(getTypeId(t), 1); });
|
|
65695
|
+
var hasOverlap_1 = false;
|
|
65696
|
+
ts.forEach(originalTarget.types, function (t) {
|
|
65697
|
+
var id = getTypeId(t);
|
|
65698
|
+
if (combinedTypeSet_1.has(id)) {
|
|
65699
|
+
combinedTypeSet_1.set(getTypeId(t), 2);
|
|
65700
|
+
hasOverlap_1 = true;
|
|
65701
|
+
}
|
|
65702
|
+
});
|
|
65703
|
+
if (hasOverlap_1) {
|
|
65704
|
+
var filteredSource = ts.filter(originalSource.types, function (t) { return combinedTypeSet_1.get(getTypeId(t)) !== 2; });
|
|
65705
|
+
var filteredTarget = ts.filter(originalTarget.types, function (t) { return combinedTypeSet_1.get(getTypeId(t)) !== 2; });
|
|
65706
|
+
if (!ts.length(filteredTarget)) {
|
|
65707
|
+
return -1 /* True */; // Source has all parts of target
|
|
65708
|
+
}
|
|
65709
|
+
if (ts.length(filteredSource)) {
|
|
65710
|
+
var result_7;
|
|
65711
|
+
if (result_7 = isRelatedTo(getIntersectionType(filteredSource), getIntersectionType(filteredTarget), recursionFlags, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
65712
|
+
return result_7;
|
|
65713
|
+
}
|
|
65714
|
+
// In the false case, we may still be assignable at the structural level, rather than the algebraic level
|
|
65715
|
+
}
|
|
65716
|
+
// Even if every member of the source is in the target but the target still has members left, the source may still be assignable
|
|
65717
|
+
// 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
|
|
65718
|
+
}
|
|
65719
|
+
}
|
|
65686
65720
|
// Normalize the source and target types: Turn fresh literal types into regular literal types,
|
|
65687
65721
|
// turn deferred type references into regular type references, simplify indexed access and
|
|
65688
65722
|
// conditional types, and resolve substitution types to either the substitution (on the source
|
|
@@ -65733,7 +65767,8 @@ var ts;
|
|
|
65733
65767
|
return 0 /* False */;
|
|
65734
65768
|
}
|
|
65735
65769
|
}
|
|
65736
|
-
var isPerformingCommonPropertyChecks = relation !== comparableRelation
|
|
65770
|
+
var isPerformingCommonPropertyChecks = (relation !== comparableRelation || relation === comparableRelation && isLiteralType(source)) &&
|
|
65771
|
+
!(intersectionState & 2 /* Target */) &&
|
|
65737
65772
|
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
|
|
65738
65773
|
target.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target) &&
|
|
65739
65774
|
(getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
|
|
@@ -65757,7 +65792,7 @@ var ts;
|
|
|
65757
65792
|
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
65758
65793
|
var skipCaching = source.flags & 1048576 /* Union */ && source.types.length < 4 && !(target.flags & 1048576 /* Union */) ||
|
|
65759
65794
|
target.flags & 1048576 /* Union */ && target.types.length < 4 && !(source.flags & 469499904 /* StructuredOrInstantiable */);
|
|
65760
|
-
var
|
|
65795
|
+
var result_8 = skipCaching ?
|
|
65761
65796
|
unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
|
|
65762
65797
|
recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
|
|
65763
65798
|
// For certain combinations involving intersections and optional, excess, or mismatched properties we need
|
|
@@ -65775,14 +65810,14 @@ var ts;
|
|
|
65775
65810
|
//
|
|
65776
65811
|
// We suppress recursive intersection property checks because they can generate lots of work when relating
|
|
65777
65812
|
// recursive intersections that are structurally similar but not exactly identical. See #37854.
|
|
65778
|
-
if (
|
|
65813
|
+
if (result_8 && !inPropertyCheck && (target.flags & 2097152 /* Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
|
|
65779
65814
|
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 */); }))) {
|
|
65780
65815
|
inPropertyCheck = true;
|
|
65781
|
-
|
|
65816
|
+
result_8 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* PropertyCheck */, recursionFlags);
|
|
65782
65817
|
inPropertyCheck = false;
|
|
65783
65818
|
}
|
|
65784
|
-
if (
|
|
65785
|
-
return
|
|
65819
|
+
if (result_8) {
|
|
65820
|
+
return result_8;
|
|
65786
65821
|
}
|
|
65787
65822
|
}
|
|
65788
65823
|
if (reportErrors) {
|
|
@@ -66171,6 +66206,9 @@ var ts;
|
|
|
66171
66206
|
// equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion
|
|
66172
66207
|
// and issue an error. Otherwise, actually compare the structure of the two types.
|
|
66173
66208
|
function recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags) {
|
|
66209
|
+
if (relation.size > Math.pow(2, 20)) {
|
|
66210
|
+
debugger;
|
|
66211
|
+
}
|
|
66174
66212
|
if (overflow) {
|
|
66175
66213
|
return 0 /* False */;
|
|
66176
66214
|
}
|
|
@@ -66329,11 +66367,11 @@ var ts;
|
|
|
66329
66367
|
if (relation === identityRelation) {
|
|
66330
66368
|
// We've already checked that source.flags and target.flags are identical
|
|
66331
66369
|
if (sourceFlags & 3145728 /* UnionOrIntersection */) {
|
|
66332
|
-
var
|
|
66333
|
-
if (
|
|
66334
|
-
|
|
66370
|
+
var result_9 = eachTypeRelatedToSomeType(source, target);
|
|
66371
|
+
if (result_9) {
|
|
66372
|
+
result_9 &= eachTypeRelatedToSomeType(target, source);
|
|
66335
66373
|
}
|
|
66336
|
-
return
|
|
66374
|
+
return result_9;
|
|
66337
66375
|
}
|
|
66338
66376
|
if (sourceFlags & 4194304 /* Index */) {
|
|
66339
66377
|
return isRelatedTo(source.type, target.type, 3 /* Both */, /*reportErrors*/ false);
|
|
@@ -66510,7 +66548,7 @@ var ts;
|
|
|
66510
66548
|
// create a new chain for the constraint error
|
|
66511
66549
|
resetErrorInfo(saveErrorInfo);
|
|
66512
66550
|
}
|
|
66513
|
-
if (result = isRelatedTo(source, constraint, 2 /* Target */, reportErrors)) {
|
|
66551
|
+
if (result = isRelatedTo(source, constraint, 2 /* Target */, reportErrors, /* headMessage */ undefined, intersectionState)) {
|
|
66514
66552
|
return result;
|
|
66515
66553
|
}
|
|
66516
66554
|
// prefer the shorter chain of the constraint comparison chain, and the direct comparison chain
|
|
@@ -66822,9 +66860,9 @@ var ts;
|
|
|
66822
66860
|
if (sourceFlags & (524288 /* Object */ | 2097152 /* Intersection */) && targetFlags & 1048576 /* Union */) {
|
|
66823
66861
|
var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */ | 2097152 /* Intersection */ | 33554432 /* Substitution */);
|
|
66824
66862
|
if (objectOnlyTarget.flags & 1048576 /* Union */) {
|
|
66825
|
-
var
|
|
66826
|
-
if (
|
|
66827
|
-
return
|
|
66863
|
+
var result_10 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
|
|
66864
|
+
if (result_10) {
|
|
66865
|
+
return result_10;
|
|
66828
66866
|
}
|
|
66829
66867
|
}
|
|
66830
66868
|
}
|
|
@@ -66884,13 +66922,13 @@ var ts;
|
|
|
66884
66922
|
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
|
|
66885
66923
|
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
|
|
66886
66924
|
if (modifiersRelated) {
|
|
66887
|
-
var
|
|
66925
|
+
var result_11;
|
|
66888
66926
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
66889
66927
|
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
66890
|
-
if (
|
|
66928
|
+
if (result_11 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
66891
66929
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
66892
66930
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
66893
|
-
return
|
|
66931
|
+
return result_11 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3 /* Both */, reportErrors);
|
|
66894
66932
|
}
|
|
66895
66933
|
}
|
|
66896
66934
|
}
|
|
@@ -68216,7 +68254,7 @@ var ts;
|
|
|
68216
68254
|
if (!isLiteralOfContextualType(type, contextualType)) {
|
|
68217
68255
|
type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type));
|
|
68218
68256
|
}
|
|
68219
|
-
return type;
|
|
68257
|
+
return getRegularTypeOfLiteralType(type);
|
|
68220
68258
|
}
|
|
68221
68259
|
function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) {
|
|
68222
68260
|
if (type && isUnitType(type)) {
|
|
@@ -78241,10 +78279,10 @@ var ts;
|
|
|
78241
78279
|
hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
|
|
78242
78280
|
hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
|
|
78243
78281
|
if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
|
|
78244
|
-
var
|
|
78245
|
-
|
|
78246
|
-
|
|
78247
|
-
return
|
|
78282
|
+
var result_12 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
|
|
78283
|
+
result_12.objectFlags |= 8388608 /* InstantiationExpressionType */;
|
|
78284
|
+
result_12.node = node;
|
|
78285
|
+
return result_12;
|
|
78248
78286
|
}
|
|
78249
78287
|
}
|
|
78250
78288
|
else if (type.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
@@ -82079,12 +82117,12 @@ var ts;
|
|
|
82079
82117
|
case 265 /* ImportEqualsDeclaration */:
|
|
82080
82118
|
case 268 /* NamespaceImport */:
|
|
82081
82119
|
case 267 /* ImportClause */:
|
|
82082
|
-
var
|
|
82120
|
+
var result_13 = 0 /* None */;
|
|
82083
82121
|
var target = resolveAlias(getSymbolOfNode(d));
|
|
82084
82122
|
ts.forEach(target.declarations, function (d) {
|
|
82085
|
-
|
|
82123
|
+
result_13 |= getDeclarationSpaces(d);
|
|
82086
82124
|
});
|
|
82087
|
-
return
|
|
82125
|
+
return result_13;
|
|
82088
82126
|
case 254 /* VariableDeclaration */:
|
|
82089
82127
|
case 203 /* BindingElement */:
|
|
82090
82128
|
case 256 /* FunctionDeclaration */:
|
|
@@ -99265,8 +99303,8 @@ var ts;
|
|
|
99265
99303
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
99266
99304
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
99267
99305
|
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
99268
|
-
var
|
|
99269
|
-
return
|
|
99306
|
+
var result_14 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
99307
|
+
return result_14 && factory.createPropertyAssignment("children", result_14);
|
|
99270
99308
|
}
|
|
99271
99309
|
var result = ts.mapDefined(children, transformJsxChildToExpression);
|
|
99272
99310
|
return ts.length(result) ? factory.createPropertyAssignment("children", factory.createArrayLiteralExpression(result)) : undefined;
|
|
@@ -118521,15 +118559,15 @@ var ts;
|
|
|
118521
118559
|
// which per above occurred during the current program creation.
|
|
118522
118560
|
// Since we assume the filesystem does not change during program creation,
|
|
118523
118561
|
// it is safe to reuse resolutions from the earlier call.
|
|
118524
|
-
var
|
|
118562
|
+
var result_15 = [];
|
|
118525
118563
|
var i = 0;
|
|
118526
118564
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
118527
118565
|
var moduleName = moduleNames_1[_i];
|
|
118528
118566
|
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
118529
118567
|
i++;
|
|
118530
|
-
|
|
118568
|
+
result_15.push(resolvedModule);
|
|
118531
118569
|
}
|
|
118532
|
-
return
|
|
118570
|
+
return result_15;
|
|
118533
118571
|
}
|
|
118534
118572
|
// At this point, we know at least one of the following hold:
|
|
118535
118573
|
// - file has local declarations for ambient modules
|
|
@@ -121989,14 +122027,14 @@ var ts;
|
|
|
121989
122027
|
fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
|
|
121990
122028
|
fileInfos_1.push(sourceFile.version);
|
|
121991
122029
|
});
|
|
121992
|
-
var
|
|
122030
|
+
var result_16 = {
|
|
121993
122031
|
fileNames: fileNames_1,
|
|
121994
122032
|
fileInfos: fileInfos_1,
|
|
121995
122033
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
121996
122034
|
outSignature: state.outSignature,
|
|
121997
122035
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
121998
122036
|
};
|
|
121999
|
-
return
|
|
122037
|
+
return result_16;
|
|
122000
122038
|
}
|
|
122001
122039
|
var fileNames = [];
|
|
122002
122040
|
var fileNameToFileId = new ts.Map();
|
|
@@ -123934,9 +123972,9 @@ var ts;
|
|
|
123934
123972
|
if (!preferSymlinks) {
|
|
123935
123973
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
123936
123974
|
// so we only need to remove them from the realpath filenames.
|
|
123937
|
-
var
|
|
123938
|
-
if (
|
|
123939
|
-
return
|
|
123975
|
+
var result_17 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
123976
|
+
if (result_17)
|
|
123977
|
+
return result_17;
|
|
123940
123978
|
}
|
|
123941
123979
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
123942
123980
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -123956,10 +123994,10 @@ var ts;
|
|
|
123956
123994
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
123957
123995
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
123958
123996
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
123959
|
-
var
|
|
123997
|
+
var result_18 = cb(option, target === referenceRedirect);
|
|
123960
123998
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
123961
|
-
if (
|
|
123962
|
-
return
|
|
123999
|
+
if (result_18)
|
|
124000
|
+
return result_18;
|
|
123963
124001
|
}
|
|
123964
124002
|
});
|
|
123965
124003
|
});
|
|
@@ -159745,23 +159783,36 @@ var ts;
|
|
|
159745
159783
|
* @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub.
|
|
159746
159784
|
*/
|
|
159747
159785
|
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) {
|
|
159786
|
+
var _a;
|
|
159748
159787
|
if (preserveOptional === void 0) { preserveOptional = 3 /* All */; }
|
|
159749
159788
|
if (isAmbient === void 0) { isAmbient = false; }
|
|
159750
159789
|
var declarations = symbol.getDeclarations();
|
|
159751
|
-
|
|
159752
|
-
return undefined;
|
|
159753
|
-
}
|
|
159790
|
+
var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0];
|
|
159754
159791
|
var checker = context.program.getTypeChecker();
|
|
159755
159792
|
var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions());
|
|
159756
|
-
|
|
159793
|
+
/**
|
|
159794
|
+
* (#49811)
|
|
159795
|
+
* Note that there are cases in which the symbol declaration is not present. For example, in the code below both
|
|
159796
|
+
* `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type
|
|
159797
|
+
* parent):
|
|
159798
|
+
*
|
|
159799
|
+
* >>> ```ts
|
|
159800
|
+
* >>> type Base = { ax: number; ay: string };
|
|
159801
|
+
* >>> type BaseKeys = keyof Base;
|
|
159802
|
+
* >>> type MappedIndirect = { [K in BaseKeys]: boolean };
|
|
159803
|
+
* >>> ```
|
|
159804
|
+
*
|
|
159805
|
+
* In such cases, we assume the declaration to be a `PropertySignature`.
|
|
159806
|
+
*/
|
|
159807
|
+
var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 166 /* PropertySignature */;
|
|
159757
159808
|
var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false);
|
|
159758
|
-
var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration));
|
|
159809
|
+
var visibilityModifier = createVisibilityModifier(declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* None */);
|
|
159759
159810
|
var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined;
|
|
159760
159811
|
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
159761
159812
|
var optional = !!(symbol.flags & 16777216 /* Optional */);
|
|
159762
159813
|
var ambient = !!(enclosingDeclaration.flags & 16777216 /* Ambient */) || isAmbient;
|
|
159763
159814
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
159764
|
-
switch (
|
|
159815
|
+
switch (kind) {
|
|
159765
159816
|
case 166 /* PropertySignature */:
|
|
159766
159817
|
case 167 /* PropertyDeclaration */:
|
|
159767
159818
|
var flags = quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : undefined;
|
|
@@ -159773,11 +159824,12 @@ var ts;
|
|
|
159773
159824
|
importSymbols(importAdder, importableReference.symbols);
|
|
159774
159825
|
}
|
|
159775
159826
|
}
|
|
159776
|
-
addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* Property */) ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeNode,
|
|
159827
|
+
addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? name : symbol.getName(), optional && (preserveOptional & 2 /* Property */) ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeNode,
|
|
159777
159828
|
/*initializer*/ undefined));
|
|
159778
159829
|
break;
|
|
159779
159830
|
case 172 /* GetAccessor */:
|
|
159780
159831
|
case 173 /* SetAccessor */: {
|
|
159832
|
+
ts.Debug.assertIsDefined(declarations);
|
|
159781
159833
|
var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
|
|
159782
159834
|
var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration);
|
|
159783
159835
|
var orderedAccessors = allAccessors.secondAccessor
|
|
@@ -159813,6 +159865,7 @@ var ts;
|
|
|
159813
159865
|
// If there is more than one overload but no implementation signature
|
|
159814
159866
|
// (eg: an abstract method or interface declaration), there is a 1-1
|
|
159815
159867
|
// correspondence of declarations and signatures.
|
|
159868
|
+
ts.Debug.assertIsDefined(declarations);
|
|
159816
159869
|
var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures();
|
|
159817
159870
|
if (!ts.some(signatures)) {
|
|
159818
159871
|
break;
|
|
@@ -159823,8 +159876,8 @@ var ts;
|
|
|
159823
159876
|
outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference));
|
|
159824
159877
|
break;
|
|
159825
159878
|
}
|
|
159826
|
-
for (var
|
|
159827
|
-
var signature = signatures_1[
|
|
159879
|
+
for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) {
|
|
159880
|
+
var signature = signatures_1[_b];
|
|
159828
159881
|
// Ensure nodes are fresh so they can have different positions when going through formatting.
|
|
159829
159882
|
outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false));
|
|
159830
159883
|
}
|