VS Code + Typescript reporting irrelevant errors on files inside platforms directory


#1

Hi all,

I suddenly have an annoying and puzzling problem that I didn’t have before.

I use VS Code and TypeScript (but no Angular).

Suddenly, VS Code has started to report TypeScript “errors” that aren’t really errors…

Look:

As you can see, it is reporting the “error” to be INSIDE the platforms\android\src\main\assets\app directory. Red squiggly line under “application”, indicating that module “application” is not found.

The actual TypeScript file in my app directory however, doesn’t show this error:

And, strangely enough, compilation (I use LiveSync from the command line) works fine!

VS Code is configured (.vscode\settings.json) to not show platform and node_modules directories, and TypeScript is configured (tsconfig.json) to not compile platform and node_modules directories.

How do I make VS Code / TypeScript not report “errors” on files inside the platforms directory?

:slight_smile:


#2

This is really dumb sounding, but have you quit and restarted VSCode. I sometimes have to do that when encountering the squigglies from hell…


#3

Hi Jen,

Yes, of course. In fact, I was having some other problems (Node.js seemed to be corrupt somehow), so I uninstalled everything, except the Android SDK. I uninstalled Node.js, Visual Studio Code, etc.

After reinstallation, the problem have gone, except the squiggly lines.

So, I now have a working setup, no real problems, but VS Code still displays the (non-fatal) errors about not being able to compile the files within the platforms directory.

No big deal. Just a bit annoying, and strange.

Thanks Jen :slight_smile:


#4

If you’re on 3.0 - try resolving the core-modules with tns-core-modules/... like tns-core-modules/platform. Assuming you have the tsconfig setup correctly and are on 3.0 this should help with module resolution.