-
-
Notifications
You must be signed in to change notification settings - Fork 797
Closed
Description
Hi, this PR actually break some of my stuff.. not sure if there's better way.. #2090
This is what I currently have in 4.5.9
interface User {
_id: string;
name: string;
email: string;
// and so on
}
const getUserId = (user: User) => user._id ?? 'default';
// in some of my hook, I will grab the user from the params or return the default name
const userId = getUserId(params.user);But with the upgrade, it now breaks in places where I pass in params.user
// because of the new addition
// it now complains..
// Argument of type '{ [key: string]: any; } | undefined' is not assignable to parameter of type 'User'.
// Type 'undefined' is not assignable to 'User'
I can do this but then I have to go all over to make the changes
const userId = getUserId(params.user as User);Is there a better way to do this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels