Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript definitions #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
"module": "dist/stockroom.es.js",
"main": "dist/stockroom.js",
"umd:main": "dist/stockroom.umd.js",
"typings": "index.d.ts",
"typings": "src/index.d.ts",
"scripts": {
"build": "npm-run-all --silent bundle size docs",
"build": "npm-run-all --silent bundle size docs types",
"bundle": "microbundle src/index.js -o dist/stockroom.js && microbundle src/inline.js -o inline/index.js && microbundle src/worker.js -o worker/index.js",
"size": "strip-json-comments --no-whitespace dist/stockroom.js | gzip-size && bundlesize",
"docs": "documentation readme src/*.js -q --section API && npm run -s fixreadme",
"fixreadme": "node -e 'var fs=require(\"fs\");fs.writeFileSync(\"README.md\", fs.readFileSync(\"README.md\", \"utf8\").replace(/^- /gm, \"- \"))'",
"test": "eslint src test && npm run bundle && karma start test/karma.conf.js --single-run",
"types": "cp-cli src/worker.d.ts worker/index.d.ts && cp-cli src/inline.d.ts inline/index.d.ts",
"prepare": "npm t",
"release": "npm t && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"
},
Expand Down Expand Up @@ -68,6 +69,7 @@
"babel-preset-stage-0": "^6.24.1",
"bundlesize": "^0.15.3",
"chai": "^4.1.2",
"cp-cli": "^1.1.2",
"documentation": "^4.0.0",
"eslint": "^4.16.0",
"eslint-config-developit": "^1.1.1",
Expand Down
5 changes: 5 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// K - Store state

import { Store } from "unistore";

export default function createStore<K>(worker: Worker): Store<K>;
12 changes: 12 additions & 0 deletions src/inline.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// K - Store state

import { Store } from "unistore";

export interface WorkerStore<K> extends Store<K> {
freeze: () => void;
unfreeze: () => void;
}

export default function createInlineStore<K>(
workerStore: WorkerStore<K>
): WorkerStore<K>;
10 changes: 10 additions & 0 deletions src/worker.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// K - Store state

import { Store } from "unistore";

export interface WorkerStore<K> extends Store<K> {
freeze: () => void;
unfreeze: () => void;
}

export default function createWorkerStore<K>(initialState?: K): WorkerStore<K>;