Closed
Description
TypeScript Version: 3.2.0-dev.20181107
Search Terms:
Pick Inconsistent readonly optional
Code
interface T {
a: string;
b?: string;
c: string;
readonly d: string;
readonly e?: string;
}
type Test = Pick<T, Exclude<keyof T, 'c'>>;
type Test1 = { [P in Exclude<keyof T, 'c'>]: T[P]; };
Expected behavior:
Test1
should be equal to Test
, as it is just an inline version of it
Actual behavior:
Test1
removed any optional or readonly on properties, while Test
doesn't.
Playground Link:
Playground
Related Issues:
#14295