roblox-luau-types
Luau Type System
When to Load
Annotations, inference, narrowing, strictness, exports, solver features. Syntax: roblox-luau-core; lifecycle: roblox-luau-patterns.
Quick Reference
Strictness: --!strict for maintained code, --!nonstrict while transitioning, --!nocheck only for legacy or generated code. Directives and project settings select it.
New solver gate: keyof, rawkeyof, setmetatable<T, M>, type functions, and read members need the new type solver. Strict projects opt in with Workspace.UseNewLuauTypeSolver = Enabled; Default follows the rollout, so a "sudden" error in unchanged code may be a solver switch.
Inference: annotate boundaries (params, returns, exports), not every local.
Sealed vs unsealed tables: An unannotated local table stays open until annotated, returned, or out of scope. Build it fully before annotating.
Unions: local id: string | number is a union; prefer tagged unions (type State<T> = {kind:"loading"} | {kind:"ready", value:T}) and discriminate on kind to narrow.
Narrowing: typeof, IsA, assertions, tagged discriminants.