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

Move Equals constraint into an intersection type. #2123

Merged
merged 1 commit into from Jan 25, 2024

Conversation

DanielRosenwasser
Copy link
Contributor

@DanielRosenwasser DanielRosenwasser commented Jan 24, 2024

In microsoft/TypeScript#57117, we noticed that react-redux's build is impacted by a change in in microsoft/TypeScript#56515. What this means is that TypeScript 5.4, you'll get an error in expectExactType.

export function expectExactType<T>(t: T) {
  return <U extends Equals<T, U>>(u: U) => {}
//        ~
// error TS2313: Type parameter 'U' has a circular constraint.
}

The solution I would suggest for now is to just make U extend T and move the constraint to an intersection wherever you use U.

-  return <U extends Equals<T, U>>(u: U) => {}
+  return <U extends T>(u: U & Equals<T, U>) => {}

Copy link

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 ca9aa48:

Sandbox Source
Vanilla Typescript Configuration

@timdorr
Copy link
Member

timdorr commented Jan 25, 2024

Thanks, Daniel! This is only in our test suite, so it shouldn't be a user-facing issue, but I very much appreciate the attention to detail on your end and the PR!

@EskiMojo14
Copy link
Collaborator

React Redux and Reselect don't use expectExactType properly, as noted in microsoft/TypeScript#57117 (comment). Their usage is equivalent to expectType (and should probably be changed to it).

RTK on the other hand does, and this suggestion seems to break the expected behaviour of the utility. As per reduxjs/redux-toolkit@1ae8a62 it appears some errors we want to be raised are no longer raised.

Here's a quick reproduction: https://tsplay.dev/NVePlw

@DanielRosenwasser DanielRosenwasser deleted the constraintToIntersection branch January 26, 2024 19:50
@DanielRosenwasser
Copy link
Contributor Author

@EskiMojo14 looks like this is from use of any in the conditional type. It seems like using unknown fixes the issue.

Playground link

Let me know if that works!

@EskiMojo14
Copy link
Collaborator

that seems to do the trick, thanks!

in the slightly more long term I think we'll switch to vitest's type test utilities, so hopefully those will continue to work :)

github-merge-queue bot pushed a commit to valora-inc/wallet that referenced this pull request Apr 18, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [react-redux](https://togithub.com/reduxjs/react-redux) | [`^9.1.0` ->
`^9.1.1`](https://renovatebot.com/diffs/npm/react-redux/9.1.0/9.1.1) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-redux/9.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-redux/9.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-redux/9.1.0/9.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-redux/9.1.0/9.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>reduxjs/react-redux (react-redux)</summary>

###
[`v9.1.1`](https://togithub.com/reduxjs/react-redux/releases/tag/v9.1.1)

[Compare
Source](https://togithub.com/reduxjs/react-redux/compare/v9.1.0...v9.1.1)

This bugfix release fixes an issue with `connect` and React Native
caused by changes to our bundling setup in v9. Nested `connect` calls
should work correctly now.

#### What's Changed

- Remove unused isProcessingDispatch by
[@&#8203;Connormiha](https://togithub.com/Connormiha) in
[reduxjs/react-redux#2122
- Move `Equals` constraint into an intersection type. by
[@&#8203;DanielRosenwasser](https://togithub.com/DanielRosenwasser) in
[reduxjs/react-redux#2123
- Fix `useIsomorphicLayoutEffect` usage in React Native environments by
[@&#8203;aryaemami59](https://togithub.com/aryaemami59) in
[reduxjs/react-redux#2156

**Full Changelog**:
reduxjs/react-redux@v9.1.0...v9.1.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone
America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone
America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/valora-inc/wallet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMDEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjMwMS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJucG0iLCJyZW5vdmF0ZSJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
github-merge-queue bot pushed a commit to valora-inc/wallet that referenced this pull request Apr 18, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [react-redux](https://togithub.com/reduxjs/react-redux) | [`^9.1.0` ->
`^9.1.1`](https://renovatebot.com/diffs/npm/react-redux/9.1.0/9.1.1) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-redux/9.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-redux/9.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-redux/9.1.0/9.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-redux/9.1.0/9.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>reduxjs/react-redux (react-redux)</summary>

###
[`v9.1.1`](https://togithub.com/reduxjs/react-redux/releases/tag/v9.1.1)

[Compare
Source](https://togithub.com/reduxjs/react-redux/compare/v9.1.0...v9.1.1)

This bugfix release fixes an issue with `connect` and React Native
caused by changes to our bundling setup in v9. Nested `connect` calls
should work correctly now.

#### What's Changed

- Remove unused isProcessingDispatch by
[@&#8203;Connormiha](https://togithub.com/Connormiha) in
[reduxjs/react-redux#2122
- Move `Equals` constraint into an intersection type. by
[@&#8203;DanielRosenwasser](https://togithub.com/DanielRosenwasser) in
[reduxjs/react-redux#2123
- Fix `useIsomorphicLayoutEffect` usage in React Native environments by
[@&#8203;aryaemami59](https://togithub.com/aryaemami59) in
[reduxjs/react-redux#2156

**Full Changelog**:
reduxjs/react-redux@v9.1.0...v9.1.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone
America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone
America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/valora-inc/wallet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMDEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjMwMS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJucG0iLCJyZW5vdmF0ZSJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
shottah pushed a commit to zed-io/kolektivo that referenced this pull request May 15, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [react-redux](https://togithub.com/reduxjs/react-redux) | [`^9.1.0` ->
`^9.1.1`](https://renovatebot.com/diffs/npm/react-redux/9.1.0/9.1.1) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-redux/9.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-redux/9.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-redux/9.1.0/9.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-redux/9.1.0/9.1.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>reduxjs/react-redux (react-redux)</summary>

###
[`v9.1.1`](https://togithub.com/reduxjs/react-redux/releases/tag/v9.1.1)

[Compare
Source](https://togithub.com/reduxjs/react-redux/compare/v9.1.0...v9.1.1)

This bugfix release fixes an issue with `connect` and React Native
caused by changes to our bundling setup in v9. Nested `connect` calls
should work correctly now.

#### What's Changed

- Remove unused isProcessingDispatch by
[@&#8203;Connormiha](https://togithub.com/Connormiha) in
[reduxjs/react-redux#2122
- Move `Equals` constraint into an intersection type. by
[@&#8203;DanielRosenwasser](https://togithub.com/DanielRosenwasser) in
[reduxjs/react-redux#2123
- Fix `useIsomorphicLayoutEffect` usage in React Native environments by
[@&#8203;aryaemami59](https://togithub.com/aryaemami59) in
[reduxjs/react-redux#2156

**Full Changelog**:
reduxjs/react-redux@v9.1.0...v9.1.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone
America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone
America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/valora-inc/wallet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMDEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjMwMS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJucG0iLCJyZW5vdmF0ZSJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

None yet

3 participants