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

Support ["prop"] syntax on class definitions #704

Merged
merged 2 commits into from
Oct 18, 2022

Conversation

JohnnyMorganz
Copy link
Contributor

@JohnnyMorganz JohnnyMorganz commented Oct 13, 2022

Some classes have properties which are not valid identifiers (such as https://create.roblox.com/docs/reference/engine/classes/Studio)

This adds support for the following syntax in definition files:

declare class Foo
    ["a property"]: string
end

Closes #702

@ghost
Copy link

ghost commented Oct 17, 2022

Surely this could be expanded to work inside Luau as well? Having [x] support in type defs would be insanely useful for non-string types

type ATypeWithSpaces = {
  ["member with spaces"]: string
}

@JohnnyMorganz
Copy link
Contributor Author

Surely this could be expanded to work inside Luau as well? Having [x] support in type defs would be insanely useful for non-string types

type ATypeWithSpaces = {

  ["member with spaces"]: string

}

I'm pretty sure this already exists (it's what I based this PR off)

@ghost
Copy link

ghost commented Oct 17, 2022

Surely this could be expanded to work inside Luau as well? Having [x] support in type defs would be insanely useful for non-string types

type ATypeWithSpaces = {

  ["member with spaces"]: string

}

I'm pretty sure this already exists (it's what I based this PR off)

Must have missed it because yea thats valid lol 👍

@AmaranthineCodices AmaranthineCodices merged commit edb4453 into luau-lang:master Oct 18, 2022
andyfriesen added a commit that referenced this pull request Oct 21, 2022
* Support `["prop"]` syntax on class definitions in definition files.
(#704)
* Improve type checking performance for complex overloaded functions
* Fix rare cases of incorrect stack traces for out of memory errors at
runtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Support ["prop"] syntax on class declarations
2 participants