Skip to content

Commit

Permalink
Update custom-scalars.mdx (#7880)
Browse files Browse the repository at this point in the history
`value` should be of type `unknown` instead of `number` with
[email protected]:

```log
Type '(value: number) => number' is not assignable to type 'GraphQLScalarValueParser<number>'.
  Types of parameters 'value' and 'inputValue' are incompatible.
    Type 'unknown' is not assignable to type 'number'.ts(2322)
definition.d.ts(365, 3): The expected type comes from property 'parseValue' which is declared here on type 'Readonly<GraphQLScalarTypeConfig<number, number>>'
```
  • Loading branch information
mx-bernhard authored Jul 22, 2024
1 parent b2e15e7 commit 47d72d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/source/schema/custom-scalars.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const typeDefs = `#graphql
`;

// Validation function for checking "oddness"
function oddValue(value: number) {
function oddValue(value: unknown) {
if (typeof value === 'number' && Number.isInteger(value) && value % 2 !== 0) {
return value;
}
Expand Down

0 comments on commit 47d72d7

Please sign in to comment.