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

Move named exports to properties of default export #205

Closed
sholladay opened this issue Nov 15, 2019 · 0 comments · Fixed by #206
Closed

Move named exports to properties of default export #205

sholladay opened this issue Nov 15, 2019 · 0 comments · Fixed by #206
Labels
enhancement New feature or request

Comments

@sholladay
Copy link
Collaborator

sholladay commented Nov 15, 2019

We want to restructure the exports of Ky to only use export default and no named exports. This involves attaching HTTPError and TimeoutError to the Ky instance and removing the existing export statements for them.

The reasoning behind this:

  • ky.TimeoutError is clearer than just TimeoutError
  • The current situation of mixing default and named exports hurts the ergonomics for CommonJS users since they have to use ky.default
  • The alternative is to only use named exports, but then what would we name the current default export? import { ky } from 'ky' would be a bit strange and import * as ky would then involve using ky.ky, which almost seems worse than ky.default. We should just stick to using either named exports or the default export. In Ky's case, default export seems to make the most sense.

See discussion in #198 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants