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

type: fix type error on SWRConfig #1913

Merged
merged 1 commit into from Apr 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/utils/config-context.ts
@@ -1,4 +1,11 @@
import { createContext, createElement, useContext, useState, FC } from 'react'
import {
createContext,
createElement,
useContext,
useState,
FC,
PropsWithChildren
} from 'react'
import { cache as defaultCache } from './config'
import { initCache } from './cache'
import { mergeConfigs } from './merge-config'
Expand All @@ -13,12 +20,14 @@ import {

export const SWRConfigContext = createContext<Partial<FullConfiguration>>({})

const SWRConfig: FC<{
value?: SWRConfiguration &
Partial<ProviderConfiguration> & {
provider?: (cache: Readonly<Cache>) => Cache
}
}> = props => {
const SWRConfig: FC<
PropsWithChildren<{
value?: SWRConfiguration &
Partial<ProviderConfiguration> & {
provider?: (cache: Readonly<Cache>) => Cache
}
}>
> = props => {
const { value } = props

// Extend parent context values and middleware.
Expand Down