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

(WIP, DON'T MERGE) Fix typings in scenes/context.ts #1828

Draft
wants to merge 5 commits into
base: v4
Choose a base branch
from
Draft
Changes from 1 commit
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: 3 additions & 3 deletions src/scenes/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ export default class SceneContextScene<
return session
}

get state() {
get state(): D["state"] {
return (this.session.state ??= {})
}

set state(value) {
set state(value: D["state"]) {
this.session.state = { ...value }
}

Expand All @@ -82,7 +82,7 @@ export default class SceneContextScene<
this.ctx.session.__scenes = Object.assign({}, this.options.defaultSession)
}

async enter(sceneId: string, initialState: object = {}, silent = false) {
async enter(sceneId: string, initialState: D["state"] = {}, silent = false) {
if (!this.scenes.has(sceneId)) {
throw new Error(`Can't find scene: ${sceneId}`)
}
Expand Down