Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function findEventArgumentsAndType(
: null;
if (
typeAnnotation.typeParameters.params[0].type ===
'NullLiteralTypeAnnotation'
parser.nullLiteralTypeAnnotation
) {
return {
argumentProps: [],
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-codegen/src/parsers/flow/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const {
class FlowParser implements Parser {
typeParameterInstantiation: string = 'TypeParameterInstantiation';

nullLiteralTypeAnnotation: string = 'NullLiteralTypeAnnotation';

isProperty(property: $FlowFixMe): boolean {
return property.type === 'ObjectTypeProperty';
}
Expand Down
5 changes: 5 additions & 0 deletions packages/react-native-codegen/src/parsers/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ export interface Parser {
*/
typeParameterInstantiation: string;

/**
* This is the NullLiteralTypeAnnotation value
*/
nullLiteralTypeAnnotation: string;

/**
* Given a declaration, it returns true if it is a property
*/
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-codegen/src/parsers/parserMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const schemaMock = {
export class MockedParser implements Parser {
typeParameterInstantiation: string = 'TypeParameterInstantiation';

nullLiteralTypeAnnotation: string = 'NullLiteralTypeAnnotation';

isProperty(property: $FlowFixMe): boolean {
return property.type === 'ObjectTypeProperty';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function findEventArgumentsAndType(
: null;

switch (typeAnnotation.typeParameters.params[0].type) {
case 'TSNullKeyword':
case parser.nullLiteralTypeAnnotation:
case 'TSUndefinedKeyword':
return {
argumentProps: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const {
class TypeScriptParser implements Parser {
typeParameterInstantiation: string = 'TSTypeParameterInstantiation';

nullLiteralTypeAnnotation: string = 'TSNullKeyword';

isProperty(property: $FlowFixMe): boolean {
return property.type === 'TSPropertySignature';
}
Expand Down