Skip to content

Object.values wrongly excludes undefined with optional propertiesΒ #44494

Closed
@jer-sen

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

const a: { b?: 1 | undefined } = { b: undefined };
const c = 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

Assignees

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