export type DraftObject<T> = {-readonly [P in keyof T]: Draft<T[P]>}
export interface DraftArray<T> extends Array<Draft<T>> {}
export type Draft<T> = T extends any[]
? DraftArray<T[number]>
: T extends ReadonlyArray<any>
? DraftArray<T[number]>
: T extends object ? DraftObject<T> : T
type tup = [number, number, number, number]
const T: Draft<tup> = [1, 2, 3, 4]
const U: tup = [1, 2, 3, 4]
const TT: tup = T
const UU: Draft<tup> = U
The function of DraftObject is to return any type with all its properties marked as not readonly. It works as expected in most cases, however, it incorrectly converts tuple types into arrays. How can I handle tuple types as a special case, and instead of turning them into DraftArrays, mark them as Readonly<>?