statelyai / xstate

Actor-based state management & orchestration for complex app logic.
https://stately.ai/docs
MIT License
26.98k stars 1.24k forks source link

Types Improvement: prevent deep _parent access (a TODO fix) #4800

Closed korniychuk closed 6 months ago

korniychuk commented 6 months ago
 self._parent._parent

Screenshot 2024-03-15 at 14 52 00@2x

This is a suggestion, I didn't check all the side effects.

changeset-bot[bot] commented 6 months ago

⚠️ No Changeset found

Latest commit: a28086becf7895c6a75219986be70c350c480aba

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

codesandbox-ci[bot] commented 6 months ago

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.

Andarist commented 6 months ago

Even shallow access is discouraged. This is a private property as denoted by the leading underscore. I prefer to avoid the Omit type when possible since it’s not the most performant type util.

I think the added benefit here doesn't justify this code change.

korniychuk commented 6 months ago

Thanks for the explanation!