type Actual = {
a: () => 1;
x: string;
s: {
q: Nullable;
s: {
i: {
x: {
o: Maybe<Primitive>;
n: Falsy;
};
e: 'foo';
};
};
};
};
type Expected = {
readonly a: () => 1;
readonly x: string;
readonly s: {
readonly q: Nullable;
readonly s: {
readonly i: {
readonly x: {
readonly o: Maybe<Primitive>;
readonly n: Falsy;
};
readonly e: 'foo';
};
};
};
};
type T = DeepImmutable<Actual>; // T Results in: Expected
A type that recursively turns the proprties within a given object type
T
immutable.