-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
Lets say I have an object type that represents the template of other more specific types. How does one define the more specific type so that the following usecase does not fail?
Here's a failing attempt:
type Data<T1> = {
loading: boolean,
error: string,
fetch: (options: {
update: (prevResult: T1, moreData: { moreResult: T1, moreVar: Object }) => Object
}) => void
}
type SpecificData<T1> = Data<T1> & {
items: Array<string>
}
const f = (data: SpecificData<SpecificData>) => ({
data,
loadMore: () => {
data.fetch({
update: (prevResult, { moreResult, moreVar }) => ({
items: [...prevResult.items, ...moreResult.items]
})
})
}
})Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels