Skip to content

JS Client: Uri inference in invocation #79

Open
@krisbitney

Description

@krisbitney

Our invoke function in the JS client looks like this:

  public async invoke<TData = unknown, TUri extends Uri | string = string>(
    options: InvokerOptions<TUri>
  ): Promise<InvokeResult<TData>> {
    return super.invoke({
      ...options,
      uri: Uri.from(options.uri),
    });
  }

There is a problem in how the generics are defined, in which if we pass a generic for the result type, the Uri must be a string (unless its defined). For example, if we do this:

  const t = await client.invoke<String>({
    uri: new Uri("wrap/polywrap"),
    method: "h"
  })
}

It will complain because the uri is of type Uri, instead of String we should support that the default is Uri

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions