File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,13 +13,13 @@ export interface BaseOptions<T = any> {
1313 [ key : string ] : any ;
1414}
1515
16- export abstract class Base < T = any > extends ReadyEventEmitter {
17- options : BaseOptions < T > ;
16+ export abstract class Base < T = any , O extends BaseOptions < T > = BaseOptions < T > > extends ReadyEventEmitter {
17+ options : O ;
1818 #closed = false ;
1919 #localStorage: AsyncLocalStorage < T > ;
2020 /* @ts -expect-error just a placeholder, will be implemented in subclass */
2121 protected _close ( ) : Promise < void > ;
22- constructor ( options ?: BaseOptions < T > ) {
22+ constructor ( options ?: O ) {
2323 super ( ) ;
2424
2525 if ( options ?. initMethod ) {
@@ -44,7 +44,7 @@ export abstract class Base<T = any> extends ReadyEventEmitter {
4444 } ) ;
4545 } ) ;
4646 }
47- this . options = options ?? { } ;
47+ this . options = options ?? ( { } as O ) ;
4848 this . #localStorage = this . options . localStorage ?? getAsyncLocalStorage < T > ( ) ;
4949 super . on ( 'error' , err => {
5050 this . _defaultErrorHandler ( err ) ;
You can’t perform that action at this time.
0 commit comments