From b958b647d4d8764e5e2603fefa9fa4a7ca46301d Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 2 May 2023 17:56:08 -0700 Subject: [PATCH] TypeScript fixes Summary: 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. Differential Revision: D45506781 fbshipit-source-id: 4fa450d986d5be5ed09849724cc63d1762a0ecbf --- 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;