-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix(core): fix type ExtractStateValue to describe real state value #1409
Conversation
🦋 Changeset is good to goLatest commit: f51614d We got this. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit f51614d:
|
Consider the following schema: type LightStateSchema = { states: { green: {}, yellow: {}, red: { states: { walk: {}, wait: {}, stop: {}, }, }, }, } The current implementation of the ExtractStateValue type generates the following type: { green?: {} | undefined yellow?: {} | undefined red?: "walk" | "wait" | "stop" | { walk?: {} | undefined wait?: {} | undefined stop?: {} | undefined } | undefined } This does not describe the StateValue of LightStateSchema as provided in State.value. The new implementation generates the following type: "green" | "yellow" | "red" | { red?: "walk" | "wait" | "stop" | undefined }
Could you open a discussion that would describe your use case? For context, this type was removed in #2828 as we've assumed that it was a leftover from a previous implementation and that it wasn't used externally. |
@Andarist sorry I can't answer right now, I will try to figure out it. I guess it was used to make deal with TS |
Consider the following schema:
The current implementation of the ExtractStateValue type generates the
following type:
This does not describe the StateValue of LightStateSchema as provided
in State.value.
The new implementation generates the following type: