Skip to content

Commit

Permalink
Updated codesandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrwitek committed Apr 20, 2019
1 parent 74005e8 commit 557b8e4
Show file tree
Hide file tree
Showing 29 changed files with 8,846 additions and 4,866 deletions.
23 changes: 23 additions & 0 deletions codesandbox/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
6 changes: 6 additions & 0 deletions codesandbox/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 80,
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
}
12,801 changes: 8,058 additions & 4,743 deletions codesandbox/package-lock.json

Large diffs are not rendered by default.

29 changes: 15 additions & 14 deletions codesandbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,30 @@
},
"dependencies": {
"@babel/polyfill": "7.4.3",
"@types/jest": "23.3.10",
"@types/react": "16.8.4",
"@types/react-dom": "16.8.2",
"@types/react-redux": "6.0.11",
"@types/react-router-dom": "4.3.1",
"@types/jest": "24.0.11",
"@types/react": "16.8.14",
"@types/react-dom": "16.8.4",
"@types/react-redux": "7.0.8",
"@types/react-router-dom": "4.3.2",
"@types/react-router-redux": "5.0.18",
"cuid": "2.1.6",
"jest": "23.6.0",
"react": "16.8.3",
"react-dom": "16.8.3",
"react-redux": "6.0.1",
"jest": "24.7.1",
"react": "16.8.6",
"react-dom": "16.8.6",
"react-redux": "7.0.2",
"react-redux-typescript-scripts": "1.5.0",
"react-router-dom": "4.3.1",
"react-router-redux": "5.0.0-alpha.9",
"react-scripts-ts": "3.1.0",
"redux": "4.0.1",
"redux-observable": "1.0.0",
"redux-observable": "1.1.0",
"reselect": "4.0.0",
"rxjs": "6.4.0",
"tslib": "1.9.3",
"tslint": "5.13.0",
"tslint-react": "3.6.0",
"typesafe-actions": "4.0.0",
"typescript": "3.4.3"
"tslint": "5.16.0",
"tslint-react": "4.0.0",
"typesafe-actions": "file:src/typesafe-actions",
"typescript": "3.4.4"
},
"devDependencies": {}
}
1 change: 0 additions & 1 deletion codesandbox/src/env.ts

This file was deleted.

4 changes: 2 additions & 2 deletions codesandbox/src/features/todos/components/TodoList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import { connect } from 'react-redux';

import * as selectors from '../selectors';
import { removeTodo } from '../actions';
import * as actions from '../actions';

import TodoListItem from './TodoListItem';

Expand All @@ -12,7 +12,7 @@ const mapStateToProps = (state: RootState) => ({
todos: selectors.getTodos(state.todos),
});
const dispatchProps = {
removeTodo,
removeTodo: actions.removeTodo,
};

type Props = ReturnType<typeof mapStateToProps> & typeof dispatchProps;
Expand Down
8 changes: 0 additions & 8 deletions codesandbox/src/index.js

This file was deleted.

8 changes: 2 additions & 6 deletions codesandbox/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// tslint:disable-next-line:no-import-side-effect
// tslint:disable-next-line: no-import-side-effect
import '@babel/polyfill';
// console.log('polyfills');

// tslint:disable-next-line:no-import-side-effect
// tslint:disable-next-line: no-import-side-effect
import 'tslib';
// tslint:disable-next-line:no-import-side-effect
import './env';

