!303 fix @Preview with parameter error

Merge pull request !303 from houhaoyu/master
This commit is contained in:
openharmony_ci
2022-03-08 13:12:47 +00:00
committed by Gitee
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ function checkPreview(node: ts.ClassDeclaration) {
let hasPreview: boolean = false;
if (node && node.decorators) {
for (let i = 0; i < node.decorators.length; i++) {
const name: string = node.decorators[i].getText().replace(/\((.|\n)*\)/, '').trim();
const name: string = node.decorators[i].getText().replace(/\([^\(\)]*\)/, '').trim();
if (name === COMPONENT_DECORATOR_PREVIEW) {
hasPreview = true;
break;
+1 -1
View File
@@ -271,7 +271,7 @@ function checkDecorators(node: ts.MissingDeclaration | ts.ExportAssignment, resu
let hasComponentDecorator: boolean = false;
const componentName: string = component.getText();
node.decorators.forEach((element) => {
const name: string = element.getText().replace(/\((.|\n)*\)/, '').trim();
const name: string = element.getText().replace(/\([^\(\)]*\)/, '').trim();
if (INNER_COMPONENT_DECORATORS.has(name)) {
componentCollection.customComponents.add(componentName);
switch (name) {