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(compiler-cli): evaluate const tuple types statically #48091

Closed
wants to merge 1 commit into from

Commits on Nov 16, 2022

  1. fix(compiler-cli): evaluate const tuple types statically

    For standalone components it may be beneficial to group multiple declarations
    into a single array, that can then be imported all at once in `Component.imports`.
    If this array is declared within a library, however, would the AOT compiler
    need to extract the contents of the array from the declaration file. This
    requires that the array is constructed using an `as const` cast, which results
    in a readonly tuple declaration in the generated .d.ts file of the library:
    
    ```ts
    export declare const DECLARATIONS: readonly [typeof StandaloneDir];
    ```
    
    The partial evaluator logic did not support this syntax, so this pattern was
    not functional when a library is involved. This commit adds the necessary
    logic in the static interpreter to evaluate this type at compile time.
    
    Closes angular#48089
    JoostK committed Nov 16, 2022
    Configuration menu
    Copy the full SHA
    1fe7685 View commit details
    Browse the repository at this point in the history