diff --git a/packages/core/src/QueryBuilder.ts b/packages/core/src/QueryBuilder.ts index 546365e3..94d3547c 100644 --- a/packages/core/src/QueryBuilder.ts +++ b/packages/core/src/QueryBuilder.ts @@ -228,7 +228,15 @@ export default class Query< return new Query([ ...this.#instructions, { instruction: "fetch-constant", pallet, constant }, - ]); + // TODO: remove manual type hint once all TypeScript environments + // i.e. StackBlitz can infer this correctly + ]) as Query< + [ + ...TInstructions, + { instruction: "fetch-constant"; pallet: TPallet; constant: TConstant }, + ], + TDescriptor + >; } readStorage< @@ -241,7 +249,20 @@ export default class Query< return new Query([ ...this.#instructions, { instruction: "read-storage", pallet, storage, args }, - ]); + // TODO: remove manual type hint once all TypeScript environments + // i.e. StackBlitz can infer this correctly + ]) as Query< + [ + ...TInstructions, + { + instruction: "read-storage"; + pallet: TPallet; + storage: TStorage; + args: TArguments; + }, + ], + TDescriptor + >; } readStorages< @@ -254,7 +275,21 @@ export default class Query< return new Query([ ...this.#instructions, { instruction: "read-storage", pallet, storage, args, multi: true }, - ]); + // TODO: remove manual type hint once all TypeScript environments + // i.e. StackBlitz can infer this correctly + ]) as Query< + [ + ...TInstructions, + { + instruction: "read-storage"; + pallet: TPallet; + storage: TStorage; + args: TArguments; + multi: true; + }, + ], + TDescriptor + >; } readStorageEntries< @@ -269,7 +304,20 @@ export default class Query< return new Query([ ...this.#instructions, { instruction: "read-storage-entries", pallet, storage, args }, - ]); + // TODO: remove manual type hint once all TypeScript environments + // i.e. StackBlitz can infer this correctly + ]) as Query< + [ + ...TInstructions, + { + instruction: "read-storage-entries"; + pallet: TPallet; + storage: TStorage; + args: TArguments; + }, + ], + TDescriptor + >; } callApi< @@ -282,7 +330,20 @@ export default class Query< return new Query([ ...this.#instructions, { instruction: "call-api", pallet, api, args }, - ]); + // TODO: remove manual type hint once all TypeScript environments + // i.e. StackBlitz can infer this correctly + ]) as Query< + [ + ...TInstructions, + { + instruction: "call-api"; + pallet: TPallet; + api: TApi; + args: TArguments; + }, + ], + TDescriptor + >; } callApis< @@ -295,6 +356,20 @@ export default class Query< return new Query([ ...this.#instructions, { instruction: "call-api", pallet, api, args, multi: true }, - ]); + // TODO: remove manual type hint once all TypeScript environments + // i.e. StackBlitz can infer this correctly + ]) as Query< + [ + ...TInstructions, + { + instruction: "call-api"; + pallet: TPallet; + api: TApi; + args: TArguments; + multi: true; + }, + ], + TDescriptor + >; } }