MCPcopy Index your code
hub / github.com/reactjs/react-codemod / createStaticClassProperty

Function createStaticClassProperty

transforms/class.js:1016–1041  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1014 };
1015
1016 const createStaticClassProperty = staticProperty => {
1017 if (staticProperty.value.type === 'FunctionExpression') {
1018 return withComments(j.methodDefinition(
1019 'method',
1020 j.identifier(staticProperty.key.name),
1021 staticProperty.value,
1022 true
1023 ), staticProperty);
1024 }
1025
1026 if (staticProperty.value.type === 'TypeCastExpression') {
1027 return withComments(j.classProperty(
1028 j.identifier(staticProperty.key.name),
1029 staticProperty.value.expression,
1030 staticProperty.value.typeAnnotation,
1031 true
1032 ), staticProperty);
1033 }
1034
1035 return withComments(j.classProperty(
1036 j.identifier(staticProperty.key.name),
1037 staticProperty.value,
1038 null,
1039 true
1040 ), staticProperty);
1041 };
1042
1043 const createStaticClassProperties = statics =>
1044 statics.map(createStaticClassProperty);

Callers

nothing calls this directly

Calls 1

withCommentsFunction · 0.70

Tested by

no test coverage detected