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
The type Record<PropertyKey, unknown> used in assertObjectEquals() does not accept interface types as an argument. This is due to an intentional quirk in how TypeScript operates with interfaces. With that said, I do not believe this assertion function should disallow inputs that uses types declared with the interface keyword.
I'm not completely sure what to suggest changing this to, but the most minimal change is to use Record<PropertyKey, any> instead, which seems to work for this case and confirmed to not be a bug from the TypeScript team.
Here are some test inputs for the Record<PropertyKey, any> signature:
// Continued from previous blockfunctionfoo(input: Record<PropertyKey,any>){}foo(token);// passfoo(typeToken);// passfoo(foo);// passfoo("");// failfoo(15);// fail
I'm facing this issue too. May I make the p-r to change the props type Record<PropertyKey, unknown> to Record<PropertyKey, any>? I think this change is trivial and there don't seem to be any unexpected problems.
The type
Record<PropertyKey, unknown>
used inassertObjectEquals()
does not accept interface types as an argument. This is due to an intentional quirk in how TypeScript operates with interfaces. With that said, I do not believe this assertion function should disallow inputs that uses types declared with theinterface
keyword.I'm not completely sure what to suggest changing this to, but the most minimal change is to use
Record<PropertyKey, any>
instead, which seems to work for this case and confirmed to not be a bug from the TypeScript team.Here are some test inputs for the
Record<PropertyKey, any>
signature:Relevant issues:
The text was updated successfully, but these errors were encountered: