I am working with a pure JavaScript library without any TypeScript declarations, so I have added this (which isn't working):
declare module '@drumwork/tone' {
declare let mod = function (str: string): string
mod.list = (str: string) => Array<string>
export default mod
}
My functions' implementations are basically like this:
function main(str) {
// return some newly generated string
return str + str
}
main.list = (str) => [...str]
export default main
Given that the implementation is pure JavaScript and is somewhat like that, how do I do a declare module
in TypeScript?
The documentation says to do this, but it doesn't do what I'm describing exactly:
declare module '@drumwork/tone' {
export default function (str: string): string
export function list(str: string): Array<{ i: string; o: string }>
}