"t" - A Runtime Type Checker for Roblox

Small update:

Renamed t.instance to t.instanceOf
(less confusing, kept t.instance as an alias for backward compatibility)

Added t.children - allows you to describe an Instance with children
Added t.match - allows you to match a string against a pattern

Added a new optional parameter “childTable” to:

  • t.instanceOf(className, [childTable])
  • t.instanceIsA(className, [childTable])

If provided, it will be automatically passed into t.children

i.e.:

t.instanceOf("Frame", { Button = t.instanceOf("Button") })

is equivalent to:

t.intersection(t.instanceOf("Frame"), t.children({ Button = t.instanceOf("Button") }))

t.literal now takes multiple values and will union them together for you. So,

t.literal(1, 2, 3)

is equivalent to:

t.union(t.literal(1), t.literal(2), t.literal(3))

Check out the documentation for more info :smile:

8 Likes

gotta say this is probably one of my favourite libraries now. saves me so much time :heart:

3 Likes