Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#65973 [@types/react] Add suppressHydration…
Browse files Browse the repository at this point in the history
…Warning type to SVGAttributes by @O4epegb

* Add suppressHydrationWarning type to SVGAttributes

* Fix linting error

* Revert autoformat changes
  • Loading branch information
O4epegb authored Jul 13, 2023
1 parent ed82e56 commit 3c9701a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions types/react/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2591,6 +2591,9 @@ declare namespace React {
// - "string"
// - union of string literals
interface SVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
// React-specific Attributes
suppressHydrationWarning?: boolean | undefined;

// Attributes which also defined in HTMLAttributes
// See comment in SVGDOMPropertyConfig.js
className?: string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion types/react/test/tsx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const ComponentWithChildren3: React.FunctionComponent<React.PropsWithChildren<Co
<ComponentWithChildren3 bar="42"></ComponentWithChildren3>;

// svg sanity check
<svg viewBox="0 0 1000 1000">
<svg suppressHydrationWarning viewBox="0 0 1000 1000">
<g>
<text x="200" y="300" strokeWidth="5" stroke="black" alignmentBaseline="middle">
Hello, world!
Expand Down
3 changes: 3 additions & 0 deletions types/react/ts5.0/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2560,6 +2560,9 @@ declare namespace React {
// - "string"
// - union of string literals
interface SVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
// React-specific Attributes
suppressHydrationWarning?: boolean | undefined;

// Attributes which also defined in HTMLAttributes
// See comment in SVGDOMPropertyConfig.js
className?: string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion types/react/ts5.0/test/tsx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const ComponentWithChildren3: React.FunctionComponent<React.PropsWithChildren<Co
<ComponentWithChildren3 bar="42"></ComponentWithChildren3>;

// svg sanity check
<svg viewBox="0 0 1000 1000">
<svg suppressHydrationWarning viewBox="0 0 1000 1000">
<g>
<text x="200" y="300" strokeWidth="5" stroke="black" alignmentBaseline="middle">
Hello, world!
Expand Down

0 comments on commit 3c9701a

Please sign in to comment.