Skip to content

Correct getRandom response type#164

Merged
OliverJAsh merged 1 commit into
masterfrom
fix/get-random-response-type
May 6, 2021
Merged

Correct getRandom response type#164
OliverJAsh merged 1 commit into
masterfrom
fix/get-random-response-type

Conversation

@OliverJAsh
Copy link
Copy Markdown
Contributor

Fixes #163

@OliverJAsh OliverJAsh requested a review from a team as a code owner March 2, 2021 20:53
@OliverJAsh OliverJAsh requested a review from Magellol March 2, 2021 20:53
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 2, 2021

size-limit report 📦

Path Size
dist/unsplash-js.cjs.production.min.js 4 KB (0%)
dist/unsplash-js.esm.js 4 KB (0%)

}),
),
handleResponse: castResponse<Photo.Random>(),
handleResponse: castResponse<
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing there isn't an easy way to model this so the types convey that information instead? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah I thought about that. Options:

  • Overloads (a pain to work with, especially here because we're using function composition instead of function declarations)
  • Two separate functions, one with count, one without

I'm not sure it's worth it at this point, we could see what feedback we get from users. WDYT?

@OliverJAsh OliverJAsh merged commit 07fe4c8 into master May 6, 2021
@OliverJAsh OliverJAsh deleted the fix/get-random-response-type branch May 6, 2021 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getRandom is always cast to Photo.Random but can return an array

2 participants