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

Make calling a method with an Union Type dispatch to the correct overload. #129

Open
Kuinox opened this issue Nov 6, 2023 · 0 comments
Open
Labels
Language idea One single idea which may be a start of a design document

Comments

@Kuinox
Copy link
Member

Kuinox commented Nov 6, 2023

This is basically a syntaxic sugar to dispatch an union type to the correct overload if the method overloads cover all the union types.
This would make the following possible:

public ToJSON(a: Foo): string {}
public ToJSON(a: Bar): string {}
public ToJSON(a: int): string {}

public string Process(arg: Foo|Bar|int)
{
  ToJson(arg);
}
@LPeter1997 LPeter1997 added the Language idea One single idea which may be a start of a design document label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language idea One single idea which may be a start of a design document
Projects
None yet
Development

No branches or pull requests

2 participants