I'm a beginner with TypeScript and I want to learn how to create a declaration file for a custom JavaScript function. I attempted to do this, however, I encountered an error stating "Could not find a declaration file for module './main'." Additionally, IntelliSense is not working in the 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 }
`