mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
fix(47562): Add option to suppress type hint if variable name matches type name (#48529)
* fix(47562): Add option to suppress type hint if variable name matches type * Remove the unnecessary debug code * Re-run gulp runtests * Use equateStringsCaseInsensitive to compare strings
This commit is contained in:
7 files changed
+38
-4
No files matched your search
@@ -137,6 +137,10 @@ namespace ts.InlayHints {
|
||||
|
||||
const typeDisplayString = printTypeInSingleLine(declarationType);
|
||||
if (typeDisplayString) {
|
||||
const isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && equateStringsCaseInsensitive(decl.name.getText(), typeDisplayString);
|
||||
if (isVariableNameMatchesType) {
|
||||
return;
|
||||
}
|
||||
addTypeHints(typeDisplayString, decl.name.end);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user