@@ -45,3 +45,32 @@ it('should handle different key and value types', () => {
4545 expectTypeOf ( map . set ( [ true , 123 , 'hello' ] , { status : 'active' } ) ) . toEqualTypeOf < typeof map > ( ) ;
4646 expectTypeOf ( map . get ( [ false , 456 , 'world' ] ) ) . toEqualTypeOf < DiverseValue | undefined > ( ) ;
4747} ) ;
48+
49+ it ( 'should not accept non-array keys' , ( ) => {
50+ // @ts -expect-error - string key should not be allowed
51+ expectTypeOf < ManyKeysMap < string , any > > ( ) . not . toBeAny ( ) ;
52+
53+ // @ts -expect-error - number key should not be allowed
54+ expectTypeOf < ManyKeysMap < number , any > > ( ) . not . toBeAny ( ) ;
55+
56+ // @ts -expect-error - object key should not be allowed
57+ expectTypeOf < ManyKeysMap < Record < string , unknown > , any > > ( ) . not . toBeAny ( ) ;
58+ } ) ;
59+
60+ it ( 'should not accept undefined or null keys' , ( ) => {
61+ // @ts -expect-error - undefined key should not be allowed
62+ expectTypeOf < ManyKeysMap < undefined , any > > ( ) . not . toBeAny ( ) ;
63+
64+ // @ts -expect-error - null key should not be allowed
65+ expectTypeOf < ManyKeysMap < undefined , any > > ( ) . not . toBeAny ( ) ;
66+ } ) ;
67+
68+ it ( 'should not accept function keys' , ( ) => {
69+ // @ts -expect-error - function key should not be allowed
70+ expectTypeOf < ManyKeysMap < ( ) => void , any > > ( ) . not . toBeAny ( ) ;
71+ } ) ;
72+
73+ it ( 'should not accept symbol keys' , ( ) => {
74+ // @ts -expect-error - symbol key should not be allowed
75+ expectTypeOf < ManyKeysMap < symbol , any > > ( ) . not . toBeAny ( ) ;
76+ } ) ;
0 commit comments