Issue
Very strange issue. I have angular project (vs code as IDE). I add new file named 'log-logger'
with empty class 'LogLogger'
.
export class LogLogger{
}
I want to import this class in other file from other directory (but obviously the same project). So i made instance of this class in other:
import {LogLogger} from '@app/core/helpers/log-logger';
export MyOtherClass{
let x = new LogLogger();
}
What is funny - import has been added by "quick-fix" hint, but I still have error:
Cannot find module '@app/core/helpers/log-logger' or its corresponding type declarations.ts(2307)
Path is valid.
No difference between path @app/core/...
and ../../helpers/log-logger
WARNING: It's a minimal reproducible example. In my real project both classes are much more bigger, and class which I showed as LogLogger has constructor,many fields, and few methods.
Solution
I fixed it. Remember that if you adding new file with new class add extension at the end of the name of file. In my case log-logger.ts
- IDE (VS Code) didn't show any error, class was properly colored and everything seemed to be fine.
Answered By - The Trainer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.