Skip to content

Commit

Permalink
Merge pull request #935 from mittwald/explicit-typing-in-OptionalValu…
Browse files Browse the repository at this point in the history
…e-tsx

Stricter typing in optional value tsx
  • Loading branch information
martin-helmich authored Dec 5, 2024
2 parents 2e0064d + ecf3c39 commit d2260e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rendering/react/components/OptionalValue.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ReactNode } from "react";
import { Value } from "./Value.js";

interface OptionalValueProps<T> {
interface OptionalValueProps<T extends ReactNode> {
value: T | undefined | null;
render?: (value: T) => ReactNode;
}
Expand All @@ -12,7 +12,7 @@ interface OptionalValueProps<T> {
* @class
* @param props
*/
function OptionalValue<T>(props: OptionalValueProps<T>) {
function OptionalValue<T extends ReactNode>(props: OptionalValueProps<T>) {
const { render = (v) => <>{v}</> } = props;

if (props.value === undefined || props.value === null) {
Expand Down

0 comments on commit d2260e7

Please sign in to comment.