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
functionfoo<TextendsRecord<string,unknown>>(param: T){}typetype1={a: string};interfaceinterface1{a: string;};functiontWrapper(value: type1){foo(value);}functioniWrapper(value: interface1){foo(value);//error /* Argument of type 'interface1' is not assignable to parameter of type 'Record<string, unknown> Index signature for type 'string' is missing in type 'interface1'.(2345) */}consti: interface1={a: 'interface'};constt: type1={a: 'type'};tWrapper(t);tWrapper(i);iWrapper(t);iWrapper(i);
π Actual behavior
Even though type1 and interface1 have the same shape and variables of their types can be used interchangeably as see that there are no errors in
tWrapper(t);tWrapper(i);iWrapper(t);iWrapper(i);
π Expected behavior
interface and type with same shape works the same
The text was updated successfully, but these errors were encountered:
Bug Report
π Search Terms
interface, type, Record<string, unknown>
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
Even though type1 and interface1 have the same shape and variables of their types can be used interchangeably as see that there are no errors in
π Expected behavior
interface and type with same shape works the same
The text was updated successfully, but these errors were encountered: