When I try to run the angular server to test the project it fails to compile with the following error:
ERROR in ./src/app/shared/objeto/Venda.ts
Module build failed: Error: F:\Xampp\htdocs\www\Angular\fidaliza\src\app\shared\objeto\Venda.ts is missing from the TypeScript compilation.
Please make sure it is in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (F:\Xampp\htdocs\www\Angular\fidaliza\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:674:23)
at plugin.done.then (F:\Xampp\htdocs\www\Angular\fidaliza\node_modules\@ngtools\webpack\src\loader.js:467:39)
at <anonymous>
everything was working normal until I created this class:
export class Venda {
venda_cliente: string;
venda_loja: string;
venda_cupom: number;
venda_produtos: number;
venda_valor: number;
venda_resgate: number;
venda_dtresgate: string;
resgatar: boolean;
}
The error occurs when this line is executed:
@Input() venda: Venda = new Venda();
When I comment on the above line it runs normal the application, I already tried to include the path in tsconfig.app
and tsconfig.spec
but did not solve.
tsconfig.app.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
tsconfig.spec.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
resgatar.component.ts
import { Component, OnInit, Input } from '@angular/core';
import { routerTransition } from '../../../router.animations';
import { ClientesService } from '../../../shared/services /clientes.service';
import { VendasService } from '../../../shared/services/vendas.service';
import { Cliente } from '../../../shared/objeto/cliente';
import { Venda } from '../../../shared/objeto/Venda';
import { FormBuilder, FormGroup } from '@angular/forms';
@Component({
selector: 'app-resgatar',
templateUrl: './resgatar.component.html',
styleUrls: ['./resgatar.component.scss'],
animations: [routerTransition()],
})
export class ResgatarComponent implements OnInit {
@Input() venda: Venda = new Venda();
{restante da classe acho que não é util pois só tem funções de botões}
When I did this include
"include: ["**/*.d.ts"]
ontsconfig.app.json
not on compilation error, but the application just keeps loading and no error appears on the console!