You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@bem-react/classname: Unclear typing for element-bound class name formatters #636
Problem: the first argument 'Element2' in this call is accepted by types, but has no effect. This makes the type contract unclear. For an element-bound formatter, passing another element name is meaningless: the element is already fixed when the formatter is created and Block-Element-Element can't exist as well.
Suggestion: the two formatter creation patterns should have different return types:
ClassNameFormatter]= for block formatters created by the one-argument form ClassNameElementFormatter- for element-bound formatters created by the two strings
cnBlockElement('Element2',{mod: true});// should be a TypeScript error
Notes:
Not a runtime bug
Bump will be safe since first argument was doing nothing
changed the title [-]Unclear typing for element-bound class name formatters[/-][+]@bem-react/classname: Unclear typing for element-bound class name formatters[/+]on Jun 20, 2026
Activity
rrabmig commentedon Jun 20, 2026
#637 - my solution
[-]Unclear typing for element-bound class name formatters[/-][+]@bem-react/classname: Unclear typing for element-bound class name formatters[/+]