How to use the classProperty function from babel-types
Find comprehensive JavaScript babel-types.classProperty code examples handpicked from public code repositorys.
39 40 41 42 43 44 45 46 47 48
properties.forEach(property => { const typeAnnotation = property.get('typeAnnotation'); const { name } = property.node.key; const objectExpression = convertWithHandler(typeAnnotation, property); const propsClassProperty = Object.assign( t.classProperty(t.identifier(name), objectExpression), { static: true } ); property.insertAfter(propsClassProperty); });
1
9
2
GitHub: astrocean/taro-cli-2.0.6
374 375 376 377 378 379 380 381 382 383
if (tabBar) { if (!hasComponentWillMount) { node.body.push(t.classMethod('method', t.identifier('componentWillMount'), [], t.blockStatement([initTabbarApiNode]), false, false)); } if (!stateNode) { stateNode = t.classProperty(t.identifier('state'), t.objectExpression([])); node.body.unshift(stateNode); } if (t.isObjectExpression(stateNode.value)) { stateNode.value.properties.push(t.objectProperty(t.identifier(constants_2.tabBarConfigName), tabBar));
0
0
0
+ 11 other calls in file
GitHub: eyasudev/vue-to-react
75 76 77 78 79 80 81 82 83 84 85 86 87
properties.push(t.objectProperty(identifier, val)); } // Babel does't support to create static class property??? return t.classProperty(t.identifier('static propTypes'), t.objectExpression(properties), null, []); }; exports.genDefaultProps = function genDefaultProps (props) { const properties = [];
0
0
0
318 319 320 321 322 323 324 325 326 327
astPath.pushContainer('body', t.classMethod( 'method', t.identifier('componentWillMount'), [], t.blockStatement([]), false, false)) } if (!hasState) { astPath.unshiftContainer('body', t.classProperty( t.identifier('state'), t.objectExpression([]) )) }
0
0
0
+ 7 other calls in file
babel-types.identifier is the most popular function in babel-types (4076 examples)