From 7d0beb4825399f1c746bd580b5efa963fb1f314b Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Sat, 19 Sep 2015 17:28:49 -0700 Subject: [PATCH] Make a generic base version of HTMLAttributes and DOMAttributes to allow for components that pass all remaining properties to an underlying HTML element. --- react/react.d.ts | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/react/react.d.ts b/react/react.d.ts index 54d13d5eb2..8d5b621e01 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -336,7 +336,7 @@ declare namespace __React { ref?: string | ((component: T) => any); } - interface DOMAttributes extends Props> { + interface DOMAttributesBase extends Props { onCopy?: ClipboardEventHandler; onCut?: ClipboardEventHandler; onPaste?: ClipboardEventHandler; @@ -377,6 +377,9 @@ declare namespace __React { }; } + interface DOMAttributes extends DOMAttributesBase> { + } + // This interface is not complete. Only properties accepting // unitless numbers are listed here (see CSSProperty.js in React) interface CSSProperties { @@ -406,9 +409,7 @@ declare namespace __React { [propertyName: string]: any; } - interface HTMLAttributes extends DOMAttributes { - ref?: string | ((component: HTMLComponent) => void); - + interface HTMLAttributesBase extends DOMAttributesBase { accept?: string; acceptCharset?: string; accessKey?: string; @@ -528,6 +529,9 @@ declare namespace __React { unselectable?: boolean; } + interface HTMLAttributes extends HTMLAttributesBase { + } + interface SVGElementAttributes extends HTMLAttributes { viewBox?: string; preserveAspectRatio?: string; @@ -1133,7 +1137,7 @@ declare module "react/addons" { ref?: string | ((component: T) => any); } - interface DOMAttributes extends Props> { + interface DOMAttributesBase extends Props { onCopy?: ClipboardEventHandler; onCut?: ClipboardEventHandler; onPaste?: ClipboardEventHandler; @@ -1174,6 +1178,9 @@ declare module "react/addons" { }; } + interface DOMAttributes extends DOMAttributesBase> { + } + // This interface is not complete. Only properties accepting // unitless numbers are listed here (see CSSProperty.js in React) interface CSSProperties { @@ -1203,9 +1210,7 @@ declare module "react/addons" { [propertyName: string]: any; } - interface HTMLAttributes extends DOMAttributes { - ref?: string | ((component: HTMLComponent) => void); - + interface HTMLAttributesBase extends DOMAttributesBase { accept?: string; acceptCharset?: string; accessKey?: string; @@ -1325,6 +1330,9 @@ declare module "react/addons" { unselectable?: boolean; } + interface HTMLAttributes extends HTMLAttributesBase { + } + interface SVGElementAttributes extends HTMLAttributes { viewBox?: string; preserveAspectRatio?: string;