Skip to content

Commit ac87e82

Browse files
committed
inline local functions
1 parent ddfab96 commit ac87e82

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24884,13 +24884,10 @@ namespace ts {
2488424884
function getSuggestedSymbolForNonexistentJSXAttribute(name: Identifier | PrivateIdentifier | string, containingType: Type): Symbol | undefined {
2488524885
const strName = isString(name) ? name : idText(name);
2488624886
const properties = getPropertiesOfType(containingType);
24887-
const defaultSuggestion = () => getSpellingSuggestionForName(strName, properties, SymbolFlags.Value);
24888-
const getCandidate = (expectedName: string) => properties.find(x => symbolName(x) === expectedName);
24889-
switch (strName) {
24890-
case "for": return getCandidate("htmlFor") || defaultSuggestion();
24891-
case "class": return getCandidate("className") || defaultSuggestion();
24892-
}
24893-
return defaultSuggestion();
24887+
const jsxSpecific = strName === "for" ? properties.find(x => symbolName(x) === "htmlFor")
24888+
: strName === "class" ? properties.find(x => symbolName(x) === "className")
24889+
: undefined;
24890+
return jsxSpecific ?? getSpellingSuggestionForName(strName, properties, SymbolFlags.Value);
2489424891
}
2489524892

2489624893
function getSuggestionForNonexistentProperty(name: Identifier | PrivateIdentifier | string, containingType: Type): string | undefined {

0 commit comments

Comments
 (0)