typescript 4.8.0-dev.20220524 → 4.8.0-dev.20220527
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/protocol.d.ts +1 -0
- package/lib/tsc.js +51 -39
- package/lib/tsserver.js +82 -55
- package/lib/tsserverlibrary.d.ts +2 -0
- package/lib/tsserverlibrary.js +82 -55
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +81 -53
- package/lib/typescriptServices.d.ts +1 -0
- package/lib/typescriptServices.js +81 -53
- package/lib/typingsInstaller.js +74 -51
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220527";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -16412,9 +16412,6 @@ var ts;
|
|
|
16412
16412
|
}
|
|
16413
16413
|
ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
|
|
16414
16414
|
function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
|
|
16415
|
-
if (node.kind === 203 /* BindingElement */) {
|
|
16416
|
-
node = node.parent.parent;
|
|
16417
|
-
}
|
|
16418
16415
|
return ts.isVariableDeclaration(node) &&
|
|
16419
16416
|
!!node.initializer &&
|
|
16420
16417
|
isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, /*requireStringLiteralLikeArgument*/ true);
|
|
@@ -20226,8 +20223,9 @@ var ts;
|
|
|
20226
20223
|
*/
|
|
20227
20224
|
function isFileForcedToBeModuleByFormat(file) {
|
|
20228
20225
|
// Excludes declaration files - they still require an explicit `export {}` or the like
|
|
20229
|
-
// for back compat purposes.
|
|
20230
|
-
|
|
20226
|
+
// for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files
|
|
20227
|
+
// that aren't esm-mode (meaning not in a `type: module` scope).
|
|
20228
|
+
return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) && !file.isDeclarationFile ? true : undefined;
|
|
20231
20229
|
}
|
|
20232
20230
|
function getSetExternalModuleIndicator(options) {
|
|
20233
20231
|
// TODO: Should this callback be cached?
|
|
@@ -20235,7 +20233,7 @@ var ts;
|
|
|
20235
20233
|
case ts.ModuleDetectionKind.Force:
|
|
20236
20234
|
// All non-declaration files are modules, declaration files still do the usual isFileProbablyExternalModule
|
|
20237
20235
|
return function (file) {
|
|
20238
|
-
file.externalModuleIndicator = !file.isDeclarationFile ||
|
|
20236
|
+
file.externalModuleIndicator = ts.isFileProbablyExternalModule(file) || !file.isDeclarationFile || undefined;
|
|
20239
20237
|
};
|
|
20240
20238
|
case ts.ModuleDetectionKind.Legacy:
|
|
20241
20239
|
// Files are modules if they have imports, exports, or import.meta
|
|
@@ -20295,7 +20293,8 @@ var ts;
|
|
|
20295
20293
|
}
|
|
20296
20294
|
ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
|
|
20297
20295
|
function getEmitModuleDetectionKind(options) {
|
|
20298
|
-
return options.moduleDetection ||
|
|
20296
|
+
return options.moduleDetection ||
|
|
20297
|
+
(getEmitModuleKind(options) === ts.ModuleKind.Node16 || getEmitModuleKind(options) === ts.ModuleKind.NodeNext ? ts.ModuleDetectionKind.Force : ts.ModuleDetectionKind.Auto);
|
|
20299
20298
|
}
|
|
20300
20299
|
ts.getEmitModuleDetectionKind = getEmitModuleDetectionKind;
|
|
20301
20300
|
function hasJsonModuleEmitEnabled(options) {
|
|
@@ -42237,7 +42236,7 @@ var ts;
|
|
|
42237
42236
|
}
|
|
42238
42237
|
if (ts.isImplicitGlob(spec.substring(spec.lastIndexOf(ts.directorySeparator) + 1))) {
|
|
42239
42238
|
return {
|
|
42240
|
-
key: useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec),
|
|
42239
|
+
key: ts.removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : ts.toFileNameLowerCase(spec)),
|
|
42241
42240
|
flags: 1 /* Recursive */
|
|
42242
42241
|
};
|
|
42243
42242
|
}
|
|
@@ -43342,16 +43341,20 @@ var ts;
|
|
|
43342
43341
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43343
43342
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43344
43343
|
}
|
|
43344
|
+
var jsOnlyExtensions = [Extensions.JavaScript];
|
|
43345
|
+
var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
|
|
43346
|
+
var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
|
|
43347
|
+
var tsconfigExtensions = [Extensions.TSConfig];
|
|
43345
43348
|
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43346
43349
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
43347
43350
|
// es module file or cjs-like input file, use a variant of the legacy cjs resolver that supports the selected modern features
|
|
43348
43351
|
var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
|
|
43349
|
-
|
|
43352
|
+
var extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions;
|
|
43353
|
+
if (compilerOptions.resolveJsonModule) {
|
|
43354
|
+
extensions = __spreadArray(__spreadArray([], extensions, true), [Extensions.Json], false);
|
|
43355
|
+
}
|
|
43356
|
+
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference);
|
|
43350
43357
|
}
|
|
43351
|
-
var jsOnlyExtensions = [Extensions.JavaScript];
|
|
43352
|
-
var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
|
|
43353
|
-
var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
|
|
43354
|
-
var tsconfigExtensions = [Extensions.TSConfig];
|
|
43355
43358
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
43356
43359
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
43357
43360
|
}
|
|
@@ -47136,12 +47139,14 @@ var ts;
|
|
|
47136
47139
|
}
|
|
47137
47140
|
}
|
|
47138
47141
|
function setCommonJsModuleIndicator(node) {
|
|
47139
|
-
if (file.externalModuleIndicator) {
|
|
47142
|
+
if (file.externalModuleIndicator && file.externalModuleIndicator !== true) {
|
|
47140
47143
|
return false;
|
|
47141
47144
|
}
|
|
47142
47145
|
if (!file.commonJsModuleIndicator) {
|
|
47143
47146
|
file.commonJsModuleIndicator = node;
|
|
47144
|
-
|
|
47147
|
+
if (!file.externalModuleIndicator) {
|
|
47148
|
+
bindSourceFileAsExternalModule();
|
|
47149
|
+
}
|
|
47145
47150
|
}
|
|
47146
47151
|
return true;
|
|
47147
47152
|
}
|
|
@@ -47555,7 +47560,11 @@ var ts;
|
|
|
47555
47560
|
checkStrictModeEvalOrArguments(node, node.name);
|
|
47556
47561
|
}
|
|
47557
47562
|
if (!ts.isBindingPattern(node.name)) {
|
|
47558
|
-
|
|
47563
|
+
var possibleVariableDecl = node.kind === 254 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
47564
|
+
if (ts.isInJSFile(node) &&
|
|
47565
|
+
ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) &&
|
|
47566
|
+
!ts.getJSDocTypeTag(node) &&
|
|
47567
|
+
!(ts.getCombinedModifierFlags(node) & 1 /* Export */)) {
|
|
47559
47568
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
47560
47569
|
}
|
|
47561
47570
|
else if (ts.isBlockOrCatchScoped(node)) {
|
|
@@ -50382,7 +50391,8 @@ var ts;
|
|
|
50382
50391
|
&& isAliasableOrJsExpression(node.parent.right)
|
|
50383
50392
|
|| node.kind === 297 /* ShorthandPropertyAssignment */
|
|
50384
50393
|
|| node.kind === 296 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer)
|
|
50385
|
-
|| ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
|
|
50394
|
+
|| node.kind === 254 /* VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
|
|
50395
|
+
|| node.kind === 203 /* BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent);
|
|
50386
50396
|
}
|
|
50387
50397
|
function isAliasableOrJsExpression(e) {
|
|
50388
50398
|
return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
|
|
@@ -50475,7 +50485,7 @@ var ts;
|
|
|
50475
50485
|
return hasExportAssignmentSymbol(moduleSymbol);
|
|
50476
50486
|
}
|
|
50477
50487
|
// JS files have a synthetic default if they do not contain ES2015+ module syntax (export = is not valid in js) _and_ do not have an __esModule marker
|
|
50478
|
-
return
|
|
50488
|
+
return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
|
|
50479
50489
|
}
|
|
50480
50490
|
function getTargetOfImportClause(node, dontResolveAlias) {
|
|
50481
50491
|
var _a;
|
|
@@ -72490,7 +72500,7 @@ var ts;
|
|
|
72490
72500
|
if (result) {
|
|
72491
72501
|
return result;
|
|
72492
72502
|
}
|
|
72493
|
-
if (!(contextFlags & 8 /* SkipBindingPatterns */) && ts.isBindingPattern(declaration.name)
|
|
72503
|
+
if (!(contextFlags & 8 /* SkipBindingPatterns */) && ts.isBindingPattern(declaration.name) && declaration.name.elements.length > 0) {
|
|
72494
72504
|
return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true, /*reportErrors*/ false);
|
|
72495
72505
|
}
|
|
72496
72506
|
}
|
|
@@ -72959,22 +72969,20 @@ var ts;
|
|
|
72959
72969
|
var inferenceContext = getInferenceContext(node);
|
|
72960
72970
|
// If no inferences have been made, nothing is gained from instantiating as type parameters
|
|
72961
72971
|
// would just be replaced with their defaults similar to the apparent type.
|
|
72962
|
-
if (inferenceContext && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
|
|
72972
|
+
if (inferenceContext && contextFlags & 1 /* Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
|
|
72963
72973
|
// For contextual signatures we incorporate all inferences made so far, e.g. from return
|
|
72964
72974
|
// types as well as arguments to the left in a function call.
|
|
72965
|
-
|
|
72966
|
-
|
|
72967
|
-
|
|
72975
|
+
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
72976
|
+
}
|
|
72977
|
+
if (inferenceContext === null || inferenceContext === void 0 ? void 0 : inferenceContext.returnMapper) {
|
|
72968
72978
|
// For other purposes (e.g. determining whether to produce literal types) we only
|
|
72969
72979
|
// incorporate inferences made from the return type in a function call. We remove
|
|
72970
72980
|
// the 'boolean' type from the contextual type such that contextually typed boolean
|
|
72971
72981
|
// literals actually end up widening to 'boolean' (see #48363).
|
|
72972
|
-
|
|
72973
|
-
|
|
72974
|
-
|
|
72975
|
-
|
|
72976
|
-
type;
|
|
72977
|
-
}
|
|
72982
|
+
var type = instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
|
|
72983
|
+
return type.flags & 1048576 /* Union */ && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ?
|
|
72984
|
+
filterType(type, function (t) { return t !== regularFalseType && t !== regularTrueType; }) :
|
|
72985
|
+
type;
|
|
72978
72986
|
}
|
|
72979
72987
|
}
|
|
72980
72988
|
return contextualType;
|
|
@@ -75508,29 +75516,43 @@ var ts;
|
|
|
75508
75516
|
// 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the
|
|
75509
75517
|
// return type of 'wrap'.
|
|
75510
75518
|
if (node.kind !== 165 /* Decorator */) {
|
|
75511
|
-
var
|
|
75519
|
+
var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); });
|
|
75520
|
+
var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* SkipBindingPatterns */ : 0 /* None */);
|
|
75512
75521
|
if (contextualType) {
|
|
75513
75522
|
var inferenceTargetType = getReturnTypeOfSignature(signature);
|
|
75514
75523
|
if (couldContainTypeVariables(inferenceTargetType)) {
|
|
75515
|
-
// We clone the inference context to avoid disturbing a resolution in progress for an
|
|
75516
|
-
// outer call expression. Effectively we just want a snapshot of whatever has been
|
|
75517
|
-
// inferred for any outer call expression so far.
|
|
75518
75524
|
var outerContext = getInferenceContext(node);
|
|
75519
|
-
var
|
|
75520
|
-
|
|
75521
|
-
//
|
|
75522
|
-
//
|
|
75523
|
-
//
|
|
75524
|
-
//
|
|
75525
|
-
// declare function
|
|
75526
|
-
// const
|
|
75527
|
-
//
|
|
75528
|
-
|
|
75529
|
-
|
|
75530
|
-
|
|
75531
|
-
|
|
75532
|
-
|
|
75533
|
-
|
|
75525
|
+
var isFromBindingPattern = !skipBindingPatterns && getContextualType(node, 8 /* SkipBindingPatterns */) !== contextualType;
|
|
75526
|
+
// A return type inference from a binding pattern can be used in instantiating the contextual
|
|
75527
|
+
// type of an argument later in inference, but cannot stand on its own as the final return type.
|
|
75528
|
+
// It is incorporated into `context.returnMapper` which is used in `instantiateContextualType`,
|
|
75529
|
+
// but doesn't need to go into `context.inferences`. This allows a an array binding pattern to
|
|
75530
|
+
// produce a tuple for `T` in
|
|
75531
|
+
// declare function f<T>(cb: () => T): T;
|
|
75532
|
+
// const [e1, e2, e3] = f(() => [1, "hi", true]);
|
|
75533
|
+
// but does not produce any inference for `T` in
|
|
75534
|
+
// declare function f<T>(): T;
|
|
75535
|
+
// const [e1, e2, e3] = f();
|
|
75536
|
+
if (!isFromBindingPattern) {
|
|
75537
|
+
// We clone the inference context to avoid disturbing a resolution in progress for an
|
|
75538
|
+
// outer call expression. Effectively we just want a snapshot of whatever has been
|
|
75539
|
+
// inferred for any outer call expression so far.
|
|
75540
|
+
var outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
|
|
75541
|
+
var instantiatedType = instantiateType(contextualType, outerMapper);
|
|
75542
|
+
// If the contextual type is a generic function type with a single call signature, we
|
|
75543
|
+
// instantiate the type with its own type parameters and type arguments. This ensures that
|
|
75544
|
+
// the type parameters are not erased to type any during type inference such that they can
|
|
75545
|
+
// be inferred as actual types from the contextual type. For example:
|
|
75546
|
+
// declare function arrayMap<T, U>(f: (x: T) => U): (a: T[]) => U[];
|
|
75547
|
+
// const boxElements: <A>(a: A[]) => { value: A }[] = arrayMap(value => ({ value }));
|
|
75548
|
+
// Above, the type of the 'value' parameter is inferred to be 'A'.
|
|
75549
|
+
var contextualSignature = getSingleCallSignature(instantiatedType);
|
|
75550
|
+
var inferenceSourceType = contextualSignature && contextualSignature.typeParameters ?
|
|
75551
|
+
getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
|
|
75552
|
+
instantiatedType;
|
|
75553
|
+
// Inferences made from return types have lower priority than all other inferences.
|
|
75554
|
+
inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
|
|
75555
|
+
}
|
|
75534
75556
|
// Create a type mapper for instantiating generic contextual types using the inferences made
|
|
75535
75557
|
// from the return type. We need a separate inference pass here because (a) instantiation of
|
|
75536
75558
|
// the source type uses the outer context's return mapper (which excludes inferences made from
|
|
@@ -82646,7 +82668,7 @@ var ts;
|
|
|
82646
82668
|
}
|
|
82647
82669
|
// For a commonjs `const x = require`, validate the alias and exit
|
|
82648
82670
|
var symbol = getSymbolOfNode(node);
|
|
82649
|
-
if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
|
|
82671
|
+
if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* BindingElement */ ? node.parent.parent : node)) {
|
|
82650
82672
|
checkAliasSymbol(node);
|
|
82651
82673
|
return;
|
|
82652
82674
|
}
|
|
@@ -107455,7 +107477,7 @@ var ts;
|
|
|
107455
107477
|
// Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call
|
|
107456
107478
|
// To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url`
|
|
107457
107479
|
// is available, just because the output is reasonable for a node-like runtime.
|
|
107458
|
-
return ts.
|
|
107480
|
+
return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined;
|
|
107459
107481
|
case 271 /* ExportAssignment */:
|
|
107460
107482
|
return visitExportAssignment(node);
|
|
107461
107483
|
case 272 /* ExportDeclaration */:
|
|
@@ -123829,6 +123851,7 @@ var ts;
|
|
|
123829
123851
|
}
|
|
123830
123852
|
function reloadFileNamesFromConfigFile() {
|
|
123831
123853
|
writeLog("Reloading new file names and options");
|
|
123854
|
+
reloadLevel = ts.ConfigFileProgramReloadLevel.None;
|
|
123832
123855
|
rootFileNames = ts.getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
|
|
123833
123856
|
if (ts.updateErrorForNoInputFiles(rootFileNames, ts.getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
|
|
123834
123857
|
hasChangedConfigFileParsingErrors = true;
|
|
@@ -135309,6 +135332,7 @@ var ts;
|
|
|
135309
135332
|
return kind === 131 /* AsyncKeyword */
|
|
135310
135333
|
|| kind === 132 /* AwaitKeyword */
|
|
135311
135334
|
|| kind === 127 /* AsKeyword */
|
|
135335
|
+
|| kind === 152 /* TypeKeyword */
|
|
135312
135336
|
|| !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
|
|
135313
135337
|
}
|
|
135314
135338
|
function keywordForNode(node) {
|
|
@@ -136925,7 +136949,7 @@ var ts;
|
|
|
136925
136949
|
ts.Debug.assert(parent.name === node);
|
|
136926
136950
|
return true;
|
|
136927
136951
|
case 203 /* BindingElement */:
|
|
136928
|
-
return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent);
|
|
136952
|
+
return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent);
|
|
136929
136953
|
default:
|
|
136930
136954
|
return false;
|
|
136931
136955
|
}
|
|
@@ -138391,7 +138415,7 @@ var ts;
|
|
|
138391
138415
|
// Use the parent symbol if the location is commonjs require syntax on javascript files only.
|
|
138392
138416
|
if (ts.isInJSFile(referenceLocation)
|
|
138393
138417
|
&& referenceLocation.parent.kind === 203 /* BindingElement */
|
|
138394
|
-
&& ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent)) {
|
|
138418
|
+
&& ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) {
|
|
138395
138419
|
referenceSymbol = referenceLocation.parent.symbol;
|
|
138396
138420
|
// The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In
|
|
138397
138421
|
// this case, just skip it, since the bound identifiers are not an alias of the import.
|
|
@@ -144563,6 +144587,10 @@ var ts;
|
|
|
144563
144587
|
}
|
|
144564
144588
|
var typeDisplayString = printTypeInSingleLine(declarationType);
|
|
144565
144589
|
if (typeDisplayString) {
|
|
144590
|
+
var isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && ts.equateStringsCaseInsensitive(decl.name.getText(), typeDisplayString);
|
|
144591
|
+
if (isVariableNameMatchesType) {
|
|
144592
|
+
return;
|
|
144593
|
+
}
|
|
144566
144594
|
addTypeHints(typeDisplayString, decl.name.end);
|
|
144567
144595
|
}
|
|
144568
144596
|
}
|
|
@@ -175253,8 +175281,7 @@ var ts;
|
|
|
175253
175281
|
// it easier for the caller to skip post-processing.
|
|
175254
175282
|
if (searchedProjects.size === 1) {
|
|
175255
175283
|
var it = resultsMap.values().next();
|
|
175256
|
-
|
|
175257
|
-
return it.value;
|
|
175284
|
+
return it.done ? server.emptyArray : it.value; // There may not be any results at all
|
|
175258
175285
|
}
|
|
175259
175286
|
return resultsMap;
|
|
175260
175287
|
// May enqueue to otherPositionQueue
|
package/lib/typescript.d.ts
CHANGED
|
@@ -4120,6 +4120,7 @@ declare namespace ts {
|
|
|
4120
4120
|
readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean;
|
|
4121
4121
|
readonly includeInlayFunctionParameterTypeHints?: boolean;
|
|
4122
4122
|
readonly includeInlayVariableTypeHints?: boolean;
|
|
4123
|
+
readonly includeInlayVariableTypeHintsWhenTypeMatchesName?: boolean;
|
|
4123
4124
|
readonly includeInlayPropertyDeclarationTypeHints?: boolean;
|
|
4124
4125
|
readonly includeInlayFunctionLikeReturnTypeHints?: boolean;
|
|
4125
4126
|
readonly includeInlayEnumMemberValueHints?: boolean;
|