apollographql / apollographql/federation
loadSupergraphSdlFromStorage throws TS2869
- Dominant language
- TypeScript
- Stars
- 725
- Forks
- 276
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 1
Description
### Issue Description
**Node version:** v22.14.0 (lts/jod)
**pnpm version**: 10.6.4
While building the application, I encounter the following error:
> TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
The error is throw in the following file in gateway-js:
`supergraphManagers/UplinkSupergraphManager/loadSupergraphSdlFromStorage.ts`
At line 163:
```typescript
throw new UplinkFetcherError(fetchErrorMsg + result.status + ' ' + e.message ?? e);
```
## Possible solution
Change the line to as follows (notice the parenthesis):
```typescript
throw new UplinkFetcherError(fetchErrorMsg + result.status + ' ' + (e.message ?? e));
```
or as follows:
```typescript
throw new UplinkFetcherError(`${fetchErrorMsg} ${result.status} ${e.message ?? e}`);
```
### Link to Reproduction
https://github.com/qumberrizvi/escrow-backend
### Reproduction Steps
Install dependencies:
```bash
pnpm install
```
Start microservices:
```bash
pnpm start:dev:ms
Contributor guide
Research direction
Start in supergraphManagers/UplinkSupergraphManager/loadSupergraphSdlFromStorage.ts at line 163 and inspect the TS2869 diagnostic during the application build. Reproduce with the reported pnpm install and build or development startup steps; done means the unreachable-nullish-operand error is resolved while the resulting UplinkFetcherError still includes the relevant message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100