Type Functions
Type functions are functions that run during analysis time and operate on types, instead of runtime values. They can use the types library to transform existing types or create new ones.
Here’s a simplified implementation of the builtin type function keyof. It takes a table type and returns its property names as a union of singletons.
Type function environment
Section titled “Type function environment”In addition to the types library, type functions have access to:
assert,error,printnext,ipairs,pairsselect,unpackgetmetatable,setmetatablerawget,rawset,rawlen,raweqtonumber,tostringtype,typeofmathlibrarytablelibrarystringlibrarybit32libraryutf8librarybufferlibrary