Skip to content

Commit

Permalink
Wrap buildPropSchema to pass the right parameters based on @cipolle…
Browse files Browse the repository at this point in the history
…schi's suggestion
  • Loading branch information
ken0nek committed Apr 24, 2023
1 parent 04d2dd1 commit b0912dd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/react-native-codegen/src/parsers/parsers-commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,9 +832,8 @@ type SchemaInfo = {
function buildPropSchema(
property: PropAST,
types: TypeDeclarationMap,
getSchemaInfo: (property: PropAST, types: TypeDeclarationMap) => ?SchemaInfo, // TODO:
getSchemaInfo: (property: PropAST, types: TypeDeclarationMap) => ?SchemaInfo,
getTypeAnnotation: (
// TODO:
name: string,
annotation: $FlowFixMe | ASTNode,
defaultValue: $FlowFixMe | void,
Expand All @@ -849,6 +848,13 @@ function buildPropSchema(
}
const {name, optional, typeAnnotation, defaultValue, withNullDefault} = info;

const wrappedBuildSchema = (
passedProps: PropAST,
passedTypes: TypeDeclarationMap,
): $FlowFixMe => {
buildPropSchema(passedProps, passedTypes, getSchemaInfo, getTypeAnnotation);
};

return {
name,
optional,
Expand All @@ -858,7 +864,7 @@ function buildPropSchema(
defaultValue,
withNullDefault,
types,
buildPropSchema,
wrappedBuildSchema,
),
};
}
Expand Down

0 comments on commit b0912dd

Please sign in to comment.