Skip to content

Commit

Permalink
Add typings for preact-robot (#217)
Browse files Browse the repository at this point in the history
* chore: update package json to point typings properly

* chore: add typings

* chore: update package json to point typings properly
  • Loading branch information
exidz authored Jul 1, 2024
1 parent 52742ab commit c953ce8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
"version": "0.4.1",
"description": "A functional, immutable Finite State Machine library",
"main": "dist/machine.js",
"types": "./index.d.ts",
"exports": {
".": {
"require": "./dist/machine.js",
"import": "./machine.js",
"default": "./machine.js"
"default": "./machine.js",
"types": "./index.d.ts"
}
},
"files": [
Expand Down
12 changes: 12 additions & 0 deletions packages/preact-robot/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
declare module "preact-robot" {
import type { Machine, SendFunction, Service } from "robot3";
export function useMachine<M extends Machine>(
machine: M,
initialContext?: M["context"]
): [
M["state"] & { context: M["context"] },
SendFunction,
Service<typeof machine>
];
}

4 changes: 3 additions & 1 deletion packages/preact-robot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
"description": "Preact hooks for Robot finite state machines",
"main": "dist/machine.js",
"module": "machine.js",
"types": "./index.d.ts",
"exports": {
".": {
"require": "./dist/machine.js",
"default": "./machine.js"
"default": "./machine.js",
"types": "./index.d.ts"
}
},
"scripts": {
Expand Down

0 comments on commit c953ce8

Please sign in to comment.