mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-24 02:30:13 +00:00
Update remaining templates to TypeScript 2 / @types / etc.
This commit is contained in:
committed by
SteveSandersonMS
parent
a7ed0112db
commit
f6d7321243
@@ -1,14 +1,14 @@
|
||||
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
|
||||
import * as thunkModule from 'redux-thunk';
|
||||
import { createStore, applyMiddleware, compose, combineReducers, GenericStoreEnhancer } from 'redux';
|
||||
import thunk from 'redux-thunk';
|
||||
import { routerReducer } from 'react-router-redux';
|
||||
import * as Store from './store';
|
||||
import { typedToPlain } from 'redux-typed';
|
||||
|
||||
export default function configureStore(initialState?: Store.ApplicationState) {
|
||||
// Build middleware. These are functions that can process the actions before they reach the store.
|
||||
const thunk = (thunkModule as any).default; // Workaround for TypeScript not importing thunk module as expected
|
||||
const windowIfDefined = typeof window === 'undefined' ? null : window as any;
|
||||
const devToolsExtension = windowIfDefined && windowIfDefined.devToolsExtension; // If devTools is installed, connect to it
|
||||
// If devTools is installed, connect to it
|
||||
const devToolsExtension = windowIfDefined && windowIfDefined.devToolsExtension as () => GenericStoreEnhancer;
|
||||
const createStoreWithMiddleware = compose(
|
||||
applyMiddleware(thunk, typedToPlain),
|
||||
devToolsExtension ? devToolsExtension() : f => f
|
||||
@@ -16,7 +16,7 @@ export default function configureStore(initialState?: Store.ApplicationState) {
|
||||
|
||||
// Combine all reducers and instantiate the app-wide store instance
|
||||
const allReducers = buildRootReducer(Store.reducers);
|
||||
const store = createStoreWithMiddleware(allReducers, initialState) as Redux.Store;
|
||||
const store = createStoreWithMiddleware(allReducers, initialState) as Redux.Store<Store.ApplicationState>;
|
||||
|
||||
// Enable Webpack hot module replacement for reducers
|
||||
if (module.hot) {
|
||||
@@ -30,5 +30,5 @@ export default function configureStore(initialState?: Store.ApplicationState) {
|
||||
}
|
||||
|
||||
function buildRootReducer(allReducers) {
|
||||
return combineReducers(Object.assign({}, allReducers, { routing: routerReducer })) as Redux.Reducer;
|
||||
return combineReducers<Store.ApplicationState>(Object.assign({}, allReducers, { routing: routerReducer }));
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@ export default <Route component={ Layout }>
|
||||
</Route>
|
||||
</Route>;
|
||||
|
||||
// Allow Hot Module Reloading
|
||||
declare var module: any;
|
||||
// Enable Hot Module Replacement (HMR)
|
||||
if (module.hot) {
|
||||
module.hot.accept();
|
||||
}
|
||||
|
||||
@@ -2,8 +2,20 @@
|
||||
"name": "WebApplicationBasic",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"aspnet-prerendering": "^1.0.2",
|
||||
"aspnet-webpack": "^1.0.6",
|
||||
"@types/react": "^0.14.29",
|
||||
"@types/react-dom": "^0.14.14",
|
||||
"@types/react-redux": "^4.4.29",
|
||||
"@types/react-router": "^2.0.30",
|
||||
"@types/react-router-redux": "^4.0.30",
|
||||
"@types/redux": "3.5.27",
|
||||
"@types/redux-thunk": "^2.1.28",
|
||||
"@types/source-map": "^0.1.28",
|
||||
"@types/uglify-js": "^2.0.27",
|
||||
"@types/webpack": "^1.12.35",
|
||||
"@types/webpack-env": "^1.12.1",
|
||||
"@types/whatwg-fetch": "0.0.28",
|
||||
"aspnet-prerendering": "^1.0.7",
|
||||
"aspnet-webpack": "^1.0.17",
|
||||
"aspnet-webpack-react": "^1.0.2",
|
||||
"babel-core": "^6.5.2",
|
||||
"babel-loader": "^6.2.3",
|
||||
@@ -11,26 +23,26 @@
|
||||
"babel-preset-react": "^6.5.0",
|
||||
"bootstrap": "^3.3.6",
|
||||
"css-loader": "^0.23.1",
|
||||
"domain-task": "^2.0.0",
|
||||
"domain-task": "^2.0.1",
|
||||
"event-source-polyfill": "^0.0.7",
|
||||
"extract-text-webpack-plugin": "^1.0.1",
|
||||
"file-loader": "^0.8.5",
|
||||
"jquery": "^2.2.1",
|
||||
"react": "^15.0.1",
|
||||
"react-dom": "^15.0.1",
|
||||
"react-redux": "^4.4.4",
|
||||
"react-router": "^2.1.1",
|
||||
"react-router-redux": "^4.0.2",
|
||||
"redux": "^3.4.0",
|
||||
"redux-thunk": "^2.0.1",
|
||||
"redux-typed": "^1.0.0",
|
||||
"react": "^15.3.2",
|
||||
"react-dom": "^15.3.2",
|
||||
"react-redux": "^4.4.5",
|
||||
"react-router": "^2.8.1",
|
||||
"react-router-redux": "^4.0.6",
|
||||
"redux": "^3.6.0",
|
||||
"redux-thunk": "^2.1.0",
|
||||
"redux-typed": "^1.0.1",
|
||||
"style-loader": "^0.13.0",
|
||||
"ts-loader": "^0.8.1",
|
||||
"typescript": "^1.8.2",
|
||||
"typescript": "2.0.3",
|
||||
"url-loader": "^0.5.7",
|
||||
"webpack": "^1.12.14",
|
||||
"webpack": "^1.13.2",
|
||||
"webpack-node-externals": "^1.4.3",
|
||||
"webpack-hot-middleware": "^2.10.0",
|
||||
"webpack-hot-middleware": "^2.12.2",
|
||||
"webpack-merge": "^0.14.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
"jsx": "preserve",
|
||||
"experimentalDecorators": true,
|
||||
"sourceMap": true,
|
||||
"skipDefaultLibCheck": true
|
||||
"skipDefaultLibCheck": true,
|
||||
"lib": ["es6", "dom"],
|
||||
"types": [ "webpack-env", "whatwg-fetch" ]
|
||||
},
|
||||
"exclude": [
|
||||
"bin",
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
{
|
||||
"version": "v4",
|
||||
"repo": "borisyankov/DefinitelyTyped",
|
||||
"ref": "master",
|
||||
"path": "typings",
|
||||
"bundle": "typings/tsd.d.ts",
|
||||
"installed": {
|
||||
"react/react.d.ts": {
|
||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
||||
},
|
||||
"react-router/react-router.d.ts": {
|
||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
||||
},
|
||||
"react/react-dom.d.ts": {
|
||||
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
|
||||
},
|
||||
"react-router/history.d.ts": {
|
||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
||||
},
|
||||
"whatwg-fetch/whatwg-fetch.d.ts": {
|
||||
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
|
||||
},
|
||||
"react-redux/react-redux.d.ts": {
|
||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
||||
},
|
||||
"redux/redux.d.ts": {
|
||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
||||
},
|
||||
"react-router-redux/react-router-redux.d.ts": {
|
||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
||||
},
|
||||
"redux-thunk/redux-thunk.d.ts": {
|
||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
||||
},
|
||||
"uglify-js/uglify-js.d.ts": {
|
||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
||||
},
|
||||
"source-map/source-map.d.ts": {
|
||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
||||
},
|
||||
"webpack/webpack-env.d.ts": {
|
||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
// Type definitions for react-redux 4.4.0
|
||||
// Project: https://github.com/rackt/react-redux
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
/// <reference path="../redux/redux.d.ts" />
|
||||
|
||||
declare module "react-redux" {
|
||||
import { ComponentClass, Component, StatelessComponent } from 'react';
|
||||
import { Store, Dispatch, ActionCreator } from 'redux';
|
||||
|
||||
export interface ComponentConstructDecorator<P> {
|
||||
<TComponentConstruct extends (ComponentClass<P>|StatelessComponent<P>)>(component: TComponentConstruct): TComponentConstruct
|
||||
}
|
||||
|
||||
/**
|
||||
* Connects a React component to a Redux store.
|
||||
* @param mapStateToProps
|
||||
* @param mapDispatchToProps
|
||||
* @param mergeProps
|
||||
* @param options
|
||||
*/
|
||||
export function connect<P>(mapStateToProps?: MapStateToProps,
|
||||
mapDispatchToProps?: MapDispatchToPropsFunction|MapDispatchToPropsObject,
|
||||
mergeProps?: MergeProps,
|
||||
options?: Options): ComponentConstructDecorator<P>;
|
||||
|
||||
interface MapStateToProps {
|
||||
(state: any, ownProps?: any): any;
|
||||
}
|
||||
|
||||
interface MapDispatchToPropsFunction {
|
||||
(dispatch: Dispatch, ownProps?: any): any;
|
||||
}
|
||||
|
||||
interface MapDispatchToPropsObject {
|
||||
[name: string]: ActionCreator;
|
||||
}
|
||||
|
||||
interface MergeProps {
|
||||
(stateProps: any, dispatchProps: any, ownProps: any): any;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* If true, implements shouldComponentUpdate and shallowly compares the result of mergeProps,
|
||||
* preventing unnecessary updates, assuming that the component is a “pure” component
|
||||
* and does not rely on any input or state other than its props and the selected Redux store’s state.
|
||||
* Defaults to true.
|
||||
* @default true
|
||||
*/
|
||||
pure: boolean;
|
||||
}
|
||||
|
||||
export interface Property {
|
||||
/**
|
||||
* The single Redux store in your application.
|
||||
*/
|
||||
store?: Store;
|
||||
children?: Function;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the Redux store available to the connect() calls in the component hierarchy below.
|
||||
*/
|
||||
export class Provider extends Component<Property, {}> { }
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
// Type definitions for react-router-redux v4.0.0
|
||||
// Project: https://github.com/rackt/react-router-redux
|
||||
// Definitions by: Isman Usoh <http://github.com/isman-usoh>, Noah Shipley <https://github.com/noah79>, Dimitri Rosenberg <https://github.com/rosendi>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../redux/redux.d.ts" />
|
||||
/// <reference path="../react-router/react-router.d.ts"/>
|
||||
|
||||
declare namespace ReactRouterRedux {
|
||||
import R = Redux;
|
||||
import H = HistoryModule;
|
||||
|
||||
const CALL_HISTORY_METHOD: string;
|
||||
const LOCATION_CHANGE: string;
|
||||
|
||||
const push: PushAction;
|
||||
const replace: ReplaceAction;
|
||||
const go: GoAction;
|
||||
const goBack: GoForwardAction;
|
||||
const goForward: GoBackAction;
|
||||
const routerActions: RouteActions;
|
||||
|
||||
type LocationDescriptor = H.Location | H.Path;
|
||||
type PushAction = (nextLocation: LocationDescriptor) => RouterAction;
|
||||
type ReplaceAction = (nextLocation: LocationDescriptor) => RouterAction;
|
||||
type GoAction = (n: number) => RouterAction;
|
||||
type GoForwardAction = () => RouterAction;
|
||||
type GoBackAction = () => RouterAction;
|
||||
|
||||
type RouterAction = {
|
||||
type: string
|
||||
payload?: any
|
||||
}
|
||||
|
||||
interface RouteActions {
|
||||
push: PushAction;
|
||||
replace: ReplaceAction;
|
||||
go: GoAction;
|
||||
goForward: GoForwardAction;
|
||||
goBack: GoBackAction;
|
||||
}
|
||||
interface ReactRouterReduxHistory extends H.History {
|
||||
unsubscribe(): void;
|
||||
}
|
||||
|
||||
interface DefaultSelectLocationState extends Function {
|
||||
(state: any): any;
|
||||
}
|
||||
|
||||
interface SyncHistoryWithStoreOptions {
|
||||
selectLocationState?: DefaultSelectLocationState;
|
||||
adjustUrlOnReplay?: boolean;
|
||||
}
|
||||
|
||||
function routerReducer(state?: any, options?: any): R.Reducer;
|
||||
function syncHistoryWithStore(history: H.History, store: R.Store, options?: SyncHistoryWithStoreOptions): ReactRouterReduxHistory;
|
||||
function routerMiddleware(history: H.History): R.Middleware;
|
||||
}
|
||||
|
||||
declare module "react-router-redux" {
|
||||
export = ReactRouterRedux;
|
||||
}
|
||||
@@ -1,233 +0,0 @@
|
||||
// Type definitions for history v2.0.0
|
||||
// Project: https://github.com/rackt/history
|
||||
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Nathan Brown <https://github.com/ngbrown>
|
||||
// Definitions: https://github.com/borisyankov/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<T> = (options?: HistoryOptions) => T
|
||||
|
||||
type CreateHistoryEnhancer<T, E> = (createHistory: CreateHistory<T>) => CreateHistory<T & E>
|
||||
|
||||
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<History>
|
||||
createHashHistory: CreateHistory<History>
|
||||
createMemoryHistory: CreateHistory<History>
|
||||
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
||||
useBasename<T>(createHistory: CreateHistory<T>): CreateHistory<T>
|
||||
useBeforeUnload<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryBeforeUnload>
|
||||
useQueries<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryQueries>
|
||||
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<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T>
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "history/lib/useBeforeUnload" {
|
||||
|
||||
export default function useBeforeUnload<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryBeforeUnload>
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare module "history/lib/useQueries" {
|
||||
|
||||
export default function useQueries<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryQueries>
|
||||
|
||||
}
|
||||
|
||||
|
||||
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 }
|
||||
|
||||
}
|
||||
@@ -1,480 +0,0 @@
|
||||
// Type definitions for react-router v2.0.0
|
||||
// Project: https://github.com/rackt/react-router
|
||||
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>, Nathan Brown <https://github.com/ngbrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
/// <reference path="./history.d.ts"/>
|
||||
|
||||
|
||||
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, replaceState: RedirectFunction, callback?: Function) => any
|
||||
|
||||
type LeaveHook = () => any
|
||||
|
||||
type Params = Object
|
||||
|
||||
type ParseQueryString = (queryString: H.QueryString) => H.Query
|
||||
|
||||
type RedirectFunction = (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<P, R> {
|
||||
history?: History
|
||||
location?: H.Location
|
||||
params?: P
|
||||
route?: PlainRoute
|
||||
routeParams?: R
|
||||
routes?: PlainRoute[]
|
||||
children?: React.ReactElement<any>
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/* components */
|
||||
|
||||
interface RouterProps extends React.Props<Router> {
|
||||
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<RouterProps> {}
|
||||
interface RouterElement extends React.ReactElement<RouterProps> {}
|
||||
const Router: Router
|
||||
|
||||
|
||||
interface LinkProps extends React.HTMLAttributes, React.Props<Link> {
|
||||
activeStyle?: React.CSSProperties
|
||||
activeClassName?: string
|
||||
onlyActiveOnIndex?: boolean
|
||||
to: RoutePattern
|
||||
query?: H.Query
|
||||
state?: H.LocationState
|
||||
}
|
||||
interface Link extends React.ComponentClass<LinkProps> {}
|
||||
interface LinkElement extends React.ReactElement<LinkProps> {}
|
||||
const Link: Link
|
||||
|
||||
|
||||
const IndexLink: Link
|
||||
|
||||
|
||||
interface RouterContextProps extends React.Props<RouterContext> {
|
||||
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<RouterContextProps> {}
|
||||
interface RouterContextElement extends React.ReactElement<RouterContextProps> {
|
||||
history?: H.History
|
||||
location: H.Location
|
||||
router?: Router
|
||||
}
|
||||
const RouterContext: RouterContext
|
||||
|
||||
|
||||
/* components (configuration) */
|
||||
|
||||
interface RouteProps extends React.Props<Route> {
|
||||
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
|
||||
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<RouteProps> {}
|
||||
interface RouteElement extends React.ReactElement<RouteProps> {}
|
||||
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<Redirect> {
|
||||
path?: RoutePattern
|
||||
from?: RoutePattern // alias for path
|
||||
to: RoutePattern
|
||||
query?: H.Query
|
||||
state?: H.LocationState
|
||||
}
|
||||
interface Redirect extends React.ComponentClass<RedirectProps> {}
|
||||
interface RedirectElement extends React.ReactElement<RedirectProps> {}
|
||||
const Redirect: Redirect
|
||||
|
||||
|
||||
interface IndexRouteProps extends React.Props<IndexRoute> {
|
||||
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<IndexRouteProps> {}
|
||||
interface IndexRouteElement extends React.ReactElement<IndexRouteProps> {}
|
||||
const IndexRoute: IndexRoute
|
||||
|
||||
|
||||
interface IndexRedirectProps extends React.Props<IndexRedirect> {
|
||||
to: RoutePattern
|
||||
query?: H.Query
|
||||
state?: H.LocationState
|
||||
}
|
||||
interface IndexRedirect extends React.ComponentClass<IndexRedirectProps> {}
|
||||
interface IndexRedirectElement extends React.ReactElement<IndexRedirectProps> {}
|
||||
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<any, any>
|
||||
|
||||
|
||||
interface LifecycleMixin {
|
||||
routerWillLeave(nextLocation: H.Location): string | boolean
|
||||
}
|
||||
const Lifecycle: React.Mixin<any, any>
|
||||
|
||||
|
||||
const RouteContext: React.Mixin<any, any>
|
||||
|
||||
|
||||
/* 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<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryRoutes>
|
||||
|
||||
|
||||
function createRoutes(routes: RouteConfig): PlainRoute[]
|
||||
|
||||
|
||||
interface MatchArgs {
|
||||
routes?: RouteConfig
|
||||
history?: H.History
|
||||
location?: H.Location
|
||||
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<any>
|
||||
|
||||
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<any>
|
||||
|
||||
export const location: React.Requireable<any>
|
||||
|
||||
export const component: React.Requireable<any>
|
||||
|
||||
export const components: React.Requireable<any>
|
||||
|
||||
export const route: React.Requireable<any>
|
||||
|
||||
export const routes: React.Requireable<any>
|
||||
|
||||
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" {
|
||||
|
||||
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"
|
||||
|
||||
// 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<P,R> = ReactRouter.RouteComponentProps<P,R>;
|
||||
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
|
||||
}
|
||||
|
||||
export default Router
|
||||
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
// Type definitions for React v0.14 (react-dom)
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react.d.ts" />
|
||||
|
||||
declare namespace __React {
|
||||
namespace __DOM {
|
||||
function findDOMNode<E extends Element>(instance: ReactInstance): E;
|
||||
function findDOMNode(instance: ReactInstance): Element;
|
||||
|
||||
function render<P>(
|
||||
element: DOMElement<P>,
|
||||
container: Element,
|
||||
callback?: (element: Element) => any): Element;
|
||||
function render<P, S>(
|
||||
element: ClassicElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
||||
function render<P, S>(
|
||||
element: ReactElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
||||
|
||||
function unmountComponentAtNode(container: Element): boolean;
|
||||
|
||||
var version: string;
|
||||
|
||||
function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
|
||||
function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
||||
function unstable_batchedUpdates(callback: () => any): void;
|
||||
|
||||
function unstable_renderSubtreeIntoContainer<P>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: DOMElement<P>,
|
||||
container: Element,
|
||||
callback?: (element: Element) => any): Element;
|
||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: ClassicElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
||||
parentComponent: Component<any, any>,
|
||||
nextElement: ReactElement<P>,
|
||||
container: Element,
|
||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
||||
}
|
||||
|
||||
namespace __DOMServer {
|
||||
function renderToString(element: ReactElement<any>): string;
|
||||
function renderToStaticMarkup(element: ReactElement<any>): string;
|
||||
var version: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react-dom" {
|
||||
import DOM = __React.__DOM;
|
||||
export = DOM;
|
||||
}
|
||||
|
||||
declare module "react-dom/server" {
|
||||
import DOMServer = __React.__DOMServer;
|
||||
export = DOMServer;
|
||||
}
|
||||
2405
templates/ReactReduxSpa/typings/react/react.d.ts
vendored
2405
templates/ReactReduxSpa/typings/react/react.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
// Type definitions for redux-thunk
|
||||
// Project: https://github.com/gaearon/redux-thunk
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../redux/redux.d.ts" />
|
||||
|
||||
declare module ReduxThunk {
|
||||
export interface Thunk extends Redux.Middleware {}
|
||||
export interface ThunkInterface {
|
||||
<T>(dispatch: Redux.Dispatch, getState?: () => T): any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "redux-thunk" {
|
||||
var thunk: ReduxThunk.Thunk;
|
||||
export = thunk;
|
||||
}
|
||||
52
templates/ReactReduxSpa/typings/redux/redux.d.ts
vendored
52
templates/ReactReduxSpa/typings/redux/redux.d.ts
vendored
@@ -1,52 +0,0 @@
|
||||
// Type definitions for Redux v1.0.0
|
||||
// Project: https://github.com/rackt/redux
|
||||
// Definitions by: William Buchwalter <https://github.com/wbuchwalter/>, Vincent Prouillet <https://github.com/Keats/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Redux {
|
||||
|
||||
interface ActionCreator extends Function {
|
||||
(...args: any[]): any;
|
||||
}
|
||||
|
||||
interface Reducer extends Function {
|
||||
(state: any, action: any): any;
|
||||
}
|
||||
|
||||
interface Dispatch extends Function {
|
||||
(action: any): any;
|
||||
}
|
||||
|
||||
interface StoreMethods {
|
||||
dispatch: Dispatch;
|
||||
getState(): any;
|
||||
}
|
||||
|
||||
|
||||
interface MiddlewareArg {
|
||||
dispatch: Dispatch;
|
||||
getState: Function;
|
||||
}
|
||||
|
||||
interface Middleware extends Function {
|
||||
(obj: MiddlewareArg): Function;
|
||||
}
|
||||
|
||||
class Store {
|
||||
getReducer(): Reducer;
|
||||
replaceReducer(nextReducer: Reducer): void;
|
||||
dispatch(action: any): any;
|
||||
getState(): any;
|
||||
subscribe(listener: Function): Function;
|
||||
}
|
||||
|
||||
function createStore(reducer: Reducer, initialState?: any, enhancer?: ()=>any): Store;
|
||||
function bindActionCreators<T>(actionCreators: T, dispatch: Dispatch): T;
|
||||
function combineReducers(reducers: any): Reducer;
|
||||
function applyMiddleware(...middlewares: Middleware[]): Function;
|
||||
function compose<T extends Function>(...functions: Function[]): T;
|
||||
}
|
||||
|
||||
declare module "redux" {
|
||||
export = Redux;
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
// Type definitions for source-map v0.1.38
|
||||
// Project: https://github.com/mozilla/source-map
|
||||
// Definitions by: Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module SourceMap {
|
||||
interface StartOfSourceMap {
|
||||
file?: string;
|
||||
sourceRoot?: string;
|
||||
}
|
||||
|
||||
interface RawSourceMap extends StartOfSourceMap {
|
||||
version: string;
|
||||
sources: Array<string>;
|
||||
names: Array<string>;
|
||||
sourcesContent?: string[];
|
||||
mappings: string;
|
||||
}
|
||||
|
||||
interface Position {
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
interface MappedPosition extends Position {
|
||||
source: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface MappingItem {
|
||||
source: string;
|
||||
generatedLine: number;
|
||||
generatedColumn: number;
|
||||
originalLine: number;
|
||||
originalColumn: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface Mapping {
|
||||
generated: Position;
|
||||
original: Position;
|
||||
source: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface CodeWithSourceMap {
|
||||
code: string;
|
||||
map: SourceMapGenerator;
|
||||
}
|
||||
|
||||
class SourceMapConsumer {
|
||||
public static GENERATED_ORDER: number;
|
||||
public static ORIGINAL_ORDER: number;
|
||||
|
||||
constructor(rawSourceMap: RawSourceMap);
|
||||
public originalPositionFor(generatedPosition: Position): MappedPosition;
|
||||
public generatedPositionFor(originalPosition: MappedPosition): Position;
|
||||
public sourceContentFor(source: string): string;
|
||||
public eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
|
||||
}
|
||||
|
||||
class SourceMapGenerator {
|
||||
constructor(startOfSourceMap?: StartOfSourceMap);
|
||||
public static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
|
||||
public addMapping(mapping: Mapping): void;
|
||||
public setSourceContent(sourceFile: string, sourceContent: string): void;
|
||||
public applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
class SourceNode {
|
||||
constructor();
|
||||
constructor(line: number, column: number, source: string);
|
||||
constructor(line: number, column: number, source: string, chunk?: string, name?: string);
|
||||
public static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
|
||||
public add(chunk: any): SourceNode;
|
||||
public prepend(chunk: any): SourceNode;
|
||||
public setSourceContent(sourceFile: string, sourceContent: string): void;
|
||||
public walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
|
||||
public walkSourceContents(fn: (file: string, content: string) => void): void;
|
||||
public join(sep: string): SourceNode;
|
||||
public replaceRight(pattern: string, replacement: string): SourceNode;
|
||||
public toString(): string;
|
||||
public toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'source-map' {
|
||||
export = SourceMap;
|
||||
}
|
||||
13
templates/ReactReduxSpa/typings/tsd.d.ts
vendored
13
templates/ReactReduxSpa/typings/tsd.d.ts
vendored
@@ -1,13 +0,0 @@
|
||||
|
||||
/// <reference path="react/react.d.ts" />
|
||||
/// <reference path="react-router/history.d.ts" />
|
||||
/// <reference path="react-router/react-router.d.ts" />
|
||||
/// <reference path="react/react-dom.d.ts" />
|
||||
/// <reference path="whatwg-fetch/whatwg-fetch.d.ts" />
|
||||
/// <reference path="react-redux/react-redux.d.ts" />
|
||||
/// <reference path="react-router-redux/react-router-redux.d.ts" />
|
||||
/// <reference path="redux-thunk/redux-thunk.d.ts" />
|
||||
/// <reference path="redux/redux.d.ts" />
|
||||
/// <reference path="source-map/source-map.d.ts" />
|
||||
/// <reference path="uglify-js/uglify-js.d.ts" />
|
||||
/// <reference path="webpack/webpack-env.d.ts" />
|
||||
@@ -1,430 +0,0 @@
|
||||
// Type definitions for UglifyJS 2 v2.6.1
|
||||
// Project: https://github.com/mishoo/UglifyJS2
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../source-map/source-map.d.ts" />
|
||||
|
||||
declare module 'uglify-js' {
|
||||
import * as MOZ_SourceMap from 'source-map';
|
||||
|
||||
namespace UglifyJS {
|
||||
interface Tokenizer {
|
||||
/**
|
||||
* The type of this token.
|
||||
* Can be "num", "string", "regexp", "operator", "punc", "atom", "name", "keyword", "comment1" or "comment2".
|
||||
* "comment1" and "comment2" are for single-line, respectively multi-line comments.
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* The name of the file where this token originated from. Useful when compressing multiple files at once to generate the proper source map.
|
||||
*/
|
||||
file: string;
|
||||
|
||||
/**
|
||||
* The "value" of the token.
|
||||
* That's additional information and depends on the token type: "num", "string" and "regexp" tokens you get their literal value.
|
||||
* - For "operator" you get the operator.
|
||||
* - For "punc" it's the punctuation sign (parens, comma, semicolon etc).
|
||||
* - For "atom", "name" and "keyword" it's the name of the identifier
|
||||
* - For comments it's the body of the comment (excluding the initial "//" and "/*".
|
||||
*/
|
||||
value: string;
|
||||
|
||||
/**
|
||||
* The line number of this token in the original code.
|
||||
* 1-based index.
|
||||
*/
|
||||
line: number;
|
||||
|
||||
/**
|
||||
* The column number of this token in the original code.
|
||||
* 0-based index.
|
||||
*/
|
||||
col: number;
|
||||
|
||||
/**
|
||||
* Short for "newline before", it's a boolean that tells us whether there was a newline before this node in the original source. It helps for automatic semicolon insertion.
|
||||
* For multi-line comments in particular this will be set to true if there either was a newline before this comment, or * * if this comment contains a newline.
|
||||
*/
|
||||
nlb: boolean;
|
||||
|
||||
/**
|
||||
* This doesn't apply for comment tokens, but for all other token types it will be an array of comment tokens that were found before.
|
||||
*/
|
||||
comments_before: string[];
|
||||
}
|
||||
|
||||
interface AST_Node {
|
||||
// The first token of this node
|
||||
start: AST_Node;
|
||||
|
||||
// The last token of this node
|
||||
end: AST_Node;
|
||||
|
||||
transform(tt: TreeTransformer): AST_Toplevel;
|
||||
}
|
||||
|
||||
interface AST_Toplevel extends AST_Node {
|
||||
// UglifyJS contains a scope analyzer which figures out variable/function definitions, references etc.
|
||||
// You need to call it manually before compression or mangling.
|
||||
// The figure_out_scope method is defined only on the AST_Toplevel node.
|
||||
figure_out_scope(): void;
|
||||
|
||||
// Get names that are optimized for GZip compression (names will be generated using the most frequent characters first)
|
||||
compute_char_frequency(): void;
|
||||
|
||||
mangle_names(): void;
|
||||
|
||||
print(stream: OutputStream): void;
|
||||
|
||||
print_to_string(options?: BeautifierOptions): string;
|
||||
}
|
||||
|
||||
interface MinifyOptions {
|
||||
spidermonkey?: boolean;
|
||||
outSourceMap?: string;
|
||||
sourceRoot?: string;
|
||||
inSourceMap?: string;
|
||||
fromString?: boolean;
|
||||
warnings?: boolean;
|
||||
mangle?: Object;
|
||||
output?: MinifyOutput,
|
||||
compress?: Object;
|
||||
}
|
||||
|
||||
interface MinifyOutput {
|
||||
code: string;
|
||||
map: string;
|
||||
}
|
||||
|
||||
function minify(files: string | Array<string>, options?: MinifyOptions): MinifyOutput;
|
||||
|
||||
|
||||
interface ParseOptions {
|
||||
// Default is false
|
||||
strict?: boolean;
|
||||
|
||||
// Input file name, default is null
|
||||
filename?: string;
|
||||
|
||||
// Default is null
|
||||
toplevel?: AST_Toplevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* The parser creates a custom abstract syntax tree given a piece of JavaScript code.
|
||||
* Perhaps you should read about the AST first.
|
||||
*/
|
||||
function parse(code: string, options?: ParseOptions): AST_Toplevel;
|
||||
|
||||
|
||||
interface BeautifierOptions {
|
||||
/**
|
||||
* Start indentation on every line (only when `beautify`)
|
||||
*/
|
||||
indent_start?: number;
|
||||
|
||||
/**
|
||||
* Indentation level (only when `beautify`)
|
||||
*/
|
||||
indent_level?: number;
|
||||
|
||||
/**
|
||||
* Quote all keys in object literals?
|
||||
*/
|
||||
quote_keys?: boolean;
|
||||
|
||||
/**
|
||||
* Add a space after colon signs?
|
||||
*/
|
||||
space_colon?: boolean;
|
||||
|
||||
/**
|
||||
* Output ASCII-safe? (encodes Unicode characters as ASCII)
|
||||
*/
|
||||
ascii_only?: boolean;
|
||||
|
||||
/**
|
||||
* Escape "</script"?
|
||||
*/
|
||||
inline_script?: boolean;
|
||||
|
||||
/**
|
||||
* Informative maximum line width (for beautified output)
|
||||
*/
|
||||
width?: number;
|
||||
|
||||
/**
|
||||
* Maximum line length (for non-beautified output)
|
||||
*/
|
||||
max_line_len?: number;
|
||||
|
||||
/**
|
||||
* Output IE-safe code?
|
||||
*/
|
||||
ie_proof?: boolean;
|
||||
|
||||
/**
|
||||
* Beautify output?
|
||||
*/
|
||||
beautify?: boolean;
|
||||
|
||||
/**
|
||||
* Output a source map
|
||||
*/
|
||||
source_map?: SourceMapOptions;
|
||||
|
||||
/**
|
||||
* Use brackets every time?
|
||||
*/
|
||||
bracketize?: boolean;
|
||||
|
||||
/**
|
||||
* Output comments?
|
||||
*/
|
||||
comments?: boolean;
|
||||
|
||||
/**
|
||||
* Use semicolons to separate statements? (otherwise, newlines)
|
||||
*/
|
||||
semicolons?: boolean;
|
||||
}
|
||||
|
||||
interface OutputStream {
|
||||
// Return the output so far as a string
|
||||
get(): string;
|
||||
toString(): string;
|
||||
|
||||
// Insert one indentation string (usually 4 characters).
|
||||
// Optionally pass true to indent half the width (I'm using that for case and default lines in switch blocks.
|
||||
// If beautify is off, this function does nothing.
|
||||
indent(half?: boolean): void;
|
||||
|
||||
// Return the current indentation width (not level; for example if we're in level 2 and indent_level is 4, this method would return 8.
|
||||
indentation(): number;
|
||||
|
||||
// return the width of the current line text minus indentation.
|
||||
current_width(): number
|
||||
|
||||
// Return true if current_width() is bigger than options.width (assuming options.width is non-null, non-zero).
|
||||
should_break(): boolean;
|
||||
|
||||
// If beautification is on, this inserts a newline. Otherwise it does nothing.
|
||||
newline(): void;
|
||||
|
||||
// Include the given string into the output, adjusting current_line, current_col and current_pos accordingly.
|
||||
print(str: string): void;
|
||||
|
||||
// If beautification is on this always includes a space character.
|
||||
// Otherwise it saves a hint somewhere that a space might be needed at current point.
|
||||
// The space will go in at the next output but only when absolutely required, for example it will insert the space in return 10 but not in return"stuff".
|
||||
space(): void;
|
||||
|
||||
// Inserts a comma, and calls space() — that is, if beautification is on you'll get a space after the comma.
|
||||
comma(): void;
|
||||
|
||||
// Inserts a colon, and calls space() if options.space_colon is set.
|
||||
colon(): void;
|
||||
|
||||
// Returns the last printed chunk.
|
||||
last(): string;
|
||||
|
||||
// If beautification is on it always inserts a semicolon.
|
||||
// Otherwise it saves a hint that a semicolon might be needed at current point.
|
||||
// The semicolon is inserted when the next output comes in, only if required to not break the JS syntax.
|
||||
semicolon(): void;
|
||||
|
||||
// Always inserts a semicolon and clears the hint that a semicolon might be needed.
|
||||
force_semicolon(): void;
|
||||
|
||||
// Encodes any non-ASCII characters in string with JavaScript's conventions (using \uCODE).
|
||||
to_ascii(str: string): void;
|
||||
|
||||
// Prints an identifier. If options.ascii_only is set, non-ASCII chars will be encoded with JavaScript conventions.
|
||||
print_name(name: string): void;
|
||||
|
||||
// Prints a string. It adds quotes automatically.
|
||||
// It prefers double-quotes, but will actually count any quotes in the string and will use single-quotes if the output proves to be shorter (depending on how many backslashes it has to insert).
|
||||
// It encodes to ASCII if options.ascii_only is set.
|
||||
print_string(str: string): void;
|
||||
|
||||
// Returns the width of the next indentation level. For example if current level is 2 and options.indent_level is 4, it'll return 12.
|
||||
next_indent(): number;
|
||||
|
||||
// Sets the current indentation to col (column), calls the function and thereafter restores the previous indentation level.
|
||||
// If beautification is off it simply calls func.
|
||||
with_indent(col: number, func: Function): void;
|
||||
|
||||
// This is used to output blocks in curly brackets.
|
||||
// It'll print an open bracket at current point, then call newline() and with the next indentation level it calls your func.
|
||||
// Lastly, it'll print an indented closing bracket. As usual, if beautification is off you'll just get {x} where x is whatever func outputs.
|
||||
with_block(func: Function): void;
|
||||
|
||||
// Adds parens around the output that your function prints.
|
||||
with_parens(func: Function): void;
|
||||
|
||||
// Adds square brackets around the output that your function prints.
|
||||
with_square(func: Function): void;
|
||||
|
||||
// If options.source_map is set, this will generate a source mapping between the given token (which should be an AST_Token-like object) and the current line/col.
|
||||
// The name is optional; in most cases it will be inferred from the token.
|
||||
add_mapping(token: AST_Node, name?: string): void;
|
||||
|
||||
// Returns the option with the given name.
|
||||
option(name: string): any;
|
||||
|
||||
// Returns the current line in the output (1-based).
|
||||
line(): number;
|
||||
|
||||
// Returns the current column in the output (zero-based).
|
||||
col(): number;
|
||||
|
||||
// Push the given node into an internal stack. This is used to keep track of current node's parent(s).
|
||||
push_node(node: AST_Node): void;
|
||||
|
||||
// Pops the top of the stack and returns it.
|
||||
pop_node(): AST_Node;
|
||||
|
||||
// Returns that internal stack.
|
||||
stack(): any;
|
||||
|
||||
// Returns the n-th parent node (where zero means the direct parent).
|
||||
parent(n: number): AST_Node;
|
||||
}
|
||||
|
||||
/**
|
||||
* The code generator is a recursive process of getting back source code from an AST returned by the parser.
|
||||
* Every AST node has a “print” method that takes an OutputStream and dumps the code from that node into it.
|
||||
* The stream object supports a lot of options that control the output.
|
||||
* You can specify whether you'd like to get human-readable (indented) output, the indentation level, whether you'd like to quote all properties in object literals etc.
|
||||
*/
|
||||
function OutputStream(options?: BeautifierOptions): OutputStream;
|
||||
|
||||
|
||||
interface SourceMapOptions {
|
||||
/**
|
||||
* The compressed file name
|
||||
*/
|
||||
file?: string;
|
||||
|
||||
/**
|
||||
* The root URL to the original sources
|
||||
*/
|
||||
root?: string;
|
||||
|
||||
/**
|
||||
* The input source map.
|
||||
* Useful when you compress code that was generated from some other source (possibly other programming language).
|
||||
* If you have an input source map, pass it in this argument and UglifyJS will generate a mapping that maps back
|
||||
* to the original source (as opposed to the compiled code that you are compressing).
|
||||
*/
|
||||
orig?: Object | JSON;
|
||||
}
|
||||
|
||||
interface SourceMap {
|
||||
add(source: string, gen_line: number, gen_col: number, orig_line: number, orig_col: number, name?: string): void;
|
||||
get(): MOZ_SourceMap.SourceMapGenerator;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The output stream keeps track of the current line/column in the output and can trivially generate a source mapping to the original code via Mozilla's source-map library.
|
||||
* To use this functionality, you must load this library (it's automatically require-d by UglifyJS in the NodeJS version, but in a browser you must load it yourself)
|
||||
* and make it available via the global MOZ_SourceMap variable.
|
||||
*/
|
||||
function SourceMap(options?: SourceMapOptions): SourceMap;
|
||||
|
||||
|
||||
interface CompressorOptions {
|
||||
// Join consecutive statemets with the “comma operator”
|
||||
sequences?: boolean;
|
||||
|
||||
// Optimize property access: a["foo"] → a.foo
|
||||
properties?: boolean;
|
||||
|
||||
// Discard unreachable code
|
||||
dead_code?: boolean;
|
||||
|
||||
// Discard “debugger” statements
|
||||
drop_debugger?: boolean;
|
||||
|
||||
// Some unsafe optimizations (see below)
|
||||
unsafe?: boolean;
|
||||
|
||||
// Optimize if-s and conditional expressions
|
||||
conditionals?: boolean;
|
||||
|
||||
// Optimize comparisons
|
||||
comparisons?: boolean;
|
||||
|
||||
// Evaluate constant expressions
|
||||
evaluate?: boolean;
|
||||
|
||||
// Optimize boolean expressions
|
||||
booleans?: boolean;
|
||||
|
||||
// Optimize loops
|
||||
loops?: boolean;
|
||||
|
||||
// Drop unused variables/functions
|
||||
unused?: boolean;
|
||||
|
||||
// Hoist function declarations
|
||||
hoist_funs?: boolean;
|
||||
|
||||
// Hoist variable declarations
|
||||
hoist_vars?: boolean;
|
||||
|
||||
// Optimize if-s followed by return/continue
|
||||
if_return?: boolean;
|
||||
|
||||
// Join var declarations
|
||||
join_vars?: boolean;
|
||||
|
||||
// Try to cascade `right` into `left` in sequences
|
||||
cascade?: boolean;
|
||||
|
||||
// Drop side-effect-free statements
|
||||
side_effects?: boolean;
|
||||
|
||||
// Warn about potentially dangerous optimizations/code
|
||||
warnings?: boolean;
|
||||
|
||||
// Global definitions
|
||||
global_defs?: Object;
|
||||
}
|
||||
|
||||
/**
|
||||
* The compressor is a tree transformer which reduces the code size by applying various optimizations on the AST
|
||||
*/
|
||||
function Compressor(options?: CompressorOptions): AST_Toplevel;
|
||||
|
||||
|
||||
// TODO
|
||||
interface TreeWalker {
|
||||
}
|
||||
|
||||
type visitor = (node: AST_Node, descend: Function) => boolean;
|
||||
|
||||
/**
|
||||
* UglifyJS provides a TreeWalker object and every node has a walk method that given a walker will apply your visitor to each node in the tree.
|
||||
* Your visitor can return a non-falsy value in order to prevent descending the current node.
|
||||
*/
|
||||
function TreeWalker(visitor: visitor): TreeWalker;
|
||||
|
||||
|
||||
// TODO
|
||||
interface TreeTransformer extends TreeWalker {
|
||||
}
|
||||
|
||||
/**
|
||||
* The tree transformer is a special case of a tree walker.
|
||||
* In fact it even inherits from TreeWalker and you can use the same methods, but initialization and visitor protocol are a bit different.
|
||||
*/
|
||||
function TreeTransformer(before: visitor, after: visitor): TreeTransformer;
|
||||
}
|
||||
|
||||
export = UglifyJS;
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
// Type definitions for webpack 1.12.2 (module API)
|
||||
// Project: https://github.com/webpack/webpack
|
||||
// Definitions by: use-strict <https://github.com/use-strict>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Webpack module API - variables and global functions available inside modules
|
||||
*/
|
||||
|
||||
declare namespace __WebpackModuleApi {
|
||||
interface RequireContext {
|
||||
keys(): string[];
|
||||
<T>(id: string): T;
|
||||
resolve(id: string): string;
|
||||
}
|
||||
|
||||
interface RequireFunction {
|
||||
/**
|
||||
* Returns the exports from a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available.
|
||||
*/
|
||||
<T>(path: string): T;
|
||||
/**
|
||||
* Behaves similar to require.ensure, but the callback is called with the exports of each dependency in the paths array. There is no option to provide a chunk name.
|
||||
*/
|
||||
(paths: string[], callback: (...modules: any[]) => void): void;
|
||||
/**
|
||||
* Download additional dependencies on demand. The paths array lists modules that should be available. When they are, callback is called. If the callback is a function expression, dependencies in that source part are extracted and also loaded on demand. A single request is fired to the server, except if all modules are already available.
|
||||
*
|
||||
* This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used.
|
||||
*/
|
||||
ensure: (paths: string[], callback: (require: <T>(path: string) => T) => void, chunkName?: string) => void;
|
||||
context: (path: string, deep?: boolean, filter?: RegExp) => RequireContext;
|
||||
/**
|
||||
* Returns the module id of a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available.
|
||||
*
|
||||
* The module id is a number in webpack (in contrast to node.js where it is a string, the filename).
|
||||
*/
|
||||
resolve(path: string): number;
|
||||
/**
|
||||
* Like require.resolve, but doesn’t include the module into the bundle. It’s a weak dependency.
|
||||
*/
|
||||
resolveWeak(path: string): number;
|
||||
/**
|
||||
* Ensures that the dependency is available, but don’t execute it. This can be use for optimizing the position of a module in the chunks.
|
||||
*/
|
||||
include(path: string): void;
|
||||
/**
|
||||
* Multiple requires to the same module result in only one module execution and only one export. Therefore a cache in the runtime exists. Removing values from this cache cause new module execution and a new export. This is only needed in rare cases (for compatibility!).
|
||||
*/
|
||||
cache: {
|
||||
[id: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
interface Module {
|
||||
exports: any;
|
||||
require(id: string): any;
|
||||
id: string;
|
||||
filename: string;
|
||||
loaded: boolean;
|
||||
parent: any;
|
||||
children: any[];
|
||||
hot: Hot;
|
||||
}
|
||||
type ModuleId = string|number;
|
||||
|
||||
interface Hot {
|
||||
/**
|
||||
* Accept code updates for the specified dependencies. The callback is called when dependencies were replaced.
|
||||
* @param dependencies
|
||||
* @param callback
|
||||
*/
|
||||
accept(dependencies: string[], callback: (updatedDependencies: ModuleId[]) => void): void;
|
||||
/**
|
||||
* Accept code updates for the specified dependencies. The callback is called when dependencies were replaced.
|
||||
* @param dependency
|
||||
* @param callback
|
||||
*/
|
||||
accept(dependency: string, callback: () => void): void;
|
||||
/**
|
||||
* Accept code updates for this module without notification of parents.
|
||||
* This should only be used if the module doesn’t export anything.
|
||||
* The errHandler can be used to handle errors that occur while loading the updated module.
|
||||
* @param errHandler
|
||||
*/
|
||||
accept(errHandler?: (err: Error) => void): void;
|
||||
/**
|
||||
* Do not accept updates for the specified dependencies. If any dependencies is updated, the code update fails with code "decline".
|
||||
*/
|
||||
decline(dependencies: string[]): void;
|
||||
/**
|
||||
* Do not accept updates for the specified dependencies. If any dependencies is updated, the code update fails with code "decline".
|
||||
*/
|
||||
decline(dependency: string): void;
|
||||
/**
|
||||
* Flag the current module as not update-able. If updated the update code would fail with code "decline".
|
||||
*/
|
||||
decline(): void;
|
||||
/**
|
||||
* Add a one time handler, which is executed when the current module code is replaced.
|
||||
* Here you should destroy/remove any persistent resource you have claimed/created.
|
||||
* If you want to transfer state to the new module, add it to data object.
|
||||
* The data will be available at module.hot.data on the new module.
|
||||
* @param callback
|
||||
*/
|
||||
dispose<T>(callback: (data: T) => void): void;
|
||||
/**
|
||||
* Add a one time handler, which is executed when the current module code is replaced.
|
||||
* Here you should destroy/remove any persistent resource you have claimed/created.
|
||||
* If you want to transfer state to the new module, add it to data object.
|
||||
* The data will be available at module.hot.data on the new module.
|
||||
* @param callback
|
||||
*/
|
||||
addDisposeHandler<T>(callback: (data: T) => void): void;
|
||||
/**
|
||||
* Remove a handler.
|
||||
* This can useful to add a temporary dispose handler. You could i. e. replace code while in the middle of a multi-step async function.
|
||||
* @param callback
|
||||
*/
|
||||
removeDisposeHandler<T>(callback: (data: T) => void): void;
|
||||
/**
|
||||
* Throws an exceptions if status() is not idle.
|
||||
* Check all currently loaded modules for updates and apply updates if found.
|
||||
* If no update was found, the callback is called with null.
|
||||
* If autoApply is truthy the callback will be called with all modules that were disposed.
|
||||
* apply() is automatically called with autoApply as options parameter.
|
||||
* If autoApply is not set the callback will be called with all modules that will be disposed on apply().
|
||||
* @param autoApply
|
||||
* @param callback
|
||||
*/
|
||||
check(autoApply: boolean, callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
|
||||
/**
|
||||
* Throws an exceptions if status() is not idle.
|
||||
* Check all currently loaded modules for updates and apply updates if found.
|
||||
* If no update was found, the callback is called with null.
|
||||
* The callback will be called with all modules that will be disposed on apply().
|
||||
* @param callback
|
||||
*/
|
||||
check(callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
|
||||
/**
|
||||
* If status() != "ready" it throws an error.
|
||||
* Continue the update process.
|
||||
* @param options
|
||||
* @param callback
|
||||
*/
|
||||
apply(options: AcceptOptions, callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
|
||||
/**
|
||||
* If status() != "ready" it throws an error.
|
||||
* Continue the update process.
|
||||
* @param callback
|
||||
*/
|
||||
apply(callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
|
||||
/**
|
||||
* Return one of idle, check, watch, watch-delay, prepare, ready, dispose, apply, abort or fail.
|
||||
*/
|
||||
status(): string;
|
||||
/** Register a callback on status change. */
|
||||
status(callback: (status: string) => void): void;
|
||||
/** Register a callback on status change. */
|
||||
addStatusHandler(callback: (status: string) => void): void;
|
||||
/**
|
||||
* Remove a registered status change handler.
|
||||
* @param callback
|
||||
*/
|
||||
removeStatusHandler(callback: (status: string) => void): void;
|
||||
|
||||
active: boolean;
|
||||
data: {};
|
||||
}
|
||||
|
||||
interface AcceptOptions {
|
||||
/**
|
||||
* If true the update process continues even if some modules are not accepted (and would bubble to the entry point).
|
||||
*/
|
||||
ignoreUnaccepted?: boolean;
|
||||
/**
|
||||
* Indicates that apply() is automatically called by check function
|
||||
*/
|
||||
autoApply?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare var require: __WebpackModuleApi.RequireFunction;
|
||||
|
||||
/**
|
||||
* The resource query of the current module.
|
||||
*
|
||||
* e.g. __resourceQuery === "?test" // Inside "file.js?test"
|
||||
*/
|
||||
declare var __resourceQuery: string;
|
||||
|
||||
/**
|
||||
* Equals the config options output.publicPath.
|
||||
*/
|
||||
declare var __webpack_public_path__: string;
|
||||
|
||||
/**
|
||||
* The raw require function. This expression isn’t parsed by the Parser for dependencies.
|
||||
*/
|
||||
declare var __webpack_require__: any;
|
||||
|
||||
/**
|
||||
* The internal chunk loading function
|
||||
*
|
||||
* @param chunkId The id for the chunk to load.
|
||||
* @param callback A callback function called once the chunk is loaded.
|
||||
*/
|
||||
declare var __webpack_chunk_load__: (chunkId: any, callback: (require: (id: string) => any) => void) => void;
|
||||
|
||||
/**
|
||||
* Access to the internal object of all modules.
|
||||
*/
|
||||
declare var __webpack_modules__: any[];
|
||||
|
||||
/**
|
||||
* Access to the hash of the compilation.
|
||||
*
|
||||
* Only available with the HotModuleReplacementPlugin or the ExtendedAPIPlugin
|
||||
*/
|
||||
declare var __webpack_hash__: any;
|
||||
|
||||
/**
|
||||
* Generates a require function that is not parsed by webpack. Can be used to do cool stuff with a global require function if available.
|
||||
*/
|
||||
declare var __non_webpack_require__: any;
|
||||
|
||||
/**
|
||||
* Equals the config option debug
|
||||
*/
|
||||
declare var DEBUG: boolean;
|
||||
|
||||
declare var module: __WebpackModuleApi.Module;
|
||||
@@ -1,85 +0,0 @@
|
||||
// Type definitions for fetch API
|
||||
// Project: https://github.com/github/fetch
|
||||
// Definitions by: Ryan Graham <https://github.com/ryan-codingintrigue>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare class Request extends Body {
|
||||
constructor(input: string|Request, init?:RequestInit);
|
||||
method: string;
|
||||
url: string;
|
||||
headers: Headers;
|
||||
context: string|RequestContext;
|
||||
referrer: string;
|
||||
mode: string|RequestMode;
|
||||
credentials: string|RequestCredentials;
|
||||
cache: string|RequestCache;
|
||||
}
|
||||
|
||||
interface RequestInit {
|
||||
method?: string;
|
||||
headers?: HeaderInit|{ [index: string]: string };
|
||||
body?: BodyInit;
|
||||
mode?: string|RequestMode;
|
||||
credentials?: string|RequestCredentials;
|
||||
cache?: string|RequestCache;
|
||||
}
|
||||
|
||||
declare enum RequestContext {
|
||||
"audio", "beacon", "cspreport", "download", "embed", "eventsource", "favicon", "fetch",
|
||||
"font", "form", "frame", "hyperlink", "iframe", "image", "imageset", "import",
|
||||
"internal", "location", "manifest", "object", "ping", "plugin", "prefetch", "script",
|
||||
"serviceworker", "sharedworker", "subresource", "style", "track", "video", "worker",
|
||||
"xmlhttprequest", "xslt"
|
||||
}
|
||||
declare enum RequestMode { "same-origin", "no-cors", "cors" }
|
||||
declare enum RequestCredentials { "omit", "same-origin", "include" }
|
||||
declare enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" }
|
||||
|
||||
declare class Headers {
|
||||
append(name: string, value: string): void;
|
||||
delete(name: string):void;
|
||||
get(name: string): string;
|
||||
getAll(name: string): Array<string>;
|
||||
has(name: string): boolean;
|
||||
set(name: string, value: string): void;
|
||||
}
|
||||
|
||||
declare class Body {
|
||||
bodyUsed: boolean;
|
||||
arrayBuffer(): Promise<ArrayBuffer>;
|
||||
blob(): Promise<Blob>;
|
||||
formData(): Promise<FormData>;
|
||||
json(): Promise<any>;
|
||||
json<T>(): Promise<T>;
|
||||
text(): Promise<string>;
|
||||
}
|
||||
declare class Response extends Body {
|
||||
constructor(body?: BodyInit, init?: ResponseInit);
|
||||
error(): Response;
|
||||
redirect(url: string, status: number): Response;
|
||||
type: string|ResponseType;
|
||||
url: string;
|
||||
status: number;
|
||||
ok: boolean;
|
||||
statusText: string;
|
||||
headers: Headers;
|
||||
clone(): Response;
|
||||
}
|
||||
|
||||
declare enum ResponseType { "basic", "cors", "default", "error", "opaque" }
|
||||
|
||||
interface ResponseInit {
|
||||
status: number;
|
||||
statusText?: string;
|
||||
headers?: HeaderInit;
|
||||
}
|
||||
|
||||
declare type HeaderInit = Headers|Array<string>;
|
||||
declare type BodyInit = Blob|FormData|string;
|
||||
declare type RequestInfo = Request|string;
|
||||
|
||||
interface Window {
|
||||
fetch(url: string|Request, init?: RequestInit): Promise<Response>;
|
||||
}
|
||||
|
||||
declare var fetch: typeof window.fetch;
|
||||
Reference in New Issue
Block a user