Fixup TypeScript with export maps #1284

Closed
NickGerleman wants to merge 2 commits from export-D45713689 into main

2 Commits

Author SHA1 Message Date
Nick Gerleman
c1d37fcf69 Fixup TypeScript with export maps (#1284)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1284

This makes TypeScript resolution play nicely with export maps, and converts the entrypoints to TypeScript.

We remove the non-export-map fallbacks as well, so the export maps are always followed.

Tests are moved to load yoga from its external export, testing the entrypoints.

This moves the only untyped bit to the binary wrapper, which another diff will move.

Reviewed By: yungsters

Differential Revision: D45713689

fbshipit-source-id: a255b4faff57d6b579ef86cbcae6f0f5ee0fde1a
2023-05-09 21:36:38 -07:00
Nick Gerleman
aeffaf93a7 Namespaced and TypeScript Enums
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.

Differential Revision: https://internalfb.com/D45570417

fbshipit-source-id: c9c40f4b4dd6cb0c46bc05e558dded39dd299cf0
2023-05-09 21:36:00 -07:00