Namespaced and TypeScript Enums (#1285)

Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1285

Enums are currently exposed to the JS package as constants (e.g. `import {ERRATA_NONE} from 'yoga-layout'`).

This exports enums in the form of `import {Errata} from 'yoga-layout'` then `Errata.None`.

It would be more ergonomic for these to be string union based enums instead, but right now it is a pretty thin wrapper around the native API, we need ordinal values to do things with bit masks, and folks have wanted to serialize them before.

Reviewed By: yungsters

Differential Revision: D45570417

fbshipit-source-id: dbfd330e939051d0c16460a4d2a996f88f98875c
This commit is contained in:
Nick Gerleman
2023-05-09 22:21:01 -07:00
committed by Facebook GitHub Bot
parent aa812d0e48
commit 104646d8ca
7 changed files with 265 additions and 548 deletions

View File

@@ -24,7 +24,7 @@ import type {
Wrap,
} from './generated/YGEnums';
import type * as YGEnums from './generated/YGEnums';
import YGEnums from './generated/YGEnums';
type Layout = {
left: number;