Skip to content

Commit db887a0

Browse files
chore(examples): add typecheck commands
1 parent 13af066 commit db887a0

3 files changed

Lines changed: 26 additions & 13 deletions

File tree

examples/platformer/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"type": "module",
77
"scripts": {
88
"dev": "vite",
9-
"build": "tsc --noEmit && vite build",
9+
"typecheck": "tsc --noEmit",
10+
"build": "pnpm typecheck && vite build",
1011
"preview": "vite preview",
1112
"check": "pnpm build"
1213
},

examples/platformer/src/machine.ts

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,29 @@ export const CharacterMachine = Machine.make({
151151
Grounded: {
152152
on: {
153153
JumpPressed: ({ event, target }) =>
154-
target.branch.Character.locomotion.Airborne(
155-
State.cases.Airborne.make({ originY: event.y }),
156-
(airborne) =>
157-
airborne
158-
.motion(State.cases.Motion.make({}), (motion) =>
159-
motion.Jumping(
160-
State.cases.Jumping.make({ startedAt: event.at, push: 0, kind: "Ground" })
161-
)
162-
)
163-
.airJump(State.cases.AirJump.make({}), (airJump) =>
164-
airJump.AirJumpGroundLock(State.cases.AirJumpGroundLock.make({}))
154+
target.full.Character(State.cases.Character.make({}), (character) =>
155+
character
156+
.locomotion(State.cases.Locomotion.make({}), (locomotion) =>
157+
locomotion.Airborne(State.cases.Airborne.make({ originY: event.y }), (airborne) =>
158+
airborne
159+
.motion(State.cases.Motion.make({}), (motion) =>
160+
motion.Jumping(
161+
State.cases.Jumping.make({ startedAt: event.at, push: 0, kind: "Ground" })
162+
)
163+
)
164+
.airJump(State.cases.AirJump.make({}), (airJump) =>
165+
airJump.AirJumpGroundLock(State.cases.AirJumpGroundLock.make({}))
166+
)
165167
)
168+
)
169+
.facing(State.cases.Facing.make({}), (facing) => facing.Right(State.cases.Right.make({})))
170+
.contact(State.cases.WallContact.make({}), (contact) =>
171+
event.wall === -1
172+
? contact.LeftWall(State.cases.LeftWall.make({}))
173+
: event.wall === 1
174+
? contact.RightWall(State.cases.RightWall.make({}))
175+
: contact.NoWall(State.cases.NoWall.make({}))
176+
)
166177
)
167178
},
168179
states: {

examples/pokemon/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"type": "module",
77
"scripts": {
88
"dev": "vite",
9-
"build": "tsc --noEmit && vite build",
9+
"typecheck": "tsc --noEmit",
10+
"build": "pnpm typecheck && vite build",
1011
"preview": "vite preview",
1112
"check": "pnpm build"
1213
},

0 commit comments

Comments
 (0)