I'm not sure it's correct to expect from TS some βcustomβ primitives or anything in runtime π TS doesn't have a runtime, and cannot add anything to JS primitives. These are parts of the TS type system which, combined together, form the TS uniqueness: unions and intersections, ambient types, augmented types, mapped types, conditional types (T extends U ? X : Y), inference by request (T extends Array<infer E> ? E : never), types assertions, types widening and narrowing. Now they added yet more: template literal types.
"TypeScript way more powerful than Java or Scala." Citation Needed!.
TypeScript type system is π That's not a citation, that's my own impression
Types on TypeScript are kind of limited compared to other programming languages, to name a few things missing:
I'm not sure it's correct to expect from TS some βcustomβ primitives or anything in runtime π TS doesn't have a runtime, and cannot add anything to JS primitives. These are parts of the TS type system which, combined together, form the TS uniqueness: unions and intersections, ambient types, augmented types, mapped types, conditional types (
T extends U ? X : Y
), inference by request (T extends Array<infer E> ? E : never
), types assertions, types widening and narrowing. Now they added yet more: template literal types.Other languages just have it builtin since long time ago for frontend too.
I said run-time not runtime.