[react] Add module augmentation target to restore implicit children#59751
Closed
eps1lon wants to merge 2 commits intoDefinitelyTyped:masterfrom
Closed
[react] Add module augmentation target to restore implicit children#59751eps1lon wants to merge 2 commits intoDefinitelyTyped:masterfrom
eps1lon wants to merge 2 commits intoDefinitelyTyped:masterfrom
Conversation
This was referenced Apr 7, 2022
eps1lon
commented
Apr 8, 2022
| * To restore that behavior you can augment `ComponentTypeBaseProps` with `children`: | ||
| * @link https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAKjgQwM5wEoFNkGN4BmUEIcA5FDvmQFA0AmWuANspXCBPQK7NbmU8MMnADeNOJLhYAHpFhxgAOxhYoBPPwDCJSEqwqAKgE8wWAEJosABWJh04qU7i4AFsGb1KSgPwAuTCoYADpsIQA5LiwAbgkpAF8aRJpcCCVUeB1wNIMYALD8YIAxLTgAXjgAClE3Dy8DeIBKcoA+MTjJShhuKCU4AB56YAA3FoBJcGZgXGB4Ws9vAEIxefqleP6AeiHRpKA | ||
| */ | ||
| interface ComponentTypeBaseProps {} |
Collaborator
Author
There was a problem hiding this comment.
Suggested change
| interface ComponentTypeBaseProps {} | |
| interface ComponentTypeCommonProps {} |
9363284 to
31771ff
Compare
31771ff to
d3875bd
Compare
htbkoo
added a commit
to htbkoo/personal-portfolio
that referenced
this pull request
Apr 13, 2022
…owngrade `@types/react` and `@types/react-dom` back to `v17.x.x` because of the breaking changes in version 18 that could not be fixed until either material-ui is upgraded to v5 or this PR (DefinitelyTyped/DefinitelyTyped#59751) is merged Note this codemod (https://github.com/eps1lon/types-react-codemod) would not help because the errors are caused by library (see this facebook/react#24304 (comment) for the details) References: 1. https://stackoverflow.com/questions/71810438/compilation-issue-with-react-typescript-and-material-ui-4 2. DefinitelyTyped/DefinitelyTyped#56210 (comment) 3. facebook/react#24304 (comment) 4. https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/ 5. facebook/react#24304 (comment)
Collaborator
Author
|
This won't work since it disables excess prop checking. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows restoring implicit children like we had with React 17. This should ease migration pain.
Playground Link
This also allows implicit children for
React.forwardRefwhich was frequently requested ( #32785, #48420, #52604, #50436, #33602).Need to test locally first. I don't think we can add automated tests since module augmentation is permanent.