Skip to content

Typescript, Primer Components, Styled-Components don't play nice #782

@xtellurian

Description

@xtellurian

tl;dr the dependency on styled components is bad for typescript users.

Hey primer components team,

I know this isn't an issue directly with this repository or with Primer Components, but it greatly affects the experience of getting started with Primer Components, and I wanted to share it with you.

I'm using react + typescript in a brand new project. I wanted to use primer components because they look cool and fit a style I'm looking for. OK, should be easy, just yarn add @primer/components...

That worked OK, but now when I try to use the components, I get a error:

Module not found: Can't resolve 'styled-components'

bit odd, but OK, I'll install styled-components yarn add styled-components

and now a typescript compilation error:

Duplicate identifier 'FormData'. TS2300

Looking into it, I found these issues:

  1. The maintainers at styled-components don't seem to care
    Duplicate identifier 'FormData'. TS2300 styled-components/styled-components#2842

  2. The maintainers at definitely types haven't been able to resolve the issue.
    node_modules/@types/react-native/globals.d.ts (36,15): Duplicate identifier 'FormData'. DefinitelyTyped/DefinitelyTyped#33311

For me it was easier to just remove Primer Components and I'll use something else, but I assume that's not the experience you're looking for. I hope this was helpful :)

Metadata

Metadata

Assignees

Labels

fr-skipRemove this from the Design Systems first responder list

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions