I was studying better type predicates and how they actually narrow the type through pet is Fish, for example.
I've tried to create a simple Typescript playground
In doSomething I use isFish function.
isFish is represented to have a return type pet is Fish, but if I use it and assign the result to a variable, the result is kinda "casted" to a boolean. So I guess pet is Fish can be seen as a type itself.
So my question is: can pet is Fish (or whatever similar expression) be considered a subtype of boolean, just like "Hello world" is a subtype of string?
type X = "hello world" | string;
// ^? type X = string
type Y = "hello world" & string;
// ^? type Y = "hello world"
Thank you!