TypeScript Splits the Atom!
TypeScript Splits the Atom!
https://effectivetypescript.com/2020/11/05/template-literal-types/
Comment by Bob on 2020-11-22 12:53:
Where does Capitalize come from?
Comment by danvdk on 2020-11-22 01:50:
It's one of four new built-in generics in TS 4.1: Uppercase, Lowercase, Capitalize and Uncapitalize. Take a look at the TypeScript 4.1 release post.
Comment by Pomar81 (pomar81) on 2020-11-22 06:51:
Unfortunately type OnString = `on${string}` gives an error in playgroud
Comment by danvdk on 2020-11-22 07:17:
You're on the 4.1 beta for the playground. Try it on the 4.1 release (4.1.2) or a nightly, it'll work: https://www.typescriptlang....
Comment by Pomar81 (pomar81) on 2020-11-23 05:13:
it will be great if we can type something like type WithData = {[key: `data-${string}`]: string}
Comment by Tomás Fox (tom_s_fox) on 2021-09-02 01:51:
This is now possible in 4.4: https://devblogs.microsoft....