Until just recently, when running my program to test that it all works, I get an error when I try to import my types.d.ts, but only when I import it in two files, all other files are completely fine. (File Structure: https://i.sstatic.net/LPVBc.jpg)
index.ts import:
import { CommandJSONExport, CommandInterface } from "./Definitions/types";
handlers.ts import:
import { CommandInterface, CommandJSONExport, ConstructorOptions } from "../Definitions/types";
The Error Message:
Error: Cannot find module '../Definitions/types'
Require stack:
- F:\Coding\Command Handler\Handlers\handlers.ts
- F:\Coding\Command Handler\index.ts
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (C:\Users\sebas\AppData\Roaming\npm\node_modules\ts-node\node_modules\@cspotcode\source-map-support\source-map-support.js:679:30)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (F:\Coding\Command Handler\Handlers\handlers.ts:3:1)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Module.m._compile (C:\Users\sebas\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1371:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\sebas\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1374:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'F:\\Coding\\Command Handler\\Handlers\\handlers.ts',
'F:\\Coding\\Command Handler\\index.ts'
]
}
(Note: The folder I am working in ATM is the 'Command Handler' folder) UPDATE: Getting rid of the types.d.ts import in my handlers.ts file fixes the error, but it still causes problems for me in other ways so I still need it to be imported.