@@ -4,11 +4,11 @@ import { MongoInvalidArgumentError } from './error';
44const kPromise = Symbol ( 'promise' ) ;
55
66interface PromiseStore {
7- [ kPromise ] ? : PromiseConstructor ;
7+ [ kPromise ] : PromiseConstructor | null ;
88}
99
1010const store : PromiseStore = {
11- [ kPromise ] : undefined
11+ [ kPromise ] : null
1212} ;
1313
1414/**
@@ -31,7 +31,14 @@ export class PromiseProvider {
3131 * Sets the promise library
3232 * @deprecated Setting a custom promise library is deprecated the next major version will use the global Promise constructor only.
3333 */
34- static set ( lib : PromiseConstructor ) : void {
34+ static set ( lib : PromiseConstructor | null ) : void {
35+ // eslint-disable-next-line no-restricted-syntax
36+ if ( lib === null ) {
37+ // Check explicitly against null since `.set()` (no args) should fall through to validate
38+ store [ kPromise ] = null ;
39+ return ;
40+ }
41+
3542 if ( ! PromiseProvider . validate ( lib ) ) {
3643 // validate
3744 return ;
@@ -43,9 +50,7 @@ export class PromiseProvider {
4350 * Get the stored promise library, or resolves passed in
4451 * @deprecated Setting a custom promise library is deprecated the next major version will use the global Promise constructor only.
4552 */
46- static get ( ) : PromiseConstructor {
47- return store [ kPromise ] as PromiseConstructor ;
53+ static get ( ) : PromiseConstructor | null {
54+ return store [ kPromise ] ;
4855 }
4956}
50-
51- PromiseProvider . set ( global . Promise ) ;
0 commit comments