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

Fix type defs for .with() and .clone() #104

Closed
dbushong opened this issue Oct 4, 2019 · 2 comments · Fixed by #106
Closed

Fix type defs for .with() and .clone() #104

dbushong opened this issue Oct 4, 2019 · 2 comments · Fixed by #106
Labels

Comments

@dbushong
Copy link
Member

dbushong commented Oct 4, 2019

The return values for

gofer/lib/typedefs.d.ts

Lines 23 to 25 in 02c190f

clone(): Gofer;
with(opts: Gofer.Opts): Gofer;
shouldn't be Gofer - they should be whatever the subclass is - I'm not sure how to properly declare this in typescript

@dbushong dbushong added the bug label Oct 4, 2019
@jkrems
Copy link
Collaborator

jkrems commented Oct 5, 2019

There's the magical this annotation that may help.

Screen Shot 2019-10-05 at 10 52 30 AM

@dbushong
Copy link
Member Author

dbushong commented Oct 7, 2019

Thanks! I saw the this syntax, but assumed it meant you had to be returning the exact same object - but I guess it really doesn't matter from a typing perspective - at least at the level of detail we're currently using.

dbushong added a commit that referenced this issue Oct 7, 2019
* `clone()` and `with()` now return `this` type
* type sig added for `getMergedOptions()`
* made `endpointName` optional in FetchOpts
* make Opts more open to allow for custom opts
* run typedefs thru prettier --single-quote

Fixes: #104
Fixes: #105
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants