apollographql / apollographql/apollo-tooling
Argument.value should be strongly typed with TypeScript 3.7
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 460
- PR merge metrics
- No merged PRs in 30d
Description
With TypeScript 3.7 type aliases [can now be recursive](http://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#more-recursive-type-aliases) when the recursive use is inside another type. This should let us create a strong type for `Argument.value`. I think it would look something like
```typescript
type ArgumentValue =
| number
| null
| ArgumentValue[]
| { [key: string]: ArgumentValue }
| { kind: "Variable"; variableName: string }
| string
| boolean;
```
This type was written out based on the implementation of `valueFromValueNode()`, which would of course return this type as well.
Contributor guide
Research direction
Start by locating the definition of Argument.value and the valueFromValueNode() implementation mentioned in the issue. Review the surrounding TypeScript types and existing checks before introducing the recursive ArgumentValue type. Done means Argument.value and valueFromValueNode() are strongly typed without breaking the repository's existing type checks or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100