React - Should TData of useMutation optimisticResponse be Partial<TData>?

I might be missunderstanding the correct usage here, so please correct me if so. To my understanding, the optimisticResponse option of useMutation will merge whatever you return from there with the CacheObject associated with the mutation.

When using typescript, the interface of the object is just TData (The generic argument passed to useMutation), however in my case, and even in cases in the documentation, not all fields that the mutation returns will have changed, and as such not all are accessible when defining the optimistic response.


interface Post {
  id: string;
  comments: Comment[];
  title: string;
  body: string;

function Posts() {
  const [updatePost] = useMutation<Post>(UPDATE_POST);

  function updateTitle(title: string) {
      variables: {
        id: "1",
        input: {
      optimisticResponse: (variables) => { 
        // Typescript complains here because return type is missing properties comments, body from Post
        return {
          posts: {
            title: variables.input.title,
  // ...

My current solution to this is to do a type assertion as Post in the optimisticResponse function. I also thought about reading from the cache, and merging manually, but it seems convoluted. Shouldnt the return type really be a Partial?