File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -528,17 +528,8 @@ export class Activator implements ActivationHandler {
528528 }
529529
530530 public bindCurrentRandom < T extends ( ...args : any [ ] ) => any > ( fn : T ) : T {
531- const storage = ( this . currentRandomStorage ??= new AsyncLocalStorage < ScopedWorkflowRandomSource | undefined > ( ) ) ;
532- const randomSource = storage . getStore ( ) ;
533- const bind = (
534- AsyncLocalStorage as typeof AsyncLocalStorage & {
535- bind ?: < F extends ( ...args : any [ ] ) => any > ( fn : F ) => F ;
536- }
537- ) . bind ;
538- if ( bind ) {
539- return storage . run ( randomSource , ( ) => bind ( fn ) ) as T ;
540- }
541- return ( ( ...args : Parameters < T > ) => storage . run ( randomSource , ( ) => fn ( ...args ) ) ) as unknown as T ;
531+ const randomSource = this . currentRandomStorage ?. getStore ( ) ;
532+ return ( ( ...args : Parameters < T > ) => this . withRandomSource ( randomSource , ( ) => fn ( ...args ) ) ) as unknown as T ;
542533 }
543534
544535 public currentRandom ( ) : number {
You can’t perform that action at this time.
0 commit comments