truthy checks shouldn't drop type info

This commit is contained in:
2021-04-02 18:56:13 -06:00
parent 4ce70d9d86
commit 84d1a6877e

View File

@@ -222,10 +222,10 @@ class Prelude {
};
}
public static dynamic function truthy(v:Any) {
public static dynamic function truthy<T>(v:T) {
return switch (Type.typeof(v)) {
case TNull: false;
case TBool: (v : Bool);
case TBool: cast(v, Bool);
default:
// Empty strings are falsy
if (v.isOfType(String)) {