NoExtraKeys type

Rejects mutation inputs with keys that TShape does not declare, or with relationship values that lack their key. Resolves to an empty tuple for a valid TInput; otherwise it adds a required never argument, so the call fails to compile.

type NoExtraKeys<TInput, TShape> = 0 extends 1 & TInput
  ? Object
  : () => (T extends TInput ? 1 : 2) extends () => T extends TShape ? 1 : 2
      ? Object
      :
          | Exclude<UnionKeys<TInput>, keyof TShape>
          | InvalidMutationRelationshipKeys<TInput> extends never
      ? Object
      : [invalidKeys]