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

fix(ivy): allow abstract directives to have an invalid constructor #32987

Closed
wants to merge 1 commit into from

Commits on Oct 25, 2019

  1. fix(ivy): allow abstract directives to have an invalid constructor

    For abstract directives, i.e. directives without a selector, it may
    happen that their constructor is called explicitly from a subclass,
    hence its parameters are not required to be valid for Angular's DI
    purposes. Prior to this commit however, having an abstract directive
    with a constructor that has parameters that are not eligible for
    Angular's DI would produce a compilation error.
    
    A similar scenario may occur for `@Injectable`s, where an explicit
    `use*` definition allows for the constructor to be irrelevant. For
    example, the situation where `useFactory` is specified allows for the
    constructor to be called explicitly with any value, so its constructor
    parameters are not required to be valid. For `@Injectable`s this is
    handled by generating a DI factory function that throws.
    
    This commit implements the same solution for abstract directives, such
    that a compilation error is avoided while still producing an error at
    runtime if the type is instantiated implicitly by Angular's DI
    mechanism.
    
    Fixes angular#32981
    JoostK authored and alxhub committed Oct 25, 2019
    Configuration menu
    Copy the full SHA
    fc8481b View commit details
    Browse the repository at this point in the history