Skip to content

React.createElement intellisense #17207

Closed
@mjbvz

Description

@mjbvz

From @czb on July 14, 2017 13:43

  • VSCode Version: Code 1.14.1 (2648980a697a4c8fb5777dcfb2ab110cec8a2f58, 2017-07-13T19:18:47.188Z)
  • OS Version: Windows_NT ia32 10.0.15063
  • Extensions:
Extension Author (truncated) Version
vscodeZoom chr 0.0.1

Steps to Reproduce:

  1. Install @types/react
  2. Create a ts file and paste:
import * as React from 'react'

interface Props { test: string }

class El extends React.Component<Props, any> { }

React.createElement(El, { test })
  1. The intellisense of test in the last line is broken:
    a. When I start typing test the intellisense is NOT showing test
    b. When I finish typing test the intellisense suddenly finds and properly shows test (too late though)
    c. If I completely erase test from the last line, I get Property 'test' is missing in type '{}'. error as expected.

I guess the problem is that the intellisense for the second parameter of createElement is be based on the type of the first parameter.

EDIT: It is not React specific. The same issue also appears when using Mithril and other libraries.

Reproduces without extensions: Yes

Copied from original issue: microsoft/vscode#30709

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already createdVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions