@@ -4,7 +4,7 @@ import {createMemo, createSignal, useContext} from 'solid-js';
44import type { Id } from '../@types/index.d.ts' ;
55import type { ProviderProps } from '../@types/ui-solid/index.d.ts' ;
66import { arrayNew , arrayWith } from '../common/array.ts' ;
7- import { objDel , objGet , objHas } from '../common/obj.ts' ;
7+ import { IdObj , objDel , objGet , objHas } from '../common/obj.ts' ;
88import { ExtraThingsById , ThingsById } from './common/index.tsx' ;
99import { Context , ContextValue , ThingsByOffset } from './context.ts' ;
1010
@@ -47,7 +47,7 @@ const EMPTY_CONTEXT = () => [] as ContextValue;
4747
4848export const Provider = (
4949 props : ProviderProps & { readonly children : JSXElement } ,
50- ) : any => {
50+ ) : JSXElement => {
5151 const parentValue =
5252 useContext ( Context ) ?? ( EMPTY_CONTEXT as Accessor < ContextValue > ) ;
5353 const [ extraThingsById , setExtraThingsById ] = createSignal < ExtraThingsById > (
@@ -60,12 +60,17 @@ export const Provider = (
6060 thing : ThingsByOffset [ Offset ] ,
6161 ) : void => {
6262 setExtraThingsById ( ( extraThingsById ) =>
63- objGet ( extraThingsById [ thingOffset ] as any , id ) == thing
63+ objGet (
64+ extraThingsById [ thingOffset ] as IdObj < ThingsByOffset [ Offset ] > ,
65+ id ,
66+ ) == thing
6467 ? extraThingsById
6568 : ( arrayWith ( extraThingsById , thingOffset , {
66- ...extraThingsById [ thingOffset ] ,
69+ ...( extraThingsById [ thingOffset ] as IdObj <
70+ ThingsByOffset [ Offset ]
71+ > ) ,
6772 [ id ] : thing ,
68- } as any ) as ExtraThingsById ) ,
73+ } as ThingsById < ThingsByOffset > [ Offset ] ) as ExtraThingsById ) ,
6974 ) ;
7075 } ;
7176
@@ -76,7 +81,12 @@ export const Provider = (
7681 : ( arrayWith (
7782 extraThingsById ,
7883 thingOffset ,
79- objDel ( extraThingsById [ thingOffset ] as any , id ) ,
84+ objDel (
85+ extraThingsById [ thingOffset ] as IdObj <
86+ ThingsByOffset [ typeof thingOffset ]
87+ > ,
88+ id ,
89+ ) ,
8090 ) as ExtraThingsById ) ,
8191 ) ;
8292 } ;
0 commit comments