Typescript is implementing a using keyword

https://www.totaltypescript.com/typescript-5-2-new-keyword-using

20 points · 5 comments · view on lemmy.world

5 Comments

cwagner@lemmy.cwagner.me · 8 pts · 2y (2 replies)
[ removed ]
kogasa@programming.dev · 3 pts · 2y (1 reply)

Discriminated unions have been In The Works(tm) for quite a while. I believe they were cut from the C# 12 roadmap. But maybe C# 13?

I think a source-generation based approach similar to OneOf isn't unlikely.

Lmaydev@programming.dev · 1 pts · 2y

Yeah unfortunately tacking them onto a 20 year old language is not easy.

It's great to see it being worked on but there is a long way to go.

yads@lemmy.ca · 3 pts · 2y

That seems quite useful

nickel@programming.dev · 1 pts · 2y (1 reply)

Does using function as a const? Meaning: when a using variable is declared, is it immutable?

burkybang@programming.dev · 1 pts · 2y

This comment sounds like you’re having a stroke if we didn’t know the context.