How to use the classProperty function from @babel/types
Find comprehensive JavaScript @babel/types.classProperty code examples handpicked from public code repositorys.
GitHub: startupjs/startupjs
56 57 58 59 60 61 62 63 64 65
fs.unlinkSync(interfaceFile) } if (ExportDefaultDeclaration) { ExportDefaultDeclaration.declaration.body.body.unshift( t.classProperty( t.identifier('schema'), babelParser.parseExpression(JSON.stringify(schema, null, 2)), null, null,
42
91
8
53 54 55 56 57 58 59 60 61 62
if (path.node.left.name === 'config' && !t.isExportDefaultDeclaration(parent)) { ObjectExpression = path.node.right } } }) const ClassProperty = t.classProperty(t.identifier('config'), ObjectExpression) classBody.push(ClassProperty) classBody.push(genConstructor(state)) if (Object.keys(state.props).length) { classBody.push(genPropTypes(state.props));
1
2
1
134 135 136 137 138 139 140 141 142 143
const parent = superClasses ? t.identifier(superClasses.getText()) : null; const body = this.visitChildren(children[children.length - 1]).map( child => { switch (child.type) { case "ExpressionStatement": return t.classProperty(t.identifier(child.expression.name)); case "FunctionDeclaration": const isConstructor = child.id.name === "__init__"; const methodId = isConstructor ? "constructor" : child.id.name; const methodParams = child.params.filter(
0
1
0
@babel/types.identifier is the most popular function in @babel/types (20936 examples)