Skip to content

TSX spread regression in 2.3 #15420

Closed
Closed
@Igorbek

Description

@Igorbek

TypeScript Version: 2.3.1

Code

import * as React from 'react';

function test<T extends object>(Component: React.StatelessComponent<T>, props: T) {
    return <Component {...props} />
                      ~~~~~~~~~~ error TS2698: Spread types may only be created from object types.
}

(same with React.ComponentClass)

Expected behavior:

Compile without an error.

Actual behavior:

Error: error TS2698: Spread types may only be created from object types.

That was already reported in closed issue #14112

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