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

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

Closed
Andarist opened this issue Jan 24, 2024 · 2 comments
Closed
Assignees
Labels
Design Limitation Constraints of the existing architecture prevent this from being fixed

Comments

@Andarist
Copy link
Contributor

πŸ”Ž 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

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Feb 1, 2024
@ahejlsberg
Copy link
Member

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

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

@ahejlsberg ahejlsberg added Design Limitation Constraints of the existing architecture prevent this from being fixed and removed Needs Investigation This issue needs a team member to investigate its status. labels Mar 6, 2024
@typescript-bot
Copy link
Collaborator

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

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design Limitation Constraints of the existing architecture prevent this from being fixed
Projects
None yet
Development

No branches or pull requests

4 participants