-
Notifications
You must be signed in to change notification settings - Fork 2
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
URI generics default to Uri
; ConfigBuilder accepts string | Uri
where possible
#81
base: origin-dev
Are you sure you want to change the base?
Conversation
…ccepts Uri | string when possible
Uri
; ConfigBuilder accepts string | Uri
wherepossibleUri
; ConfigBuilder accepts string | Uri
where possible
…nference # Conflicts: # yarn.lock
@@ -118,7 +115,7 @@ export class PolywrapClient extends PolywrapCoreClient { | |||
} | |||
|
|||
@Tracer.traceMethod("PolywrapClient: invoke") | |||
public async invoke<TData = unknown, TUri extends Uri | string = string>( | |||
public async invoke<TData = unknown, TUri extends Uri | string = Uri>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the default to Uri
doesn't fix #79 , it just flips the coin and requires you to have a Uri
instance if you specify a return type.
The problem is that if you specialize the generic with the first template argument, the second one appears to be required. Instead of using a template argument for TUri
maybe we should just make the actual argument type options: InvokerOptions<Uri | string>
and we can determine the type within the function's body. This way if you specialize the first template argument, there isn't a second one that needs to be specified as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, my mistake. I misunderstood. I read "...instead of String we should support that the default is Uri" and thought we just wanted to modify the generic type. I changed everything to use union types instead, so we should be good to go.
…nference # Conflicts: # yarn.lock
Generic URI types in client are now a union type
Uri | string
Closes #79