11import { describe , test , expect } from "vitest"
22import { FastEvent } from "../event"
3- import { FastEventListener } from '../types' ;
3+ import { TypedFastEventListener } from '../types' ;
44
55
66describe ( "退订事件" , ( ) => {
@@ -91,7 +91,7 @@ describe("退订事件", () => {
9191 test ( "根据事件类型和监听器进行退订" , ( ) => {
9292 const emitter = new FastEvent ( )
9393 const events : string [ ] = [ ]
94- const listener : FastEventListener < string , number > = ( ( { payload, type } ) => {
94+ const listener : TypedFastEventListener < string , number > = ( ( { payload, type } ) => {
9595 expect ( type ) . toBe ( "x" )
9696 expect ( payload ) . toBe ( 1 )
9797 events . push ( type )
@@ -105,7 +105,7 @@ describe("退订事件", () => {
105105 test ( "多级事件根据事件类型和监听器进行退订" , ( ) => {
106106 const emitter = new FastEvent ( )
107107 const events : string [ ] = [ ]
108- const listener : FastEventListener < string , number > = ( ( { payload, type } ) => {
108+ const listener : TypedFastEventListener < string , number > = ( ( { payload, type } ) => {
109109 expect ( type ) . toBe ( "a/b/c/d" )
110110 expect ( payload ) . toBe ( 1 )
111111 events . push ( type )
@@ -122,7 +122,7 @@ describe("退订事件", () => {
122122 test ( "通配符事件退订" , ( ) => {
123123 const emitter = new FastEvent ( )
124124 const events : string [ ] = [ ]
125- const listener : FastEventListener < string , number > = ( { payload, type } ) => {
125+ const listener : TypedFastEventListener < string , number > = ( { payload, type } ) => {
126126 expect ( type ) . toBe ( "a/b/c/d" )
127127 expect ( payload ) . toBe ( 1 )
128128 events . push ( type )
@@ -139,7 +139,7 @@ describe("退订事件", () => {
139139 test ( "退订指定的监听器" , ( ) => {
140140 const emitter = new FastEvent ( )
141141 const events : string [ ] = [ ]
142- const listener : FastEventListener < string , number > = ( { payload, type } ) => {
142+ const listener : TypedFastEventListener < string , number > = ( { payload, type } ) => {
143143 expect ( type ) . toBe ( "a/b/c/d" )
144144 expect ( payload ) . toBe ( 1 )
145145 events . push ( type )
@@ -159,7 +159,7 @@ describe("退订事件", () => {
159159 test ( "退订指定的事件时不指定监听器" , ( ) => {
160160 const emitter = new FastEvent ( )
161161 const events : string [ ] = [ ]
162- const listener : FastEventListener < string , number > = ( { payload, type } ) => {
162+ const listener : TypedFastEventListener < string , number > = ( { payload, type } ) => {
163163 events . push ( type )
164164 }
165165 emitter . on ( "a" , listener )
@@ -180,7 +180,7 @@ describe("退订事件", () => {
180180 test ( "退订所有监听器" , ( ) => {
181181 const emitter = new FastEvent ( )
182182 const events : string [ ] = [ ]
183- const listener : FastEventListener < string , number > = ( { payload, type } ) => {
183+ const listener : TypedFastEventListener < string , number > = ( { payload, type } ) => {
184184 events . push ( type )
185185 }
186186 emitter . on ( "a" , listener )
@@ -205,7 +205,7 @@ describe("退订事件", () => {
205205 test ( "退订含通配符的事件" , ( ) => {
206206 const emitter = new FastEvent ( )
207207 const events : string [ ] = [ ]
208- const listener : FastEventListener < string , number > = ( { payload, type } ) => {
208+ const listener : TypedFastEventListener < string , number > = ( { payload, type } ) => {
209209 events . push ( type )
210210 }
211211 emitter . on ( "a" , listener )
@@ -230,7 +230,7 @@ describe("退订事件", () => {
230230 test ( "退订含通配符的事件" , ( ) => {
231231 const emitter = new FastEvent ( )
232232 const events : string [ ] = [ ]
233- const listener : FastEventListener < string , number > = ( { payload, type } ) => {
233+ const listener : TypedFastEventListener < string , number > = ( { payload, type } ) => {
234234 events . push ( type )
235235 }
236236 emitter . on ( "a/*" , listener )
@@ -252,7 +252,7 @@ describe("退订事件", () => {
252252 test ( "退订多层含通配符的事件" , ( ) => {
253253 const emitter = new FastEvent ( )
254254 const events : string [ ] = [ ]
255- const listener : FastEventListener < string , number > = ( { payload, type } ) => {
255+ const listener : TypedFastEventListener < string , number > = ( { payload, type } ) => {
256256 events . push ( type )
257257 }
258258 emitter . on ( "a/*" , listener )
0 commit comments