Trato de usar un tipo global, pero cuando lo hago, el nodo falla sin ningún error real.
Mi global.d.ts :
import { Method } from 'axios'; declare global { type AxiosConf = { url: string, method: Method, data: object }; } export {};Luego, el siguiente código hace que el nodo se bloquee:
const postBaseline: AxiosConf = { url: urlObj.urlStr, method: urlObj.urlMethod as Method, data: {} }; Como resultado [nodemon] app crashed - waiting for file changes before starting... .
¿Qué está mal con mi código?
Eventualmente no usé una declaración global, sino una exportación del tipo y luego la importé.
types.d.ts :
import { Method } from 'axios'; // Axios config object export type AxiosConf = { url: string, method: Method, data: object };Al usarlo:
import { AxiosConf } from "../lib/global/types"