From 8e7248d523ab8caee8d403a0debb46270323f15f Mon Sep 17 00:00:00 2001 From: Federico Brigante Date: Tue, 3 Dec 2019 01:46:10 +0700 Subject: [PATCH] @types/react: Mark booleanish HTML/SVG JSX attributes as such (#40658) * Mark booleanish HTML/SVG JSX attributes as such * Extend `contentEditable` and `focusable` types --- types/react/index.d.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 2aa7ee5a52..d277c7e07f 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -45,6 +45,7 @@ type NativePointerEvent = PointerEvent; type NativeTransitionEvent = TransitionEvent; type NativeUIEvent = UIEvent; type NativeWheelEvent = WheelEvent; +type Booleanish = boolean | 'true' | 'false'; /** * defined in scheduler/tracing @@ -1656,16 +1657,16 @@ declare namespace React { // Standard HTML Attributes accessKey?: string; className?: string; - contentEditable?: boolean; + contentEditable?: Booleanish | "inherit"; contextMenu?: string; dir?: string; - draggable?: boolean; + draggable?: Booleanish; hidden?: boolean; id?: string; lang?: string; placeholder?: string; slot?: string; - spellCheck?: boolean; + spellCheck?: Booleanish; style?: CSSProperties; tabIndex?: number; title?: string; @@ -2272,7 +2273,7 @@ declare namespace React { ascent?: number | string; attributeName?: string; attributeType?: string; - autoReverse?: number | string; + autoReverse?: Booleanish; azimuth?: number | string; baseFrequency?: number | string; baselineShift?: number | string; @@ -2312,7 +2313,7 @@ declare namespace React { enableBackground?: number | string; end?: number | string; exponent?: number | string; - externalResourcesRequired?: number | string; + externalResourcesRequired?: Booleanish; fill?: string; fillOpacity?: number | string; fillRule?: "nonzero" | "evenodd" | "inherit"; @@ -2321,7 +2322,7 @@ declare namespace React { filterUnits?: number | string; floodColor?: number | string; floodOpacity?: number | string; - focusable?: number | string; + focusable?: Booleanish | "auto"; fontFamily?: string; fontSize?: number | string; fontSizeAdjust?: number | string; @@ -2399,7 +2400,7 @@ declare namespace React { pointsAtX?: number | string; pointsAtY?: number | string; pointsAtZ?: number | string; - preserveAlpha?: number | string; + preserveAlpha?: Booleanish; preserveAspectRatio?: string; primitiveUnits?: number | string; r?: number | string;