Namespaced and TypeScript Enums #1285

Closed
NickGerleman wants to merge 1 commits from export-D45570417 into main
NickGerleman commented 2023-05-09 21:09:18 -07:00 (Migrated from github.com)

Summary:
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

Summary: 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
facebook-github-bot commented 2023-05-09 21:10:32 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D45570417

This pull request was **exported** from Phabricator. Differential Revision: [D45570417](https://www.internalfb.com/diff/D45570417)
facebook-github-bot commented 2023-05-09 22:24:35 -07:00 (Migrated from github.com)

This pull request has been merged in facebook/yoga@104646d8ca.

This pull request has been merged in facebook/yoga@104646d8ca69456864cab1183db5c6c2aaa5aaf8.

Pull request closed

Sign in to join this conversation.
No description provided.