Skip to content

[noUnusedLocals] JSX spreading with type "any" excludes children from used variables #15478

Closed
@alitaheri

Description

@alitaheri

TypeScript Version: 2.4.0-dev.20170429

Code

export function render() {
    const foo = 'foo'; // Gives error when noUnusedLocals are enabled.

    // foo is used here, but the compiler doesn't "see" it
    return <div {...{} as any}>{foo}</div>;
}

Expected behavior:
Since foo is used it should compile properly.

Actual behavior:
'foo' is declared but never used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions