diff --git a/packages/core/core.ts b/packages/core/core.ts index 4a61922c..be0b4ece 100644 --- a/packages/core/core.ts +++ b/packages/core/core.ts @@ -169,6 +169,19 @@ export type Composition = >( function composeSimple(mods: any[]) { const { __blockName } = mods[0] + + for (const mod of mods) { + if (mod.__blockName !== __blockName) { + console.error( + new Error( + '[bem-react] composeSimple: all modifiers must belong to the same block. ' + + `Expected "${__blockName}", got "${mod.__blockName}" for modifier "${mod.__mod}". ` + + 'The modifier will be applied incorrectly.', + ), + ) + } + } + const allMods: Record = {} const allModsPassProps: Record = {}