-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: bson-4.2.0
-
Component/s: BSON
-
Empty show more show less
Hi,
When using TypeScript overload, the last type (the one used for the implementation) is not exported in the `d.ts` file. Because of this there are only two signature for the `EJSON.stringify` function:
export function stringify(value: SerializableTypes): string; export function stringify(value: SerializableTypes, options?: EJSON.Options): string;
To fix this, you need 3 function overloads (plus the implementation signature):
export function stringify(value: SerializableTypes): string; export function stringify(value: SerializableTypes, options?: EJSON.Options): string; export function stringify( value: SerializableTypes, replacer?: (number | string)[] | ((this: any, key: string, value: any) => any), space?: string | number, options?: EJSON.Options): string; export function stringify( value: SerializableTypes, replacer?: (number | string)[] | ((this: any, key: string, value: any) => any) | EJSON.Options, space?: string | number, options?: EJSON.Options): string { // ... }