Skip to content

Commit 6432e2c

Browse files
author
Mohsen Azimi
committed
Merge branch 'master' of github.com:lyft/react-javascript-to-typescript-transform into propsOptional
2 parents 23fd00e + d7ee147 commit 6432e2c

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/transforms/react-js-make-props-and-state-transform.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ export function reactJSMakePropsAndStateInterfaceTransformFactoryFactory(typeChe
228228
return result;
229229
}
230230

231+
// Ignore children, React types have it
232+
if (propertyAssignment.name.getText() === 'children') {
233+
return result;
234+
}
235+
231236
const typeValue = getTypeFromReactPropTypeExpression(propertyAssignment.initializer);
232237
const isOptional = isPropTypeOptional(propertyAssignment.initializer);
233238
const propertySignature = ts.createPropertySignature(

test/react-js-make-props-and-state-transform/static-proptypes-many-props/input.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react';
22

33
export default class MyComponent extends React.Component {
44
static propTypes = {
5+
children: React.PropTypes.node,
56
any: React.PropTypes.any,
67
array: React.PropTypes.array,
78
bool: React.PropTypes.bool,
@@ -24,4 +25,4 @@ export default class MyComponent extends React.Component {
2425
render() {
2526
return <div />;
2627
}
27-
}
28+
}

test/react-js-make-props-and-state-transform/static-proptypes-many-props/output.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default class MyComponent extends React.Component<{
2121
elementRequired: JSX.Element;
2222
}, {}> {
2323
static propTypes = {
24+
children: React.PropTypes.node,
2425
any: React.PropTypes.any,
2526
array: React.PropTypes.array,
2627
bool: React.PropTypes.bool,

0 commit comments

Comments
 (0)