Christopher Horobin's Avatar

Christopher Horobin

@chorobin.bsky.social

🌌 Type spacer

93 Followers  |  35 Following  |  100 Posts  |  Joined: 27.11.2024  |  2.0779

Latest posts by chorobin.bsky.social on Bluesky

Precompilation is not the same as generation.

12.06.2025 14:03 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Precompiled types require check time and emit which is slower than inference. You just live with stale types for longer

12.06.2025 14:02 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Honestly its likely not a very documented topic. Also I am pretty certain TS does an awful lot of caching regardless of if you are making and using loads of utility types. Best thing is letting instantiation and type counts plus tracing guide you

06.06.2025 18:24 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Its also worth checking both instatiations and type count. They are both useful, when both go down its a win-win. But if one goes up and the other goes down, it can probably vary which is faster

06.06.2025 17:16 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

But its not always the case though. Sometimes you want A and B to be instantiated lazily, when they are used. And you only want to do the work for A and not B only when A is used.

06.06.2025 17:07 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Its probably the caching. If you know both A and B are always used in the majority of cases then having a shared util type which does the work once can definitely help

06.06.2025 17:04 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Now is the time to design for typescript and write plenty of types

24.05.2025 13:28 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Just think how many more types we can write now

23.05.2025 20:50 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

tsgo is really incredible

23.05.2025 20:38 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Also feels less natural to me

21.05.2025 16:35 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Mapped types feel too verbose for this purpose

21.05.2025 16:34 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

`extends any` is my favourite use of `any` to trigger conditional type distribution.

21.05.2025 16:33 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

In the end. Its about 'rich types', adding precise types where it matters most

10.05.2025 21:56 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Or should it be the most suitable type? Or are we saying 'type-safe' stuff just cares about TypeScript. If so, that is sad.

10.05.2025 21:48 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

The term 'type-safe' is used rather a lot. Is `string` 'type-safe'? Depends. Maybe we should be referring to the most precise type for 'type-safety'? But do we?

10.05.2025 19:46 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0

I just see them as if expressions

20.04.2025 09:11 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Types are pure functions. There are no side effects possible, like ever. The language is also quite small. I personally find this combination makes it easy to reason

19.04.2025 18:38 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Maybe a unpopular opinion but type level code actually looks nice after you get used to it

19.04.2025 18:31 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0

I think the designer of those languages has a better understanding of what language to choose for a code base they know very well than maybe anybody on the outside

13.03.2025 10:43 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Realisation that my first language was delphi as a child because my father liked it. My first actual toy projects in college were in c#, spent years in that language. Now I have spent 9 years in typescript.

13.03.2025 09:35 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

There are some footguns which I have learnt to avoid regarding performance. If the compiler is 10 times faster then definitely some quirks become way less noticable. I wonder if things like conflicting properties with intersections might still be noticable.

12.03.2025 13:41 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I want to hope types will get more ambitious with a faster typescript. Not more sloppy. That would be sad

12.03.2025 08:56 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Completely gobsmacked. Never thought I would see the day this type checks in less than a second

11.03.2025 17:38 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I use mapped types when i want to transform an object or tuple

10.03.2025 19:21 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I prefer to use distributive conditionals to transform unions

10.03.2025 19:20 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I prefer to compose types bottom up with interfaces rather than top down with Omit or Pick

10.03.2025 19:20 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Mapped types are great. I just see them used in places where I would not all the time

10.03.2025 19:18 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 3    πŸ“Œ 0

Of course intuitions on this is good for library authors to build. Devs should just keep thinking in terms of structural typing imo

06.03.2025 19:28 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

And you can go even further by adding variance annotations

06.03.2025 19:26 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

So sometimes you can just replace an anonymous object literal type with a named type

06.03.2025 19:25 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

@chorobin is following 20 prominent accounts