ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property

Solution 1:

I had same problem, after 2 hour searching i finally found solution. In my case (i'm using Angular), i just set typescript related path into tsconfig.app.json(ATTENTION: file name is not tsconfig.json). another way is set entire typescript path into include section in tsconfig.app.json file (see below example).

in tsconfig.app.json change:

"files": [
    ...,
    "node_modules/jqwidgets-scripts/jqwidgets-ts/angular_jqxbargauge.ts"
  ],

or

"include": [
    ...,
    "node_modules/jqwidgets-scripts/jqwidgets-ts/**/*.ts"
  ],

Solution 2:

05-09-2020

Angular 10

My issue was an invalid case of the component path due to copy/paste error :D

Wrong:

import { RegisterComponent } from './Register/Register.component';

Correct:

import { RegisterComponent } from './register/register.component';

Solution 3:

In my case had a case mistake while importing the class in another component:

import { MyClass } from '../../../shared/models/Myclass';

The file was called MyClass.ts (capital C) and import from ../../../Myclass (lower c).

Solution 4:

There are three scenarios that can cause this warning.

In the explanation below I will assume a src/scripts/example.ts file which causes the warning.

Scenario 1) You include the wrong path. For example src/scts/example.ts

Scenario 2) You created the file, but you do not include it anywhere inside your project.

Scenario 3) You try to import it asynchronously using import() but you do not import it synchronously anywhere inside your project.

Angular + Webpack needs to know where the file is. When you import it synchronously in at least one of your project files that are part of an angular app (component, service, directive, pipe, module, etc) then due to that import statement angular will detect and keep in mind that this typescript module exists.

But if you create the .ts file without importing it anywhere, maybe because you want to import it dynamically later at runtime, then you need to include it at the tsconfig.app.json. NOT at tsconfig.json, this is important!