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

Fixed an issue with wrapped class components not having a type for the ref prop #1996

Merged
merged 1 commit into from
Sep 8, 2020

Conversation

Andarist
Copy link
Member

@Andarist Andarist commented Sep 4, 2020

fixes #1987

@changeset-bot
Copy link

changeset-bot bot commented Sep 4, 2020

🦋 Changeset is good to go

Latest commit: 3430109

We got this.

This PR includes changesets to release 3 packages
Name Type
@emotion/styled Patch
@emotion/react Patch
@emotion/jest 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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 4, 2020

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

Sandbox Source
Emotion Configuration
Emotion 11 ref issue Issue #1987

@Andarist
Copy link
Member Author

Andarist commented Sep 8, 2020

Going to merge this, but feel free to review at any time. I've noticed that this still has an issue:

  class FixedSizeList extends React.Component {
    scrollTo = () => {}

    render() {
      return null
    }
  }

  const StyledFixedList = styled(FixedSizeList)`
    color: hotpink;
  `

  // this has wrong type of the `ref`
  const WrappedStyledFixedList = styled(StyledFixedList)``.withComponent('li')

but the issue is not really a regression from this PR because this doesn't work correctly for a very similar reason:

  const StyledLabel = styled('label')`
    color: hotpink;
  `

  // this has wrong type of the `ref`
  const WrappedStyledLabel = styled(StyledLabel)``.withComponent('span')

@Andarist Andarist merged commit 23faf9e into next Sep 8, 2020
@Andarist Andarist deleted the ts/wrapped-class-refs branch September 8, 2020 11:20
@github-actions github-actions bot mentioned this pull request Sep 8, 2020
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

1 participant