apollographql / apollographql/apollo-tooling

Include "@deprecated" in generated TypeScript types

Open
#2,160 0 comments 13 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

**Problem**
Currently the generated TypeScript types omit all deprecation information for fields. This makes it less obvious that client source code is using a deprecated field that should be removed.

**Suggested Solution**
Include `@deprecated` in the documentation block for deprecated field. This can be utilized by IDEs (such as VSCode) to mark the field as deprecated in the editor.

**Example**
Generated code:
```
/**
* Example of a deprecated field
* @deprecated
*/
deprecatedField: string | null;
```

![image](https://user-images.githubusercontent.com/253245/98564086-8bfa0800-2271-11eb-819f-4563a33f8e88.png)

Contributor guide

Open the contributing guide

Research direction

No source file or test is named in the issue. Start by locating the TypeScript type-generation entry point and the handling of deprecated GraphQL fields; update the generated documentation block and verify that deprecated fields contain @deprecated in the output.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.