Hacker News new | past | comments | ask | show | jobs | submit login

I tried to find an example to see what you mean, take this file - https://github.com/microsoft/vscode/blob/main/src/vs/editor/...

The typings on the class variables are useful to have. There are also typings on the function signatures, not a huge deal.

In the method bodies there are almost no typings as all of it is already inferred. Seems pretty readable to me.




How about this one: https://github.com/microsoft/vscode/blob/427530e884b33be2451...

  export interface IDomEvent {
   <K extends keyof HTMLElementEventMap>(element: EventHandler, type: K, useCapture?: boolean): BaseEvent<HTMLElementEventMap[K]>;
   (element: EventHandler, type: string, useCapture?: boolean): BaseEvent<unknown>;
  }


I agree that in your example it is not bad. Throughout that codebase it is clear though that they don't have a formatter that enforces a char-limit per line. It is when you combine those things it gets messy. Prettier uses a default of 80.

Looking at the code there is an awful lot of 'null's returned which I find hard to work with but that is a different topic.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: