Error: ./node_modules/@apollo/client/cache/core/types/common.d.ts:52:110 Type error: '?' expected

I had tried building images of next, but I got an error in this process.

My packages:
“dependencies”: {
@apollo/client”: “^3.7.8”,
}
“devDependencies”: {

“eslint-config-next”: “^13.2.4”,
“typescript”: “5.2.2”
}
15 165.7 ./node_modules/@apollo/client/cache/core/types/common.d.ts:52:110
#15 165.7 Type error: ‘?’ expected.
#15 165.7
#15 165.7 50 | };
#15 165.7 51 | export type Modifier = (value: T, details: ModifierDetails) => T | DeleteModifier | InvalidateModifier;
#15 165.7 > 52 | type StoreObjectValueMaybeReference = StoreVal extends Array<infer Item extends Record<string, any>> ? ReadonlyArray<AsStoreObject | Reference> : StoreVal extends Record<string, any> ? AsStoreObject | Reference : StoreVal;
#15 165.7 | ^
#15 165.7 53 | export type AllFieldsModifier<Entity extends Record<string, any>> = Modifier<Entity[keyof Entity] extends infer Value ? StoreObjectValueMaybeReference<Exclude<Value, undefined>> : never>;
#15 165.7 54 | export type Modifiers<T extends Record<string, any> = Record<string, unknown>> = Partial<{
#15 165.7 55 | [FieldName in keyof T]: Modifier<StoreObjectValueMaybeReference<Exclude<T[FieldName], undefined>>>;
#15 179.9 error Command failed with exit code 1.

Please update TypeScript to at least version 4.8. TypeScript regularly adds new syntax (in this case the infer X extends Y syntax) in minor releases, so you need to stay up to date.

1 Like

Thank you so much, I fixed it with updated version