🎯 System typów

Type guards (is)

if (value is string) { ... } if (value is number) { ... } if (value is bool) { ... } if (value is list) { ... } if (value is map) { ... } if (value is function) { ... } if (value is null) { ... }

Type cast (as! / as?)

// Force cast - błąd przy niepowodzeniu let num = "42" as! number; // 42 // Safe cast - null przy niepowodzeniu let maybe = "abc" as? number; // null

Type alias

type UserId = number; type Email = string; type UserList = list;

ensure (runtime check)

ensure age is number; ensure name is string, "name must be string";