# unreachable-types

Source: https://api-genie.dev/docs/linter/graphql/rules/unreachable-types

A rule of the GraphQL linter, which reads GraphQL schemas and operations. Since 0.9.0. In the rulesets: Strict at error, All at error.

This rule checks that every type is reachable from the root operation types.

## Rule details

A type that no field, argument or union reaches is dead code: clients cannot use it. Types are reached through the fields, arguments, input fields, union members and interfaces of reached types, the implementations of reached interfaces, and the arguments of directive definitions. Documents without root operation types are not checked.

Turn the rule off when the schema is split across files.

The rule applies to definitions. An `# apigenie-lint-disable unreachable-types` comment on a node
turns it off for the node and everything nested in it; at the top of the file, separated from the
first definition by a blank line, the comment turns it off for the whole file.

## Examples

**Good**.

```graphql
type Query { user: User }
type User { id: ID! }
```

**Bad**. The linter reports `Object type 'Orphan' is not reachable from the root operation types`.

```graphql
type Query { user: User }
type User { id: ID! }
type Orphan { id: ID! }
```
