News for hackers. Stuff that matters.
Re:TypeScript please give us types by MrResearcher on Friday July 07, 2023 @03:56PM (#36637477)
Typescript already kind of has it, it's just they got it backwards.

One needs to define their types as a const, like this one:

``` [{ type: Number, name: "field1" }, { type: String, name: "field2" }] as const ```

and then use Typescript magic to convert it into the fully fledged Typescript type.

Yes, it's annoying, but it's more flexible.

Re:TypeScript please give us types by epolanski on Friday July 07, 2023 @04:37PM (#36637982)
This is as useful as vue 2's prop types: very little.
Re:TypeScript please give us types by gloryjulio on Friday July 07, 2023 @04:01PM (#36637546)
U just need a library to enable this to reduce the boilerplate. I don't see how that's impossible
Re:TypeScript please give us types by asherah on Friday July 07, 2023 @04:03PM (#36637581)
this wouldn't work for interfaces, or more complicated types