Skip to content

Commit

Permalink
Add ReducerEvent to Reducer callbacks to match C# SDK and provide err…
Browse files Browse the repository at this point in the history
…or message (#94)

Co-authored-by: Derek Brinkmann <dbrinkmann@citadelstudios.net>
  • Loading branch information
2 people authored and cloutiertyler committed Aug 1, 2023
1 parent b2b4873 commit e1246b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/cli/src/subcommands/generate/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ pub fn autogen_typescript_reducer(ctx: &GenCtx, reducer: &ReducerDef) -> String
writeln!(output).unwrap();

writeln!(output, "// @ts-ignore").unwrap();
writeln!(output, "import {{ __SPACETIMEDB__, AlgebraicType, ProductType, BuiltinType, ProductTypeElement, IDatabaseTable, AlgebraicValue, ReducerArgsAdapter, SumTypeVariant, Serializer }} from \"@clockworklabs/spacetimedb-sdk\";").unwrap();
writeln!(output, "import {{ __SPACETIMEDB__, AlgebraicType, ProductType, BuiltinType, ProductTypeElement, IDatabaseTable, AlgebraicValue, ReducerArgsAdapter, SumTypeVariant, Serializer, Identity, ReducerEvent }} from \"@clockworklabs/spacetimedb-sdk\";").unwrap();

let mut imports = Vec::new();
generate_imports(
Expand Down Expand Up @@ -1275,7 +1275,7 @@ pub fn autogen_typescript_reducer(ctx: &GenCtx, reducer: &ReducerDef) -> String
// OnCreatePlayerEvent(dbEvent.Status, Identity.From(dbEvent.CallerIdentity.ToByteArray()), args[0].ToObject<string>());
writeln!(
output,
"public static on(callback: (status: string, identity: Uint8Array, reducerArgs: any[]) => void)"
"public static on(callback: (reducerEvent: ReducerEvent, reducerArgs: any[]) => void)"
)
.unwrap();
writeln!(output, "{{").unwrap();
Expand Down

0 comments on commit e1246b6

Please sign in to comment.