diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index 2da586b..79e6a03 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -1181,7 +1181,9 @@ function traverseStateStylesAttr(temp: any, statements: ts.Statement[], bindComponentAttr(ts.factory.createExpressionStatement( item.initializer.properties[0].initializer), identifierNode, statements, log, false, true); } else { - validateStateStyleSyntax(item, temp, log); + if (!(ts.isObjectLiteralExpression(item.initializer) && item.initializer.properties.length === 0)) { + validateStateStyleSyntax(temp, log); + } } if (item.name) { statements.push(createViewStackProcessor(item, false)); @@ -1367,14 +1369,12 @@ function getComponentType(node: ts.ExpressionStatement, log: LogInfo[], return null; } -export function validateStateStyleSyntax(item: ts.PropertyAssignment, temp: any, log: LogInfo[]): void { - if (!(ts.isObjectLiteralExpression(item.initializer) && item.initializer.properties.length === 0)) { - log.push({ - type: LogType.ERROR, - message: `.stateStyles doesn't conform standard.`, - pos: temp.getStart() - }); - } +export function validateStateStyleSyntax(temp: any, log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: `.stateStyles doesn't conform standard.`, + pos: temp.getStart() + }); } function getEtsComponentExpression(node:ts.ExpressionStatement): ts.EtsComponentExpression {