diff --git a/types/microstates.d.ts b/types/microstates.d.ts index 0e63030c..45296f3c 100644 --- a/types/microstates.d.ts +++ b/types/microstates.d.ts @@ -56,6 +56,10 @@ declare module "microstates" { slice(start?: number, end?: number): ArrayType sort(fn: (a: any, b: any) => number): ArrayType filter(fn: (member: T) => boolean): ArrayType + map(fn: (member: T) => T): ArrayType + remove(item: any): ArrayType + clear(): ArrayType + initialize(value: any): ArrayType } interface ArrayTypeConstructor { diff --git a/types/types.test.ts b/types/types.test.ts index fdb93441..d684370d 100644 --- a/types/types.test.ts +++ b/types/types.test.ts @@ -117,4 +117,24 @@ describe('ArrayType', () => { a.filter((item) => (item.state + '!!!') === 'hello!!!') ) }); + it('has map transition that returns ArrayType', () => { + expectType>( + a.map(item => item.concat('!!!')) + ) + }); + it('has remove transition that returns ArrayType', () => { + expectType>( + a.remove('hello') + ) + }); + it('has clear transition that returns ArrayType', () => { + expectType>( + a.clear() + ) + }); + it('has initialize transition taht returns ArrayType', () => { + expectType>( + a.initialize('foo') + ) + }); });