Skip to content

Commit

Permalink
feat(router): Better autocomplete for <Set>s
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Dec 12, 2024
1 parent 8e1644a commit 44de3a6
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions packages/router/src/Set.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,23 @@ import React from 'react'

import type { AvailableRoutes } from '@redwoodjs/router'

type SetProps<P> = (P extends React.FC ? React.ComponentProps<P> : unknown) & {
type SetProps<P> = (P extends React.FC<any>
? React.ComponentProps<P>
: P extends React.FC<any>[]
? React.ComponentProps<P[0]> &
React.ComponentProps<P[1]> &
React.ComponentProps<P[2]> &
React.ComponentProps<P[3]> &
React.ComponentProps<P[4]> &
React.ComponentProps<P[5]> &
React.ComponentProps<P[6]> &
React.ComponentProps<P[7]> &
React.ComponentProps<P[8]> &
React.ComponentProps<P[9]>
: unknown) & {
/**
* A react component that the children of the Set will be wrapped
* in (typically a Layout component)
* A React component, or an array of React components, that the children of
* the Set will be wrapped in (typically a Layout component and/or a context)
*/
wrap?: P
/**
Expand Down

0 comments on commit 44de3a6

Please sign in to comment.