From cdf9aa4e1d306f4ba472755f4b3b1b4d30552976 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Wed, 11 May 2016 16:33:19 -0700 Subject: [PATCH] Convert react-router --- react-router/history-tests.ts | 132 ----- react-router/history.d.ts | 233 --------- react-router/index.d.ts | 572 +++------------------- react-router/lib/History.d.ts | 22 + react-router/lib/IndexLink.d.ts | 5 + react-router/lib/IndexRedirect.d.ts | 17 + react-router/lib/IndexRoute.d.ts | 20 + react-router/lib/Lifecycle.d.ts | 4 + react-router/lib/Link.d.ts | 22 + react-router/lib/PatternUtils.d.ts | 1 + react-router/lib/PropTypes.d.ts | 19 + react-router/lib/Redirect.d.ts | 19 + react-router/lib/Route.d.ts | 25 + react-router/lib/RouteContext.d.ts | 5 + react-router/lib/RouteUtils.d.ts | 8 + react-router/lib/Router.d.ts | 89 ++++ react-router/lib/RouterContext.d.ts | 25 + react-router/lib/browserHistory.d.ts | 3 + react-router/lib/createMemoryHistory.d.ts | 3 + react-router/lib/hashHistory.d.ts | 3 + react-router/lib/match.d.ts | 15 + react-router/lib/useRouterHistory.d.ts | 7 + react-router/lib/useRoutes.d.ts | 5 + react-router/react-router-tests.tsx | 11 +- react-swf/react-swf-tests.ts | 3 +- react/index.d.ts | 309 ++++++------ 26 files changed, 543 insertions(+), 1034 deletions(-) delete mode 100644 react-router/history-tests.ts delete mode 100644 react-router/history.d.ts create mode 100644 react-router/lib/History.d.ts create mode 100644 react-router/lib/IndexLink.d.ts create mode 100644 react-router/lib/IndexRedirect.d.ts create mode 100644 react-router/lib/IndexRoute.d.ts create mode 100644 react-router/lib/Lifecycle.d.ts create mode 100644 react-router/lib/Link.d.ts create mode 100644 react-router/lib/PatternUtils.d.ts create mode 100644 react-router/lib/PropTypes.d.ts create mode 100644 react-router/lib/Redirect.d.ts create mode 100644 react-router/lib/Route.d.ts create mode 100644 react-router/lib/RouteContext.d.ts create mode 100644 react-router/lib/RouteUtils.d.ts create mode 100644 react-router/lib/Router.d.ts create mode 100644 react-router/lib/RouterContext.d.ts create mode 100644 react-router/lib/browserHistory.d.ts create mode 100644 react-router/lib/createMemoryHistory.d.ts create mode 100644 react-router/lib/hashHistory.d.ts create mode 100644 react-router/lib/match.d.ts create mode 100644 react-router/lib/useRouterHistory.d.ts create mode 100644 react-router/lib/useRoutes.d.ts diff --git a/react-router/history-tests.ts b/react-router/history-tests.ts deleted file mode 100644 index fb4ae10cfd..0000000000 --- a/react-router/history-tests.ts +++ /dev/null @@ -1,132 +0,0 @@ - - -import { createHistory, createLocation, useBeforeUnload, useQueries, useBasename } from 'history' -import { getUserConfirmation } from 'history/lib/DOMUtils' - -interface Promise { - then(onfulfilled?: (value: T) => TResult): Promise; -} - -let doSomethingAsync: () => Promise; -let input = { value: "" }; - -{ - let history = createHistory() - - // Listen for changes to the current location. The - // listener is called once immediately. - let unlisten = history.listen(function(location) { - console.log(location.pathname) - }) - - // When you're finished, stop the listener. - unlisten() - - // Push a new entry onto the history stack. - history.push('/home') - - // Replace the current entry on the history stack. - history.replace('/profile') - - // Push a new entry with state onto the history stack. - history.push({ - pathname: '/about', - search: '?the=search', - state: { some: 'state' } - }); - - // Change just the search on an existing location. - //history.push({ ...location, search: '?the=other+search' }) - - // Go back to the previous history entry. The following - // two lines are synonymous. - history.go(-1) - history.goBack() - - let href = history.createHref('/the/path') -} - -{ - let history = createHistory() - - // Pushing a path string. - history.push('/the/path') - - // Omitting location state when pushing a location descriptor. - history.push({ pathname: '/the/path', search: '?the=search' }) - - // Extending an existing location object. - //history.push({ ...location, search: '?other=search' }) - - let location = createLocation('/a/path?a=query', { the: 'state' }) - - location = history.createLocation('/a/path?a=query', { the: 'state' }) -} - -{ - let history = createHistory() - history.listenBefore(function(location) { - if (input.value !== '') - return 'Are you sure you want to leave this page?' - }) - - history.listenBefore(function(location, callback) { - doSomethingAsync().then(callback) - }) -} - -{ - let history = createHistory({ - getUserConfirmation(message, callback) { - callback(window.confirm(message)) // The default behavior - } - }) -} - -{ - let history = useBeforeUnload(createHistory)() - - history.listenBeforeUnload(function() { - return 'Are you sure you want to leave this page?' - }) -} - -{ - let history = useQueries(createHistory)() - - history.listen(function(location) { - console.log(location.query) - }) -} - -{ - let history = useQueries(createHistory)({ - parseQueryString: function(queryString) { - // TODO: return a parsed version of queryString - return {}; - }, - stringifyQuery: function(query) { - // TODO: return a query string created from query - return ""; - } - }) - - history.createPath({ pathname: '/the/path', query: { the: 'query' } }) - history.push({ pathname: '/the/path', query: { the: 'query' } }) -} - -{ - // Run our app under the /base URL. - let history = useBasename(createHistory)({ - basename: '/base' - }) - - // At the /base/hello/world URL: - history.listen(function(location) { - console.log(location.pathname) // /hello/world - console.log(location.basename) // /base - }) - - history.createPath('/the/path') // /base/the/path - history.push('/the/path') // push /base/the/path -} \ No newline at end of file diff --git a/react-router/history.d.ts b/react-router/history.d.ts deleted file mode 100644 index 1af2d26993..0000000000 --- a/react-router/history.d.ts +++ /dev/null @@ -1,233 +0,0 @@ -// Type definitions for history v2.0.0 -// Project: https://github.com/rackt/history -// Definitions by: Sergey Buturlakin , Nathan Brown -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare namespace HistoryModule { - - // types based on https://github.com/rackt/history/blob/master/docs/Terms.md - - type Action = string - - type BeforeUnloadHook = () => string | boolean - - type CreateHistory = (options?: HistoryOptions) => T - - type CreateHistoryEnhancer = (createHistory: CreateHistory) => CreateHistory - - interface History { - listenBefore(hook: TransitionHook): () => void - listen(listener: LocationListener): () => void - transitionTo(location: Location): void - push(path: LocationDescriptor): void - replace(path: LocationDescriptor): void - go(n: number): void - goBack(): void - goForward(): void - createKey(): LocationKey - createPath(path: LocationDescriptor): Path - createHref(path: LocationDescriptor): Href - createLocation(path?: LocationDescriptor, action?: Action, key?: LocationKey): Location - - /** @deprecated use a location descriptor instead */ - createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location - /** @deprecated use location.key to save state instead */ - pushState(state: LocationState, path: Path): void - /** @deprecated use location.key to save state instead */ - replaceState(state: LocationState, path: Path): void - /** @deprecated use location.key to save state instead */ - setState(state: LocationState): void - /** @deprecated use listenBefore instead */ - registerTransitionHook(hook: TransitionHook): void - /** @deprecated use the callback returned from listenBefore instead */ - unregisterTransitionHook(hook: TransitionHook): void - } - - type HistoryOptions = { - getCurrentLocation?: () => Location - finishTransition?: (nextLocation: Location) => boolean - saveState?: (key: LocationKey, state: LocationState) => void - go?: (n: number) => void - getUserConfirmation?: (message: string, callback: (result: boolean) => void) => void - keyLength?: number - queryKey?: string | boolean - stringifyQuery?: (obj: any) => string - parseQueryString?: (str: string) => any - basename?: string - entries?: string | [any] - current?: number - } - - type Href = string - - type Location = { - pathname: Pathname - search: Search - query: Query - state: LocationState - action: Action - key: LocationKey - basename?: string - } - - type LocationDescriptorObject = { - pathname?: Pathname - search?: Search - query?: Query - state?: LocationState - } - - type LocationDescriptor = LocationDescriptorObject | Path - - type LocationKey = string - - type LocationListener = (location: Location) => void - - type LocationState = Object - - type Path = string // Pathname + QueryString - - type Pathname = string - - type Query = Object - - type QueryString = string - - type Search = string - - type TransitionHook = (location: Location, callback: (result: any) => void) => any - - - interface HistoryBeforeUnload { - listenBeforeUnload(hook: BeforeUnloadHook): () => void - } - - interface HistoryQueries { - pushState(state: LocationState, pathname: Pathname | Path, query?: Query): void - replaceState(state: LocationState, pathname: Pathname | Path, query?: Query): void - createPath(path: Path, query?: Query): Path - createHref(path: Path, query?: Query): Href - } - - - // Global usage, without modules, needs the small trick, because lib.d.ts - // already has `history` and `History` global definitions: - // var createHistory = ((window as any).History as HistoryModule.Module).createHistory; - interface Module { - createHistory: CreateHistory - createHashHistory: CreateHistory - createMemoryHistory: CreateHistory - createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location - useBasename(createHistory: CreateHistory): CreateHistory - useBeforeUnload(createHistory: CreateHistory): CreateHistory - useQueries(createHistory: CreateHistory): CreateHistory - actions: { - PUSH: string - REPLACE: string - POP: string - } - } - -} - - -declare module "history/lib/createBrowserHistory" { - - export default function createBrowserHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History - -} - - -declare module "history/lib/createHashHistory" { - - export default function createHashHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History - -} - - -declare module "history/lib/createMemoryHistory" { - - export default function createMemoryHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History - -} - - -declare module "history/lib/createLocation" { - - export default function createLocation(path?: HistoryModule.Path, state?: HistoryModule.LocationState, action?: HistoryModule.Action, key?: HistoryModule.LocationKey): HistoryModule.Location - -} - - -declare module "history/lib/useBasename" { - - export default function useBasename(createHistory: HistoryModule.CreateHistory): HistoryModule.CreateHistory - -} - - -declare module "history/lib/useBeforeUnload" { - - export default function useBeforeUnload(createHistory: HistoryModule.CreateHistory): HistoryModule.CreateHistory - -} - - -declare module "history/lib/useQueries" { - - export default function useQueries(createHistory: HistoryModule.CreateHistory): HistoryModule.CreateHistory - -} - - -declare module "history/lib/actions" { - - export const PUSH: string - - export const REPLACE: string - - export const POP: string - - export default { - PUSH, - REPLACE, - POP - } - -} - -declare module "history/lib/DOMUtils" { - export function addEventListener(node: EventTarget, event: string, listener: EventListenerOrEventListenerObject): void; - export function removeEventListener(node: EventTarget, event: string, listener: EventListenerOrEventListenerObject): void; - export function getHashPath(): string; - export function replaceHashPath(path: string): void; - export function getWindowPath(): string; - export function go(n: number): void; - export function getUserConfirmation(message: string, callback: (result: boolean) => void): void; - export function supportsHistory(): boolean; - export function supportsGoWithoutReloadUsingHash(): boolean; -} - - -declare module "history" { - - export { default as createHistory } from "history/lib/createBrowserHistory" - - export { default as createHashHistory } from "history/lib/createHashHistory" - - export { default as createMemoryHistory } from "history/lib/createMemoryHistory" - - export { default as createLocation } from "history/lib/createLocation" - - export { default as useBasename } from "history/lib/useBasename" - - export { default as useBeforeUnload } from "history/lib/useBeforeUnload" - - export { default as useQueries } from "history/lib/useQueries" - - import * as Actions from "history/lib/actions" - - export { Actions } - -} diff --git a/react-router/index.d.ts b/react-router/index.d.ts index af17c3b5b0..89c09daa25 100644 --- a/react-router/index.d.ts +++ b/react-router/index.d.ts @@ -3,506 +3,72 @@ // Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík , Nathan Brown // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// - - -declare namespace ReactRouter { - - import React = __React - - import H = HistoryModule - - // types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md - - type Component = React.ReactType - - type EnterHook = (nextState: RouterState, replace: RedirectFunction, callback?: Function) => void - - type LeaveHook = () => void - - type ChangeHook = (prevState: RouterState, nextState: RouterState, replace: RedirectFunction, callback: Function) => void; - - type Params = { [param: string]: string } - - type ParseQueryString = (queryString: H.QueryString) => H.Query - - interface RedirectFunction { - (location: H.LocationDescriptor): void; - /** - * @deprecated `replaceState(state, pathname, query) is deprecated; Use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated - */ - (state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query): void; - } - - type RouteComponent = Component - - // use the following interface in an app code to get access to route param values, history, location... - // interface MyComponentProps extends ReactRouter.RouteComponentProps<{}, { id: number }> {} - // somewhere in MyComponent - // ... - // let id = this.props.routeParams.id - // ... - // this.props.history. ... - // ... - interface RouteComponentProps { - history?: History - location?: H.Location - params?: P - route?: PlainRoute - routeParams?: R - routes?: PlainRoute[] - children?: React.ReactElement - } - - type RouteComponents = { [key: string]: RouteComponent } - - type RouteConfig = React.ReactNode | PlainRoute | PlainRoute[] - - type RouteHook = (nextLocation?: H.Location) => any - - type RoutePattern = string - - type StringifyQuery = (queryObject: H.Query) => H.QueryString - - type RouterListener = (error: Error, nextState: RouterState) => void - - interface RouterState { - location: H.Location - routes: PlainRoute[] - params: Params - components: RouteComponent[] - } - - - interface HistoryBase extends H.History { - routes: PlainRoute[] - parseQueryString?: ParseQueryString - stringifyQuery?: StringifyQuery - } - - type History = HistoryBase & H.HistoryQueries & HistoryRoutes - const browserHistory: History; - const hashHistory: History; - - function createMemoryHistory(options?: H.HistoryOptions): H.History - - /* components */ - - interface RouterProps extends React.Props { - history?: H.History - routes?: RouteConfig // alias for children - createElement?: (component: RouteComponent, props: Object) => any - onError?: (error: any) => any - onUpdate?: () => any - parseQueryString?: ParseQueryString - stringifyQuery?: StringifyQuery - } - interface Router extends React.ComponentClass {} - interface RouterElement extends React.ReactElement {} - const Router: Router - - - interface LinkProps extends React.HTMLAttributes, React.Props { - activeStyle?: React.CSSProperties - activeClassName?: string - onlyActiveOnIndex?: boolean - to: RoutePattern | H.LocationDescriptor - query?: H.Query - state?: H.LocationState - } - interface Link extends React.ComponentClass {} - interface LinkElement extends React.ReactElement {} - const Link: Link - - - const IndexLink: Link - - - interface RouterContextProps extends React.Props { - history?: H.History - router: Router - createElement: (component: RouteComponent, props: Object) => any - location: H.Location - routes: RouteConfig - params: Params - components?: RouteComponent[] - } - interface RouterContext extends React.ComponentClass {} - interface RouterContextElement extends React.ReactElement { - history?: H.History - location: H.Location - router?: Router - } - const RouterContext: RouterContext - - - /* components (configuration) */ - - interface RouteProps extends React.Props { - path?: RoutePattern - component?: RouteComponent - components?: RouteComponents - getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void - getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void - onEnter?: EnterHook - onLeave?: LeaveHook - onChange?: ChangeHook - getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void - getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void - } - interface Route extends React.ComponentClass {} - interface RouteElement extends React.ReactElement {} - const Route: Route - - - interface PlainRoute { - path?: RoutePattern - component?: RouteComponent - components?: RouteComponents - getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void - getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void - onEnter?: EnterHook - onLeave?: LeaveHook - indexRoute?: PlainRoute - getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void - childRoutes?: PlainRoute[] - getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void - } - - - interface RedirectProps extends React.Props { - path?: RoutePattern - from?: RoutePattern // alias for path - to: RoutePattern - query?: H.Query - state?: H.LocationState - } - interface Redirect extends React.ComponentClass {} - interface RedirectElement extends React.ReactElement {} - const Redirect: Redirect - - - interface IndexRouteProps extends React.Props { - component?: RouteComponent - components?: RouteComponents - getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void - getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void - onEnter?: EnterHook - onLeave?: LeaveHook - } - interface IndexRoute extends React.ComponentClass {} - interface IndexRouteElement extends React.ReactElement {} - const IndexRoute: IndexRoute - - - interface IndexRedirectProps extends React.Props { - to: RoutePattern - query?: H.Query - state?: H.LocationState - } - interface IndexRedirect extends React.ComponentClass {} - interface IndexRedirectElement extends React.ReactElement {} - const IndexRedirect: IndexRedirect - - interface RouterOnContext extends H.History { - setRouteLeaveHook(route: PlainRoute, hook?: RouteHook): () => void; - isActive(pathOrLoc: H.LocationDescriptor, indexOnly?: boolean): boolean; - } - - /* mixins */ - - interface HistoryMixin { - history: History - } - const History: React.Mixin - - - interface LifecycleMixin { - routerWillLeave(nextLocation: H.Location): string | boolean - } - const Lifecycle: React.Mixin - - - const RouteContext: React.Mixin - - - /* utils */ - - interface HistoryRoutes { - listen(listener: RouterListener): Function - listenBeforeLeavingRoute(route: PlainRoute, hook: RouteHook): void - match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void - isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean - setRouteLeaveHook(route: PlainRoute, callback: RouteHook): void - } - - function useRoutes(createHistory: HistoryModule.CreateHistory): HistoryModule.CreateHistory - - - function createRoutes(routes: RouteConfig): PlainRoute[] - - - interface MatchArgs { - routes?: RouteConfig - history?: H.History - location?: H.Location | string - parseQueryString?: ParseQueryString - stringifyQuery?: StringifyQuery - } - interface MatchState extends RouterState { - history: History - } - function match(args: MatchArgs, cb: (error: any, nextLocation: H.Location, nextState: MatchState) => void): void - -} - - -declare module "react-router/lib/Router" { - - export default ReactRouter.Router - -} - - -declare module "react-router/lib/Link" { - - export default ReactRouter.Link - -} - - -declare module "react-router/lib/IndexLink" { - - export default ReactRouter.IndexLink - -} - - -declare module "react-router/lib/IndexRedirect" { - - export default ReactRouter.IndexRedirect - -} - - -declare module "react-router/lib/IndexRoute" { - - export default ReactRouter.IndexRoute - -} - - -declare module "react-router/lib/Redirect" { - - export default ReactRouter.Redirect - -} - - -declare module "react-router/lib/Route" { - - export default ReactRouter.Route - -} - - -declare module "react-router/lib/History" { - - export default ReactRouter.History - -} - - -declare module "react-router/lib/Lifecycle" { - - export default ReactRouter.Lifecycle - -} - - -declare module "react-router/lib/RouteContext" { - - export default ReactRouter.RouteContext - -} - - -declare module "react-router/lib/useRoutes" { - - export default ReactRouter.useRoutes - -} - -declare module "react-router/lib/PatternUtils" { - - export function formatPattern(pattern: string, params: {}): string; - -} - -declare module "react-router/lib/RouteUtils" { - - type E = __React.ReactElement - - export function isReactChildren(object: E | E[]): boolean - - export function createRouteFromReactElement(element: E): ReactRouter.PlainRoute - - export function createRoutesFromReactChildren(children: E | E[], parentRoute: ReactRouter.PlainRoute): ReactRouter.PlainRoute[] - - export import createRoutes = ReactRouter.createRoutes - -} - - -declare module "react-router/lib/RouterContext" { - - export default ReactRouter.RouterContext - -} - - -declare module "react-router/lib/PropTypes" { - - import React = __React - - export function falsy(props: any, propName: string, componentName: string): Error; - - export const history: React.Requireable - - export const location: React.Requireable - - export const component: React.Requireable - - export const components: React.Requireable - - export const route: React.Requireable - - export const routes: React.Requireable - - export default { - falsy, - history, - location, - component, - components, - route - } - -} - -declare module "react-router/lib/browserHistory" { - export default ReactRouter.browserHistory; -} - -declare module "react-router/lib/hashHistory" { - export default ReactRouter.hashHistory; -} - -declare module "react-router/lib/match" { - - export default ReactRouter.match - -} - -declare module "react-router/lib/useRouterHistory" { - interface CreateRouterHistory { - (options?: HistoryModule.HistoryOptions): HistoryModule.History & HistoryModule.HistoryQueries; - } - - export default function useRouterHistory(createHistory: HistoryModule.CreateHistory): CreateRouterHistory; -} - -declare module "react-router/lib/createMemoryHistory" { - export default ReactRouter.createMemoryHistory; -} - -declare module "react-router" { - - import Router from "react-router/lib/Router" - - import Link from "react-router/lib/Link" - - import IndexLink from "react-router/lib/IndexLink" - - import IndexRedirect from "react-router/lib/IndexRedirect" - - import IndexRoute from "react-router/lib/IndexRoute" - - import Redirect from "react-router/lib/Redirect" - - import Route from "react-router/lib/Route" - - import History from "react-router/lib/History" - - import Lifecycle from "react-router/lib/Lifecycle" - - import RouteContext from "react-router/lib/RouteContext" - - import browserHistory from "react-router/lib/browserHistory" - - import hashHistory from "react-router/lib/hashHistory" - - import useRoutes from "react-router/lib/useRoutes" - - import { createRoutes } from "react-router/lib/RouteUtils" - - import { formatPattern } from "react-router/lib/PatternUtils" - - import RouterContext from "react-router/lib/RouterContext" - - import PropTypes from "react-router/lib/PropTypes" - - import match from "react-router/lib/match" - - import useRouterHistory from "react-router/lib/useRouterHistory"; - - import createMemoryHistory from "react-router/lib/createMemoryHistory"; - - // PlainRoute is defined in the API documented at: - // https://github.com/rackt/react-router/blob/master/docs/API.md - // but not included in any of the .../lib modules above. - export type PlainRoute = ReactRouter.PlainRoute - - // The following definitions are also very useful to export - // because by using these types lots of potential type errors - // can be exposed: - export type EnterHook = ReactRouter.EnterHook - export type LeaveHook = ReactRouter.LeaveHook - export type ParseQueryString = ReactRouter.ParseQueryString - export type RedirectFunction = ReactRouter.RedirectFunction - export type RouteComponentProps = ReactRouter.RouteComponentProps; - export type RouteHook = ReactRouter.RouteHook - export type StringifyQuery = ReactRouter.StringifyQuery - export type RouterListener = ReactRouter.RouterListener - export type RouterState = ReactRouter.RouterState - export type HistoryBase = ReactRouter.HistoryBase - export type RouterOnContext = ReactRouter.RouterOnContext - - export { - Router, - Link, - IndexLink, - IndexRedirect, - IndexRoute, - Redirect, - Route, - History, - browserHistory, - hashHistory, - Lifecycle, - RouteContext, - useRoutes, - createRoutes, - formatPattern, - RouterContext, - PropTypes, - match, - useRouterHistory, - createMemoryHistory - } - - export default Router - -} +export as namespace ReactRouter; + +import * as React from 'react'; + +import Router from "./lib/Router"; +import Link from "./lib/Link"; +import IndexLink from "./lib/IndexLink"; +import IndexRedirect from "./lib/IndexRedirect"; +import IndexRoute from "./lib/IndexRoute"; +import Redirect from "./lib/Redirect"; +import Route from "./lib/Route"; +import * as History from "./lib/History"; +import Lifecycle from "./lib/Lifecycle"; +import RouteContext from "./lib/RouteContext"; +import browserHistory from "./lib/browserHistory"; +import hashHistory from "./lib/hashHistory"; +import useRoutes from "./lib/useRoutes"; +import { createRoutes } from "./lib/RouteUtils"; +import { formatPattern } from "./lib/PatternUtils"; +import RouterContext from "./lib/RouterContext"; +import PropTypes from "./lib/PropTypes"; +import match from "./lib/match"; +import useRouterHistory from "./lib/useRouterHistory"; +import createMemoryHistory from "./lib/createMemoryHistory"; + +// PlainRoute is defined in the API documented at: +// https://github.com/rackt/react-router/blob/master/docs/API.md +// but not included in any of the .../lib modules above. +export type PlainRoute = Router.PlainRoute; + +// The following definitions are also very useful to export +// because by using these types lots of potential type errors +// can be exposed: +export type EnterHook = Router.EnterHook; +export type LeaveHook = Router.LeaveHook; +export type ParseQueryString = Router.ParseQueryString; +export type RedirectFunction = Router.RedirectFunction; +export type RouteComponentProps = Router.RouteComponentProps; +export type RouteHook = Router.RouteHook; +export type StringifyQuery = Router.StringifyQuery; +export type RouterListener = Router.RouterListener; +export type RouterState = Router.RouterState; +export type HistoryBase = History.HistoryBase; +export type RouterOnContext = Router.RouterOnContext; + +export { + Router, + Link, + IndexLink, + IndexRedirect, + IndexRoute, + Redirect, + Route, + History, + browserHistory, + hashHistory, + Lifecycle, + RouteContext, + useRoutes, + createRoutes, + formatPattern, + RouterContext, + PropTypes, + match, + useRouterHistory, + createMemoryHistory +}; + +export default Router; diff --git a/react-router/lib/History.d.ts b/react-router/lib/History.d.ts new file mode 100644 index 0000000000..660af424b4 --- /dev/null +++ b/react-router/lib/History.d.ts @@ -0,0 +1,22 @@ +import Router from './Router'; +import * as H from 'history'; + +export default History; + +export interface HistoryRoutes { + listen(listener: Router.RouterListener): Function + listenBeforeLeavingRoute(route: Router.PlainRoute, hook: Router.RouteHook): void + match(location: H.Location, callback: (error: any, nextState: Router.RouterState, nextLocation: H.Location) => void): void + isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean + setRouteLeaveHook(route: Router.PlainRoute, callback: Router.RouteHook): void +} + +export interface HistoryBase extends H.History { + routes: Router.PlainRoute[]; + parseQueryString?: Router.ParseQueryString; + stringifyQuery?: Router.StringifyQuery; +} + +export type History = HistoryBase & H.HistoryQueries & HistoryRoutes; +export declare const browserHistory: History; +export declare const hashHistory: History; diff --git a/react-router/lib/IndexLink.d.ts b/react-router/lib/IndexLink.d.ts new file mode 100644 index 0000000000..56ecf82c1d --- /dev/null +++ b/react-router/lib/IndexLink.d.ts @@ -0,0 +1,5 @@ +import Link from './Link'; + +declare const IndexLink: Link; +export default IndexLink; + diff --git a/react-router/lib/IndexRedirect.d.ts b/react-router/lib/IndexRedirect.d.ts new file mode 100644 index 0000000000..41dab299c8 --- /dev/null +++ b/react-router/lib/IndexRedirect.d.ts @@ -0,0 +1,17 @@ +import Router from './Router'; +import * as React from 'react'; +import * as H from 'history'; + +declare const self: self.IndexRedirect; +type self = self.IndexRedirect; +export default self; + +declare namespace self { + interface IndexRedirectProps extends React.Props { + to: Router.RoutePattern; + query?: H.Query; + state?: H.LocationState; + } + interface IndexRedirectElement extends React.ReactElement { } + interface IndexRedirect extends React.ComponentClass { } +} diff --git a/react-router/lib/IndexRoute.d.ts b/react-router/lib/IndexRoute.d.ts new file mode 100644 index 0000000000..b11b16d0e2 --- /dev/null +++ b/react-router/lib/IndexRoute.d.ts @@ -0,0 +1,20 @@ +import * as React from 'react'; +import Router from './Router'; +import * as H from 'history'; + +declare const self: self.IndexRoute; +type self = self.IndexRoute; +export default self; + +declare namespace self { + interface IndexRouteProps extends React.Props { + component?: Router.RouteComponent; + components?: Router.RouteComponents; + getComponent?: (location: H.Location, cb: (error: any, component?: Router.RouteComponent) => void) => void; + getComponents?: (location: H.Location, cb: (error: any, components?: Router.RouteComponents) => void) => void; + onEnter?: Router.EnterHook; + onLeave?: Router.LeaveHook; + } + interface IndexRoute extends React.ComponentClass { } + interface IndexRouteElement extends React.ReactElement { } +} \ No newline at end of file diff --git a/react-router/lib/Lifecycle.d.ts b/react-router/lib/Lifecycle.d.ts new file mode 100644 index 0000000000..3db1e726b4 --- /dev/null +++ b/react-router/lib/Lifecycle.d.ts @@ -0,0 +1,4 @@ +import * as React from 'react'; + +declare const Lifecycle: React.Mixin; +export default Lifecycle; diff --git a/react-router/lib/Link.d.ts b/react-router/lib/Link.d.ts new file mode 100644 index 0000000000..2375724ebc --- /dev/null +++ b/react-router/lib/Link.d.ts @@ -0,0 +1,22 @@ +import * as React from 'react'; +import Router from './Router'; +import * as H from 'history'; + +declare const Link: Link; +type Link = Link.Link; + +export default Link; + +declare namespace Link { + interface LinkProps extends React.HTMLAttributes, React.Props { + activeStyle?: React.CSSProperties; + activeClassName?: string; + onlyActiveOnIndex?: boolean; + to: Router.RoutePattern | H.LocationDescriptor; + query?: H.Query; + state?: H.LocationState; + } + + interface Link extends React.ComponentClass {} + interface LinkElement extends React.ReactElement {} +} diff --git a/react-router/lib/PatternUtils.d.ts b/react-router/lib/PatternUtils.d.ts new file mode 100644 index 0000000000..50e90f6e49 --- /dev/null +++ b/react-router/lib/PatternUtils.d.ts @@ -0,0 +1 @@ +export function formatPattern(pattern: string, params: {}): string; diff --git a/react-router/lib/PropTypes.d.ts b/react-router/lib/PropTypes.d.ts new file mode 100644 index 0000000000..bbd6431070 --- /dev/null +++ b/react-router/lib/PropTypes.d.ts @@ -0,0 +1,19 @@ +import * as React from 'react'; + +export function falsy(props: any, propName: string, componentName: string): Error; +export const history: React.Requireable; +export const location: React.Requireable; +export const component: React.Requireable; +export const components: React.Requireable; +export const route: React.Requireable; +export const routes: React.Requireable; + +export default { + falsy, + history, + location, + component, + components, + route +}; + diff --git a/react-router/lib/Redirect.d.ts b/react-router/lib/Redirect.d.ts new file mode 100644 index 0000000000..e09b576d53 --- /dev/null +++ b/react-router/lib/Redirect.d.ts @@ -0,0 +1,19 @@ +import * as React from 'react'; +import Router from './Router'; +import * as H from 'history'; + +declare const self: self.Redirect; +type self = typeof self; +export default self; + +declare namespace self { + interface RedirectProps extends React.Props { + path?: Router.RoutePattern; + from?: Router.RoutePattern; // alias for path + to: Router.RoutePattern; + query?: H.Query; + state?: H.LocationState; + } + interface Redirect extends React.ComponentClass { } + interface RedirectElement extends React.ReactElement { } +} diff --git a/react-router/lib/Route.d.ts b/react-router/lib/Route.d.ts new file mode 100644 index 0000000000..682f74f1ac --- /dev/null +++ b/react-router/lib/Route.d.ts @@ -0,0 +1,25 @@ +import * as React from 'react'; +import Router from './Router'; +import { Location } from 'history'; + +declare const self: self.Route; +type self = self.Route; +export default self; + +declare namespace self { + + interface RouteProps extends React.Props { + path?: Router.RoutePattern; + component?: Router.RouteComponent; + components?: Router.RouteComponents; + getComponent?: (location: Location, cb: (error: any, component?: Router.RouteComponent) => void) => void; + getComponents?: (location: Location, cb: (error: any, components?: Router.RouteComponents) => void) => void; + onEnter?: Router.EnterHook; + onLeave?: Router.LeaveHook; + onChange?: Router.ChangeHook; + getIndexRoute?: (location: Location, cb: (error: any, indexRoute: Router.RouteConfig) => void) => void; + getChildRoutes?: (location: Location, cb: (error: any, childRoutes: Router.RouteConfig) => void) => void; + } + interface Route extends React.ComponentClass {} + interface RouteElement extends React.ReactElement {} +} \ No newline at end of file diff --git a/react-router/lib/RouteContext.d.ts b/react-router/lib/RouteContext.d.ts new file mode 100644 index 0000000000..c35ab92a80 --- /dev/null +++ b/react-router/lib/RouteContext.d.ts @@ -0,0 +1,5 @@ +import * as React from 'react'; + +declare const RouteContext: React.Mixin +export default RouteContext; + diff --git a/react-router/lib/RouteUtils.d.ts b/react-router/lib/RouteUtils.d.ts new file mode 100644 index 0000000000..7065056ff5 --- /dev/null +++ b/react-router/lib/RouteUtils.d.ts @@ -0,0 +1,8 @@ +import * as React from 'react'; +import Router from './Router'; + +type E = React.ReactElement; +export function isReactChildren(object: E | E[]): boolean; +export function createRouteFromReactElement(element: E): Router.PlainRoute; +export function createRoutesFromReactChildren(children: E | E[], parentRoute: Router.PlainRoute): Router.PlainRoute[]; +export function createRoutes(routes: Router.RouteConfig): Router.PlainRoute[]; diff --git a/react-router/lib/Router.d.ts b/react-router/lib/Router.d.ts new file mode 100644 index 0000000000..c6eb38379d --- /dev/null +++ b/react-router/lib/Router.d.ts @@ -0,0 +1,89 @@ +import * as React from 'react'; +import { + QueryString, Query, + Location, LocationDescriptor, LocationState, + History, + Pathname, Path } from 'history'; + +declare const Router: Router; +interface Router extends React.ComponentClass { } + +export default Router; + +// types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md + +declare namespace Router { + type RouteConfig = React.ReactNode | PlainRoute | PlainRoute[]; + type RoutePattern = string; + type RouteComponents = { [key: string]: RouteComponent }; + + type ParseQueryString = (queryString: QueryString) => Query; + type StringifyQuery = (queryObject: Query) => QueryString; + + type Component = React.ReactType; + type RouteComponent = Component; + + type EnterHook = (nextState: RouterState, replace: RedirectFunction, callback?: Function) => void; + type LeaveHook = () => void; + type ChangeHook = (prevState: RouterState, nextState: RouterState, replace: RedirectFunction, callback: Function) => void; + type RouteHook = (nextLocation?: Location) => any; + + type Params = { [param: string]: string }; + + type RouterListener = (error: Error, nextState: RouterState) => void; + + + interface RedirectFunction { + (location: LocationDescriptor): void; + /** + * @deprecated `replaceState(state, pathname, query) is deprecated; Use `replace(location)` with a location descriptor instead. http://tiny.cc/router-isActivedeprecated + */ + (state: LocationState, pathname: Pathname | Path, query?: Query): void; + } + + interface RouterState { + location: Location; + routes: PlainRoute[]; + params: Params; + components: RouteComponent[]; + } + + interface RouterProps extends React.Props { + history?: History; + routes?: RouteConfig; // alias for children + createElement?: (component: RouteComponent, props: Object) => any; + onError?: (error: any) => any; + onUpdate?: () => any; + parseQueryString?: ParseQueryString; + stringifyQuery?: StringifyQuery; + } + + interface PlainRoute { + path?: RoutePattern; + component?: RouteComponent; + components?: RouteComponents; + getComponent?: (location: Location, cb: (error: any, component?: RouteComponent) => void) => void; + getComponents?: (location: Location, cb: (error: any, components?: RouteComponents) => void) => void; + onEnter?: EnterHook; + onLeave?: LeaveHook; + indexRoute?: PlainRoute; + getIndexRoute?: (location: Location, cb: (error: any, indexRoute: RouteConfig) => void) => void; + childRoutes?: PlainRoute[]; + getChildRoutes?: (location: Location, cb: (error: any, childRoutes: RouteConfig) => void) => void; + } + + interface RouteComponentProps { + history?: History; + location?: Location; + params?: P; + route?: PlainRoute; + routeParams?: R; + routes?: PlainRoute[]; + children?: React.ReactElement; + } + + interface RouterOnContext extends History { + setRouteLeaveHook(route: PlainRoute, hook?: RouteHook): () => void; + isActive(pathOrLoc: LocationDescriptor, indexOnly?: boolean): boolean; + } +} diff --git a/react-router/lib/RouterContext.d.ts b/react-router/lib/RouterContext.d.ts new file mode 100644 index 0000000000..b6eab5831c --- /dev/null +++ b/react-router/lib/RouterContext.d.ts @@ -0,0 +1,25 @@ +import * as React from 'react'; +import * as H from 'history'; +import Router from './Router'; + +declare const self: self.RouterContext; +type self = self.RouterContext; +export default self; + +declare namespace self { + interface RouterContextProps extends React.Props { + history?: H.History; + router: Router; + createElement: (component: Router.RouteComponent, props: Object) => any; + location: H.Location; + routes: Router.RouteConfig; + params: Router.Params; + components?: Router.RouteComponent[]; + } + interface RouterContext extends React.ComponentClass {} + interface RouterContextElement extends React.ReactElement { + history?: H.History; + location: H.Location; + router?: Router; + } +} \ No newline at end of file diff --git a/react-router/lib/browserHistory.d.ts b/react-router/lib/browserHistory.d.ts new file mode 100644 index 0000000000..e486255b72 --- /dev/null +++ b/react-router/lib/browserHistory.d.ts @@ -0,0 +1,3 @@ +import { History } from './History'; +declare const browserHistory: History; +export default browserHistory; diff --git a/react-router/lib/createMemoryHistory.d.ts b/react-router/lib/createMemoryHistory.d.ts new file mode 100644 index 0000000000..5df481bfa1 --- /dev/null +++ b/react-router/lib/createMemoryHistory.d.ts @@ -0,0 +1,3 @@ +import * as H from 'history'; + +export default function createMemoryHistory(options?: H.HistoryOptions): H.History; \ No newline at end of file diff --git a/react-router/lib/hashHistory.d.ts b/react-router/lib/hashHistory.d.ts new file mode 100644 index 0000000000..34b6f7113d --- /dev/null +++ b/react-router/lib/hashHistory.d.ts @@ -0,0 +1,3 @@ +import { History } from './History'; +declare const hashHistory: History; +export default hashHistory; diff --git a/react-router/lib/match.d.ts b/react-router/lib/match.d.ts new file mode 100644 index 0000000000..3a353367ed --- /dev/null +++ b/react-router/lib/match.d.ts @@ -0,0 +1,15 @@ +import * as H from 'history'; +import Router from './Router'; + +interface MatchArgs { + routes?: Router.RouteConfig; + history?: H.History; + location?: H.Location | string; + parseQueryString?: Router.ParseQueryString; + stringifyQuery?: Router.StringifyQuery; +} +interface MatchState extends Router.RouterState { + history: History; +} +export default function match(args: MatchArgs, cb: (error: any, nextLocation: H.Location, nextState: MatchState) => void): void; + diff --git a/react-router/lib/useRouterHistory.d.ts b/react-router/lib/useRouterHistory.d.ts new file mode 100644 index 0000000000..d3e043b609 --- /dev/null +++ b/react-router/lib/useRouterHistory.d.ts @@ -0,0 +1,7 @@ +import { History, HistoryOptions, HistoryQueries, CreateHistory } from 'history'; + +interface CreateRouterHistory { + (options?: HistoryOptions): History & HistoryQueries; +} + +export default function useRouterHistory(createHistory: CreateHistory): CreateRouterHistory; diff --git a/react-router/lib/useRoutes.d.ts b/react-router/lib/useRoutes.d.ts new file mode 100644 index 0000000000..47f47a7c2f --- /dev/null +++ b/react-router/lib/useRoutes.d.ts @@ -0,0 +1,5 @@ +import * as H from 'history'; +import { HistoryRoutes } from './History'; + +declare function useRoutes(createHistory: H.CreateHistory): H.CreateHistory; +export default useRoutes; diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx index bdf2528f5b..6da334bffb 100644 --- a/react-router/react-router-tests.tsx +++ b/react-router/react-router-tests.tsx @@ -1,17 +1,10 @@ - -/// -/// - - - - import * as React from "react" import * as ReactDOM from "react-dom" -import { browserHistory, hashHistory, createMemoryHistory, Router, Route, IndexRoute, Link } from "react-router" +import { browserHistory, hashHistory, createMemoryHistory, Router, Route, IndexRoute, Link, RouterOnContext } from "react-router" interface MasterContext { - router: ReactRouter.RouterOnContext; + router: RouterOnContext; } class Master extends React.Component, {}> { diff --git a/react-swf/react-swf-tests.ts b/react-swf/react-swf-tests.ts index fca60061c6..4203826a3c 100644 --- a/react-swf/react-swf-tests.ts +++ b/react-swf/react-swf-tests.ts @@ -1,5 +1,4 @@ -/// -/// +/// var version = ReactSWF.getFPVersion(); var isFPVersionSupported = ReactSWF.isFPVersionSupported('5'); var reactSWF = new ReactSWF(); diff --git a/react/index.d.ts b/react/index.d.ts index efe8d8c2e8..9e00e19d82 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -3,7 +3,10 @@ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace __React { +export = React; +export as namespace React; + +declare namespace React { // // React Elements @@ -2315,160 +2318,156 @@ declare namespace __React { } } -declare module "react" { - export = __React; -} +declare global { + namespace JSX { + interface Element extends React.ReactElement { } + interface ElementClass extends React.Component { + render(): JSX.Element; + } + interface ElementAttributesProperty { props: {}; } -declare namespace JSX { - import React = __React; + interface IntrinsicAttributes extends React.Attributes { } + interface IntrinsicClassAttributes extends React.ClassAttributes { } - interface Element extends React.ReactElement { } - interface ElementClass extends React.Component { - render(): JSX.Element; + interface IntrinsicElements { + // HTML + a: React.HTMLProps; + abbr: React.HTMLProps; + address: React.HTMLProps; + area: React.HTMLProps; + article: React.HTMLProps; + aside: React.HTMLProps; + audio: React.HTMLProps; + b: React.HTMLProps; + base: React.HTMLProps; + bdi: React.HTMLProps; + bdo: React.HTMLProps; + big: React.HTMLProps; + blockquote: React.HTMLProps; + body: React.HTMLProps; + br: React.HTMLProps; + button: React.HTMLProps; + canvas: React.HTMLProps; + caption: React.HTMLProps; + cite: React.HTMLProps; + code: React.HTMLProps; + col: React.HTMLProps; + colgroup: React.HTMLProps; + data: React.HTMLProps; + datalist: React.HTMLProps; + dd: React.HTMLProps; + del: React.HTMLProps; + details: React.HTMLProps; + dfn: React.HTMLProps; + dialog: React.HTMLProps; + div: React.HTMLProps; + dl: React.HTMLProps; + dt: React.HTMLProps; + em: React.HTMLProps; + embed: React.HTMLProps; + fieldset: React.HTMLProps; + figcaption: React.HTMLProps; + figure: React.HTMLProps; + footer: React.HTMLProps; + form: React.HTMLProps; + h1: React.HTMLProps; + h2: React.HTMLProps; + h3: React.HTMLProps; + h4: React.HTMLProps; + h5: React.HTMLProps; + h6: React.HTMLProps; + head: React.HTMLProps; + header: React.HTMLProps; + hgroup: React.HTMLProps; + hr: React.HTMLProps; + html: React.HTMLProps; + i: React.HTMLProps; + iframe: React.HTMLProps; + img: React.HTMLProps; + input: React.HTMLProps; + ins: React.HTMLProps; + kbd: React.HTMLProps; + keygen: React.HTMLProps; + label: React.HTMLProps; + legend: React.HTMLProps; + li: React.HTMLProps; + link: React.HTMLProps; + main: React.HTMLProps; + map: React.HTMLProps; + mark: React.HTMLProps; + menu: React.HTMLProps; + menuitem: React.HTMLProps; + meta: React.HTMLProps; + meter: React.HTMLProps; + nav: React.HTMLProps; + noscript: React.HTMLProps; + object: React.HTMLProps; + ol: React.HTMLProps; + optgroup: React.HTMLProps; + option: React.HTMLProps; + output: React.HTMLProps; + p: React.HTMLProps; + param: React.HTMLProps; + picture: React.HTMLProps; + pre: React.HTMLProps; + progress: React.HTMLProps; + q: React.HTMLProps; + rp: React.HTMLProps; + rt: React.HTMLProps; + ruby: React.HTMLProps; + s: React.HTMLProps; + samp: React.HTMLProps; + script: React.HTMLProps; + section: React.HTMLProps; + select: React.HTMLProps; + small: React.HTMLProps; + source: React.HTMLProps; + span: React.HTMLProps; + strong: React.HTMLProps; + style: React.HTMLProps; + sub: React.HTMLProps; + summary: React.HTMLProps; + sup: React.HTMLProps; + table: React.HTMLProps; + tbody: React.HTMLProps; + td: React.HTMLProps; + textarea: React.HTMLProps; + tfoot: React.HTMLProps; + th: React.HTMLProps; + thead: React.HTMLProps; + time: React.HTMLProps; + title: React.HTMLProps; + tr: React.HTMLProps; + track: React.HTMLProps; + u: React.HTMLProps; + ul: React.HTMLProps; + "var": React.HTMLProps; + video: React.HTMLProps; + wbr: React.HTMLProps; + + // SVG + svg: React.SVGProps; + + circle: React.SVGProps; + clipPath: React.SVGProps; + defs: React.SVGProps; + ellipse: React.SVGProps; + g: React.SVGProps; + image: React.SVGProps; + line: React.SVGProps; + linearGradient: React.SVGProps; + mask: React.SVGProps; + path: React.SVGProps; + pattern: React.SVGProps; + polygon: React.SVGProps; + polyline: React.SVGProps; + radialGradient: React.SVGProps; + rect: React.SVGProps; + stop: React.SVGProps; + symbol: React.SVGProps; + text: React.SVGProps; + tspan: React.SVGProps; + use: React.SVGProps; + } } - interface ElementAttributesProperty { props: {}; } - - interface IntrinsicAttributes extends React.Attributes { } - interface IntrinsicClassAttributes extends React.ClassAttributes { } - - interface IntrinsicElements { - // HTML - a: React.HTMLProps; - abbr: React.HTMLProps; - address: React.HTMLProps; - area: React.HTMLProps; - article: React.HTMLProps; - aside: React.HTMLProps; - audio: React.HTMLProps; - b: React.HTMLProps; - base: React.HTMLProps; - bdi: React.HTMLProps; - bdo: React.HTMLProps; - big: React.HTMLProps; - blockquote: React.HTMLProps; - body: React.HTMLProps; - br: React.HTMLProps; - button: React.HTMLProps; - canvas: React.HTMLProps; - caption: React.HTMLProps; - cite: React.HTMLProps; - code: React.HTMLProps; - col: React.HTMLProps; - colgroup: React.HTMLProps; - data: React.HTMLProps; - datalist: React.HTMLProps; - dd: React.HTMLProps; - del: React.HTMLProps; - details: React.HTMLProps; - dfn: React.HTMLProps; - dialog: React.HTMLProps; - div: React.HTMLProps; - dl: React.HTMLProps; - dt: React.HTMLProps; - em: React.HTMLProps; - embed: React.HTMLProps; - fieldset: React.HTMLProps; - figcaption: React.HTMLProps; - figure: React.HTMLProps; - footer: React.HTMLProps; - form: React.HTMLProps; - h1: React.HTMLProps; - h2: React.HTMLProps; - h3: React.HTMLProps; - h4: React.HTMLProps; - h5: React.HTMLProps; - h6: React.HTMLProps; - head: React.HTMLProps; - header: React.HTMLProps; - hgroup: React.HTMLProps; - hr: React.HTMLProps; - html: React.HTMLProps; - i: React.HTMLProps; - iframe: React.HTMLProps; - img: React.HTMLProps; - input: React.HTMLProps; - ins: React.HTMLProps; - kbd: React.HTMLProps; - keygen: React.HTMLProps; - label: React.HTMLProps; - legend: React.HTMLProps; - li: React.HTMLProps; - link: React.HTMLProps; - main: React.HTMLProps; - map: React.HTMLProps; - mark: React.HTMLProps; - menu: React.HTMLProps; - menuitem: React.HTMLProps; - meta: React.HTMLProps; - meter: React.HTMLProps; - nav: React.HTMLProps; - noscript: React.HTMLProps; - object: React.HTMLProps; - ol: React.HTMLProps; - optgroup: React.HTMLProps; - option: React.HTMLProps; - output: React.HTMLProps; - p: React.HTMLProps; - param: React.HTMLProps; - picture: React.HTMLProps; - pre: React.HTMLProps; - progress: React.HTMLProps; - q: React.HTMLProps; - rp: React.HTMLProps; - rt: React.HTMLProps; - ruby: React.HTMLProps; - s: React.HTMLProps; - samp: React.HTMLProps; - script: React.HTMLProps; - section: React.HTMLProps; - select: React.HTMLProps; - small: React.HTMLProps; - source: React.HTMLProps; - span: React.HTMLProps; - strong: React.HTMLProps; - style: React.HTMLProps; - sub: React.HTMLProps; - summary: React.HTMLProps; - sup: React.HTMLProps; - table: React.HTMLProps; - tbody: React.HTMLProps; - td: React.HTMLProps; - textarea: React.HTMLProps; - tfoot: React.HTMLProps; - th: React.HTMLProps; - thead: React.HTMLProps; - time: React.HTMLProps; - title: React.HTMLProps; - tr: React.HTMLProps; - track: React.HTMLProps; - u: React.HTMLProps; - ul: React.HTMLProps; - "var": React.HTMLProps; - video: React.HTMLProps; - wbr: React.HTMLProps; - - // SVG - svg: React.SVGProps; - - circle: React.SVGProps; - clipPath: React.SVGProps; - defs: React.SVGProps; - ellipse: React.SVGProps; - g: React.SVGProps; - image: React.SVGProps; - line: React.SVGProps; - linearGradient: React.SVGProps; - mask: React.SVGProps; - path: React.SVGProps; - pattern: React.SVGProps; - polygon: React.SVGProps; - polyline: React.SVGProps; - radialGradient: React.SVGProps; - rect: React.SVGProps; - stop: React.SVGProps; - symbol: React.SVGProps; - text: React.SVGProps; - tspan: React.SVGProps; - use: React.SVGProps; - } -} +} \ No newline at end of file