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: 984e055072f31e7d2e20f4fcb9c929b9356d2a57
This commit is contained in:
Nick Gerleman
2023-05-02 16:44:20 -07:00
committed by Facebook GitHub Bot
parent 3156cb207f
commit d1e7ad4b3a

View File

@@ -65,12 +65,14 @@ export type Config = {
* conformance fix previously disabled by "UseLegacyStretchBehaviour". * conformance fix previously disabled by "UseLegacyStretchBehaviour".
*/ */
setUseLegacyStretchBehaviour(useLegacyStretchBehaviour: boolean): void; setUseLegacyStretchBehaviour(useLegacyStretchBehaviour: boolean): void;
getErrata(): Errata, getErrata(): Errata;
setErrata(errata: Errata): void, setErrata(errata: Errata): void;
useWebDefaults(): boolean; useWebDefaults(): boolean;
setUseWebDefaults(useWebDefaults: boolean): void; setUseWebDefaults(useWebDefaults: boolean): void;
}; };
export type DirtiedFunction = (node: Node) => void;
export type MeasureFunction = ( export type MeasureFunction = (
width: number, width: number,
widthMode: MeasureMode, widthMode: MeasureMode,
@@ -122,6 +124,7 @@ export type Node = {
getWidth(): Value; getWidth(): Value;
insertChild(child: Node, index: number): void; insertChild(child: Node, index: number): void;
isDirty(): boolean; isDirty(): boolean;
isReferenceBaseline(): boolean;
markDirty(): void; markDirty(): void;
removeChild(child: Node): void; removeChild(child: Node): void;
reset(): void; reset(): void;
@@ -140,6 +143,7 @@ export type Node = {
setFlexShrink(flexShrink: number): void; setFlexShrink(flexShrink: number): void;
setFlexWrap(flexWrap: Wrap): void; setFlexWrap(flexWrap: Wrap): void;
setHeight(height: number | "auto" | `${number}%`): void; setHeight(height: number | "auto" | `${number}%`): void;
setIsReferenceBaseline(isReferenceBaseline: boolean): void;
setHeightAuto(): void; setHeightAuto(): void;
setHeightPercent(height: number): void; setHeightPercent(height: number): void;
setJustifyContent(justifyContent: Justify): void; setJustifyContent(justifyContent: Justify): void;
@@ -151,6 +155,7 @@ export type Node = {
setMaxHeightPercent(maxHeight: number): void; setMaxHeightPercent(maxHeight: number): void;
setMaxWidth(maxWidth: number | `${number}%`): void; setMaxWidth(maxWidth: number | `${number}%`): void;
setMaxWidthPercent(maxWidth: number): void; setMaxWidthPercent(maxWidth: number): void;
setDirtiedFunc(dirtiedFunc: DirtiedFunction | null): void;
setMeasureFunc(measureFunc: MeasureFunction | null): void; setMeasureFunc(measureFunc: MeasureFunction | null): void;
setMinHeight(minHeight: number | `${number}%`): void; setMinHeight(minHeight: number | `${number}%`): void;
setMinHeightPercent(minHeight: number): void; setMinHeightPercent(minHeight: number): void;
@@ -165,19 +170,20 @@ export type Node = {
setWidth(width: number | "auto" | `${number}%`): void; setWidth(width: number | "auto" | `${number}%`): void;
setWidthAuto(): void; setWidthAuto(): void;
setWidthPercent(width: number): void; setWidthPercent(width: number): void;
unsetDirtiedFunc(): void;
unsetMeasureFunc(): void; unsetMeasureFunc(): void;
}; };
export type Yoga = { export type Yoga = {
Config: { Config: {
create(): Config; create(): Config;
destroy(config: Config): any; destroy(config: Config): void;
}; };
Node: { Node: {
create(): Node; create(config?: Config): Node;
createDefault(): Node; createDefault(): Node;
createWithConfig(config: Config): Node; createWithConfig(config: Config): Node;
destroy(node: Node): any; destroy(node: Node): void;
}; };
} & typeof YGEnums; } & typeof YGEnums;