0.9.9 release lifecycle types
Hey just upgraded to 0.9.9 a few minutes ago,
OnCreateOptions &
CreateStateOptionstypes seem to be missing from the actors pkg exports.
I had some helpful factory pattens setup using these types, are they still available?17 Replies
cc @Nathan
input was moved to a top-level parameter to make type inference easier
so there are no more opts rnoh gotcha, can you send me link to docs or code file on github where I can see this visually?
the diff or docs?
yea sorry haha the diff might be more helpful
@Nathan got it now so both
input & params are seperated from optionsyep. used to be really hard to write types so rivetkit would infer it before
is options completely eradicated or is it just a separated from input and params?
just separated – they'll be added back if there are options
actually i'm realizing that i should add empty options to both for forwards compat
because the d.ts files are showing that options is part of the lifecycle args for onBeforeConnect and createConnectionState
this is what they were before

ie they were empty so got removed. but there likely will be more there in the future
that's correct. you can access
request in onbeforeconnect and createconnectionstate.so for ex (i've modularized my hooks):
export function createConnState(
c: AnyActorContext,
opts: OnConnectOptions,
params: Params
) {}
export async function onBeforeConnect(
c: ChatActorContext,
opts: OnConnectOptions,
params: Params
) {}
the .d.ts file shows that opts exists and comes before params in both cases.
Just wanted to make sure this is true
more speficially want to make sure that params is always the 3rd arg and not the 2nd if opts is undefinedwe're in typescript so the dts should always be correct. if there's something that's not right then lmk and i'll fix up the tests
yep correct.
ok cool just updated my hooks, going to test now
got everything working ! no issues i can see so far