Skip to content

Inferred types of default AuthPipes are incompatible with AuthPipe under TypeScript strict mode #2494

@wSedlacek

Description

@wSedlacek

Version info

**Angular: 9.1.9

**Firebase: 7.14.6

**AngularFire: 6.0.0

How to reproduce these conditions

app-routing.module.ts

import {
  AuthPipeGenerator,
  canActivate,
  redirectUnauthorizedTo,
} from '@angular/fire/auth-guard';

const redirectUnauthorizedToLogin: AuthPipeGenerator = () => redirectUnauthorizedTo(['login']);

With Strict mode enabled.
tsconfig.json

{
  ...
  "compilerOptions": {
    ...
    "strict": true,
  },
}

Debug output

Type 'UnaryFunction<Observable<User>, Observable<true | any[]>>' is not assignable to type 'AuthPipe'.ts(2322)

Expected behavior

redirectUnauthorizedTo should return the shape of AuthPipe even while under Strict mode.

Actual behavior

redirectUnauthorizedTo and a few other helper pipes have the typing of UnaryFunction<Observable<User>, Observable<true | any[]>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions