diff --git a/src/bindings.ts b/src/bindings.ts index 3971d9c..54ade84 100644 --- a/src/bindings.ts +++ b/src/bindings.ts @@ -64,6 +64,9 @@ export interface IMongoCryptContext { get state(): number; } +/** + * All options that can be provided to a C++ MongoCrypt constructor. + */ export type MongoCryptConstructorOptions = { kmsProviders?: Uint8Array; schemaMap?: Uint8Array; @@ -132,7 +135,7 @@ export type ExplicitEncryptionContextOptions = NonNullable< Parameters[1] >; export type DataKeyContextOptions = NonNullable[1]>; -export type MongoCryptOptions = MongoCryptConstructorOptions; +export type MongoCryptOptions = Omit; export type MongoCryptErrorWrapper = MongoCryptOptions['errorWrapper']; // export const diff --git a/src/index.ts b/src/index.ts index 0cbba09..72447d6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -96,10 +96,7 @@ export class MongoCrypt implements IMongoCrypt { constructor(options: MongoCryptOptions) { // Pass in JS cryptoCallbacks implementation by default. // If the Node.js openssl version is supported this will be ignored. - this.mc = new mc.MongoCrypt( - // @ts-expect-error: intentionally passing in an argument that will throw to preserve existing behavior - options == null || typeof options !== 'object' ? undefined : { cryptoCallbacks, ...options } - ); + this.mc = new mc.MongoCrypt({ cryptoCallbacks, ...options }); this.errorWrapper = options.errorWrapper;