From f3633a256bcb95b17781b2b2f4100c5947a62555 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Wed, 3 May 2023 16:11:20 -0700 Subject: [PATCH] TypeScript fixes (#1275) Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1275 A pending change revamps a lot of how ESLint, Prettier, and Jest are configured in the repo, along with moving the world to TypeScript (and adding tsc usage). That still needs some work to split up, but this change adds types used in our unit tests that I found were missing. Reviewed By: yungsters Differential Revision: D45506781 fbshipit-source-id: c4c5cb3aeff95f16bd54121e2ca0e042b6429ba0 --- javascript/src_js/wrapAsm.d.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/javascript/src_js/wrapAsm.d.ts b/javascript/src_js/wrapAsm.d.ts index 022ac5f3..179923e8 100644 --- a/javascript/src_js/wrapAsm.d.ts +++ b/javascript/src_js/wrapAsm.d.ts @@ -65,12 +65,14 @@ export type Config = { * conformance fix previously disabled by "UseLegacyStretchBehaviour". */ setUseLegacyStretchBehaviour(useLegacyStretchBehaviour: boolean): void; - getErrata(): Errata, - setErrata(errata: Errata): void, + getErrata(): Errata; + setErrata(errata: Errata): void; useWebDefaults(): boolean; setUseWebDefaults(useWebDefaults: boolean): void; }; +export type DirtiedFunction = (node: Node) => void; + export type MeasureFunction = ( width: number, widthMode: MeasureMode, @@ -122,6 +124,7 @@ export type Node = { getWidth(): Value; insertChild(child: Node, index: number): void; isDirty(): boolean; + isReferenceBaseline(): boolean; markDirty(): void; removeChild(child: Node): void; reset(): void; @@ -140,6 +143,7 @@ export type Node = { setFlexShrink(flexShrink: number): void; setFlexWrap(flexWrap: Wrap): void; setHeight(height: number | "auto" | `${number}%`): void; + setIsReferenceBaseline(isReferenceBaseline: boolean): void; setHeightAuto(): void; setHeightPercent(height: number): void; setJustifyContent(justifyContent: Justify): void; @@ -151,6 +155,7 @@ export type Node = { setMaxHeightPercent(maxHeight: number): void; setMaxWidth(maxWidth: number | `${number}%`): void; setMaxWidthPercent(maxWidth: number): void; + setDirtiedFunc(dirtiedFunc: DirtiedFunction | null): void; setMeasureFunc(measureFunc: MeasureFunction | null): void; setMinHeight(minHeight: number | `${number}%`): void; setMinHeightPercent(minHeight: number): void; @@ -165,19 +170,20 @@ export type Node = { setWidth(width: number | "auto" | `${number}%`): void; setWidthAuto(): void; setWidthPercent(width: number): void; + unsetDirtiedFunc(): void; unsetMeasureFunc(): void; }; export type Yoga = { Config: { create(): Config; - destroy(config: Config): any; + destroy(config: Config): void; }; Node: { - create(): Node; + create(config?: Config): Node; createDefault(): Node; createWithConfig(config: Config): Node; - destroy(node: Node): any; + destroy(node: Node): void; }; } & typeof YGEnums;