8000 Should 'Partial<T>' and Readonly<T> should have their type parameters constrained to 'object'? · Issue #14249 · microsoft/TypeScript · GitHub
[go: up one dir, main page]

Skip to content
Should 'Partial<T>' and Readonly<T> should have their type parameters constrained to 'object'? #14249
@DanielRosenwasser

Description

@DanielRosenwasser

Given #14224, I think that Partial should be defined as follows:

type Partial<T extends object> = {
    [K in keyof T]?: T[K]
}

Readonly could be defined similarly.

I don't necessarily know if Pick should be defined that way. Part of me thinks that this Pick has a different intent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeclinedThe issue was declined as something which matches the TypeScript visionSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0