I have read similiar questions including tsc throws `TS2307: Cannot find module` for a local file .
I have a privat external module (on a local git server) and I try to include that into my application - this works.
- phpStorm can resolve the classes perfectly!
- the app throws the error TS2307 but runs perfectly!
I wonder why the transpiler throws this error although everything looks fine and I need this error to be gone for a stable deployment.
The module tsconfig.json looks like:
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "ES6",
"typeRoots": [
"node_modules/@types"
],
"sourceMap": false,
"noImplicitAny": false,
"declaration": true,
"noResolve": false
},
"version": "2.0.0"
}
I tried several combinations of the above without success.
I have a Main.ts
in the module like
export {default as Logger} from "./Logger";
export {ILogger as ILogger} from './ILogger';
Where the class and the interface are
export interface ILogger { }
export default class Logger implements ILogger { }
And in the app I use:
import {Logger, ILogger} from "logging";
The error happens when I try to transpile the app, not the module. Again, everything works when running the app through node and when coding in phpStorm but on transpiling I get:
src/Main.ts(9,39): error TS2307: Cannot find module 'logging'.
Update:
Looks like a bug in tsc
: https://github.com/Microsoft/TypeScript/issues/14332