Closed
Description
For code sample like
declare type HasSameKeys<T> = { [TKeyes in keyof T]: any };
declare type SingleString = { a: string };
declare const x: {
a: string;
b: string;
c: string
};
declare function check(input: HasSameKeys<SingleString>): void;
check({
a: 'x',
b: 'x',
c: 'x',
});
check(x);
the first check
invocation will produce error as expected
[ts]
Argument of type '{ a: string; b: string; c: string; }' is not assignable to parameter of type 'HasSameKeys<SingleString>'.
Object literal may only specify known properties, and 'b' does not exist in type 'HasSameKeys<SingleString>'.
but the second - will not.