I'm new to TypeScript and I want to know how to write declaration file for custom JavaScript function. I tried this, but it give me error "Could not find a declaration file for module './main'." and don't give any IntelliSense in index.ts file.
main.js
var maths={ sum:function (a,b){ console.log(a+b)}}
module.exports=maths;
index.ts
import * as mt from "./main"
mt.sum(2,5);
type.d.ts
declare module 'main' {
export function sum(a:number,b:number):void }
`