Skip to content

support Signal Function without argument (undefined implied) #64118

@hannah23280

Description

@hannah23280

Which @angular/* package(s) are relevant/related to the feature request?

core

Description

Currently, signal () function expects an argument to be passed in, even if the argument is undefined

Current Situation:

      name = signal<string| undefined>(undefined)

Proposed solution

To allow no argument for signal function. In such case, undefined will be assumed.
This aligns with the input() function, where no argument implies undefined

Proposed Enhancement

    name = signal<string | undefined>()

Side note: I do wish typescript has a way for us to condense "string | undefined" to become something like "string?"..but that is a separate matter.

Alternatives considered

Nil

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions