0

Please or Register to create posts and topics.

Visual Studio 2017 displays errors even though the code is correct

Hi,

I use the pro QuickApp Pro.

I get follow error message:
Severity Code Description Project file line suppression state
Error TS2304 (TS) The name "require" was not found. QuickApp.Pro C:\Users\Ingo\Source\repos\TipWeb\QuickApp.Pro\ClientApp\src\app\Services\app-active translation.service.ts 109

case "en":
  return Observable.of(require("../assets/locale/en.json"));

This is the original code

or

Severity Code Description Project file line suppression state
Error TS2322 (TS) The type "Observable <{} | T>" can not be assigned to the type "Observable <T>".
The type "{} | T" can not be assigned to the type "T".
The type "{}" can not be assigned to the type "T". QuickApp.Pro C:\Users\Ingo\Source\repos\TipWeb\QuickApp.Pro\ClientApp\src\app\tip-services\bank active endpoint.service.ts 30

getBanksEndpoint<T>(page?: number, pageSize?: number): Observable<T> {
    let endpointUrl = page && pageSize ? `${this._banksUrl}/${page}/${pageSize}` : this._banksUrl;

    return this.http.get<T>(endpointUrl, this.getRequestHeaders())
        .catch(error => {
            return this.handleError(error, () => this.getBanksEndpoint(page, pageSize));
        });
}

This code are ok. What can I do??

regards Ingo

If your import statements are there and you didn't change the package.json then I would suggest to remove the node_modules folder and make an npm install again.

rm -rf node_modules/
npm cache clean
npm install