I'm using typescript and not able to use the declared interfaces from another file.
My global.d.ts
looks like this.
declare interface IPropSendEmail {
from: string,
to: string,
subject: string,
html: string,
}
below is tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "./build",
"esModuleInterop": true,
"declaration": true,
"strict": true,
"typeRoots": [
"types"
],
}
}
the directory structure looks like this
| -- src
|-- types
|-- global.d.ts
|-- util
|-- common.ts
|-- ...
using it in common.ts
file
export async function sendEmail({ from, to, subject, html }: IPropSendEmail) {
// function code here
...
}