Skip to content

fix(styletron): correct StyletronComponent signature#5012

Closed
simPod wants to merge 1 commit intouber:masterfrom
simPod:fix-styletron-types
Closed

fix(styletron): correct StyletronComponent signature#5012
simPod wants to merge 1 commit intouber:masterfrom
simPod:fix-styletron-types

Conversation

@simPod
Copy link
Contributor

@simPod simPod commented Jul 3, 2022

Description

#5006 broke TS since type declaration has changed

TS2314: Generic type 'StyletronComponent' requires 1 type argument(s).

I hope this gets merged so such issues won't happen. Flow was great but it's TS era now (no offense)

Scope

Patch: Bug Fix

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 3, 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 945ed20:

Sandbox Source
Basic usage Configuration

@simPod simPod force-pushed the fix-styletron-types branch from 8db52fb to 945ed20 Compare July 3, 2022 16:58
@simPod simPod marked this pull request as ready for review July 3, 2022 16:59
@zxbodya
Copy link
Contributor

zxbodya commented Jul 3, 2022

that is intended change to have two type arguments in StyletroinComponent, it is coming with a new version of styletron(https://github.com/uber/baseweb/pull/5006/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L196-R195)

in @types/styletron-react there was only one type argument for component props, but in the new types now available as part of updated styletron-react package there is also element type - which allows to correctly check types when using $as property

@simPod
Copy link
Contributor Author

simPod commented Jul 3, 2022

@zxbodya upgrading from 11.1.2 to 11.2.0 fails for TS users, since StyletronComponent has one argument. what should TS user do in order to upgrade?

styled from import { styled } from 'baseui'; returns any because the generic signature is wrong now.

I'm using latest 5.0.3 v of @types/styletron-react.

How to upgrade to baseui 11.2 then? It's using wrong types it seems.

@zxbodya
Copy link
Contributor

zxbodya commented Jul 3, 2022

baseui 11.2.0, is relying on types published in:

  • styletron-react@6.1.0-beta.1
  • styletron-standard@3.1.0-beta.1

(@types/styletron-react should not be used, and can be removed after updating styletron)

@simPod
Copy link
Contributor Author

simPod commented Jul 3, 2022

Shouldn't have been the versions of styletron peer dependencies be raised to 6.1 and 3.1? Cuz it's effectively broken for TS users now.

Though I understand I should update those dependencies before upgrading to 11.2. Hope other users find this too.

@simPod simPod closed this Jul 3, 2022
@simPod simPod deleted the fix-styletron-types branch July 3, 2022 20:47
@simPod simPod restored the fix-styletron-types branch July 6, 2022 10:31
@simPod simPod reopened this Jul 6, 2022
@simPod simPod closed this Jul 25, 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.

2 participants