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

Mechanism to pass equivalent of no optional argument explicitly #1955

Open
nguerrera opened this issue May 19, 2023 · 0 comments
Open

Mechanism to pass equivalent of no optional argument explicitly #1955

nguerrera opened this issue May 19, 2023 · 0 comments
Labels
design:needed A design request has been raised that needs a proposal
Milestone

Comments

@nguerrera
Copy link
Contributor

Say you have a decorator with two optional string parameters:

extern dec test(target: unknown, arg1?: string, arg2?: string);

How do you pass arg2 without passing arg1? @test(null, "hello") doesn't compile and shouldn't compile and even if it did, it would be observably different to the JS implementation than the undefined value it gets when the optional args are not passed at all. Do we need undefined in TypeSpec? I have long hoped we didn't but this seems like a gap.

@nguerrera nguerrera added the design:needed A design request has been raised that needs a proposal label May 19, 2023
@markcowl markcowl added this to the Backlog milestone May 22, 2023
@bterlson bterlson removed the 📌 label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design:needed A design request has been raised that needs a proposal
Projects
None yet
Development

No branches or pull requests

3 participants