-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix: SVGPresentationAttributes types #2363
Conversation
🦋 Changeset detectedLatest commit: 3bb0cc0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
@@ -236,7 +236,7 @@ declare namespace ReactPDF { | |||
|
|||
class Canvas extends React.Component<CanvasProps> {} | |||
|
|||
interface SVGProps extends NodeProps { | |||
interface SVGProps extends NodeProps, SVGPresentationAttributes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure SVG supports all the props in SVGPresentationAttributes
. All other fixes look correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct me if I'm wrong, but I just checked the w3 spec, and it seems like SVG supports all Presentation Attributes, except some Geometry Properties like cx
, cy
, r
, rx
, and d
. Also, if you try using the native <svg>
element, the TS will autocomplete all the props in SVGPresentationAttributes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure our <Svg />
component supports passing all of these, but I'll include it. I don't actively maintain types tbh, so I'll let base it on what the community finds :)
* fix SVGPresentationAttributes typing * chore: add changeset --------- Co-authored-by: Diego Muracciole <[email protected]>
So I was playing around with
<Svg>
component in@react-pdf/renderer
, and I got some ts errors:<Svg stroke="#00000">
will throw an error.strokeLinejoin
prop which I think it should be supported based on this?strokeLinecap
.The value options of
strokeLinejoin
was provided by looking at the options from pdf-lib.Fixes #1873