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

Handle Union types #19

Open
marklundin opened this issue Oct 9, 2024 · 0 comments
Open

Handle Union types #19

marklundin opened this issue Oct 9, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@marklundin
Copy link
Member

marklundin commented Oct 9, 2024

The parser currently throws an error when parsing attributes with union types.

See also this repro https://playcanvas.com/editor/scene/2086873. Parse the scripts and the editor will throw an error

/** @enum {number} */
const MyEnum = {
    A : 0,
    B : 1,
}

export class Test extends Script {

    /** 
     * @attribute
     * @type {MyEnum|string}
     */
    n = MyEnum.A;
}

What should happen

The parser should at least not throw an error. It could ignore the attribute and warn, or potentially take the first type as the attribute type

@marklundin marklundin added the bug Something isn't working label Oct 9, 2024
@marklundin marklundin self-assigned this Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant