HNHacker News
TopNewBestAskShowJobs

alexcole

82 karma · joined February 1, 2020

submissionscomments
alexcole··on End-to-End TypeScript with Convex
Convex provides automatic type safety all the way from your database schema to your React app. How does it work? Hint: we use some wild TypeScript.
alexcole··on Convex vs. Firebase
Very short! We're trying to get beta keys to all of you today! :)
alexcole··on Convex vs. Firebase
Absolutely. But if you decide to use Cloud Functions with Firebase you have to give up the reactivity and automatic optimistic updates that Firebase normally provides.

Part of the difficulty of writing about Firebase is that it's actually a whole collection of tools with a host of complex tradeoffs. But that's also a lot of the difficulty in using it as well! Understanding when to use Cloud Firestore vs Realtime Database and when to load data directly vs via Cloud Functions are all complex questions with unclear answers.

alexcole··on Convex vs. Firebase
Thanks for the pointer! I'll update the article to be more accurate!
alexcole··on Convex vs. Firebase
Author here! I think the comparison between Convex and Supabase is quite similar to Convex vs. Firebase! Supabase also encourages developers to load individual SQL queries from the client, supports edge functions without having a reactivity story for them, etc. Superbase is designed to be a Firebase alternative and appears to be taking most of their high-level approach.
alexcole··on TypeScript’s quirks: How inconsistencies make the language more complex
Well discriminated unions are TypeScript's implementation of ADTs (but whether they are "clean" is could be debated)
alexcole··on TypeScript’s quirks: How inconsistencies make the language more complex
I think that Flow’s approach of using nominal types for classes and structural for everything else makes more sense. Are there really cases you expect classes to be structural types?
alexcole··on TypeScript’s quirks: How inconsistencies make the language more complex
That’s not always true. If you are going to print the object to the console or send it in a network request it’s possible that the additional property is important.
alexcole··on TypeScript’s quirks: How inconsistencies make the language more complex
> In Java you can assign any non-primitive typed expression to a variable of type Object.

Sure, but if you do this in Java you must use different variable names for the reference of type Animal and the reference of type Object.

I think algebraic data types and type refinement are great, but I’m not a fan of automagically changing the types of variables in different scopes if it can’t be applied consistently.

alexcole··on TypeScript’s quirks: How inconsistencies make the language more complex
Thats not 100% true in TypeScript. TypeScript actually only allows "up-casts" and "down-cast" (but if the type is neither a supertype nor a subtype the compiler will throw an error).
alexcole··on TypeScript’s quirks: How inconsistencies make the language more complex
Author here! Yeah I think you are right that discriminated unions are useful more broadly than just legacy JS code.

That being said, I still think TypeScript's solution to handling them of using "type guards" where the type of a variable changes in different scopes is definitely designed to match common JS patterns at the cost of added complexity. Most other languages I know of only have a single type for a variable (and if you want to pattern match you must give each case a new variable name).