Skip to content

NonNullable doesn't work on mapped types instantiated with null/undefinedΒ #57151

Description

πŸ”Ž Search Terms

mapped nonnullable empty object null undefined instantiation

πŸ•— Version & Regression Information

⏯ Playground Link

https://www.staging-typescript.org/play?ts=5.4.0-dev.20240124#code/C4TwDgpgBAYg9nAPAFQHxQLxQHJwHbYCuANsQIYBGxEiA3lANoDSUAlnlANYQhwBmUZAF0AXIOZCoAX1QBYAFALQkKACUIAZxLBMsBIjwliqIA

πŸ’» Code

type Foo<T> = NonNullable<{ [K in keyof T]: T[K] }>

type Result = Foo<null>

πŸ™ Actual behavior

Result is of type null

πŸ™‚ Expected behavior

Result should be of type never

Additional information about the issue

This likely gets closed as a design limitation like the one here: #56644

Activity

  1. ahejlsberg commented on Mar 6, 2024

    @ahejlsberg
    Member

    This likely gets closed as a design limitation like the one here: #56644

    That is indeed what I'm going to do. πŸ˜„

  2. added
    Design LimitationConstraints of the existing architecture prevent this from being fixed
    and removed
    Needs InvestigationThis issue needs a team member to investigate its status.
    on Mar 6, 2024
  3. typescript-bot commented on Mar 9, 2024

    @typescript-bot
    Contributor

    This issue has been marked as "Design Limitation" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Design LimitationConstraints of the existing architecture prevent this from being fixed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions