- 389
- 334 607
Michigan TypeScript
United States
เข้าร่วมเมื่อ 11 เม.ย. 2022
A place for advanced TypeScript to call home.
Inferred Type Predicates - TypeScript 5.5's top new feature
This has has been a top wishlist features for so many people for so many years. Dan tells the story of how he cracked it, then we do a deep dive on the code itself. Although this was a pretty technical conversation there ended up also being quite a lot of great conversation on staying motivated and thinking through all the aspects of the problem from side-effects to performance implications.
Links:
- Original PR github.com/microsoft/TypeScript/pull/57465
- A blogpost Dan wrote about it: effectivetypescript.com/2024/04/16/inferring-a-type-predicate
- The TypeScript release notes that cover it devblogs.microsoft.com/typescript/announcing-typescript-5-5-rc/#inferred-type-predicates
Dan Vanderkam is an independent software developer, formerly at Google and Sidewalk Labs. He is the author of numerous open source JavaScript/TypeScript libraries, including the dygraphs charting library, source-map-explorer, literate-ts, pg-to-ts and crosswalk. He is the author of "Effective TypeScript: 83 Specific Ways to Improve Your TypeScript" (O'Reilly 2024) and has spoken at numerous TS conferences. When he's not writing about TypeScript, Dan enjoys hiking, rock climbing and birding.
Also, Effective TypeScript is one of the most practical and useful books on TypeScript in existence. A lot of us at MiTS have a copy and you'll be seeing Dan again in the future to talk about it. Between now and then you can order a copy here: amzn.to/3UjPrsK.
effectivetypescript.com
danvk.org
github.com/danvk
danvdk
00:00:00 in this episode
00:02:06 the Recurse Center (deciding to tackle this issue)
00:03:53 first issue: numeric literal separators in ES2021
00:07:36 rediscovering this old issue
00:08:28 explaining the fundamentals of the feature
00:13:43 the idea for the first approach to solving the issue
00:16:24 wrong assumptions about how the compiler handles inference
00:17:59 what is a "Flow Node" in the compiler
00:21:46 about the TypeScript AST Viewer
00:22:18 second attempt: using Flow Nodes
00:23:26 digging into the code for the actual implementation
00:28:03 what most people don't understand about how type predicates actually work
00:30:21 are MiTS viewers interested in blog post readings (WITH the author)?
00:31:33 looking deeper than a type predicate goes
00:33:23 working with TypeScript's exhaustive test suite
00:36:03 dealing with outlier falsey types (like empty string, NaN, etc.)
00:38:27 what about `[].filter(Boolean)` (array filter with the Boolean constructor)
00:39:14 type guards now flow between functions
00:40:35 sage-tier advice from Anders Hejlsberg
00:41:20 building the courage to submit the PR
00:43:59 a scary moment where it looked like the solution might not actually work
00:46:37 a solution to the setback after going for a walk
00:50:29 a totally unique approach within the TypeScript compiler codebase
00:53:12 the process for getting it reviewed and approved and merged
00:54:36 performance optimization work
00:56:42 playing around with the end result
00:57:24 playing with truthiness checks
00:59:15 revisiting: why you shouldn't use .filter(Boolean)
01:01:57 about teaching these concepts
01:02:52 how ts-reset handles filter(Boolean)
01:05:51 wrapping up
01:07:49 after it all: it turns out this could have been done years ago
Twitter: MiTypeScript
Mastodon: fosstodon.org/@MichiganTypeScript
BlueSky: bsky.app/profile/michigantypescript.com
Threads: www.threads.net/@michigantypescript
Instagram: michigantypescript
TikTok: www.tiktok.com/@michigantypescript
Discord: discord.michigantypescript.com
GitHub: github.com/MichiganTypeScript
SoundCloud: soundcloud.com/michigan-typescript
Links:
- Original PR github.com/microsoft/TypeScript/pull/57465
- A blogpost Dan wrote about it: effectivetypescript.com/2024/04/16/inferring-a-type-predicate
- The TypeScript release notes that cover it devblogs.microsoft.com/typescript/announcing-typescript-5-5-rc/#inferred-type-predicates
Dan Vanderkam is an independent software developer, formerly at Google and Sidewalk Labs. He is the author of numerous open source JavaScript/TypeScript libraries, including the dygraphs charting library, source-map-explorer, literate-ts, pg-to-ts and crosswalk. He is the author of "Effective TypeScript: 83 Specific Ways to Improve Your TypeScript" (O'Reilly 2024) and has spoken at numerous TS conferences. When he's not writing about TypeScript, Dan enjoys hiking, rock climbing and birding.
Also, Effective TypeScript is one of the most practical and useful books on TypeScript in existence. A lot of us at MiTS have a copy and you'll be seeing Dan again in the future to talk about it. Between now and then you can order a copy here: amzn.to/3UjPrsK.
effectivetypescript.com
danvk.org
github.com/danvk
danvdk
00:00:00 in this episode
00:02:06 the Recurse Center (deciding to tackle this issue)
00:03:53 first issue: numeric literal separators in ES2021
00:07:36 rediscovering this old issue
00:08:28 explaining the fundamentals of the feature
00:13:43 the idea for the first approach to solving the issue
00:16:24 wrong assumptions about how the compiler handles inference
00:17:59 what is a "Flow Node" in the compiler
00:21:46 about the TypeScript AST Viewer
00:22:18 second attempt: using Flow Nodes
00:23:26 digging into the code for the actual implementation
00:28:03 what most people don't understand about how type predicates actually work
00:30:21 are MiTS viewers interested in blog post readings (WITH the author)?
00:31:33 looking deeper than a type predicate goes
00:33:23 working with TypeScript's exhaustive test suite
00:36:03 dealing with outlier falsey types (like empty string, NaN, etc.)
00:38:27 what about `[].filter(Boolean)` (array filter with the Boolean constructor)
00:39:14 type guards now flow between functions
00:40:35 sage-tier advice from Anders Hejlsberg
00:41:20 building the courage to submit the PR
00:43:59 a scary moment where it looked like the solution might not actually work
00:46:37 a solution to the setback after going for a walk
00:50:29 a totally unique approach within the TypeScript compiler codebase
00:53:12 the process for getting it reviewed and approved and merged
00:54:36 performance optimization work
00:56:42 playing around with the end result
00:57:24 playing with truthiness checks
00:59:15 revisiting: why you shouldn't use .filter(Boolean)
01:01:57 about teaching these concepts
01:02:52 how ts-reset handles filter(Boolean)
01:05:51 wrapping up
01:07:49 after it all: it turns out this could have been done years ago
Twitter: MiTypeScript
Mastodon: fosstodon.org/@MichiganTypeScript
BlueSky: bsky.app/profile/michigantypescript.com
Threads: www.threads.net/@michigantypescript
Instagram: michigantypescript
TikTok: www.tiktok.com/@michigantypescript
Discord: discord.michigantypescript.com
GitHub: github.com/MichiganTypeScript
SoundCloud: soundcloud.com/michigan-typescript
มุมมอง: 1 584
วีดีโอ
no one writes JavaScript anyway.. ReScript: the ReasonML successor
มุมมอง 8K5 หลายเดือนก่อน
ReScript is a robustly typed language that compiles to efficient and human-readable JavaScript. It comes with a lightning fast compiler toolchain that scales to any codebase size. If you’re using a compiler and build step, you aren’t writing the code your users are running in the browser. If you need to “build” your web application, writing JavaScript is a choice. ReScript’s syntax allows devel...
how Andarist time-travel debugs the TypeScript compiler with Replay
มุมมอง 4189 หลายเดือนก่อน
Andarist loves fixing bugs - that's how he became a maintainer of several popular JS OSS projects and a contributor to the TypeScript compiler. In this video we look at how he uses Replay to debug the TypeScript compiler while he's doing all his cutting-edge advanced TypeScript work. *note:* This is (sortof) part 2 of a video with Mark (Erikson, of Replay.io) and Andarist. In Part 1 (th-cam.com...
recording meetups like it's a 4,000 person conference: how and why
มุมมอง 1.4K9 หลายเดือนก่อน
Recently we've gotten a lot of questions from other meetup organizers (not just TypeScript people) about how we produce recordings and run our meetups. So... here's how we do it! After all, if our whole goal at MiTS is to provide resources for passionate TypeScript engineers.. running a meetup is a pretty common thing for such people to do, so it makes sense to talk about the technical side of ...
the time-traveling debugger from the future, Replay | Mark Erikson | TypeScript Showcase #10
มุมมอง 6449 หลายเดือนก่อน
Replay is a time-traveling debugger for JavaScript development. You can make recordings of your app and jump in and see what your code was doing at any instant. It includes deep React integration, collaboration tools, and E2E integrations. www.replay.io 00:00 in this episode 02:24 introductions 05:52 what is Replay? 08:31 a demo of Replay 16:29 it can step backwards! 17:47 it can jump to react ...
Distributive Conditionals as fast as possible
มุมมอง 9109 หลายเดือนก่อน
Distributive conditionals are a deep topic in the realm of advanced TypeScript. It's the sort of thing you maybe have tripped over it before, even without knowing it! This video is just the beginning, we're going to see this topic come up a lot in future Theorycraft episodes, so let us know what you want to hear about next! 0:00 what are distributive conditionals in TypeScript's type system? 1:...
Glide Data Grid with Jason Smith | TypeScript Showcase #9
มุมมอง 8279 หลายเดือนก่อน
Glide Data Grid with Jason Smith | TypeScript Showcase #9
assertUnreachable techniques with Ryan from the TypeScript team
มุมมอง 96510 หลายเดือนก่อน
assertUnreachable techniques with Ryan from the TypeScript team
that one weird trick to access array values: `T[number]`
มุมมอง 74410 หลายเดือนก่อน
that one weird trick to access array values: `T[number]`
Apollo Client with Lenz Weber-Tronic and Jerel Miller | TypeScript Showcase #8
มุมมอง 56511 หลายเดือนก่อน
Apollo Client with Lenz Weber-Tronic and Jerel Miller | TypeScript Showcase #8
effection with Charles Lowell | TypeScript Showcase #7
มุมมอง 1.7K11 หลายเดือนก่อน
effection with Charles Lowell | TypeScript Showcase #7
Redux, RTK-Query, Reselect with Lenz Weber-Tronic and Mark Erikson | TypeScript Showcase #6
มุมมอง 1.4Kปีที่แล้ว
Redux, RTK-Query, Reselect with Lenz Weber-Tronic and Mark Erikson | TypeScript Showcase #6
TypeScript 5.2 - `using` Declarations and Explicit Resource Management | Release Report
มุมมอง 596ปีที่แล้ว
TypeScript 5.2 - `using` Declarations and Explicit Resource Management | Release Report
TypeScript 5.2 - Type-Only Import Paths + TypeScript Implementation File Extensions | Release Report
มุมมอง 151ปีที่แล้ว
TypeScript 5.2 - Type-Only Import Paths TypeScript Implementation File Extensions | Release Report
TypeScript 5.2 - `module` and `moduleResolution` Must Match Node.js Settings | Release Report
มุมมอง 959ปีที่แล้ว
TypeScript 5.2 - `module` and `moduleResolution` Must Match Node.js Settings | Release Report
TypeScript 5.2 - Copying Array Methods | Release Report
มุมมอง 124ปีที่แล้ว
TypeScript 5.2 - Copying Array Methods | Release Report
TypeScript 5.2 - Optimized Checks for Ongoing Type Compatibility | Release Report
มุมมอง 80ปีที่แล้ว
TypeScript 5.2 - Optimized Checks for Ongoing Type Compatibility | Release Report
TypeScript 5.2 - Inline Variable Refactoring | Release Report
มุมมอง 86ปีที่แล้ว
TypeScript 5.2 - Inline Variable Refactoring | Release Report
TypeScript 5.1 - Linked Cursors for JSX Tags | Release Report
มุมมอง 48ปีที่แล้ว
TypeScript 5.1 - Linked Cursors for JSX Tags | Release Report
TypeScript 5.1 - Explicit `typeRoots` Disables Upward Walks for node_modules/@types | Release Report
มุมมอง 76ปีที่แล้ว
TypeScript 5.1 - Explicit `typeRoots` Disables Upward Walks for node_modules/@types | Release Report
TypeScript 5.1 - Namespaced JSX Attributes | Release Report
มุมมอง 91ปีที่แล้ว
TypeScript 5.1 - Namespaced JSX Attributes | Release Report
TypeScript 5.1 - `typeRoots` Are Consulted In Module Resolution | Release Report
มุมมอง 139ปีที่แล้ว
TypeScript 5.1 - `typeRoots` Are Consulted In Module Resolution | Release Report
TypeScript 5.1 - Decoupled Type-Checking Between JSX Elements and JSX Tag Types | Release Report
มุมมอง 83ปีที่แล้ว
TypeScript 5.1 - Decoupled Type-Checking Between JSX Elements and JSX Tag Types | Release Report
TypeScript 5.0 - `--moduleResolution bundler` | Release Report
มุมมอง 441ปีที่แล้ว
TypeScript 5.0 - ` moduleResolution bundler` | Release Report
TypeScript 5.0 - Resolution Customization Flags | Release Report
มุมมอง 835ปีที่แล้ว
TypeScript 5.0 - Resolution Customization Flags | Release Report
StringTs with Guga Guichard | TypeScript Showcase #5
มุมมอง 810ปีที่แล้ว
StringTs with Guga Guichard | TypeScript Showcase #5
Conway's Game of Life implemented with TypeScript types | TypeScript Showcase Podcast #4
มุมมอง 1.6Kปีที่แล้ว
Conway's Game of Life implemented with TypeScript types | TypeScript Showcase Podcast #4
inferred vs generated TypeScript types: how Payload CMS decided
มุมมอง 1.3Kปีที่แล้ว
inferred vs generated TypeScript types: how Payload CMS decided
Pokémon speedrunners use TypeScript (!!?)
มุมมอง 1.2Kปีที่แล้ว
Pokémon speedrunners use TypeScript (!!?)
Maybe using of Extract built-in can make it more clear? type MapTypes<T, R extends { mapFrom: unknown, mapTo: unknown }> = { [P in keyof T]: Extract<R, { mapFrom: T[P] }> extends never ? T[P] : Extract<R, { mapFrom: T[P] }>['mapTo'] }
are we gonna be getting any more videos anytime soon?
yes - three things on that: 1. SquiggleConf was awesome, but absolutely plundered and pillaged all available time over the last 6 months - we were very focused on that 1. we have two recorded videos that we need to get edited and out out both, recorded 3 months ago (😥) - an hour-long deep dive on Isolated Declarations with Titian and Rob Palmer, and a talk on Signals from Chandler Prall 1. we have something absolutely massive we've been working on very very hard for a year and it's just now coming to a head as the project itself is wrapping up and ready to be shown to the world, we're working on a video for that as we speak! - but it has been and will continue to be a long process on this one. this one video has taken more time and effort than all 300+ videos we did on the type challenges. you'll be hearing more about it soon for sure. largest undertaking on this channel by far. and, oh man, so much more. we have literally 60 shorts that have been uploaded to TH-cam for months that we just haven't had time to post. in addition to that there are a bunch of other topics we have planned and lined up (including, of course, with other people - many new faces in there too), but the above three videos are going to be what's next. we'll probably also do a wrap-up about how SquiggleConf was.
@@MichiganTypeScript that's wonderful to hear, thank you. Don't overdo it
Finally, a way to get better at Typescript! You should think about becoming a teacher for yourself.
Ok guys, let's be honest... you are saying it's easy level of challenges? I'm scared!
this guy looks like he needs sun
Happy international programmers day 🍻🍻🍻
lmao, Dan got a deep ass voice, goddamn
Actually I do like a good rant about JavaScript/TypeScript being terrible languages, but most of the problems here are just caused by not understanding, what enums are and how they work. Most of the problems addressed here would also pop up in most other languages.
Good and quick showcase of this lovely language.
6:15 My exact experience with this one. This series has been very helpful btw. Thank you!
Very interesting, thanks.
Very interesting, thanks.
Ian, Thaks for your video, it was very usefull for me. Please you don´t stop.
This one has been updated to include tuple test cases. This works: type Concat<T extends readonly unknown[], U extends readonly unknown[]> = [...T, ...U]
Been exploring rescript the past couple of days. Seems really good. Only bummer so far is the lack of macro system. They have something called PPX, but that’s apparently an ocaml thing that rescript users are discouraged from using.
great talk
thanks! what did you like about it?
"dont use semver", but isn't semver basically what he described? deriving maj/min/patch bumps from the the type of changes?
check out the original video: Sam goes into (more) pretty extensive technical depth as to why what he's describing is different from semver
@@MichiganTypeScript ok, thanks
🤯
this one really is special, isn't it?
@@MichiganTypeScript yes. Firstly I try to solve by myself, but when it takes too much time I suppose there should be some trick. This one is too tricky)))
@@СвятославКобывников-щ7г that's definitely the best way to do it!
I think it would be interesting to extend this task to check for "never". Equal<ObjectEntries<{key: never}>, ['key', never]> Equal<ObjectEntries<{key?: never}>, ['key', never]> To tell you the truth, I cannot solve challenge with never. Because if I add an IsNever<> check for values, I will crash the IsUndefined<> check. So it would be interesting to see a solution to this problem
To tell tou the truth, I cannot solve first challenges. And I like that after a couple of dozen tasks I look at this task and think: wow, it’s simple. Great progress! Thank you! You really help people!
I don't understand why do we need P=PropertyKey in generic, and why solution don't work if we directly pass PropertyKey extends K?
Distributive conditional types are only applied when testing against generic arguments I believe. If you don't pass in PropertyKey as a generic argument, then you are testing if (string | number | symbol) extends IndexSignatureType which will always fail, except in the case that the index signature is (string | number | symbol) because a broader type cannot extend a more narrow type. However, if we pass in PropertyKey as a generic argument, then union members of PropertyKey get distributed on the conditional type so that it looks more like this (assuming the index signature type is string): string extends string | number extends string | symbol extends string. 'string extends string' passes, which removes it from the mapped type. // "foo" type Foo = PropertyKey extends string | number | symbol ? "foo" : "bar"; // "bar" type Bar = PropertyKey extends string ? "foo" : "bar"; // "foo" | "bar" | "baz" type FooBarBaz<T = PropertyKey> = T extends string ? "foo" : T extends number ? "bar" : T extends symbol ? "baz" : never;
Loved it!
❤
For a long time I could not figure out how to check for an empty object, and I found a solution: {} extends Head (as extra branch after checking Falsy). But your way ({[p: PropertyKey]: never}) is cool too. Thanks for great challenges!
My full solution (the same as yours, but with extra branch to check empty object) type AnyOf<T extends readonly any[]> = T extends [infer Head, ...infer Tail] ? Head extends 0 | "" | false | [] | null | undefined ? AnyOf<Tail> : {} extends Head ? AnyOf<Tail> : true : false;
why is it so hard to memorize this shit.
Great interview! It’s so fun to see the journey of how something grew into its final form.
Thanks! We're really happy with how it turned out, too!
Amazing interview, learned a lot. Dan has some great insights and MiTS coming in clutch with thoughtful questions. Stay gold.
Dan is 🥇 for sure! We're always happy to have him back on the channel!
I like the format, but It is only as good as the people are. It must be people of the format of Dan or Josh! If you can catch them do it!
that's fantastic feedback to have! we care a lot about quality of these discussions so please continue to share your most candid feedback. also.. yeah...😅 I guess we did set the bar quite high by starting off with Dan and this particular feature!
Dan should give a workshop:"Typescript Deep Dive", he sure has a ton of interesting Typescript Type material!
we're toying around with the idea of doing a series of videos covering the 83 specific things mentioned in his book. but Dan _is_ also speaking at SquiggleConf (in Boston, October), so who knows: maybe he'll do a deep dive on something there.
@@MichiganTypeScript My Proposals would be:Titian Cernicova-Dragomir, gabriel vergnaud, Stefan Baumgartner
@@hansschenker thanks for the suggestion! We reached out to Titian and we're meeting with him late next week to do a similar video on Isolated Declarations
@@MichiganTypeScript Very good - Titian is a real expert!
PR author interviews like this have been something we've been wanting to do for a long long time, and we're so excited to finally get it started! Let us know what you think of this format and what kinds of PRs you'd like to see in the future.
"God forbid vanilla javascript" Been writing simple web-components with vanilla JS and don't want to look back.
if that works for you then full support from us!
same... I think it's a big misconception with types is that it pays off compared to the investment. my observations (and I was dealing with types even before typescript - back when google closure compiler was using es4-like types) is that the overall benefit does not contend the extra effort.
33:54 dear god what even is that syntax. Let statements inside an object closure? No thanks. 55:08 "Sometimes typescript forces you to code defensively". Yeah, that's actually a good thing. Defensive coding/early returns is a GOOD pattern not a bad one. I'm glad this wasn't adopted. That looks like an absolute nightmare.
Let statements inside block scope is an intrinsic feature of JavaScript. However when the same thing is done in ReScript as shown in 33:54 it's a no no for you? Double standards. Give it a chance before you spread negativity.
@@SubhashishPradhan That's not a closure that's an object statement.
ReScript language documentation disagrees with you.
He was referring to type guards
Type guards were shown in 55:08. I haven't commented on that.
Some part of it feels like kotlin
haven't used Kotlin: which parts seem similar?
@@MichiganTypeScript how the code is structured, in kotlin functions we can omit the open and closing bracket and all the logic will be inside as a scope of it and the last item will be returned as a value... You could Google and see how it is or to save some time just google for how to use "when expression in kotlin" and you will realize what I want say🙂🙂
When you try to convince somebody and then start using words like "magical" :D :D
are you saying magic is good or bad?
@@MichiganTypeScript it's bad
@@MichiganTypeScript Bad. When you’re trying to convince engineers magic is the last thing you want to mention 😀
I write, in fact I avoid all the compilers
we've been thinking of making a video on writing machine code with a quill. would that be interesting?
i really wish rescript won over typescript. its just SO much better. its like rust but in the JS ecosystem
there's still time. after all: at this point, we don't need "winners" and "losers" because it's not zero-sum. e.g. If webassembly opens a lot of doors
thanks for presenting this. I think that TypeScript is a mashed together little monster and it is meh at best. But OCaml derivatives like Rescript need a lot of promotion to get out there, and talks like this look to be a part of it.
would you agree that, ultimately, it's JavaScript that's the mashed together little monster and TypeScript makes it more bearable (although, we understand the "lipstick on a pig" vibes some people get from it)? And thanks: we really want to surface things like ReScript (and others!) because of the whole "rising tide lifts all boats" thing.
@@MichiganTypeScript hehe wait, what other boats?
@@adicide9070 programming languages
23:30 this kind of elite speak ("polymorphic variant") can easily be avoided (even "sum type" or "product type" would have been better) Scott Wlaschin has demonstrated many times that you can teach fp concepts with no gobbledygook
It’s not elite, it’s just unfamiliar. OOP has tons of jargon for example, and it’s not labeled as “elite”. It’s also a different concept from a “sum type” (and especially from “product type”)
asking for a friend... what's the difference between a polymorphic variant, a sum type, and a product type?
@@MichiganTypeScript Great question! Here's how I think about it: A sum type is a type-level "OR". If a `foo` type is either A | B | C - it has 3 possible states (that's where the "sum" part comes from, 1 + 1 + 1). In typescript terms, this is a discriminated union. A product type is your typical struct/record found in almost all languages, in the case of JS that would be an object. It's called "product", because you have to multiply (cartesian product) all the combinations of the fields to get the number of states. If you have a record User with 3 boolean fields, it would have 6 possible states (2x2x2). A polymorphic variant is similar to a sum type, but solves certain problems where you'd want to use the same variant constructor in multiple places. Probably best to refer to Rescript and OCaml docs for more details, I don't think I can do them justice in this format :) ocaml.org/manual/5.2/polyvariant.html rescript-lang.org/docs/manual/latest/polymorphic-variant
@@MichiganTypeScript A sum type is basically like an enum, an enumeration type has a limited/fixed number of variations, for example TimeOfDayEnum = PM | AM or LedEnum = Red | Green | Blue. In type theory, a type with a fixed number of variants goes by "sum type". The idea is that the total number of possible values for this type is simply the sum of its variants. TimeOfDayEnum has 2 possible values and LedEnum 3. A product type, on the other hand, is more like a record. For example, a Coordinate record can have entries for X and Y. Coordinate(X, Y). The number of possible values for Coordinate is the product of all possible values for X and Y, i.e., X times Y. Hence, the name product type (for example, Coordinate has 2 x 3 = 6 possible values for values int X = 1..2 and int Y = 1..3). Sum types and product types go also by the name Algebraic Data Type (ADT). Algebraic is math speak for types that combine. Example: take Person(Name, AgeCategory) where AgeCategory = Minor | Adult. Person is a product type combined with a Name and a sum type. Sum Type can also consist of other sum types or product types. Deeply nested or recursive Sum Types and Product types are possible too (json). In OCaml, sum types are also called Variants. For polymorphic variants google up "Polymorphic vs. ordinary variants in OCaml" (Yehonathan Sharvit).
@@akis854 apologies, I was being too dramatic 😆
ReScript is not a sucessor to ReasonML. ReasonML does native. ReScript does not. I used to use Reason for native applications. Melange is a sucessor to Reason.
this came up on twitter: thanks for the clarification. it's genuinely hard to get all of this straight: we're hoping that someone from the ReScript/ReasonML/Melange camps (even one person!) will accept our very-genuine offer to make a quick video breaking it all down, but no bites yet (although some people did some good stuff trying to whiteboard it).