Skip to content

Erroneous "Spread types may only be created from object types"? #22687

Closed

Description

I seem to be (incorrectly?) getting an error "Spread types may only be created from object types" for a case where the type in question is constrained as object.

Example here

When I hover over the offending call site:

image

The data property is of a type T where T extends object, so why am I not allowed to spread it's properties to a new object?

The code works as intended, I just can't seem to figure out what's required to get rid of the error message. I could just cast it as any of course, but that seems dirty?

Activity

  1. ajafff commented on Mar 19, 2018

    @ajafff
    Contributor

    Duplicate of #10727
    Fix is proposed in #13288

  2. typescript-bot commented on Apr 2, 2018

    @typescript-bot
    Contributor

    Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

  3. locked and limited conversation to collaborators on Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions