@@ -5,11 +5,11 @@ import createSlots from '../../utils/create-slots'
55
66// setup a component with slots
77const { Slots, Slot} = createSlots ( [ 'One' , 'Two' , 'Three' ] )
8- type ContextTypes = { salutation ?: string }
8+ type Props = { context ?: { salutation : string } }
99
10- const ComponentWithSlots : React . FC < React . PropsWithChildren < ContextTypes > > = ( { salutation , children} ) => {
10+ const ComponentWithSlots : React . FC < React . PropsWithChildren < Props > > = ( { context , children} ) => {
1111 return (
12- < Slots context = { { salutation } } >
12+ < Slots context = { context } >
1313 { slots => (
1414 < div >
1515 { slots . One }
@@ -25,9 +25,9 @@ const SlotItem1: React.FC<React.PropsWithChildren<unknown>> = ({children}) => <S
2525const SlotItem2 : React . FC < React . PropsWithChildren < unknown > > = ( { children} ) => < Slot name = "Two" > { children } </ Slot >
2626const SlotItem3 : React . FC < React . PropsWithChildren < unknown > > = ( { children} ) => (
2727 < Slot name = "Three" >
28- { ( context : ContextTypes ) => (
28+ { ( context : Props [ 'context' ] ) => (
2929 < >
30- { context . salutation } { children }
30+ { context ? .salutation } { children }
3131 </ >
3232 ) }
3333 </ Slot >
@@ -64,7 +64,7 @@ describe('ComponentWithSlots', () => {
6464
6565 it ( 'renders with context passed to children' , async ( ) => {
6666 const component = render (
67- < ComponentWithSlots salutation = "hi" >
67+ < ComponentWithSlots context = { { salutation : 'hi' } } >
6868 < SlotItem3 > third</ SlotItem3 >
6969 free form
7070 </ ComponentWithSlots >
0 commit comments