Luau is gradually typed, so as long as you type it strictly (which is a little bit more than just defining the method with colon-notation, but there has been interest in making it simpler), it will catch this.
Unless you're using metatables, this would just be manually defining `self` with a type containing the fields you want it to represent.
For example:
```luau
local Module = {}
export type Module = {
field: string
}
function Module.Something(self: Module)
print(self.field)
end
return Module
```
EDIT: oops, new to this site; expected codeblocks to be a thing :p
Comments
Luau is gradually typed, so as long as you type it strictly (which is a little bit more than just defining the method with colon-notation, but there has been interest in making it simpler), it will catch this.
Unless you're using metatables, this would just be manually defining `self` with a type containing the fields you want it to represent.
For example:
```luau local Module = {} export type Module = { field: string }
function Module.Something(self: Module) print(self.field) end
return Module ```
EDIT: oops, new to this site; expected codeblocks to be a thing :p