-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Needs InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.
Description
Bug Report
🔎 Search Terms
- required
- arrow
🕗 Version & Regression Information
In typecript generated type (d.ts) they is an error while using Required in [K in keyof Required<T>] in a arrow function definition
- This changed between versions 4.6.4 and newer version of typescript
⏯ Playground Link
💻 Code
export const test2 = <T = Record<string, never>>(schema: {
[K in keyof Required<T>]: T[K];
}) => {
console.log(schema);
}
export function test1<T = Record<string, never>>(schema: {
[K in keyof Required<T>]: T[K];
}) {
console.log(schema);
};🙁 Actual behavior
In typescript 4.6.4 the d.ts file look like this:
export declare const test2: <T = Record<string, never>>(schema: { [K in keyof Required<T>]: T[K]; }) => void;
export declare function test1<T = Record<string, never>>(schema: {
[K in keyof Required<T>]: T[K];
}): void;And starting from 4.7 the d.ts file look like this:
export declare const test2: <T = Record<string, never>>(schema: Required<T> extends infer T_1 ? { [K in keyof T_1]: T[K]; } : never) => void;
export declare function test1<T = Record<string, never>>(schema: {
[K in keyof Required<T>]: T[K];
}): void;🙂 Expected behavior
This should be compiled to the same output as the 4.6 version
Metadata
Metadata
Assignees
Labels
Needs InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.