Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS Client: Uri inference in invocation #79

Open
krisbitney opened this issue Sep 14, 2023 · 0 comments · May be fixed by #81
Open

JS Client: Uri inference in invocation #79

krisbitney opened this issue Sep 14, 2023 · 0 comments · May be fixed by #81
Assignees

Comments

@krisbitney
Copy link
Contributor

krisbitney commented Sep 14, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant