TGViewer
Channel Public Channel
Why Typescript is bad

Why Typescript is bad

@why_typescript_is_bad

All topics related to TS

chat: @why_typescript_is_bad_chat
contact: @stuneak
Subscribers
1.71K
Photos
72
Videos
0
Links
70

Showing posts older than #129 · Back to latest

Older Posts 18 shown
Post #128 4.79K
Variance annotations are unsound. Contravariant type variable can be pronounced to be covariant, and TS couldn't care less.

Code. Issue.

Also here is an example that actually crashes in runtime.
  • 🤔 7
  • 👍 1
  • 👎 1
Post #121 6.03K
Global declarations aren’t saved, but there is no other way to infer it. TS doesn’t respect JS standards.

Edit. TS claims to have a design goal of typing common JS patterns. The pattern in question is typeof of undeclared variable. Probably every reader used to do typeof window !== 'undefined' at least once.

It's currently possible to declare the variable globally by extending Window interface, but those declarations will be available — well — everywhere, including the modules that have nothing to do with them. Global variables, global declarations, all the globals are widely considered an antipattern for this reason.

Narrowing already makes it so that single variable can have several types in different parts of the code, but correctly typed typeof would also require dynamically changing a set of variables that are available in current scope.

It weren't us who made a decision about design goals, so the discussion on unintended consequences is under the feature request.
  • 💩 29
  • 🤨 4
  • 👍 1
  • 👎 1
  • 🤓 1
Post #118 4.91K
Strict option does not override underlying options like noImplicitAny in extended configs
  • 👎 13
  • 💩 8
  • 👍 4
  • 🤯 4
Post #116 5.47K
Post #115 5.86K
TypeScript - there is always a way to find a hack ©
  • 🤡 23
  • 🌚 13
  • 👍 3
  • 👎 2
Post #112 4.34K

Forwarded from artalog (artalar)

Как же у меня бомбит с тайпскриптовых енумов.
Мало того что они используют зарезервированное в ЖС слово (что обязательно в какой-то момент сломается), так и реализованы криво и имеют плохой интероп с остальными типами / значениями и в общем ощущаются как очень странный костыль вместо юнионов.

Главная практическая проблема в них, для меня, в том что их нельзя мапить на уровне типов, те дженерик операции над енумами практически невозможны. Какие-то гиперболизированные, но бесполезные unique type, но иногда не unique 🤪
  • 👍 16
  • 👎 8
Post #111 3.82K
Если вам кажется, что сообщения об ошибках в TS могли бы быть более понятными, вы не одни. Одного из соавторов xstate это утомило, и он сделал расширение для vscode, декодирующее ошибки с майкрософтового на английский. Штука, конечно, маргинально полезная, но кому-то, может, и поможет. Потестить без установки можно тут.
  • 👍 15
  • 🔥 3
Post #110 4.03K
Не все знают, что среди тысяч багов TS в Issues проекта на Github есть и другие тикеты, которые полезно иногда найти и почитать.

С недавнего времени Google начал писать формальные отчёты о том, как прошло обновление до свежей версии TS, в которых указаны breaking changes, забытые в официальном changelog в блоге. Обновление на новую версию — три дня потерянного времени. Смотреть, как инженеры Google наступают на грабли за вас — бесценно.

Иногда могут закрадываться подозрения, что команда TS не делает вообще ничего полезного. В таком случае полезно посмотреть лог дизайн-митингов. Там обсуждаются самые важные изменения, которые, несомненно, затронут все аспекты вашей разработки: как правильно показывать подсказки с помощью JSDoc, и должны ли *.cts файлы считаться модулями.

Stay typesafe, stay informed!
GitHub Google feedback on TS 4.7-beta · Issue #48848 · microsoft/TypeScript This GitHub issue contains feedback on the TS 4.7-beta release from the team that is responsible for keeping Google's internal software working with the latest version of TypeScript. Execut...
  • 👍 20
  • 🔥 2
  • 👏 1
  • 🎉 1
Post #109 3.28K
Post #108 3.56K
Older posts →
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →