I am currently working on creating an index.d.ts
file specifically for canonical-json
. Below is my attempted code:
declare module 'canonical-json' {
export function stringify(s: any): string;
}
I have also experimented with the following snippets:
declare namespace JSON {
export function stringify(s:any):string;
}
export = JSON;
And
export as namespace JSON;
export const stringify: (o:any) => string;
However, I keep encountering the error message:
canonical_json_1.stringify is not a function
This issue persists across all three attempts that I have made.
For reference, here is the Stackblitz link: https://stackblitz.com/edit/typescript-cryptojs?file=src%2F%40types%2Fcanonical-json%2Findex.d.ts