-
Notifications
You must be signed in to change notification settings - Fork 111
Open
Labels
Description
Describe the bug
In some cases, using the readonly modifier on an array causes type inference to break when using updateGroup in a nested fashion.
To Reproduce
Steps to reproduce the behavior:
Consider the following piece of code:
interface Item {
readonly x: number;
readonly y: number;
}
interface T1 {
readonly whatever: {
readonly keys: Item[];
};
}
const v1 = updateGroup<T1>({
whatever: updateGroup({
keys: updateArray(
updateGroup<Item>({
x: validate(required)
})
)
})
});
interface T2 {
readonly whatever: {
readonly keys: readonly Item[];
};
}
const v2 = updateGroup<T2>({
whatever: updateGroup({
keys: updateArray(
updateGroup<Item>({
x: validate(required)
})
)
})
});Expected behavior
Both v1 and v2 should be able to resolve their types.
Screenshots
N/A
Library version:
7.0.0
Additional context
It seems like there's a problem with the type inference somewhere down the line. I had a look through the core to see where it's inferring the type but I wasn't able to find the particular spot. If I could be pointed in the right direction I'd be happy to look into it.
Reactions are currently unavailable