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

Make styled-components types an optional peer peer dependency #3399

Merged
merged 7 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lovely-windows-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Makes @types/styled-components an optional peer dependency, not a dependency
21 changes: 14 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
"@styled-system/css": "^5.1.5",
"@styled-system/props": "^5.1.5",
"@styled-system/theme-get": "^5.1.2",
"@types/styled-components": "^5.1.11",
"@types/styled-system": "^5.1.12",
"@types/styled-system__css": "^5.0.16",
"@types/styled-system__theme-get": "^5.0.1",
Expand Down Expand Up @@ -171,6 +170,7 @@
"@types/node": "16.11.11",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.9",
"@types/styled-components": "^5.1.11",
"@typescript-eslint/eslint-plugin": "5.59.6",
"@typescript-eslint/parser": "5.59.6",
"ajv": "8.12.0",
Expand Down Expand Up @@ -262,6 +262,9 @@
"react-dom": "^17.0.0 || ^18.0.0",
"styled-components": "4.x || 5.x"
},
"optionalPeerDependencies": {
"@types/styled-components": "^5.1.11"
},
"prettier": "@github/prettier-config",
"size-limit": [
{
Expand Down
1 change: 0 additions & 1 deletion src/CounterLabel/CounterLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const CounterLabel = forwardRef<HTMLSpanElement, CounterLabelProps>(
)}
{...props}
as="span"
// @ts-expect-error Box is expecting a divelement, but this component forces a span element
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This started giving me a type error and I'm not sure why

ref={forwardedRef}
>
{children}
Expand Down
1 change: 1 addition & 0 deletions src/Token/TokenBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const StyledTokenBase = styled.span<

const TokenBase = React.forwardRef(({onRemove, onKeyDown, id, size = defaultTokenSize, ...rest}, forwardedRef) => {
return (
// @ts-expect-error the possible props in `...rest` would be different depending on the `as` prop
<StyledTokenBase
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This started giving me a type error and I'm not sure why

onKeyDown={(event: KeyboardEvent<HTMLSpanElement & HTMLAnchorElement & HTMLButtonElement>) => {
onKeyDown && onKeyDown(event)
Expand Down
Loading