Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of typed functions #55

Closed
Perryvw opened this issue Sep 24, 2017 · 1 comment
Closed

List of typed functions #55

Perryvw opened this issue Sep 24, 2017 · 1 comment

Comments

@Perryvw
Copy link
Contributor

Perryvw commented Sep 24, 2017

I would like to define a list of functions of a certain type. I would expect this to work as follows:

--- @type (fun(a: b): c)[]
local funcList = {}

This throws an error <type set> expected, got '('

Note that --- @type fun(a: b): c[] is allowed, but this defines a singular function that returns a list of c, instead of a list of functions that each return a singular c.

A slightly looser definition with a table does work:

--- @type table<number, fun(a: b): c>
local funcList = {}
@tangzx
Copy link
Member

tangzx commented Sep 25, 2017

OK, now spports wrap type with parentheses
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants