truthy checks shouldn't drop type info

This commit is contained in:
2021-04-02 18:56:13 -06:00
parent 72887e7b34
commit a1c7082885

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)) { return switch (Type.typeof(v)) {
case TNull: false; case TNull: false;
case TBool: (v : Bool); case TBool: cast(v, Bool);
default: default:
// Empty strings are falsy // Empty strings are falsy
if (v.isOfType(String)) { if (v.isOfType(String)) {