apollographql / apollographql/federation

Typescript compile issues

Open
#2,104 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
725
Forks
276
Avg merge
1h 47m
Merged PRs (30d)
1

Description

### This bug report should include:

I'm trying to upgrade to Typescript 4.7.4 and I'm getting some compile errors in the @apollo/gateway library.

```

node_modules/@apollo/gateway/src/datasources/RemoteGraphQLDataSource.ts:122:7 - error TS2774: This condition will always return true since this function is always defined. Did you mean to call it instead?

122 options.incomingRequestContext.overallCachePolicy?.restrict
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@apollo/gateway/src/schema-helper/addExtensions.ts:8:7 - error TS2698: Spread types may only be created from object types.

8 ...schema.extensions.apollo,
~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@apollo/gateway/src/schema-helper/addExtensions.ts:10:12 - error TS2571: Object is of type 'unknown'.

10 ...schema.extensions.apollo?.gateway,
~~~~~~~~~~~~~~~~~~~~~~~~
```

I was originally using 0.51.0, but I'm seeing the same error in the `RemoteGraphQLDataSource` when upgrading to 2.0.5.

Is there a maximum version of Typescript that is supported by @apollo/federation?

Thanks!

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the TypeScript 4.7.4 compile errors in @apollo/gateway, focusing on src/datasources/RemoteGraphQLDataSource.ts and src/schema-helper/addExtensions.ts. Check the supported TypeScript range for the reported @apollo/federation versions and determine whether the errors can be resolved; done means the affected versions compile cleanly or their compatibility limits are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.