Skip to content

Commit

Permalink
Exported Handler type from public API
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickroberts committed Oct 30, 2020
1 parent a9c9f57 commit 7f9e5fd
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 92 deletions.
182 changes: 91 additions & 91 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,91 +1,91 @@
{
"name": "suspense-service",
"version": "0.2.0",
"description": "Suspense integration library for React",
"repository": "github:patrickroberts/suspense-service",
"main": "dst/cjs/suspense-service.js",
"module": "dst/esm/suspense-service.js",
"browser": "dst/umd/suspense-service.js",
"types": "dst/esm/suspense-service.d.ts",
"scripts": {
"clean": "rimraf dst docs/**/*.md",
"lint": "eslint . --ext .js,.ts,.tsx",
"test": "jest",
"build": "rollup --config --environment NODE_ENV:production",
"rebuild": "npm run clean && npm run build",
"docs": "typedoc src/index.ts",
"watch:build": "npm run build -- --environment NODE_ENV:development --watch",
"watch:test": "npm test -- --watch",
"watch": "concurrently 'npm:watch:*'",
"prepublishOnly": "npm run clean && npm run lint && npm test && npm run build && npm run docs"
},
"author": "Patrick Roberts",
"license": "MIT",
"devDependencies": {
"@babel/preset-react": "^7.10.4",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@types/jest": "^26.0.14",
"@types/react": "^16.9.51",
"@types/react-dom": "^16.9.8",
"@types/react-test-renderer": "^16.9.3",
"@typescript-eslint/eslint-plugin": "4.0.1",
"@typescript-eslint/parser": "4.0.1",
"@wessberg/rollup-plugin-ts": "^1.3.5",
"concurrently": "^5.3.0",
"eslint": "^7.10.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.21.3",
"eslint-plugin-react-hooks": "^4.1.2",
"jest": "^26.5.3",
"prettier": "^2.1.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-test-renderer": "^16.14.0",
"rimraf": "^3.0.2",
"rollup": "^2.28.2",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^26.4.1",
"typedoc": "^0.19.2",
"typedoc-plugin-markdown": "^3.0.7",
"typedoc-plugin-sourcefile-url": "^1.0.6",
"typescript": "^4.0.3"
},
"peerDependencies": {
"react": "^16.13.1"
},
"keywords": [
"concurrent",
"context",
"data",
"fetching",
"hooks",
"integration",
"library",
"react",
"service",
"suspense",
"typescript"
],
"babel": {
"presets": [
"@babel/preset-react"
]
},
"browserslist": {
"development": [
"last 1 chrome version",
"last 1 firefox version",
"maintained node versions"
],
"production": [
"defaults"
],
"test": [
"maintained node versions"
]
}
}
{
"name": "suspense-service",
"version": "0.2.1",
"description": "Suspense integration library for React",
"repository": "github:patrickroberts/suspense-service",
"main": "dst/cjs/suspense-service.js",
"module": "dst/esm/suspense-service.js",
"browser": "dst/umd/suspense-service.js",
"types": "dst/esm/suspense-service.d.ts",
"scripts": {
"clean": "rimraf dst docs/**/*.md",
"lint": "eslint . --ext .js,.ts,.tsx",
"test": "jest",
"build": "rollup --config --environment NODE_ENV:production",
"rebuild": "npm run clean && npm run build",
"docs": "typedoc src/index.ts",
"watch:build": "npm run build -- --environment NODE_ENV:development --watch",
"watch:test": "npm test -- --watch",
"watch": "concurrently 'npm:watch:*'",
"prepublishOnly": "npm run clean && npm run lint && npm test && npm run build && npm run docs"
},
"author": "Patrick Roberts",
"license": "MIT",
"devDependencies": {
"@babel/preset-react": "^7.10.4",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@types/jest": "^26.0.14",
"@types/react": "^16.9.51",
"@types/react-dom": "^16.9.8",
"@types/react-test-renderer": "^16.9.3",
"@typescript-eslint/eslint-plugin": "4.0.1",
"@typescript-eslint/parser": "4.0.1",
"@wessberg/rollup-plugin-ts": "^1.3.5",
"concurrently": "^5.3.0",
"eslint": "^7.10.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.21.3",
"eslint-plugin-react-hooks": "^4.1.2",
"jest": "^26.5.3",
"prettier": "^2.1.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-test-renderer": "^16.14.0",
"rimraf": "^3.0.2",
"rollup": "^2.28.2",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^26.4.1",
"typedoc": "^0.19.2",
"typedoc-plugin-markdown": "^3.0.7",
"typedoc-plugin-sourcefile-url": "^1.0.6",
"typescript": "^4.0.3"
},
"peerDependencies": {
"react": "^16.13.1"
},
"keywords": [
"concurrent",
"context",
"data",
"fetching",
"hooks",
"integration",
"library",
"react",
"service",
"suspense",
"typescript"
],
"babel": {
"presets": [
"@babel/preset-react"
]
},
"browserslist": {
"development": [
"last 1 chrome version",
"last 1 firefox version",
"maintained node versions"
],
"production": [
"defaults"
],
"test": [
"maintained node versions"
]
}
}
2 changes: 2 additions & 0 deletions src/Service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export default interface Service<TRequest, TResponse> {
[kResource]: IdContext<[Resource<TResponse>, Dispatch<SetStateAction<TRequest>>]>;
}

export { Handler };

const defaultFn = () => { throw new Error('Provider is not in scope'); };
const defaultValue: [Resource<never>, Dispatch<any>] = [defaultFn, defaultFn];

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export { default as IdContextProvider, IdContextProviderProps } from './IdContex
export { default as IdContext, createIdContext, useIdContext } from './IdContext';
export { default as ServiceConsumer, ServiceConsumerProps } from './Service/Consumer';
export { default as ServiceProvider, ServiceProviderProps } from './Service/Provider';
export { default as Service, createService, useService, useServiceState } from './Service';
export { default as Service, Handler, createService, useService, useServiceState } from './Service';
export { default as Reset } from './State/Reset';

0 comments on commit 7f9e5fd

Please sign in to comment.