Exporting types for functions with colon notation

SomeModule:DoSomething is a function in a module. However, when trying to write the function in another script, the option only shows when I type SomeModule. instead of SomeModule:. How would I make it so that DoSomething pops up as an option when typing SomeModule:?

export type SomeModule = {
	DoSomething: (Player) -> ()
}

In order to make DoSomething show up in autocomplete when using SomeModule:DoSomething(...), you need to define DoSomething as a method, meaning its first parameter should be self

By specifying self: SomeModule, the type system recognises DoSomething as a method, enabling proper colon (:) autocomplete in tools like VSCode with Luau LSP

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.