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

Update data-fetching.md #27018

Merged
merged 4 commits into from
Jul 8, 2021
Merged

Update data-fetching.md #27018

merged 4 commits into from
Jul 8, 2021

Conversation

papaponmx
Copy link
Contributor

@papaponmx papaponmx commented Jul 8, 2021

Improve typing for use with Typescript example

Improve typing for use with Typescript example
timneutkens
timneutkens previously approved these changes Jul 8, 2021
styfle
styfle previously approved these changes Jul 8, 2021
@ijjk ijjk dismissed stale reviews from styfle and timneutkens via 7a3b05c July 8, 2021 17:44
@kodiakhq kodiakhq bot merged commit 1c2b171 into vercel:canary Jul 8, 2021
@papaponmx papaponmx deleted the patch-1 branch July 8, 2021 17:59
@pcjmfranken
Copy link

pcjmfranken commented Jul 10, 2021

The type GetStaticProps already implements this type constraint for its context argument. Redundantly adding it again makes no sense and could even break URL parameter type inference.

Not a big deal but this docs change should probably be reverted.

The GetStaticProps type, argument type included by default:

export type GetStaticProps<
  P extends { [key: string]: any } = { [key: string]: any },
  Q extends ParsedUrlQuery = ParsedUrlQuery
> = (
  context: GetStaticPropsContext<Q>
) => Promise<GetStaticPropsResult<P>> | GetStaticPropsResult<P>

Intellisense also works fine following the previous doc's implementation:
image

styfle added a commit that referenced this pull request Jul 13, 2021
@styfle
Copy link
Member

styfle commented Jul 13, 2021

Good point! Reverted in #27148

kodiakhq bot pushed a commit that referenced this pull request Jul 13, 2021
flybayer pushed a commit to blitz-js/next.js that referenced this pull request Aug 19, 2021
Improve typing for use with Typescript example

<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order to make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below.
Choose the right checklist for the change that you're making:

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [X] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [X] Make sure the linting passes
flybayer pushed a commit to blitz-js/next.js that referenced this pull request Aug 19, 2021
@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants