diff --git a/import/Fable.Import.Test.fsproj b/import/Fable.Import.Test.fsproj
index faa9dd08a3..5dce38e26d 100644
--- a/import/Fable.Import.Test.fsproj
+++ b/import/Fable.Import.Test.fsproj
@@ -58,6 +58,11 @@
+
+
+
+
+
diff --git a/import/electron/Fable.Import.Electron.fs b/import/electron/Fable.Import.Electron.fs
index 98560d7e8e..d6a666ce59 100644
--- a/import/electron/Fable.Import.Electron.fs
+++ b/import/electron/Fable.Import.Electron.fs
@@ -28,8 +28,10 @@ module Electron =
member __.once(``event``: string, listener: Function): NodeJS.EventEmitter = failwith "JS only"
member __.removeListener(``event``: string, listener: Function): NodeJS.EventEmitter = failwith "JS only"
member __.removeAllListeners(?``event``: string): NodeJS.EventEmitter = failwith "JS only"
- member __.setMaxListeners(n: float): unit = failwith "JS only"
+ member __.setMaxListeners(n: int): unit = failwith "JS only"
+ member __.getMaxListeners(): int = failwith "JS only"
member __.listeners(``event``: string): ResizeArray = failwith "JS only"
+ member __.listenerCount(``type``: string): int = failwith "JS only"
member __.emit(``event``: string, [] args: obj[]): bool = failwith "JS only"
and Event =
diff --git a/import/react-redux/Fable.Import.ReactRedux.fs b/import/react-redux/Fable.Import.ReactRedux.fs
index 6fd49f1e20..39777803d1 100644
--- a/import/react-redux/Fable.Import.ReactRedux.fs
+++ b/import/react-redux/Fable.Import.ReactRedux.fs
@@ -3,10 +3,13 @@ open System
open System.Text.RegularExpressions
open Fable.Core
open Fable.Import.JS
+open Fable.Import.React
+open Fable.Import.Redux
+// Type definitions for react-redux v. 4.4.0, generated from Typescript
module ReactRedux =
- type [] ElementClass() =
- interface Component
+ type [] ElementClass<'P, 'S when 'P :> Property<'P>>(?props: 'P, ?context: obj) =
+ inherit Component<'P, 'S>(?props = props, ?context = context)
and ClassDecorator =
@@ -19,20 +22,20 @@ module ReactRedux =
[] abstract Invoke: dispatch: Dispatch * ?ownProps: obj -> obj
and MapDispatchToPropsObject =
- [] abstract Item: name: string -> ActionCreator with get, set
+ [] abstract Item: name: string -> ActionCreator with get
and MergeProps =
[] abstract Invoke: stateProps: obj * dispatchProps: obj * ownProps: obj -> obj
and Options =
- abstract ``pure``: bool with get, set
+ abstract ``pure``: bool with get
- and Property =
- abstract store: Store option with get, set
- abstract children: Function option with get, set
+ and Property<'P when 'P :> Property<'P>> =
+ abstract store: Store option with get
+ abstract children: React.ReactElement<'P> option with get
- and [] Provider() =
- interface Component
+ and [] Provider<'StateType, 'PropType when 'PropType :> Property<'PropType>>(?props: Property<'PropType>, ?context: obj) =
+ inherit Component, 'StateType>(?props = props, ?context = context)
type [] Globals =
diff --git a/import/react-redux/README.md b/import/react-redux/README.md
index 7acdb104de..bd5edd9374 100644
--- a/import/react-redux/README.md
+++ b/import/react-redux/README.md
@@ -1,6 +1,11 @@
# fable-import-react-redux
-Fable bindings for the Redux React bindings
+Fable bindings for the Redux React bindings (react-redux) version 4.4.0.
+These were generated from the Typescript file but modified to remove setters.
+In addition, ElementClass needs to inherit from Component rather than
+trying to implement it as an interface.
+
+Typescript source file is [here](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0b96933934c2e37a749aad8e38e23214e21e7dab/react-redux/react-redux.d.ts).
## Installation
diff --git a/import/react-redux/package.json b/import/react-redux/package.json
index c9c8e25a85..b78d210952 100644
--- a/import/react-redux/package.json
+++ b/import/react-redux/package.json
@@ -1,7 +1,7 @@
{
"name": "fable-import-react-redux",
"version": "0.0.1",
- "description": "Fable bindings for Redux bindings for React",
+ "description": "Fable bindings for Redux bindings for React (react-redux) version 4.4.0",
"repository": {
"type": "git",
"url": "https://github.com/fsprojects/Fable/import/react-redux"
diff --git a/import/react-router-redux/Fable.Import.ReactRouterRedux.fs b/import/react-router-redux/Fable.Import.ReactRouterRedux.fs
index 54d1883c33..bbef340d84 100644
--- a/import/react-router-redux/Fable.Import.ReactRouterRedux.fs
+++ b/import/react-router-redux/Fable.Import.ReactRouterRedux.fs
@@ -3,7 +3,10 @@ open System
open System.Text.RegularExpressions
open Fable.Core
open Fable.Import.JS
+module H = Fable.Import.HistoryModule
+module R = Fable.Import.Redux
+// Type definitions for react-router-redux v4.0.0, generated from Typescript
module ReactRouterRedux =
type LocationDescriptor =
U2
@@ -27,11 +30,11 @@ module ReactRouterRedux =
obj
and RouteActions =
- abstract push: PushAction with get, set
- abstract replace: ReplaceAction with get, set
- abstract go: GoAction with get, set
- abstract goForward: GoForwardAction with get, set
- abstract goBack: GoBackAction with get, set
+ abstract push: PushAction with get
+ abstract replace: ReplaceAction with get
+ abstract go: GoAction with get
+ abstract goForward: GoForwardAction with get
+ abstract goBack: GoBackAction with get
and ReactRouterReduxHistory =
inherit H.History
@@ -42,8 +45,8 @@ module ReactRouterRedux =
[] abstract Invoke: state: obj -> obj
and SyncHistoryWithStoreOptions =
- abstract selectLocationState: DefaultSelectLocationState option with get, set
- abstract adjustUrlOnReplay: bool option with get, set
+ abstract selectLocationState: DefaultSelectLocationState option with get
+ abstract adjustUrlOnReplay: bool option with get
type [] Globals =
static member CALL_HISTORY_METHOD with get(): string = failwith "JS only" and set(v: string): unit = failwith "JS only"
@@ -54,7 +57,7 @@ module ReactRouterRedux =
static member goBack with get(): GoForwardAction = failwith "JS only" and set(v: GoForwardAction): unit = failwith "JS only"
static member goForward with get(): GoBackAction = failwith "JS only" and set(v: GoBackAction): unit = failwith "JS only"
static member routerActions with get(): RouteActions = failwith "JS only" and set(v: RouteActions): unit = failwith "JS only"
- static member routerReducer(?state: obj, ?options: obj): R.Reducer = failwith "JS only"
+ static member routerReducer(?state: obj, ?options: obj): R.Reducer<'T,'U> = failwith "JS only"
static member syncHistoryWithStore(history: H.History, store: R.Store, ?options: SyncHistoryWithStoreOptions): ReactRouterReduxHistory = failwith "JS only"
static member routerMiddleware(history: H.History): R.Middleware = failwith "JS only"
diff --git a/import/react-router-redux/README.md b/import/react-router-redux/README.md
index 3d55041806..2dde1b45fb 100644
--- a/import/react-router-redux/README.md
+++ b/import/react-router-redux/README.md
@@ -1,6 +1,10 @@
# fable-import-react-router-redux
-Fable bindings for the Redux React Router (react-router-redux) bindings.
+Fable bindings for the Redux React Router (react-router-redux) bindings, v4.0.0.
+These were generated from Typescript, with some modifications: namely, all
+setters were removed, and type parameters were provided when `Reducer` is used.
+
+Typescript source file is [here](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/56295f5058cac7ae458540423c50ac2dcf9fc711/react-router-redux/react-router-redux.d.ts).
## Installation
diff --git a/import/react-router-redux/package.json b/import/react-router-redux/package.json
index fb96b4ccf5..8bc6ca3ba8 100644
--- a/import/react-router-redux/package.json
+++ b/import/react-router-redux/package.json
@@ -1,7 +1,7 @@
{
"name": "fable-import-react-router-redux",
"version": "0.0.1",
- "description": "Fable bindings for Redux bindings for React Router",
+ "description": "Fable bindings for Redux bindings for React Router (react-router-redux) v4.0.0",
"repository": {
"type": "git",
"url": "https://github.com/fsprojects/Fable/import/react-router-redux"
diff --git a/import/react-router/Fable.Import.HistoryModule.fs b/import/react-router/Fable.Import.HistoryModule.fs
new file mode 100644
index 0000000000..06a5427801
--- /dev/null
+++ b/import/react-router/Fable.Import.HistoryModule.fs
@@ -0,0 +1,168 @@
+namespace Fable.Import
+open System
+open System.Text.RegularExpressions
+open Fable.Core
+open Fable.Import.JS
+open Fable.Import.Browser
+
+// Type definitions for history v2.0.0; generated from Typescript with some modifications including some module names.
+module HistoryModule =
+ type Action =
+ string
+
+ and BeforeUnloadHook =
+ Func>
+
+ and CreateHistory<'T> =
+ Func
+
+ and CreateHistoryEnhancer<'T, 'E> =
+ Func, CreateHistory<'E>>
+
+ and History =
+ abstract listenBefore: hook: TransitionHook -> Func
+ abstract listen: listener: LocationListener -> Func
+ abstract transitionTo: location: Location -> unit
+ abstract push: path: LocationDescriptor -> unit
+ abstract replace: path: LocationDescriptor -> unit
+ abstract go: n: float -> unit
+ abstract goBack: unit -> unit
+ abstract goForward: unit -> unit
+ abstract createKey: unit -> LocationKey
+ abstract createPath: path: LocationDescriptor -> Path
+ abstract createHref: path: LocationDescriptor -> Href
+ abstract createLocation: ?path: LocationDescriptor * ?action: Action * ?key: LocationKey -> Location
+ abstract createLocation: ?path: Path * ?state: LocationState * ?action: Action * ?key: LocationKey -> Location
+ abstract pushState: state: LocationState * path: Path -> unit
+ abstract replaceState: state: LocationState * path: Path -> unit
+ abstract setState: state: LocationState -> unit
+ abstract registerTransitionHook: hook: TransitionHook -> unit
+ abstract unregisterTransitionHook: hook: TransitionHook -> unit
+
+ and HistoryOptions =
+ obj
+
+ and Href =
+ string
+
+ and Location =
+ obj
+
+ and LocationDescriptorObject =
+ obj
+
+ and LocationDescriptor =
+ U2
+
+ and LocationKey =
+ string
+
+ and LocationListener =
+ Func
+
+ and LocationState =
+ obj
+
+ and Path =
+ string
+
+ and Pathname =
+ string
+
+ and Query =
+ obj
+
+ and QueryString =
+ string
+
+ and Search =
+ string
+
+ and TransitionHook =
+ Func, obj>
+
+ and Hash =
+ string
+
+ and HistoryBeforeUnload =
+ abstract listenBeforeUnload: hook: BeforeUnloadHook -> Func
+
+ and HistoryQueries =
+ abstract pushState: state: LocationState * pathname: U2 * ?query: Query -> unit
+ abstract replaceState: state: LocationState * pathname: U2 * ?query: Query -> unit
+ abstract createPath: path: Path * ?query: Query -> Path
+ abstract createHref: path: Path * ?query: Query -> Href
+
+ and Module =
+ abstract createHistory: CreateHistory with get
+ abstract createHashHistory: CreateHistory with get
+ abstract createMemoryHistory: CreateHistory with get
+ abstract actions: obj with get
+ abstract createLocation: ?path: Path * ?state: LocationState * ?action: Action * ?key: LocationKey -> Location
+ abstract useBasename: createHistory: CreateHistory<'T> -> CreateHistory<'T>
+ abstract useBeforeUnload: createHistory: CreateHistory<'T> -> CreateHistory
+ abstract useQueries: createHistory: CreateHistory<'T> -> CreateHistory
+
+
+
+module CreateBrowserHistory =
+ type [] Globals =
+ static member createBrowserHistory(?options: HistoryModule.HistoryOptions): HistoryModule.History = failwith "JS only"
+
+
+
+module CreateHashHistory =
+ type [] Globals =
+ static member createHashHistory(?options: HistoryModule.HistoryOptions): HistoryModule.History = failwith "JS only"
+
+
+
+module CreateMemoryHistory =
+ type [] Globals =
+ static member createMemoryHistory(?options: HistoryModule.HistoryOptions): HistoryModule.History = failwith "JS only"
+
+
+
+module CreateLocation =
+ type [] Globals =
+ static member createLocation(?path: HistoryModule.Path, ?state: HistoryModule.LocationState, ?action: HistoryModule.Action, ?key: HistoryModule.LocationKey): HistoryModule.Location = failwith "JS only"
+
+
+
+module UseBasename =
+ type [] Globals =
+ static member useBasename(createHistory: HistoryModule.CreateHistory<'T>): HistoryModule.CreateHistory<'T> = failwith "JS only"
+
+
+
+module UseBeforeUnload =
+ type [] Globals =
+ static member useBeforeUnload(createHistory: HistoryModule.CreateHistory<'T>): HistoryModule.CreateHistory = failwith "JS only"
+
+
+
+module UseQueries =
+ type [] Globals =
+ static member useQueries(createHistory: HistoryModule.CreateHistory<'T>): HistoryModule.CreateHistory = failwith "JS only"
+
+
+
+module HistoryActions =
+ type [] Globals =
+ static member PUSH with get(): string = failwith "JS only" and set(v: string): unit = failwith "JS only"
+ static member REPLACE with get(): string = failwith "JS only" and set(v: string): unit = failwith "JS only"
+ static member POP with get(): string = failwith "JS only" and set(v: string): unit = failwith "JS only"
+
+
+
+module HistoryDOMUtils =
+ type [] Globals =
+ static member addEventListener(node: EventTarget, ``event``: string, listener: EventListenerOrEventListenerObject): unit = failwith "JS only"
+ static member removeEventListener(node: EventTarget, ``event``: string, listener: EventListenerOrEventListenerObject): unit = failwith "JS only"
+ static member getHashPath(): string = failwith "JS only"
+ static member replaceHashPath(path: string): unit = failwith "JS only"
+ static member getWindowPath(): string = failwith "JS only"
+ static member go(n: float): unit = failwith "JS only"
+ static member getUserConfirmation(message: string, callback: Func): unit = failwith "JS only"
+ static member supportsHistory(): bool = failwith "JS only"
+ static member supportsGoWithoutReloadUsingHash(): bool = failwith "JS only"
diff --git a/import/react-router/Fable.Import.ReactRouter.fs b/import/react-router/Fable.Import.ReactRouter.fs
new file mode 100644
index 0000000000..5163edab9d
--- /dev/null
+++ b/import/react-router/Fable.Import.ReactRouter.fs
@@ -0,0 +1,301 @@
+namespace Fable.Import
+open System
+open System.Text.RegularExpressions
+open Fable.Core
+open Fable.Import.JS
+open Fable.Import.React
+module H = Fable.Import.HistoryModule
+
+// Type definitions for react-router v2.0.0; generated from Typescript with some modifications.
+module ReactRouter =
+ type Component =
+ React.ReactType
+
+ and EnterHook =
+ Func
+
+ and LeaveHook =
+ Func
+
+ and ChangeHook =
+ Func
+
+ and Params =
+ obj
+
+ and ParseQueryString =
+ Func
+
+ and RedirectFunction =
+ [] abstract Invoke: location: H.LocationDescriptor -> unit
+ [] abstract Invoke: state: H.LocationState * pathname: U2 * ?query: H.Query -> unit
+
+ and RouteComponent =
+ Component
+
+ and RouteComponentProps<'P, 'R> =
+ abstract history: History option with get
+ abstract location: H.Location option with get
+ abstract ``params``: 'P option with get
+ abstract route: PlainRoute option with get
+ abstract routeParams: 'R option with get
+ abstract routes: ResizeArray option with get
+ abstract children: React.ReactElement option with get
+
+ and RouteComponents =
+ obj
+
+ and RouteConfig =
+ U3>
+
+ and RouteHook =
+ Func
+
+ and RoutePattern =
+ string
+
+ and StringifyQuery =
+ Func
+
+ and RouterListener =
+ Func
+
+ and RouterState =
+ abstract location: H.Location with get
+ abstract routes: ResizeArray with get
+ abstract ``params``: Params with get
+ abstract components: ResizeArray with get
+
+ and HistoryBase =
+ inherit H.History
+ abstract routes: ResizeArray with get
+ abstract parseQueryString: ParseQueryString option with get
+ abstract stringifyQuery: StringifyQuery option with get
+
+ and History =
+ obj
+
+ and RouterProps =
+ inherit React.Props
+ abstract history: H.History option with get
+ abstract routes: RouteConfig option with get
+ abstract createElement: Func option with get
+ abstract onError: Func option with get
+ abstract onUpdate: Func option with get
+ abstract parseQueryString: ParseQueryString option with get
+ abstract stringifyQuery: StringifyQuery option with get
+
+ and Router =
+ inherit React.ComponentClass
+
+
+ and RouterElement =
+ inherit React.ReactElement
+
+
+ and LinkProps =
+ inherit React.HTMLAttributes
+ inherit React.Props
+ abstract activeStyle: React.CSSProperties option with get
+ abstract activeClassName: string option with get
+ abstract onlyActiveOnIndex: bool option with get
+ abstract ``to``: U2 with get
+ abstract query: H.Query option with get
+ abstract state: H.LocationState option with get
+
+ and Link =
+ inherit React.ComponentClass
+
+
+ and LinkElement =
+ inherit React.ReactElement
+
+
+ and RouterContextProps =
+ inherit React.Props
+ abstract history: H.History option with get
+ abstract router: Router with get
+ abstract createElement: Func with get
+ abstract location: H.Location with get
+ abstract routes: RouteConfig with get
+ abstract ``params``: Params with get
+ abstract components: ResizeArray option with get
+
+ and RouterContext =
+ inherit React.ComponentClass
+
+
+ and RouterContextElement =
+ inherit React.ReactElement
+ abstract history: H.History option with get
+ abstract location: H.Location with get
+ abstract router: Router option with get
+
+ and RouteProps =
+ inherit React.Props
+ abstract path: RoutePattern option with get
+ abstract ``component``: RouteComponent option with get
+ abstract components: RouteComponents option with get
+ abstract getComponent: Func, unit> option with get
+ abstract getComponents: Func, unit> option with get
+ abstract onEnter: EnterHook option with get
+ abstract onLeave: LeaveHook option with get
+ abstract onChange: ChangeHook option with get
+ abstract getIndexRoute: Func, unit> option with get
+ abstract getChildRoutes: Func, unit> option with get
+
+ and Route =
+ inherit React.ComponentClass
+
+
+ and RouteElement =
+ inherit React.ReactElement
+
+
+ and PlainRoute =
+ abstract path: RoutePattern option with get
+ abstract ``component``: RouteComponent option with get
+ abstract components: RouteComponents option with get
+ abstract getComponent: Func, unit> option with get
+ abstract getComponents: Func, unit> option with get
+ abstract onEnter: EnterHook option with get
+ abstract onLeave: LeaveHook option with get
+ abstract indexRoute: PlainRoute option with get
+ abstract getIndexRoute: Func, unit> option with get
+ abstract childRoutes: ResizeArray option with get
+ abstract getChildRoutes: Func, unit> option with get
+
+ and RedirectProps =
+ inherit React.Props
+ abstract path: RoutePattern option with get
+ abstract from: RoutePattern option with get
+ abstract ``to``: RoutePattern with get
+ abstract query: H.Query option with get
+ abstract state: H.LocationState option with get
+
+ and Redirect =
+ inherit React.ComponentClass
+
+
+ and RedirectElement =
+ inherit React.ReactElement
+
+
+ and IndexRouteProps =
+ inherit React.Props
+ abstract ``component``: RouteComponent option with get
+ abstract components: RouteComponents option with get
+ abstract getComponent: Func, unit> option with get
+ abstract getComponents: Func, unit> option with get
+ abstract onEnter: EnterHook option with get
+ abstract onLeave: LeaveHook option with get
+
+ and IndexRoute =
+ inherit React.ComponentClass
+
+
+ and IndexRouteElement =
+ inherit React.ReactElement
+
+
+ and IndexRedirectProps =
+ inherit React.Props
+ abstract ``to``: RoutePattern with get
+ abstract query: H.Query option with get
+ abstract state: H.LocationState option with get
+
+ and IndexRedirect =
+ inherit React.ComponentClass
+
+
+ and IndexRedirectElement =
+ inherit React.ReactElement
+
+
+ and RouterOnContext =
+ inherit H.History
+ abstract setRouteLeaveHook: route: PlainRoute * ?hook: RouteHook -> Func
+ abstract isActive: pathOrLoc: H.LocationDescriptor * ?indexOnly: bool -> bool
+
+ and HistoryMixin =
+ abstract history: History with get
+
+ and LifecycleMixin =
+ abstract routerWillLeave: nextLocation: H.Location -> U2
+
+ and HistoryRoutes =
+ abstract listen: listener: RouterListener -> Function
+ abstract listenBeforeLeavingRoute: route: PlainRoute * hook: RouteHook -> unit
+ abstract ``match``: location: H.Location * callback: Func -> unit
+ abstract isActive: pathname: H.Pathname * ?query: H.Query * ?indexOnly: bool -> bool
+ abstract setRouteLeaveHook: route: PlainRoute * callback: RouteHook -> unit
+
+ and MatchArgs =
+ abstract routes: RouteConfig option with get
+ abstract history: H.History option with get
+ abstract location: U2 option with get
+ abstract parseQueryString: ParseQueryString option with get
+ abstract stringifyQuery: StringifyQuery option with get
+ abstract basename: string option with get
+
+ and MatchState =
+ inherit RouterState
+ abstract history: History with get
+
+ type [] Globals =
+ static member browserHistory with get(): History = failwith "JS only" and set(v: History): unit = failwith "JS only"
+ static member hashHistory with get(): History = failwith "JS only" and set(v: History): unit = failwith "JS only"
+ static member Router with get(): Router = failwith "JS only" and set(v: Router): unit = failwith "JS only"
+ static member Link with get(): Link = failwith "JS only" and set(v: Link): unit = failwith "JS only"
+ static member IndexLink with get(): Link = failwith "JS only" and set(v: Link): unit = failwith "JS only"
+ static member RouterContext with get(): RouterContext = failwith "JS only" and set(v: RouterContext): unit = failwith "JS only"
+ static member Route with get(): Route = failwith "JS only" and set(v: Route): unit = failwith "JS only"
+ static member Redirect with get(): Redirect = failwith "JS only" and set(v: Redirect): unit = failwith "JS only"
+ static member IndexRoute with get(): IndexRoute = failwith "JS only" and set(v: IndexRoute): unit = failwith "JS only"
+ static member IndexRedirect with get(): IndexRedirect = failwith "JS only" and set(v: IndexRedirect): unit = failwith "JS only"
+ static member History with get(): React.Mixin = failwith "JS only" and set(v: React.Mixin): unit = failwith "JS only"
+ static member Lifecycle with get(): React.Mixin = failwith "JS only" and set(v: React.Mixin): unit = failwith "JS only"
+ static member RouteContext with get(): React.Mixin = failwith "JS only" and set(v: React.Mixin): unit = failwith "JS only"
+ static member createMemoryHistory(?options: H.HistoryOptions): H.History = failwith "JS only"
+ static member useRoutes(createHistory: HistoryModule.CreateHistory<'T>): HistoryModule.CreateHistory = failwith "JS only"
+ static member createRoutes(routes: RouteConfig): ResizeArray = failwith "JS only"
+ static member ``match``(args: MatchArgs, cb: Func): unit = failwith "JS only"
+
+
+
+module ReactRouterPatternUtils =
+ type [] Globals =
+ static member formatPattern(pattern: string, ``params``: obj): string = failwith "JS only"
+
+
+
+module ReactRouterRouteUtils =
+ type E = ReactElement
+
+ type [] Globals =
+ static member isReactChildren(``object``: U2>): bool = failwith "JS only"
+ static member createRouteFromReactElement(element: E): ReactRouter.PlainRoute = failwith "JS only"
+ static member createRoutesFromReactChildren(children: U2>, parentRoute: ReactRouter.PlainRoute): ResizeArray = failwith "JS only"
+
+
+
+module ReactRouterPropTypes =
+ type [] Globals =
+ static member history with get(): React.Requireable = failwith "JS only" and set(v: React.Requireable): unit = failwith "JS only"
+ static member location with get(): React.Requireable = failwith "JS only" and set(v: React.Requireable): unit = failwith "JS only"
+ static member ``component`` with get(): React.Requireable = failwith "JS only" and set(v: React.Requireable): unit = failwith "JS only"
+ static member components with get(): React.Requireable = failwith "JS only" and set(v: React.Requireable): unit = failwith "JS only"
+ static member route with get(): React.Requireable = failwith "JS only" and set(v: React.Requireable): unit = failwith "JS only"
+ static member routes with get(): React.Requireable = failwith "JS only" and set(v: React.Requireable): unit = failwith "JS only"
+ static member routerShape with get(): React.Requireable = failwith "JS only" and set(v: React.Requireable): unit = failwith "JS only"
+ static member locationShape with get(): React.Requireable = failwith "JS only" and set(v: React.Requireable): unit = failwith "JS only"
+ static member falsy(props: obj, propName: string, componentName: string): Error = failwith "JS only"
+
+
+
+module ReactRouteruseRouterHistory =
+ type CreateRouterHistory =
+ [] abstract Invoke: ?options: HistoryModule.HistoryOptions -> obj
+
+ type [] Globals =
+ static member useRouterHistory(createHistory: HistoryModule.CreateHistory<'T>): CreateRouterHistory = failwith "JS only"
diff --git a/import/react-router/README.md b/import/react-router/README.md
new file mode 100644
index 0000000000..9969c8764e
--- /dev/null
+++ b/import/react-router/README.md
@@ -0,0 +1,39 @@
+# fable-import-react-router
+
+Fable bindings for React Router (react-router) 2.0.0 and History 2.0.0.
+These were generated from Typescript definitions but required some manual
+modification, most significantly of certain History module names. In
+addition, setters were removed from all types.
+
+Typescript source file is [here](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/df9065dc6e93d23a0d284c57c30570eefb81d35d/react-router/react-router.d.ts).
+
+
+## Installation
+
+```sh
+$ npm install --save react-router fable-core
+$ npm install --save-dev fable-import-react-router
+```
+
+## Usage
+
+### In a F# project (.fsproj)
+
+```xml
+
+
+
+
+
+```
+
+### In a F# script (.fsx)
+
+```fsharp
+#r "node_modules/fable-core/Fable.Core.dll"
+#load "node_modules/fable-import-react-router/Fable.Import.HistoryModule.fs"
+#load "node_modules/fable-import-react-router/Fable.Import.ReactRouter.fs"
+
+open Fable.Core
+open Fable.Import
+```
diff --git a/import/react-router/history.d.ts b/import/react-router/history.d.ts
new file mode 100644
index 0000000000..5f94ea3657
--- /dev/null
+++ b/import/react-router/history.d.ts
@@ -0,0 +1,236 @@
+// 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
+ hash: Hash
+ 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 = { [key: string]: any; }
+
+ type QueryString = string
+
+ type Search = string
+
+ type TransitionHook = (location: Location, callback: (result: any) => void) => any
+
+ type Hash = string
+
+
+ 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/import/react-router/package.json b/import/react-router/package.json
new file mode 100644
index 0000000000..7f634ca07e
--- /dev/null
+++ b/import/react-router/package.json
@@ -0,0 +1,13 @@
+{
+ "name": "fable-import-react-router",
+ "version": "0.0.1",
+ "description": "Fable bindings for React Router (react-router) 2.0.0 ",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/fsprojects/Fable/import/react-router-redux"
+ },
+ "license": "Apache-2.0",
+ "author": "Paul Blair",
+ "keywords": [ "fable", "fable-compiler", "fsharp", "F#", "React" ],
+ "homepage": "https://github.com/fsprojects/Fable#readme"
+}
diff --git a/import/redux/Fable.Import.Redux.fs b/import/redux/Fable.Import.Redux.fs
index d7f3cb019c..cfa144f4a2 100644
--- a/import/redux/Fable.Import.Redux.fs
+++ b/import/redux/Fable.Import.Redux.fs
@@ -4,42 +4,41 @@ open System.Text.RegularExpressions
open Fable.Core
open Fable.Import.JS
+// Type definitions for redux v3.3.1, generated from Typescript
module Redux =
type ActionCreator =
inherit Function
[] abstract Invoke: [] args: obj[] -> obj
- and Reducer =
- inherit Function
- [] abstract Invoke: state: obj * action: obj -> obj
+ and Reducer<'T, 'U> = Func<'T, 'U, 'T>
and Dispatch =
inherit Function
[] abstract Invoke: action: obj -> obj
and StoreMethods =
- abstract dispatch: Dispatch with get, set
+ abstract dispatch: Dispatch with get
abstract getState: unit -> obj
and MiddlewareArg =
- abstract dispatch: Dispatch with get, set
- abstract getState: Function with get, set
+ abstract dispatch: Dispatch with get
+ abstract getState: Function with get
and Middleware =
inherit Function
[] abstract Invoke: obj: MiddlewareArg -> Function
- and [] Store() =
- member __.getReducer(): Reducer = failwith "JS only"
- member __.replaceReducer(nextReducer: Reducer): unit = failwith "JS only"
+ and [] Store() =
+ member __.getReducer(): Reducer<'T,'U> = failwith "JS only"
+ member __.replaceReducer(nextReducer: Reducer<'T,'U>): unit = failwith "JS only"
member __.dispatch(action: obj): obj = failwith "JS only"
member __.getState(): obj = failwith "JS only"
member __.subscribe(listener: Function): Function = failwith "JS only"
- type [] Globals =
- static member createStore(reducer: Reducer, ?initialState: obj, ?enhancer: Function): Store = failwith "JS only"
+ type [] Globals =
+ static member createStore(reducer: Reducer<'T,'U>, ?initialState: obj, ?enhancer: Function): Store = failwith "JS only"
static member bindActionCreators(actionCreators: 'T, dispatch: Dispatch): 'T = failwith "JS only"
- static member combineReducers(reducers: obj): Reducer = failwith "JS only"
+ static member combineReducers([] reducers: Reducer<'T,'U>[]): Reducer<'T,'U> = failwith "JS only"
static member applyMiddleware([] middlewares: Middleware[]): Function = failwith "JS only"
static member compose([] functions: Function[]): 'T = failwith "JS only"
diff --git a/import/redux/README.md b/import/redux/README.md
index 05b0d5ee82..f716b58c07 100644
--- a/import/redux/README.md
+++ b/import/redux/README.md
@@ -1,6 +1,15 @@
# fable-import-redux
-Fable bindings for Redux
+Fable bindings for Redux, version v3.3.1.
+
+These declarations were generated from Typescript, with some modifications,
+namely:
+
+ 1. `Reducer` is a type narrowing of Func, with type parameters
+ 2. Lowercased the module names in the Import attributes
+ 3. All setters are removed.
+
+Typescript source file is [here](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/c2bfaedeee7ae4ed5e0f01ebcf4af7acfe2c77c3/redux/redux.d.ts).
## Installation
diff --git a/import/redux/package.json b/import/redux/package.json
index e4697b96a1..dc56515a59 100644
--- a/import/redux/package.json
+++ b/import/redux/package.json
@@ -1,7 +1,7 @@
{
"name": "fable-import-redux",
"version": "0.0.1",
- "description": "Fable bindings for Redux",
+ "description": "Fable bindings for Redux v3.3.1",
"repository": {
"type": "git",
"url": "https://github.com/fsprojects/Fable/import/redux"