import * as React from 'react';
import { render } from 'react-dom';
Expand Down
37 changes: 37 additions & 0 deletions codesandbox/src/typesafe-actions/action.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { StringType } from './type-helpers';
export declare function action<T extends StringType, E>(type: T, payload: undefined, meta: undefined, error: E): {
type: T;
error: E;
};
export declare function action<T extends StringType, M, E>(type: T, payload: undefined, meta: M, error: E): {
type: T;
meta: M;
error: E;
};
export declare function action<T extends StringType, P, E>(type: T, payload: P, meta: undefined, error: E): {
type: T;
payload: P;
error: E;
};
export declare function action<T extends StringType, P, M, E>(type: T, payload: P, meta: M, error: E): {
type: T;
payload: P;
meta: M;
error: E;
};
export declare function action<T extends StringType, M>(type: T, payload: undefined, meta: M): {
type: T;
meta: M;
};
export declare function action<T extends StringType, P, M>(type: T, payload: P, meta: M): {
type: T;
payload: P;
meta: M;
};
export declare function action<T extends StringType, P>(type: T, payload: P): {
type: T;
payload: P;
};
export declare function action<T extends StringType>(type: T): {
type: T;
};
12 changes: 12 additions & 0 deletions codesandbox/src/typesafe-actions/create-action-deprecated.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { StringType } from './type-helpers';
interface FSA<T extends StringType, P = {}, M = {}, E = boolean> {
type: T;
payload?: P;
meta?: M;
error?: E;
}
export declare function createActionDeprecated<T extends StringType, AC extends (...args: any[]) => FSA<T>>(actionType: T, creatorFunction: AC): AC;
export declare function createActionDeprecated<T extends StringType, AC extends () => {
type: T;
}>(actionType: T): AC;
export {};
17 changes: 17 additions & 0 deletions codesandbox/src/typesafe-actions/create-action.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { StringType, ActionCreator } from './type-helpers';
export declare type PayloadMetaAction<T extends StringType, P, M> = P extends undefined ? M extends undefined ? {
type: T;
} : {
type: T;
meta: M;
} : M extends undefined ? {
type: T;
payload: P;
} : {
type: T;
payload: P;
meta: M;
};
export declare function createAction<T extends StringType, AC extends ActionCreator<T> = () => {
type: T;
}>(type: T, createHandler?: (actionCallback: <P = undefined, M = undefined>(payload?: P, meta?: M) => PayloadMetaAction<T, P, M>) => AC): AC;
10 changes: 10 additions & 0 deletions codesandbox/src/typesafe-actions/create-async-action.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { StringType, ActionBuilderConstructor } from './type-helpers';
export interface AsyncActionBuilder<T1 extends StringType, T2 extends StringType, T3 extends StringType> {
<P1, P2, P3>(): AsyncActionBuilderConstructor<T1, T2, T3, P1, P2, P3>;
}
export declare type AsyncActionBuilderConstructor<T1 extends StringType, T2 extends StringType, T3 extends StringType, P1, P2, P3> = {
request: ActionBuilderConstructor<T1, P1>;
success: ActionBuilderConstructor<T2, P2>;
failure: ActionBuilderConstructor<T3, P3>;
};
export declare function createAsyncAction<T1 extends StringType, T2 extends StringType, T3 extends StringType>(requestType: T1, successType: T2, failureType: T3): AsyncActionBuilder<T1, T2, T3>;
4 changes: 4 additions & 0 deletions codesandbox/src/typesafe-actions/create-custom-action.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { ActionCreator, StringType } from './type-helpers';
export declare function createCustomAction<T extends StringType, AC extends ActionCreator<T> = () => {
type: T;
}>(type: T, createHandler?: (type: T) => AC): AC;
70 changes: 70 additions & 0 deletions codesandbox/src/typesafe-actions/create-reducer.d.ts

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions codesandbox/src/typesafe-actions/create-standard-action.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { StringType, ActionBuilderConstructor, ActionBuilderMap } from './type-helpers';
export interface ActionBuilder<T extends StringType> {
<P = undefined, M = undefined>(): ActionBuilderConstructor<T, P, M>;
map<R, P = undefined, M = undefined>(fn: (payload: P, meta: M) => R): ActionBuilderMap<T, R, P, M>;
}
export declare function createStandardAction<T extends StringType>(type: T): ActionBuilder<T>;
2 changes: 2 additions & 0 deletions codesandbox/src/typesafe-actions/get-type.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { StringType, ActionCreator, TypeMeta } from './type-helpers';
export declare function getType<T extends StringType>(actionCreator: ActionCreator<T> & TypeMeta<T>): T;
11 changes: 11 additions & 0 deletions codesandbox/src/typesafe-actions/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export { action } from './action';
export { createAction } from './create-action';
export { createStandardAction } from './create-standard-action';
export { createCustomAction } from './create-custom-action';
export { createAsyncAction } from './create-async-action';
export { createReducer } from './create-reducer';
export { getType } from './get-type';
export { isOfType } from './is-of-type';
export { isActionOf } from './is-action-of';
export { ActionType, StateType, ActionCreator, TypeMeta } from './type-helpers';
export { createActionDeprecated } from './create-action-deprecated';
Loading

0 comments on commit 557b8e4

Please sign in to comment.