I try to use a global type but when I do, node crashes without any real error.
My global.d.ts:
import { Method } from 'axios';
declare global {
type AxiosConf = { url: string, method: Method, data: object };
}
export {};
Then, the following code makes node crash:
const postBaseline: AxiosConf = {
url: urlObj.urlStr,
method: urlObj.urlMethod as Method,
data: {}
};
Resulting in [nodemon] app crashed - waiting for file changes before starting....
What is wrong with my code?
I eventually didn't used global declaration, but rather an export of the type and then importing it
types.d.ts:
import { Method } from 'axios';
// Axios config object
export type AxiosConf = { url: string, method: Method, data: object };
When using it:
import { AxiosConf } from "../lib/global/types"