Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.

Commit 0c16908

Browse files
committed
Resolve TS errors
1 parent 0925258 commit 0c16908

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

packages/graphql-playground-react/src/components/Playground/DocExplorer/Argument.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default function Argument({
1717
y,
1818
}: // sessionId,
1919
Props) {
20+
const ast = astFromValue(arg.defaultValue, arg.type)
2021
return (
2122
<span>
2223
<TypeLink
@@ -29,9 +30,7 @@ Props) {
2930
showDefaultValue !== false && (
3031
<span>
3132
{' = '}
32-
<span className="arg-default-value">
33-
{print(astFromValue(arg.defaultValue, arg.type))}
34-
</span>
33+
<span className="arg-default-value">{ast && print(ast)}</span>
3534
</span>
3635
)
3736
}

packages/graphql-playground-react/src/components/Playground/DocExplorer/ArgumentInline.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface Props {
88
}
99

1010
export default function Argument({ arg, showDefaultValue }: Props) {
11+
const ast = astFromValue(arg.defaultValue, arg.type)
1112
return (
1213
<ArgumentLine>
1314
<span className="arg-name">{arg.name}</span>
@@ -17,9 +18,7 @@ export default function Argument({ arg, showDefaultValue }: Props) {
1718
showDefaultValue !== false && (
1819
<span>
1920
{' = '}
20-
<span className="arg-default-value">
21-
{print(astFromValue(arg.defaultValue, arg.type))}
22-
</span>
21+
<span className="arg-default-value">{ast && print(ast)}</span>
2322
</span>
2423
)}
2524
</ArgumentLine>

0 commit comments

Comments
 (0)