You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
For code sample like
the first
check
invocation will produce error as expectedbut the second - will not.
The text was updated successfully, but these errors were encountered: