Andrea Simone Costa's Avatar

Andrea Simone Costa

@jfet97.bsky.social

Just some TypeScript here https://andreasimonecosta.dev/posts/

20 Followers  |  42 Following  |  29 Posts  |  Joined: 01.11.2024  |  2.0481

Latest posts by jfet97.bsky.social on Bluesky

it is suspiciously similar to THIS:

_ |_out_
0 | 0
1 | 1

26.12.2024 22:17 โ€” ๐Ÿ‘ 3    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Preview
Advent of TypeScript Advent of TypeScript is a month-long event running from December 1 to Christmas, featuring daily TypeScript challenges. Participants can test their skills, climb the leaderboard, and engage with the T...

I've completed Parser Combinators: The Final Frontier - Advent of TypeScript 2024 adventofts.com/events/2024/24

Fuck "Type instantiation is excessively deep and possibly infinite", I wanna non termination

24.12.2024 21:02 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

I saw that Andarist already answered. I just wanted to point out that article because there is no proper documentation when it comes to this topic

22.12.2024 16:29 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Preview
What the heck is a homomorphic mapped type? Let's try to understand what the TypeScript guys mean when they talk about homomorphic mapped types

I wrote an article about homomorphic mapped types. I did a deep dive in the compiler to understand them

andreasimonecosta.dev/posts/what-t...

22.12.2024 16:15 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

curiosity: what is the longest lookahead you are currently using in arktype?

20.12.2024 10:30 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

yeah that would have made me think I wasn't solving the challenge in the intended way ๐Ÿ‘€

18.12.2024 09:16 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Preview
a little girl wearing a blue shirt is standing in front of a shelf full of crowns . ALT: a little girl wearing a blue shirt is standing in front of a shelf full of crowns .
18.12.2024 09:15 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Now that you made me think about it probably I'm cheating because I'm directly using the Color type in their test as upperbound ๐Ÿ˜‚

18.12.2024 09:08 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

I suspect you ahem didn't infer something

18.12.2024 08:53 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

I mean the following was enough so I don't get what you are referring to

<spoiler>
const createStreetLight = <X extends Color>(colors: X[], defaultColor: X) => {
console.log(colors);
return defaultColor;
}
</spoiler>

18.12.2024 08:52 โ€” ๐Ÿ‘ 3    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

Wait what did you do ๐Ÿ˜‚ Which thing?

18.12.2024 08:49 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

But this is less type safe and I got too many type instantiation error here and there and I didn't bother too much

16.12.2024 08:49 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

@grad.dev @andarist.bsky.social

I think we could just gather all the types of the arguments till the last one to then signaling an error when the last parameter is passed if the history does not match with the order we want.

Not sure if that's what they had in mind.

16.12.2024 08:49 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Preview
Advent of TypeScript Advent of TypeScript is a month-long event running from December 1 to Christmas, featuring daily TypeScript challenges. Participants can test their skills, climb the leaderboard, and engage with the T...

I've completed Magic Curry Mind Control Inception - Advent of TypeScript 2024 adventofts.com/events/2024/16

Special cased for t4 ๐Ÿ˜… with a powerful T extends [string, number, boolean] XD

16.12.2024 08:15 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

@andarist.bsky.social what do you think?

16.12.2024 07:57 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 2    ๐Ÿ“Œ 0

Yeah I think t4 should fail as t5 and I'm not gonna waste time on that ahhahaah

16.12.2024 07:56 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Preview
Advent of TypeScript Advent of TypeScript is a month-long event running from December 1 to Christmas, featuring daily TypeScript challenges. Participants can test their skills, climb the leaderboard, and engage with the T...

I've completed Jet Fuel Pricing - Advent of TypeScript 2024 adventofts.com/events/2024/15

15.12.2024 12:37 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

#AdventOfTypescript #AdventOfTS

Day 13

13.12.2024 08:18 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

I've completed ๐ŸŽฉBernard's Long List Of Names - Advent of TypeScript 2024 adventofts.com/events/2024/12

12.12.2024 12:47 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Yeah I remember I was tempted to write descriptions for some PRs of yours about reverse mapped types ahah

Another idea would be a six month vacation, I suspect the TS team will be more then happy to cover all the expenses for you and your family ๐Ÿ˜œ๐Ÿ˜‚

10.12.2024 18:52 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

That's just because I have only 3 PRs in total, I have to maximize the chances of being considere.

You 575 ๐Ÿ˜…. You don't need anything else than "fixes #12345"

10.12.2024 18:20 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

Naming variables, git commit messages and PR titles are definitely not my strong suit ๐Ÿ˜†

10.12.2024 17:43 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Preview
Let primitive types discriminate a union of objects by jfet97 ยท Pull Request #60718 ยท microsoft/TypeScript Main goal The ultimate goal of this PR is to allow primitive types in object unions to act as discriminants, even when there are no unit/literal types involved. Some examples of this are as follows...

nice experimentation by @jfet97.bsky.social going on: github.com/microsoft/Ty...

10.12.2024 16:31 โ€” ๐Ÿ‘ 8    ๐Ÿ” 1    ๐Ÿ’ฌ 2    ๐Ÿ“Œ 0
Preview
a cartoon dog is sitting at a table in front of a fire with the words `` it 's fine '' written above him . ALT: a cartoon dog is sitting at a table in front of a fire with the words `` it 's fine '' written above him .
10.12.2024 16:34 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Thanks also to @andarist.bsky.social for making the switch case exhaustive!

PR: github.com/microsoft/Ty...

Playground: www.typescriptlang.org/play/?ts=5.8...

04.12.2024 09:32 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

#typescript

The next TypeScript compiler update will be exciting!

PR #56941 by @gabritto.bsky.social improves support for conditional and indexed access types as return types, enabling proper typing for functions like the one in the snippet without clunky hacks or dubious overloads.

04.12.2024 09:32 โ€” ๐Ÿ‘ 6    ๐Ÿ” 1    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

Well, thanks for your exhaustive explaination! ๐Ÿ˜ƒ
Great job with that PR

30.11.2024 07:33 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
TS Playground - An online editor for exploring TypeScript and JavaScript The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.

Hi there @gabritto.bsky.social!

I'm playing with your PR and I got a couple of non working cases (and some combinations), but I can't find the reason in the description of the PR. Would you mind to have a look? Thanks!

www.typescriptlang.org/play/?ts=5.8...

29.11.2024 20:56 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
TS Playground - An online editor for exploring TypeScript and JavaScript The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.

www.typescriptlang.org/play/#code/G...

22.11.2024 21:34 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

#typescript

Immediate access in the realm of values is not deferred, but `to` has a type param as type so TS can only resort to its constraint. OTOH in the realm of types `T["property"]` stays deferred, so indirect access is well typed.

@andarist.bsky.social highlight of the day from our chat

22.11.2024 21:34 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

@jfet97 is following 20 prominent accounts