Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const stateDeclaration = Object.keys(stateDefinitions).map((stateKey) =>
t.classProperty(
t.identifier(stateKey),
ASTUtils.convertValueToLiteral(stateDefinitions[stateKey].defaultValue),
t.tsTypeAnnotation(ASTUtils.getTSAnnotationForType(stateDefinitions[stateKey].type)),
[t.decorator(t.callExpression(t.identifier('State'), []))]
)
)
const dataDeclaration = Object.keys(dataObject).map((dataKey) => {
return t.classProperty(
t.identifier(dataKey),
ASTUtils.convertValueToLiteral(dataObject[dataKey]),
t.tsTypeAnnotation(ASTUtils.getTSAnnotationForType(typeof dataObject[dataKey]))
)
})
return t.classProperty(
t.identifier(propKey),
t.newExpression(t.identifier('EventEmitter'), []),
t.typeAnnotation(
t.genericTypeAnnotation(
t.identifier('EventEmitter'),
t.typeParameterInstantiation([t.anyTypeAnnotation()])
)
),
[t.decorator(t.callExpression(t.identifier('Output'), []))]
)
}
return t.classProperty(
t.identifier(propKey),
ASTUtils.convertValueToLiteral(propDefinitions[propKey].defaultValue),
t.tsTypeAnnotation(ASTUtils.getTSAnnotationForType(propDefinitions[propKey].type)),
[t.decorator(t.callExpression(t.identifier('Input'), []))]
)
})
const propDeclaration = Object.keys(propDefinitions).map((propKey) =>
t.classProperty(
t.identifier(propKey),
ASTUtils.convertValueToLiteral(propDefinitions[propKey].defaultValue),
types.tsTypeAnnotation(ASTUtils.getTSAnnotationForType(propDefinitions[propKey].type)),
[t.decorator(t.callExpression(t.identifier('property'), []))]
)
)