Skip to content

Diagnostic when reading a required input from a constructor/initializer #63602

Closed

Description

@alxhub

There are circumstances where we can know statically that a required input is accessed in a context where it will not have a value:

id = input.required<number>();
data$ = httpClient.get('/api/user/' + this.id()); // id() read is statically in ctor scope

This is guaranteed to throw a runtime error. We can also produce a compiler diagnostic in this case.

Activity

  1. added
    feature
    area: compiler
    on Sep 4, 2025
  2. added this to the Backlog milestone on Sep 4, 2025
  3. self-assigned this
    on Sep 4, 2025
  4. added 11 commits that reference this issue on Sep 5, 2025
    8b88fd6
    72d605b
    39b48d2
    4463875
    382e68f
    85a296c
    cb8d3c3
    cfef607
    387ecaf
    0d59ad6
    fd15cef
  5. VaradGupta23 commented on Sep 15, 2025

    @VaradGupta23
  6. added a commit that references this issue on Sep 15, 2025
    5fd0082
  7. added a commit that references this issue on Sep 15, 2025
    6dff287
  8. added a commit that references this issue on Sep 18, 2025
    69c7373
  9. angular-automatic-lock-bot commented on Oct 16, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  10. locked and limited conversation to collaborators on Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: compilercompiler: extended diagnosticsfeature

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions