mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-03-16 06:28:12 -05: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:
@@ -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