File 'app/hero.ts' is not a module error in the console, where to store interfaces files in directory structure with angular2?

后端 未结 24 1833
无人共我
无人共我 2020-12-13 07:55

I am doing the angular2 tutorial at this address: https://angular.io/docs/ts/latest/tutorial/toh-pt3.html I have put the hero interface in a single

相关标签:
24条回答
  • 2020-12-13 08:17

    I faced same issue.

    I restarted my server and it works fine. Seems like a bug.

    0 讨论(0)
  • 2020-12-13 08:17

    Sometimes this error occurs when the .ts file is not saved. So make sure all files in the project are saved otherwise try to restart the editor.

    0 讨论(0)
  • 2020-12-13 08:17

    My Resolution,

    In my case, I have created a model file and kept it blank,

    so when I imported it to other model, It gives me error. so write the definition when you create a model typescript file.

    0 讨论(0)
  • 2020-12-13 08:23

    I found that not only did I have to restart Visual Studio Code but the node server process as well before I could get a good compile.

    0 讨论(0)
  • 2020-12-13 08:23

    I was facing same issue, tried restarting my server, reopening editor but computer restart did the magic.

    P.S: I was facing issue on a windows machine and issue occurred when I moved module into a new folder.

    0 讨论(0)
  • 2020-12-13 08:24

    I ran into the same issue in VSC. Did restarted the editor and started the application again. It worked fine.

    0 讨论(0)
提交回复
热议问题