How to type annotate variable in a module?

Hello
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?

Thanks

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
2 Likes

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