I'm currently in the process of creating a declaration file for h3. For guidance, you can refer to the function available here.
Initially, I'm unsure of how typescript identifies declaration files.
It seems to detect my declaration when placed in a folder such as
/src/@types/<any filename>.d.ts
, containing the following content:
declare module 'h3-js' {
export type h3ToGeoBoundary = any;
...
}
However, I've also come across suggestions to create a folder like /src/@types/h3-js/index.d.ts
, but sadly, it doesn't detect the declaration if done as follows:
export = h3;
export as namespace h3;
declare namespace h3 {
export type h3ToGeoBoundary = () => void; // TODO: correct types
}
Either method seems viable, but I'm uncertain how to export a namespace with the first approach. This results in an error stating
Property 'h3ToGeoBoundary' does not exist on type 'typeof import("h3-js")'.
I'd greatly appreciate assistance in creating a minimal file with a functional export for h3ToGeoBoundary
so that I can further expand upon it.