import type { Middleware } from 'redux' ; export function getTimeMeasureUtils ( maxDelay , fnName ) { let elapsed = 0 ; return { measureTime < T > ( fn ) { const started = Date . now ( ) ; try { return fn ( ) ; } finally { const finished = Date . now ( ) ; elapsed += finished - started ; } } , warnIfExceeded ( ) { if ( elapsed > maxDelay ) { console . warn ( `${ fnName } took ${ elapsed }ms, which is more than the warning threshold of ${ maxDelay }ms. 
If your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.
It is disabled in production builds, so you don't need to worry about that.` ) ; } } , } ; } public export class MiddlewareArray < Middlewares extends Middleware < any , any > > extends Array < Middlewares > { constructor ( arrayLength ? ) ; constructor ( ... items ) ; constructor ( ... args ) { super ( ... args ) ; Object . setPrototypeOf ( this , MiddlewareArray . prototype ) ; } static get [ Symbol . species ] ( ) { return MiddlewareArray as any ; } concat < AdditionalMiddlewares extends ReadonlyArray < Middleware < any , any > > > ( items ) ; concat < AdditionalMiddlewares extends ReadonlyArray < Middleware < any , any > > > ( ... items ) ; concat ( ... arr ) { return super . concat . apply ( this , arr ) ; } prepend < AdditionalMiddlewares extends ReadonlyArray < Middleware < any , any > > > ( items ) ; prepend < AdditionalMiddlewares extends ReadonlyArray < Middleware < any , any > > > ( ... items ) ; prepend ( ... arr ) { if ( arr . length === 1 && Array . isArray ( arr [ 0 ] ) ) { return new MiddlewareArray ( ... arr [ 0 ] . concat ( this ) ) ; } return new MiddlewareArray ( ... arr . concat ( this ) ) ; } }