-
Notifications
You must be signed in to change notification settings - Fork 16
Expose client.endpoints attribute (fixes #641) #742
Conversation
The first use case (overriding a default endpoint) will work just fine in TypeScript, but the second use case (custom endpoints) might get a bit tricky to represent both accurately and safely as a class property. What if we suggested users create their own const endpoints = {
...client.endpoints,
changeset: (bucket: string, coll: string) =>
`${client.endpoints.collection(bucket, coll)}/changeset`
}; This would allow TypeScript to correctly type all the properties of |
0f36e49
to
a18b9db
Compare
Thanks! Based on your feedback (and Ethan's in #743 ) I changed my strategy and I don't think we need the use case of adding of a new endpoint. |
Size Change: +135 B (0%) Total Size: 38.4 kB
|
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.
Nice work! I really like how you figured out a nicer way to stub out the request method.
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.
LGTM but Dylan's review should supersede mine :)
Thanks for your help @dstaley! I think we're good here, I'll merge :) |
For Kinto/kinto.js#1751, I was thinking of something like this. Usage would be:
What do you think?