@DavidKPiano not to take away the credit ofc haha just trying to understand if the models have got far enough to figure things like these out by themselves
Bro he got typestates working just like sthir π«‘
xstate is now at par with sthir-without-typescript-fork but sthir-with-typescript-fork is still ahead with many other features one being not having to write schemas π
so typescript#64091 can still improve things further πͺπΌ
XState v6 is now in beta π
Reduced API surface area (transitions are just functions), much stronger types, durable execution, new tools (CLI, viz, editor), and more to come.
Built for humans *and* agents π€
npm i xstate@beta
https://t.co/JJStSdXwwQ
@MichaelArnaldi As I said it's a spectrum, when I said math library I meant pure math (like mathjs) and not ML which has to deal with failures, resources management, etc... 1+1=2 does not require Effect
I don't understand why people recreate everything for Effect... Like the whole point of Effect being embedded into TypeScript is that you can just use TypeScript libraries...
If there are effects that the library makes then sure wrap them into an Effect type...
π€·π»ββοΈ
Been building an @EffectTS_ native ORM for a while, and it's finally ready for some of you to try.
- includes ClickHouse + Postgres
- Fully typesafe
- Migrations for both, and it can adopt your existing drizzle-kit migrations
Still early, but it's been running @Mapledotdev in production for about a month.
https://t.co/E7u2SKXRwh
@MichaelArnaldi That's why I said "assuming", if it's not 90% pure then sure use Effect... And I'm not sure about the second part... There's definitely a spectrum to pure code, surely a math library doesn't need telemetry, logging or dependency injection...
@MichaelArnaldi All I'm saying is if 90% of your implementation is pure (assuming that's the case for OP) then it doesn't make sense to use Effect (but you can target Effect with a submodule)... You can disagree with that all you want but it won't stop being silly to me anytime soon... Cheers π
@MichaelArnaldi Don't know much about drizzle but I assume drivers are not part of the core? And they are a small or relatively small part of the whole story? Sure rewrite the driver but that would still be the 10% or a smaller X%
@MichaelArnaldi It would have made much more sense if they made a core abstraction that anybody can use (if the orm is doing something novel) and then have a sub module for effect consumption... Tying yourself prematurely to effect is not very wise... (Unless you want traction...)
@MichaelArnaldi Core of drizzle remains effect free (I hope I haven't checked), the effect version wraps the 10% impure parts which is exactly my point... What OP is doing is recreating an orm _just for effect_ when it doesn't even use effect for 90% of the implementation... That's silly...
@MichaelArnaldi I'm not against making an effect version of a library (heck I myself have made one...) but people tend to make one even when it doesn't make sense (to me at least)
@MichaelArnaldi That might make sense for some library that does a lot of effects / is impure... The one that is quoted is literally just an orm / sql query builder, it's mostly a pure abstraction... I bet 90% of it's implementation would have been free from any of the abstractions Effect offers
@AndaristRake@MichaelArnaldi How to respond...
errors in bun, doesn't in tsgo? use ts-ignore and fuck off
errors in tsgo, doesn't in bun? you don't deserve the extra safety because of using an unofficial checker, fuck off even more
π
@charliermarsh@zack_overflow Note not "all methods" just the ones that are declared with method syntax instead of property syntax...
interface MyArray<T> {
push(x: T): void // bivariant
push: (x: T) => void // contravariant
}
The built-in Array type uses the method syntax intentionally
@saltyAom You can create a type level variable too and write it like this...
interface Role extends MacroTypeLamda {
output:
this["input"] extends infer Input
? { role: Input }
: never
}
@DavidKPiano@AndaristRake I think the biggest wins are typestates (state-context discriminated unions) and not having to type everything upfront with a schema
.@DavidKPiano thoughts on using the pattern that sthir uses for types in future xstate versions? Would love if my types reach everyone!
The only barrier is the `_: undefined` thing but I hope @AndaristRake gets to fix it soon as he said in TypeScript#64251
π’π’π’
@βsthir/machine (and @βsthir/machine/effect) now work with non-forked typescript as well!!!
The difference?
1. You just have to explicitly type things more (but still less than other libraries)
2. You have to write stupid `_: undefined` at times (see typescript#64251)
@DavidKPiano@AndaristRake Sorry not sure what you mean by the top-level pattern... sthir uses the `T extends F<T>` pattern... We can have more strong types with it, here's a comparison with xstate v6 that I think you have already seen, exclude points 4 & 5 tho that require a fork: https://t.co/DsXV47CwbV
@βsthir/machine vs xstate
just to understate how important it is to have dependent contextual inference in typescript
1. type-safe targets?
sthir: yes
xstate: no
(I'm using xstate@alpha btw)