Skip to content

Empty object not of exact type with optional properties #2386

@minedeljkovic

Description

@minedeljkovic

Minimal example:

type PossiblyEmpty = $Exact<{
  a?: number
}>

const p: PossiblyEmpty = {} // this errors. Should it?

https://flowtype.org/try/#0PQKgBAAgZgNg9gdzCYAoVAXAngBwKZgAKcAziQJYBGMWAogLY7ZgC8YAJLQB4CGAxhgA8Ab1RgwPAPwAuMADsArvUp4ATqgC+APnR84ckhjA5ZxMlRoMmWVmGEbUQA

Is this by design?

EDIT: inline an example

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions