-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
π Search Terms
mapped type homomorphic instantiation array tuple constraint spread spreadable
π Version & Regression Information
- This is the behavior in every version I tried
β― Playground Link
π» Code
type HandleOptions<O> = {
[I in keyof O]: {
value: O[I];
};
};
declare function func1<
T extends Record<PropertyKey, readonly any[]>,
>(fields: {
[K in keyof T]: {
label: string;
options: [...HandleOptions<T[K]>];
};
}): T;
const result = func1({
prop: {
label: "first",
options: [
{
value: 123,
},
{
value: "foo",
},
],
},
other: {
label: "second",
options: [
{
value: "bar",
},
{
value: true,
},
],
},
});
π Actual behavior
Error at line 12:
A rest element type must be an array type.(2574)
π Expected behavior
The error should not be reported
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue