ng-jhipster development creates compilation errors

2019-08-08 02:56发布

问题:

I face the following problem. I cannot test the ng-jhipster module. Steps followed: ng-jhipster: - yarn link - yarn install ( all the steps have been executed correctly)

My project: - yarn link ng-jhipster - yarn start

ERROR in [at-loader] ./src/main/webapp/app/blocks/interceptor/errorhandler.interceptor.ts:5:14 TS2415: Class 'ErrorHandlerInterceptor' incorrectly extends base class 'HttpInterceptor'. Types of property 'requestIntercept' are incompatible. Type '(options?: RequestOptionsArgs) => RequestOptionsArgs' is not assignable to type '(options?: RequestOpt ionsArgs) => RequestOptionsArgs'. Two different types with this name exist, but they are unrelated. Types of parameters 'options' and 'options' are incompatible. Type 'RequestOptionsArgs' is not assignable to type 'RequestOptionsArgs'. Two different types with this name exist, but they are unrelated.

ERROR in [at-loader] ./src/main/webapp/app/blocks/interceptor/http.provider.ts:20:9 TS2345: Argument of type 'XHRBackend' is not assignable to parameter of type 'ConnectionBackend'. Types of property 'createConnection' are incompatible. Type '(request: Request) => XHRConnection' is not assignable to type '(request: any) => Connection'. Type 'XHRConnection' is not assignable to type 'Connection'. Types of property 'request' are incompatible. Type 'Request' is not assignable to type 'Request'. Two different types with this name exist, but they are unrelated. Types of property 'headers' are incompatible. Type 'Headers' is not assignable to type 'Headers'. Two different types with this name exist, but they are unrelated. Types have separate declarations of a private property 'mayBeSetNormalizedName'.

ERROR in [at-loader] ./src/main/webapp/app/blocks/interceptor/notification.interceptor.ts:5:14 TS2415: Class 'NotificationInterceptor' incorrectly extends base class 'HttpInterceptor'. Types of property 'requestIntercept' are incompatible. Type '(options?: RequestOptionsArgs) => RequestOptionsArgs' is not assignable to type '(options?: RequestOpt ionsArgs) => RequestOptionsArgs'. Two different types with this name exist, but they are unrelated. Types of parameters 'options' and 'options' are incompatible. Type 'RequestOptionsArgs' is not assignable to type 'RequestOptionsArgs'. Two different types with this name exist, but they are unrelated.

Have you any idea why this happens?

回答1:

Finally, it works for me with this way:

ng-jhipster: yarn install, yarn run build (as it is described https://github.com/jhipster/ng-jhipster).

jhipster-project: Delete the content inside the ng-jhipster (jhipster-project\node_modules\ng-jhipster) and copy the ng-jhipster structure but:

  • In the 'src' directory(jhipster-project\node_modules\ng-jhipster\src) select all the *.ts files, keep only the *.d.ts and remove all the rest *.ts
  • delete 'node_modules'(jhipster-project\node_modules\ng-jhipster\node_modules)

Then

  • yarn (vendor.dll should be regenerated)
  • yarn start

Is this the way that you work?



标签: jhipster