Skip to content

Object.values wrongly excludes undefined with optional properties #44494

Description

@jer-sen

Bug Report

🔎 Search Terms

object values entries undefined optional properties

🕗 Version & Regression Information

  • This changed between versions 4.2.3 and 4.3.2

⏯ Playground Link

Playground link with relevant code

💻 Code

consta: {b?: 1|undefined}={b: undefined};constc=Object.values(a);console.log(c);// Returns [undefined] but c has type 1[]

🙁 Actual behavior

c has type 1[] but can be equal to [undefined]

🙂 Expected behavior

c should have type (undefined | 1)[]

Metadata

Metadata

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions