I’ve been working with and using TypeScript for a couple of years now, but I am now just running into a type I just can’t understand and don’t know how to google…
The code snippet in question is a function that validates a password and looks like this:
export const validatePassword = (password?: string): password is string => {...}
What I don’t understand is the return type of this function password is string
, what is this?? I know by inspecting the function logic that it should return a booolean but the function is doing more than checking if the password is string.
Can anyone explain this signature or provide link to the related TS docs?