How to type annotate variable in a module?

I have a module, which exports some variable to be used by other modules.
How can I type annotate these variables?

It seems I cannot do

module.Var:number = 10

I need to do something like

local Var:number = 10
module.Var = Var

is this the only way?


1 Like

Haven’t tested this, but something like this may work:

module.Var = (10 :: number)
1 Like

You need to annotate module itself.

local module = {} :: {
    Var: number

module.Var = 20

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