@react-native/codegen
Advanced tools
@@ -29,2 +29,6 @@ /** | ||
| export interface NumberTypeAnnotation { | ||
| readonly type: 'NumberTypeAnnotation'; | ||
| } | ||
| export interface BooleanTypeAnnotation { | ||
@@ -46,2 +50,7 @@ readonly type: 'BooleanTypeAnnotation'; | ||
| export interface BooleanLiteralTypeAnnotation { | ||
| readonly type: 'BooleanLiteralTypeAnnotation'; | ||
| readonly value: boolean; | ||
| } | ||
| export interface ObjectTypeAnnotation<T> { | ||
@@ -54,2 +63,7 @@ readonly type: 'ObjectTypeAnnotation'; | ||
| export interface UnionTypeAnnotation<T> { | ||
| readonly type: 'UnionTypeAnnotation'; | ||
| readonly types: readonly T[]; | ||
| } | ||
| export interface MixedTypeAnnotation { | ||
@@ -296,3 +310,3 @@ readonly type: 'MixedTypeAnnotation'; | ||
| export interface NativeModuleNumberLiteralTypeAnnotation { | ||
| export interface NumberLiteralTypeAnnotation { | ||
| readonly type: 'NumberLiteralTypeAnnotation'; | ||
@@ -306,3 +320,3 @@ readonly value: number; | ||
| export interface NativeModuleStringLiteralTypeAnnotation { | ||
| export interface StringLiteralTypeAnnotation { | ||
| readonly type: 'StringLiteralTypeAnnotation'; | ||
@@ -314,3 +328,3 @@ readonly value: string; | ||
| readonly type: 'StringLiteralUnionTypeAnnotation'; | ||
| readonly types: NativeModuleStringLiteralTypeAnnotation[]; | ||
| readonly types: StringLiteralTypeAnnotation[]; | ||
| } | ||
@@ -340,3 +354,3 @@ | ||
| readonly name: string; | ||
| readonly value: NativeModuleStringLiteralTypeAnnotation | NativeModuleNumberLiteralTypeAnnotation, | ||
| readonly value: StringLiteralTypeAnnotation | NumberLiteralTypeAnnotation, | ||
| }; | ||
@@ -384,2 +398,11 @@ | ||
| export type NativeModuleUnionTypeAnnotationMemberType = | ||
| | NativeModuleObjectTypeAnnotation | ||
| | StringLiteralTypeAnnotation | ||
| | NumberLiteralTypeAnnotation | ||
| | BooleanLiteralTypeAnnotation | ||
| | BooleanTypeAnnotation | ||
| | StringTypeAnnotation | ||
| | NumberTypeAnnotation; | ||
| export interface NativeModuleUnionTypeAnnotation { | ||
@@ -400,5 +423,6 @@ readonly type: 'UnionTypeAnnotation'; | ||
| | NativeModuleNumberTypeAnnotation | ||
| | NativeModuleNumberLiteralTypeAnnotation | ||
| | NumberLiteralTypeAnnotation | ||
| | BooleanLiteralTypeAnnotation | ||
| | NativeModuleStringTypeAnnotation | ||
| | NativeModuleStringLiteralTypeAnnotation | ||
| | StringLiteralTypeAnnotation | ||
| | StringLiteralUnionTypeAnnotation | ||
@@ -415,6 +439,7 @@ | NativeModuleTypeAliasTypeAnnotation | ||
| NativeModuleStringTypeAnnotation | ||
| | NativeModuleStringLiteralTypeAnnotation | ||
| | StringLiteralTypeAnnotation | ||
| | StringLiteralUnionTypeAnnotation | ||
| | NativeModuleNumberTypeAnnotation | ||
| | NativeModuleNumberLiteralTypeAnnotation | ||
| | NumberLiteralTypeAnnotation | ||
| | BooleanLiteralTypeAnnotation | ||
| | NativeModuleInt32TypeAnnotation | ||
@@ -421,0 +446,0 @@ | NativeModuleDoubleTypeAnnotation |
@@ -67,2 +67,4 @@ /** | ||
| return wrap(val => `${val}.asBool()`); | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return wrap(val => `${val}.asBool()`); | ||
| case 'EnumDeclaration': | ||
@@ -219,2 +221,4 @@ switch (realTypeAnnotation.memberType) { | ||
| return wrapOptional('bool', isRequired); | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return wrapOptional('bool', isRequired); | ||
| case 'EnumDeclaration': | ||
@@ -221,0 +225,0 @@ switch (realTypeAnnotation.memberType) { |
@@ -91,2 +91,3 @@ /** | ||
| case 'BooleanTypeAnnotation': | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return 'boolean'; | ||
@@ -161,2 +162,4 @@ case 'GenericObjectTypeAnnotation': | ||
| return wrapOptional('boolean', isRequired); | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return wrapOptional('boolean', isRequired); | ||
| case 'EnumDeclaration': | ||
@@ -253,2 +256,4 @@ switch (realTypeAnnotation.memberType) { | ||
| return wrapOptional('boolean', isRequired); | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return wrapOptional('boolean', isRequired); | ||
| case 'EnumDeclaration': | ||
@@ -328,2 +333,4 @@ switch (realTypeAnnotation.memberType) { | ||
| return nullable ? 'return null;' : 'return false;'; | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return nullable ? 'return null;' : 'return false;'; | ||
| case 'EnumDeclaration': | ||
@@ -330,0 +337,0 @@ switch (realTypeAnnotation.memberType) { |
@@ -112,2 +112,4 @@ /** | ||
| return 'BooleanKind'; | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return 'BooleanKind'; | ||
| case 'EnumDeclaration': | ||
@@ -189,2 +191,4 @@ switch (typeAnnotation.memberType) { | ||
| return !isRequired ? 'Ljava/lang/Boolean;' : 'Z'; | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return !isRequired ? 'Ljava/lang/Boolean;' : 'Z'; | ||
| case 'EnumDeclaration': | ||
@@ -266,2 +270,4 @@ switch (typeAnnotation.memberType) { | ||
| return nullable ? 'Ljava/lang/Boolean;' : 'Z'; | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return nullable ? 'Ljava/lang/Boolean;' : 'Z'; | ||
| case 'EnumDeclaration': | ||
@@ -268,0 +274,0 @@ switch (typeAnnotation.memberType) { |
@@ -97,2 +97,4 @@ /** | ||
| return wrapCxxOptional('bool', isRequired); | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return wrapCxxOptional('bool', isRequired); | ||
| case 'EnumDeclaration': | ||
@@ -176,2 +178,4 @@ switch (typeAnnotation.memberType) { | ||
| return wrapPrimitive('BOOL'); | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return wrapPrimitive('BOOL'); | ||
| case 'EnumDeclaration': | ||
@@ -178,0 +182,0 @@ switch (typeAnnotation.memberType) { |
@@ -85,2 +85,4 @@ /** | ||
| return wrapCxxOptional('bool', isRequired); | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return wrapCxxOptional('bool', isRequired); | ||
| case 'EnumDeclaration': | ||
@@ -165,2 +167,4 @@ switch (typeAnnotation.memberType) { | ||
| return RCTBridgingTo('Bool'); | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return RCTBridgingTo('Bool'); | ||
| case 'EnumDeclaration': | ||
@@ -167,0 +171,0 @@ switch (typeAnnotation.memberType) { |
@@ -25,2 +25,3 @@ /** | ||
| case 'BooleanTypeAnnotation': | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return 'BOOL'; | ||
@@ -27,0 +28,0 @@ case 'GenericObjectTypeAnnotation': |
@@ -227,2 +227,4 @@ /** | ||
| return notStruct(isRequired ? 'BOOL' : 'NSNumber *'); | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return notStruct(isRequired ? 'BOOL' : 'NSNumber *'); | ||
| case 'EnumDeclaration': | ||
@@ -302,2 +304,4 @@ switch (typeAnnotation.memberType) { | ||
| return wrapOptional('NSNumber *', isRequired); | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return wrapOptional('NSNumber *', isRequired); | ||
| case 'EnumDeclaration': | ||
@@ -371,2 +375,4 @@ switch (typeAnnotation.memberType) { | ||
| return 'BooleanKind'; | ||
| case 'BooleanLiteralTypeAnnotation': | ||
| return 'BooleanKind'; | ||
| case 'GenericObjectTypeAnnotation': | ||
@@ -373,0 +379,0 @@ return 'ObjectKind'; |
@@ -27,2 +27,3 @@ /** | ||
| emitArrayType, | ||
| emitBooleanLiteral, | ||
| emitCommonTypes, | ||
@@ -228,2 +229,5 @@ emitDictionary, | ||
| } | ||
| case 'BooleanLiteralTypeAnnotation': { | ||
| return emitBooleanLiteral(nullable, typeAnnotation.value); | ||
| } | ||
| case 'StringLiteralTypeAnnotation': { | ||
@@ -230,0 +234,0 @@ return wrapNullable(nullable, { |
@@ -121,2 +121,8 @@ /** | ||
| } | ||
| function emitBooleanLiteral(nullable, value) { | ||
| return wrapNullable(nullable, { | ||
| type: 'BooleanLiteralTypeAnnotation', | ||
| value, | ||
| }); | ||
| } | ||
| function emitString(nullable) { | ||
@@ -617,2 +623,3 @@ return wrapNullable(nullable, { | ||
| emitBoolean, | ||
| emitBooleanLiteral, | ||
| emitBoolProp, | ||
@@ -619,0 +626,0 @@ emitDouble, |
@@ -22,2 +22,3 @@ /** | ||
| emitArrayType, | ||
| emitBooleanLiteral, | ||
| emitCommonTypes, | ||
@@ -394,2 +395,5 @@ emitDictionary, | ||
| } | ||
| case 'BooleanLiteral': { | ||
| return emitBooleanLiteral(nullable, literal.value); | ||
| } | ||
| default: { | ||
@@ -396,0 +400,0 @@ throw new UnsupportedTypeAnnotationParserError( |
+1
-1
| { | ||
| "name": "@react-native/codegen", | ||
| "version": "0.84.0-nightly-20251120-88447cf20", | ||
| "version": "0.84.0-nightly-20251121-2bbb104a4", | ||
| "description": "Code generation tools for React Native", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1094350
0.46%16783
0.41%