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

Upgrade TypeScript version used in the repo #3559

Merged
merged 7 commits into from Aug 31, 2022
Merged

Upgrade TypeScript version used in the repo #3559

merged 7 commits into from Aug 31, 2022

Conversation

Andarist
Copy link
Member

@Andarist Andarist commented Aug 30, 2022

fixes #3557

The applied NonNullable is at the wrong level (I think?) but, for some reason, it works - I'm still rechecking why. It should be applied on TStateSchema['states'] and not on TStateSchema['states'][K]. However, this doesn't work because there is a bug In TypeScript. I've already created a fix for it but I'm not sure how long will it take to land it: microsoft/TypeScript#50540

Let's wait a couple of days to see what happens with that PR. In the meantime, we can recommend using skipLibCheck: true as a workaround.

@changeset-bot
Copy link

changeset-bot bot commented Aug 30, 2022

🦋 Changeset detected

Latest commit: 78a84bf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
xstate Patch

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

@ghost
Copy link

ghost commented Aug 30, 2022

👇 Click on the image for a new way to code review
  • Make big changes easier — review code in small groups of related files

  • Know where to start — see the whole change at a glance

  • Take a code tour — explore the change with an interactive tour

  • Make comments and review — all fully sync’ed with github

    Try it now!

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 30, 2022

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 78a84bf:

Sandbox Source
XState Example Template Configuration
XState React Template Configuration

@@ -440,7 +440,7 @@ describe('context', () => {
});

it('should work with generic context', () => {
function createMachineWithExtras<TContext>(
function createMachineWithExtras<TContext extends {}>(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably was a slight bug in the past and it got uncovered by the new, more conservative, rules around unconstrained generics. To fix some inference problems we have introduced LowInfer here:

context?: LowInfer<TContext | (() => TContext)>;

We didn't really want to constrain the TContext to be a subtype of {} but that's the effect with the current version of TS. In practice, this shouldn't be a big problem because we only accept object contexts at runtime. Some people might be forced to add extends {} in their generic declarations, just like I've done here, but that's just about it.

@Andarist Andarist marked this pull request as ready for review August 31, 2022 13:50
@Andarist
Copy link
Member Author

@davidkpiano I think this is ready to be reviewed and that we can roll with this

Copy link
Member

@davidkpiano davidkpiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@Andarist Andarist merged commit ddbc9bc into main Aug 31, 2022
@Andarist Andarist deleted the upgrade-ts branch August 31, 2022 14:52
@github-actions github-actions bot mentioned this pull request Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Compilation fails on TypeScript 4.8.2
2 participants