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

feat!: better type parsing #47

Merged
merged 18 commits into from
Oct 12, 2022
Merged

feat!: better type parsing #47

merged 18 commits into from
Oct 12, 2022

Conversation

numToStr
Copy link
Owner

@numToStr numToStr commented Oct 5, 2022

Supported Types and other cases

  • Primitive Types: nil, any, unknown, boolean, string, number, integer, function, thread, userdata and lightuserdata
  • Array: TYPE[]
  • Union Type: TYPE | TYPE | TYPE
  • Union of literals: '"g@"'|'"g@$"', '1'|'2'|'3' etc. Variants should be wrapped inside '
  • Table: table<KEY_TYPE, VALUE_TYPE>
  • Table Literal: { key1: VALUE_TYPE, key2: VALUE_TYPE }
  • Reference Type i.e., alias, class etc.
  • Function: fun(PARAM: TYPE): RETURN_TYPE
    • Optional param: fun(PARAM?: TYPE): RETURN_TYPE
    • Missing Type: fun(a) (will fallback to any type)
    • Multiple returns fun(): string, number
  • Grouping: (string|number)[]
  • Optional ---@param a? string

Not Supported

  • Dict { [string]: VALUE_TYPE } instead use table or table literal.
  • Function w/ multiple returns as VALUE_TYPE in table literal i.e. { key1: func(): string, string, key2: string }

Resolves #27
Resolves #46
Resolves #48

@numToStr numToStr changed the title chore: better type parsing feat!: better type parsing Oct 8, 2022
@numToStr numToStr marked this pull request as ready for review October 10, 2022 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

whitespace handling in function type signature Better support for nested types Better type parsing
1 participant