From 8de03ce022aa44b38c4c09d4eab062e5641f050e Mon Sep 17 00:00:00 2001 From: yhpnorra Date: Tue, 19 Dec 2017 19:40:46 +0800 Subject: [PATCH] change the defi --- types/mirrorx/index.d.ts | 343 +++++++++++++++++++-------------------- 1 file changed, 169 insertions(+), 174 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 910e516d4b..936078e9de 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -11,180 +11,175 @@ import * as React from 'react'; import { Connect } from 'react-redux'; import { match } from "react-router"; -export namespace mirror { - type Diff = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T]; - type Omit = Pick>; +type Diff = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T]; +type Omit = Pick>; - interface model { - name: string; - initialState?: any; - reducers?: any; - effects?: any; - } - - interface _model { - name: string; - reducers: any; - } - interface LinkProps extends React.AnchorHTMLAttributes { - to: H.LocationDescriptor; - replace?: boolean; - } - interface NavLinkProps extends LinkProps { - activeClassName?: string; - activeStyle?: React.CSSProperties; - exact?: boolean; - strict?: boolean; - isActive?(match: match, location: H.Location): boolean; - location?: H.Location; - } - - interface SwitchProps { - children?: React.ReactNode; - location?: H.Location; - } - - interface RedirectProps { - to: H.LocationDescriptor; - push?: boolean; - from?: string; - path?: string; - exact?: boolean; - strict?: boolean; - } - - interface RouteComponentProps

{ - match: match

; - location: H.Location; - history: H.History; - staticContext?: any; - } - - interface RouteProps { - location?: H.Location; - component?: React.ComponentType> | React.ComponentType; - render?: ((props: RouteComponentProps) => React.ReactNode); - children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; - path?: string; - exact?: boolean; - strict?: boolean; - } - - interface PromptProps { - message: string | ((location: H.Location) => string | boolean); - when?: boolean; - } - - interface LocationActionPayload { - method: string; - args?: any[]; - } - - interface RouterAction { - type: '@@router/CALL_HISTORY_METHOD'; - payload: LocationActionPayload; - } - - interface routeActions { - push(location: any, state?: any): RouterAction; - replace(location: any, state?: any): RouterAction; - go(n: number): RouterAction; - goBack(): RouterAction; - goForward(): RouterAction; - } - - interface ConnectedRouterProps { - store?: any; - history?: H.History; - } - - interface Actions { - routing: routeActions; - [propName: string]: any; - } - - interface defaultOptions { - initialState?: {}; - historyMode?: string; - middlewares: any[]; - reducers: {}; - addEffect(name: string, handler: () => any): any; - } - - interface Renderer { - // Deprecated(render): The return value is deprecated. - // In future releases the render function's return type will be void. - ( - element: React.DOMElement, T>, - container: Element | null, - callback?: () => void - ): T; - - ( - element: Array, any>>, - container: Element | null, - callback?: () => void - ): Element; - - ( - element: React.SFCElement | Array>, - container: Element | null, - callback?: () => void - ): void; - - >( - element: React.CElement, - container: Element | null, - callback?: () => void - ): T; - - ( - element: Array>>, - container: Element | null, - callback?: () => void - ): React.Component; - -

( - element: React.ReactElement

, - container: Element | null, - callback?: () => void - ): React.Component | Element | void; - - ( - element: Array>, - container: Element | null, - callback?: () => void - ): React.Component | Element | void; - - ( - parentComponent: React.Component | Array>, - element: React.SFCElement, - container: Element, - callback?: () => void - ): void; - } - - /** - * This method is used to create and inject a model. - */ - function model(options: model): _model; - /** - * connect connects your React component to your Redux store - */ - const connect: Connect; - const actions: Actions; - function hook(): (subscriber: () => any) => any; - function defaults(): (options: defaultOptions) => void; - const render: Renderer; - class Router extends React.Component> { } - class Link extends React.Component { } - class NavLink extends React.Component { } - class Redirect extends React.Component { } - class Route extends React.Component { } - class Prompt extends React.Component { } - function withRouter

>(component: React.ComponentType

): React.ComponentClass>>; - function withRouter>(target: TFunction): TFunction; +interface model { + name: string; + initialState?: any; + reducers?: any; + effects?: any; } -declare module "mirror" { - export = mirror; + +interface _model { + name: string; + reducers: any; } +interface LinkProps extends React.AnchorHTMLAttributes { + to: H.LocationDescriptor; + replace?: boolean; +} +interface NavLinkProps extends LinkProps { + activeClassName?: string; + activeStyle?: React.CSSProperties; + exact?: boolean; + strict?: boolean; + isActive?(match: match, location: H.Location): boolean; + location?: H.Location; +} + +interface SwitchProps { + children?: React.ReactNode; + location?: H.Location; +} + +interface RedirectProps { + to: H.LocationDescriptor; + push?: boolean; + from?: string; + path?: string; + exact?: boolean; + strict?: boolean; +} + +interface RouteComponentProps

{ + match: match

; + location: H.Location; + history: H.History; + staticContext?: any; +} + +interface RouteProps { + location?: H.Location; + component?: React.ComponentType> | React.ComponentType; + render?: ((props: RouteComponentProps) => React.ReactNode); + children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; + path?: string; + exact?: boolean; + strict?: boolean; +} + +interface PromptProps { + message: string | ((location: H.Location) => string | boolean); + when?: boolean; +} + +interface LocationActionPayload { + method: string; + args?: any[]; +} + +interface RouterAction { + type: '@@router/CALL_HISTORY_METHOD'; + payload: LocationActionPayload; +} + +interface routeActions { + push(location: any, state?: any): RouterAction; + replace(location: any, state?: any): RouterAction; + go(n: number): RouterAction; + goBack(): RouterAction; + goForward(): RouterAction; +} + +interface ConnectedRouterProps { + store?: any; + history?: H.History; +} + +interface Actions { + routing: routeActions; + [propName: string]: any; +} + +interface defaultOptions { + initialState?: {}; + historyMode?: string; + middlewares: any[]; + reducers: {}; + addEffect(name: string, handler: () => any): any; +} + +interface Renderer { + // Deprecated(render): The return value is deprecated. + // In future releases the render function's return type will be void. + ( + element: React.DOMElement, T>, + container: Element | null, + callback?: () => void + ): T; + + ( + element: Array, any>>, + container: Element | null, + callback?: () => void + ): Element; + + ( + element: React.SFCElement | Array>, + container: Element | null, + callback?: () => void + ): void; + + >( + element: React.CElement, + container: Element | null, + callback?: () => void + ): T; + + ( + element: Array>>, + container: Element | null, + callback?: () => void + ): React.Component; + +

( + element: React.ReactElement

, + container: Element | null, + callback?: () => void + ): React.Component | Element | void; + + ( + element: Array>, + container: Element | null, + callback?: () => void + ): React.Component | Element | void; + + ( + parentComponent: React.Component | Array>, + element: React.SFCElement, + container: Element, + callback?: () => void + ): void; +} + +/** + * This method is used to create and inject a model. + */ +export function model(options: model): _model; +/** + * connect connects your React component to your Redux store + */ +export const connect: Connect; +export const actions: Actions; +export function hook(): (subscriber: () => any) => any; +export function defaults(): (options: defaultOptions) => void; +export const render: Renderer; +export class Router extends React.Component> { } +export class Link extends React.Component { } +export class NavLink extends React.Component { } +export class Redirect extends React.Component { } +export class Route extends React.Component { } +export class Prompt extends React.Component { } +export function withRouter

>(component: React.ComponentType

): React.ComponentClass>>; +export function withRouter>(target: TFunction): TFunction;