Don't support float enums

Summary:
Changelog: [General][BREAKING] Don't support 'float' enums in Turbo Modules

- The current implementation of 'float enums' in C++ does not work as invalid results are returned.
- At potential fix could still cause rounding errors when crossing language bounaries, e.g. `4.6` can become `4.5599999942..`
- C++ enum classes don't support float: https://eel.is/c++draft/dcl.enum#2.sentence-4

> The type-specifier-seq of an enum-base shall name an integral type; any cv-qualification is ignored.

Hence removing the feature of `float enums` for now

Reviewed By: NickGerleman

Differential Revision: D52120405

fbshipit-source-id: 3685ad0629e16ff9db424ba67e07d09df6027553
This commit is contained in:
Christoph Purrer
2024-04-30 21:52:09 -07:00
committed by Facebook GitHub Bot
parent 12aef32b82
commit 536edf3726
16 changed files with 75 additions and 323 deletions
@@ -17,11 +17,6 @@ export enum EnumInt {
IB = 42,
}
export enum EnumFloat {
FA = 1.23,
FB = 4.56,
}
export enum EnumNone {
NA,
NB,
@@ -89,7 +84,7 @@ export interface Spec extends TurboModule {
+consumeCustomHostObject: (customHostObject: CustomHostObject) => string;
+getBinaryTreeNode: (arg: BinaryTreeNode) => BinaryTreeNode;
+getGraphNode: (arg: GraphNode) => GraphNode;
+getNumEnum: (arg: EnumInt) => EnumFloat;
+getNumEnum: (arg: EnumInt) => EnumInt;
+getStrEnum: (arg: EnumNone) => EnumStr;
+getMap: (arg: {[key: string]: ?number}) => {[key: string]: ?number};
+getNumber: (arg: number) => number;