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

Export the options interface #152

Merged
merged 1 commit into from
Jul 21, 2021
Merged

Export the options interface #152

merged 1 commit into from
Jul 21, 2021

Conversation

smitssjors
Copy link
Contributor

@smitssjors smitssjors commented Jul 20, 2021

This allows for writing a wrapper around the factory function to e.g. always pass the NextApiRequest and NextApiResponse generics to the factory function.
I am now unable to type the options object which I would like to pass to the factory function.
Example:

function nextConnectApi<
  T = any,
  Req = NextApiRequest,
  Res = NextApiResponse<T>
>(options?: Options<Req, Res>) {
  return nc<Req, Res>(options);
}

This allows for writing a wrapper around the factory function to e.g. always pass the NextApiRequest and NextApiResponse generics to the factory function.
I am now unable to type the options object which I would like to pass to the factory function.
@changeset-bot
Copy link

changeset-bot bot commented Jul 20, 2021

⚠️ No Changeset found

Latest commit: ac9fb2e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov
Copy link

codecov bot commented Jul 20, 2021

Codecov Report

Merging #152 (ac9fb2e) into master (2b81d76) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #152   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           80        80           
=========================================
  Hits            80        80           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b81d76...ac9fb2e. Read the comment docs.

@smitssjors
Copy link
Contributor Author

I know that you can still import Options even though it is not exported but exporting it is semantically correct and it offers better editor support.

@hoangvvo
Copy link
Owner

lgtm thanks

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

Successfully merging this pull request may close these issues.

2 participants