Minor Changes
-
#13421
d6197a4Thanks @jerelmiller! - The minimum supported TypeScript version is now 5.9.x. -
#13337
2df711fThanks @jcostello-atlassian! - Allow overriding thefrominput ofuseFragment,useSuspenseFragment,readFragment,writeFragmentand related fragment APIs via a newFromOptionValuekey on theTypeOverridesinterface.By default,
fromcontinues to acceptStoreObject | Reference | FragmentType<TData> | string. Apps can now supply a stricter policy (for example, requiring__typenameand disallowing nullish identifier values) without affectingStoreObject,cache.identify,cache.modifyor optimistic writes.// apollo.d.ts import "@apollo/client"; import type { HKT, StoreValue } from "@apollo/client/utilities"; type StrictFrom<TData extends { __typename: string }> = | { // the `__typename` has to match the one of the fragment type __typename: TData["__typename"]; // `& {}` forces values to be "defined" so an explicit `undefined` // (as well as `null`) is rejected. [key: string]: Exclude<StoreValue, null | undefined> & {}; } | { __ref: string } | string | null; interface StrictFromHKT extends HKT { arg1: { __typename: string }; // TData return: StrictFrom<this["arg1"]>; } declare module "@apollo/client" { export interface TypeOverrides { FromOptionValue: StrictFromHKT; } }