Skip to content

Comment on “The days of using untyped languages on non-trivial projects are over.”

Comments

Agree with the sentiment (statically-typed languages are cool), but TS is not ideal. Is the best we have if you want something JS-like, but try to explain the following monstrosity to a junior colleague who's starting with TS in the context of web applications (using one of the most popular frameworks out there, NestJS):

     // a DTO that handles the creation of some kind of resource
      ...
     @IsArray()
     @ArrayMinSize(1)
     @IsString({ each: true })
     @ApiProperty({
       example: ['software', 'maths'],
     })
     tags: string[]
That's real code. Since the TS types gets erased when the code is transpiled to JS, one has to annotate the whole thing just to be sure the clients are not sending us invalid data. And the validation via annotations couldn't be more cumbersome. 90% of the code in the DTO file is annotations. Reminds me Java from 10 years ago.

Is that typescript's fault though? Seems like a nestjs thing

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.