From 322ed3c618a2fe17d2bc65154ec3c707fdb75474 Mon Sep 17 00:00:00 2001 From: Eric Pabst Date: Fri, 28 Oct 2016 15:55:46 -0600 Subject: [PATCH 1/2] Dedup createElement and createFactory overloads in react/index.d.ts. This is causing issues for ts2kt where it results in duplicate Kotlin methods. --- react/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react/index.d.ts b/react/index.d.ts index dd2add0e0e..befc47431e 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -108,7 +108,7 @@ declare namespace React { type: ClassType, ClassicComponentClass

>): CFactory>; function createFactory, C extends ComponentClass

>( type: ClassType): CFactory; - function createFactory

(type: ComponentClass

| SFC

): Factory

; + function createFactory

(type: ComponentClass

): Factory

; function createElement

, T extends Element>( type: string, @@ -127,7 +127,7 @@ declare namespace React { props?: P & ClassAttributes, ...children: ReactNode[]): CElement; function createElement

( - type: ComponentClass

| SFC

, + type: ComponentClass

, props?: P & Attributes, ...children: ReactNode[]): ReactElement

; From 425bf74b428fa349c6e721aded84e7fa8928c31d Mon Sep 17 00:00:00 2001 From: Eric Pabst Date: Tue, 1 Nov 2016 09:51:42 -0600 Subject: [PATCH 2/2] Fix indentation and reorder intersection types to avoid conflicts in ts2kt. --- react/index.d.ts | 86 ++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/react/index.d.ts b/react/index.d.ts index befc47431e..f3503c97d1 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -59,22 +59,22 @@ declare namespace React { // ---------------------------------------------------------------------- interface Factory

{ - (props?: P & Attributes, ...children: ReactNode[]): ReactElement

; + (props?: Attributes & P, ...children: ReactNode[]): ReactElement

; } interface SFCFactory

{ - (props?: P & Attributes, ...children: ReactNode[]): SFCElement

; + (props?: Attributes & P, ...children: ReactNode[]): SFCElement

; } interface ComponentFactory> { - (props?: P & ClassAttributes, ...children: ReactNode[]): CElement; + (props?: ClassAttributes & P, ...children: ReactNode[]): CElement; } type CFactory> = ComponentFactory; type ClassicFactory

= CFactory>; interface DOMFactory

, T extends Element> { - (props?: P & ClassAttributes | null, ...children: ReactNode[]): DOMElement; + (props?: ClassAttributes & P | null, ...children: ReactNode[]): DOMElement; } interface HTMLFactory extends DOMFactory, T> { @@ -112,28 +112,28 @@ declare namespace React { function createElement

, T extends Element>( type: string, - props?: P & ClassAttributes, + props?: ClassAttributes & P, ...children: ReactNode[]): DOMElement; function createElement

( type: SFC

, - props?: P & Attributes, + props?: Attributes & P, ...children: ReactNode[]): SFCElement

; function createElement

( type: ClassType, ClassicComponentClass

>, - props?: P & ClassAttributes>, + props?: ClassAttributes> & P, ...children: ReactNode[]): CElement>; function createElement, C extends ComponentClass

>( type: ClassType, - props?: P & ClassAttributes, + props?: ClassAttributes & P, ...children: ReactNode[]): CElement; function createElement

( type: ComponentClass

, - props?: P & Attributes, + props?: Attributes & P, ...children: ReactNode[]): ReactElement

; function cloneElement

, T extends Element>( element: DOMElement, - props?: P & ClassAttributes, + props?: ClassAttributes & P, ...children: ReactNode[]): DOMElement; function cloneElement

( element: SFCElement

, @@ -175,7 +175,7 @@ declare namespace React { // always pass children as variadic arguments to `createElement`. // In the future, if we can define its call signature conditionally // on the existence of `children` in `P`, then we should remove this. - props: P & { children?: ReactNode }; + props: { children?: ReactNode } & P; state: S; context: {}; refs: { @@ -2557,41 +2557,41 @@ declare global { circle: React.SVGProps; clipPath: React.SVGProps; defs: React.SVGProps; - desc: React.SVGProps; + desc: React.SVGProps; ellipse: React.SVGProps; - feBlend: React.SVGProps; - feColorMatrix: React.SVGProps; - feComponentTransfer: React.SVGProps; - feComposite: React.SVGProps; - feConvolveMatrix: React.SVGProps; - feDiffuseLighting: React.SVGProps; - feDisplacementMap: React.SVGProps; - feDistantLight: React.SVGProps; - feFlood: React.SVGProps; - feFuncA: React.SVGProps; - feFuncB: React.SVGProps; - feFuncG: React.SVGProps; - feFuncR: React.SVGProps; - feGaussianBlur: React.SVGProps; - feImage: React.SVGProps; - feMerge: React.SVGProps; - feMergeNode: React.SVGProps; - feMorphology: React.SVGProps; - feOffset: React.SVGProps; - fePointLight: React.SVGProps; - feSpecularLighting: React.SVGProps; - feSpotLight: React.SVGProps; - feTile: React.SVGProps; - feTurbulence: React.SVGProps; - filter: React.SVGProps; - foreignObject: React.SVGProps; + feBlend: React.SVGProps; + feColorMatrix: React.SVGProps; + feComponentTransfer: React.SVGProps; + feComposite: React.SVGProps; + feConvolveMatrix: React.SVGProps; + feDiffuseLighting: React.SVGProps; + feDisplacementMap: React.SVGProps; + feDistantLight: React.SVGProps; + feFlood: React.SVGProps; + feFuncA: React.SVGProps; + feFuncB: React.SVGProps; + feFuncG: React.SVGProps; + feFuncR: React.SVGProps; + feGaussianBlur: React.SVGProps; + feImage: React.SVGProps; + feMerge: React.SVGProps; + feMergeNode: React.SVGProps; + feMorphology: React.SVGProps; + feOffset: React.SVGProps; + fePointLight: React.SVGProps; + feSpecularLighting: React.SVGProps; + feSpotLight: React.SVGProps; + feTile: React.SVGProps; + feTurbulence: React.SVGProps; + filter: React.SVGProps; + foreignObject: React.SVGProps; g: React.SVGProps; image: React.SVGProps; line: React.SVGProps; linearGradient: React.SVGProps; - marker: React.SVGProps; + marker: React.SVGProps; mask: React.SVGProps; - metadata: React.SVGProps; + metadata: React.SVGProps; path: React.SVGProps; pattern: React.SVGProps; polygon: React.SVGProps; @@ -2599,13 +2599,13 @@ declare global { radialGradient: React.SVGProps; rect: React.SVGProps; stop: React.SVGProps; - switch: React.SVGProps; + switch: React.SVGProps; symbol: React.SVGProps; text: React.SVGProps; - textPath: React.SVGProps; + textPath: React.SVGProps; tspan: React.SVGProps; use: React.SVGProps; - view: React.SVGProps; + view: React.SVGProps; } } }