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 ambiguous syntax with function types and union types. #82

Open
sirisian opened this issue Dec 18, 2022 · 0 comments
Open

Handle ambiguous syntax with function types and union types. #82

sirisian opened this issue Dec 18, 2022 · 0 comments

Comments

@sirisian
Copy link
Owner

const a:(b):c|d;

Is d part of the return union type or is it (b):c or d. In this case it can be rewritten as: const a:d|(b):c; to remove the ambiguity, but the order of types shouldn't matter in a union.

Keep in mind the return type can also be a function.

const a:(b):c|(e):f|g;

(b):c|(e):f or g
(b):c or (e):f or g

Ideally one would define a type separately as this is complex to read, but when prototyping it might be useful to be able to type a one-liner type. These function or something else might be rare. Except for null which might be common.

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

1 participant