Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sample-code-flow-http-config issue compiling #1202

Closed
mac-bhaird opened this issue Jul 19, 2021 · 2 comments
Closed

sample-code-flow-http-config issue compiling #1202

mac-bhaird opened this issue Jul 19, 2021 · 2 comments

Comments

@mac-bhaird
Copy link

Describe the bug
Using the auth-config.module.ts bits from sample-code-flow-http-config project results in compile error

To Reproduce
Steps to reproduce the behavior:

  1. Create new Angular 12 project
  2. npm install angular-auth-oidc-client
  3. Copy this file into project: https://github.com/damienbod/angular-auth-oidc-client/blob/main/projects/sample-code-flow-http-config/src/app/auth-config.module.ts
  4. Add AuthConfigModule to AppModule
  5. See error

`Error: node_modules/angular-auth-oidc-client/lib/auto-login/auto-login-all-routes.guard.d.ts:14:5 - error TS2416: Property 'canLoad' in type 'AutoLoginAllRoutesGuard' is not assignable to the same property in base type 'CanLoad'.
Type '(route: Route, segments: UrlSegment[]) => Observable' is not assignable to type '(route: Route, segments: UrlSegment[]) => boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree>'.
Type 'Observable' is not assignable to type 'boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree>'.

14 canLoad(route: Route, segments: UrlSegment[]): Observable;
~~~~~~~

Error: node_modules/angular-auth-oidc-client/lib/auto-login/auto-login-all-routes.guard.d.ts:15:5 - error TS2416: Property 'canActivate' in type 'AutoLoginAllRoutesGuard' is not assignable to the same property in base type 'CanActivate'.
Type '(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => Observable' is not assignable to type '(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => boolean | UrlTree | Observable<boolean | UrlTree> | Promise<...>'. Type 'Observable' is not assignable to type 'boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree>'.
Type 'Observable' is not assignable to type 'Observable<boolean | UrlTree>'.
The types of 'source.operator.call' are incompatible between these types.
Type '(subscriber: import("D:/HCR/repos/experiments/angular-only/oidc-angular-client-spike-v3/oidc-angular-client/node_modules/angular-auth-oidc-client/node_modules/rxjs/internal/Subscriber").Subscriber, source: any) => import("D:/HCR/repos/experiments/angular-only/oidc-angular-client-spike-v3/oidc-angular-client/nod...' is not assignable to type '(subscriber: import("D:/HCR/repos/experiments/angular-only/oidc-angular-client-spike-v3/oidc-angular-client/node_modules/rxjs/dist/types/internal/Subscriber").Subscriber, source: any) => import("D:/HCR/repos/experiments/angular-only/oidc-angular-client-spike-v3/oidc-angular-client/node_modules/rxjs/dist/types/i...'.
Types of parameters 'subscriber' and 'subscriber' are incompatible.
Type 'Subscriber' is missing the following properties from type 'Subscriber': syncErrorValue, syncErrorThrown, syncErrorThrowable, _unsubscribeAndRecycle, and 2 more.

15 canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable;
~~~~~~~~~~~

Error: node_modules/angular-auth-oidc-client/lib/interceptor/auth.interceptor.d.ts:14:5 - error TS2416: Property 'intercept' in type 'AuthInterceptor' is not assignable to the same property in base type 'HttpInterceptor'.
Type '(req: import("D:/HCR/repos/experiments/angular-only/oidc-angular-client-spike-v3/oidc-angular-client/node_modules/@angular/common/http/http").HttpRequest, next: import("D:/HCR/repos/experiments/angular-only/oidc-angular-client-spike-v3/oidc-angular-client/node_modules/@angular/common/http/http").HttpHandler) =>...' is not assignable to type '(req: import("D:/HCR/repos/experiments/angular-only/oidc-angular-client-spike-v3/oidc-angular-client/node_modules/@angular/common/http/http").HttpRequest, next: import("D:/HCR/repos/experiments/angular-only/oidc-angular-client-spike-v3/oidc-angular-client/node_modules/@angular/common/http/http").HttpHandler) =>...'. Two different types with this name exist, but they are unrelated.
Call signature return types 'Observable<HttpEvent>' and 'Observable<HttpEvent>' are incompatible.
The types of 'source' are incompatible between these types.
Type 'import("D:/HCR/repos/experiments/angular-only/oidc-angular-client-spike-v3/oidc-angular-client/node_modules/angular-auth-oidc-client/node_modules/rxjs/internal/Observable").Observable' is not assignable to type 'import("D:/HCR/repos/experiments/angular-only/oidc-angular-client-spike-v3/oidc-angular-client/node_modules/rxjs/dist/types/internal/Observable").Observable'.

14 intercept(req: HttpRequest, next: HttpHandler): Observable<HttpEvent>;
~~~~~~~~~

Error: src/app/auth-config.module.ts:35:34 - error TS2345: Argument of type 'Promise<OpenIdConfiguration | undefined>' is not assignable to parameter of type 'Promise | Promise[]'.
Type 'Promise<OpenIdConfiguration | undefined>' is not assignable to type 'Promise'.
Type 'OpenIdConfiguration | undefined' is not assignable to type 'OpenIdConfiguration'.
Type 'undefined' is not assignable to type 'OpenIdConfiguration'.

35 return new StsConfigHttpLoader(config$);
~~~~~~~`

Expected behavior
Should build successfully

@FabianGosebrink
Copy link
Collaborator

FabianGosebrink commented Jul 19, 2021

Just did this and got no error. Maybe duplicate to #1178 ?

@mac-bhaird
Copy link
Author

yeps, downgraded rxjs to 6.6.7 and it compiled!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants