Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#5915 from ngbrown/patch-7
Browse files Browse the repository at this point in the history
react.d.ts: Make a generic base version of HTMLAttributes and DOMAttributes
  • Loading branch information
vvakame committed Sep 22, 2015
2 parents 51268e1 + 7d0beb4 commit 32029fc
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions react/react.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ declare namespace __React {
ref?: string | ((component: T) => any);
}

interface DOMAttributes extends Props<DOMComponent<any>> {
interface DOMAttributesBase<T> extends Props<T> {
onCopy?: ClipboardEventHandler;
onCut?: ClipboardEventHandler;
onPaste?: ClipboardEventHandler;
Expand Down Expand Up @@ -377,6 +377,9 @@ declare namespace __React {
};
}

interface DOMAttributes extends DOMAttributesBase<DOMComponent<any>> {
}

// This interface is not complete. Only properties accepting
// unitless numbers are listed here (see CSSProperty.js in React)
interface CSSProperties {
Expand Down Expand Up @@ -406,9 +409,7 @@ declare namespace __React {
[propertyName: string]: any;
}

interface HTMLAttributes extends DOMAttributes {
ref?: string | ((component: HTMLComponent) => void);

interface HTMLAttributesBase<T> extends DOMAttributesBase<T> {
accept?: string;
acceptCharset?: string;
accessKey?: string;
Expand Down Expand Up @@ -528,6 +529,9 @@ declare namespace __React {
unselectable?: boolean;
}

interface HTMLAttributes extends HTMLAttributesBase<HTMLComponent> {
}

interface SVGElementAttributes extends HTMLAttributes {
viewBox?: string;
preserveAspectRatio?: string;
Expand Down Expand Up @@ -1133,7 +1137,7 @@ declare module "react/addons" {
ref?: string | ((component: T) => any);
}

interface DOMAttributes extends Props<DOMComponent<any>> {
interface DOMAttributesBase<T> extends Props<T> {
onCopy?: ClipboardEventHandler;
onCut?: ClipboardEventHandler;
onPaste?: ClipboardEventHandler;
Expand Down Expand Up @@ -1174,6 +1178,9 @@ declare module "react/addons" {
};
}

interface DOMAttributes extends DOMAttributesBase<DOMComponent<any>> {
}

// This interface is not complete. Only properties accepting
// unitless numbers are listed here (see CSSProperty.js in React)
interface CSSProperties {
Expand Down Expand Up @@ -1203,9 +1210,7 @@ declare module "react/addons" {
[propertyName: string]: any;
}

interface HTMLAttributes extends DOMAttributes {
ref?: string | ((component: HTMLComponent) => void);

interface HTMLAttributesBase<T> extends DOMAttributesBase<T> {
accept?: string;
acceptCharset?: string;
accessKey?: string;
Expand Down Expand Up @@ -1325,6 +1330,9 @@ declare module "react/addons" {
unselectable?: boolean;
}

interface HTMLAttributes extends HTMLAttributesBase<HTMLComponent> {
}

interface SVGElementAttributes extends HTMLAttributes {
viewBox?: string;
preserveAspectRatio?: string;
Expand Down

0 comments on commit 32029fc

Please sign in to comment.