Skip to content

Commit

Permalink
Add new version vue-property-decorator support
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 committed Jul 30, 2019
1 parent 869b746 commit 283d831
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions server/src/modes/script/componentInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ function getProps(tsModule: T_TypeScript, defaultExportType: ts.Type, checker: t
}

function getClassProps (type: ts.Type) {
const propDecoratorNames = ['Prop', 'Model', 'PropSync'];
const propsSymbols = type.getProperties()
.filter((property) =>
property.valueDeclaration.kind === tsModule.SyntaxKind.PropertyDeclaration &&
property.declarations[0].decorators &&
property.declarations[0].decorators.some((decorator) =>
(decorator.expression as ts.CallExpression).expression.getText() === 'Prop' ||
(decorator.expression as ts.CallExpression).expression.getText() === 'Model'
propDecoratorNames.includes((decorator.expression as ts.CallExpression).expression.getText())
)
);
if (propsSymbols.length === 0) { return undefined; }
Expand Down Expand Up @@ -208,15 +208,14 @@ function getData(tsModule: T_TypeScript, defaultExportType: ts.Type, checker: ts
}

function getClassData (type: ts.Type) {
const noDataDecoratorNames = ['Prop', 'Model', 'Provide', 'ProvideReactive', 'Ref'];
const dataSymbols = type.getProperties()
.filter((property) =>
property.valueDeclaration.kind === tsModule.SyntaxKind.PropertyDeclaration && (
property.declarations[0].decorators === undefined || (
property.declarations[0].decorators &&
!property.declarations[0].decorators.some((decorator) =>
(decorator.expression as ts.CallExpression).expression.getText() === 'Prop' ||
(decorator.expression as ts.CallExpression).expression.getText() === 'Model' ||
(decorator.expression as ts.CallExpression).expression.getText() === 'Inject'
noDataDecoratorNames.includes((decorator.expression as ts.CallExpression).expression.getText())
)
)
) &&
Expand Down

0 comments on commit 283d831

Please sign in to comment.