From 9fe1e772749d1320cc1a0d9cc06334e502faa1f6 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Fri, 30 Dec 2022 14:21:08 -0800 Subject: [PATCH] Use more specific enums types where previously using number (#1198) Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1198 The Yoga JS bindings converted a previous Flow type directly to TypeScript. The enum types we expose are safer than accepting raw ordinal numbers, and we should replace the places in the typings where an ordinal was accepted instead of the specific type. Reviewed By: cipolleschi Differential Revision: D42265824 fbshipit-source-id: 6adcf24a612e79037fdceab0e9f6e4db09fe3ab2 --- javascript/src_js/wrapAsm.d.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/javascript/src_js/wrapAsm.d.ts b/javascript/src_js/wrapAsm.d.ts index cca5026e..5c434cf5 100644 --- a/javascript/src_js/wrapAsm.d.ts +++ b/javascript/src_js/wrapAsm.d.ts @@ -8,17 +8,19 @@ */ import type { - Edge, - Wrap, Align, + Direction, + Display, + Edge, + ExperimentalFeature, FlexDirection, Gutter, - Direction, - PositionType, - Overflow, Justify, - Display, - ExperimentalFeature, + MeasureMode, + Overflow, + PositionType, + Unit, + Wrap, } from './generated/YGEnums'; import type * as YGEnums from './generated/YGEnums'; @@ -38,7 +40,7 @@ type Size = { } type Value = { - unit: number; + unit: Unit; value: number; } @@ -53,14 +55,14 @@ export type Config = { useLegacyStretchBehaviour(): boolean, setUseLegacyStretchBehaviour(useLegacyStretchBehaviour: boolean): void, useWebDefaults(): boolean, - setUseWebDefaults(useWebDefaults): void, + setUseWebDefaults(useWebDefaults: boolean): void, }; export type MeasureFunction = ( width: number, - widthMode: number, + widthMode: MeasureMode, height: number, - heightMode: number + heightMode: MeasureMode ) => Size; export type Node = {