Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React.createElement intellisense #17207

Closed
mjbvz opened this issue Jul 14, 2017 · 3 comments
Closed

React.createElement intellisense #17207

mjbvz opened this issue Jul 14, 2017 · 3 comments
Labels
Duplicate An existing issue was already created VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Jul 14, 2017

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

@mjbvz
Copy link
Contributor Author

mjbvz commented Jul 14, 2017

From @czb on July 14, 2017 19:3

The same issue is discussed also here:

MithrilJS/mithril.d.ts#23

@mjbvz mjbvz self-assigned this Jul 14, 2017
@mjbvz mjbvz removed their assignment Jul 14, 2017
@mjbvz mjbvz added the VS Code Tracked There is a VS Code equivalent to this issue label Jul 14, 2017
@oldrich-s
Copy link

Quite interestingly if interface Props { test: string } is changed to interface Props { test?: string }, the intellisense works just fine.

@mhegazy
Copy link
Contributor

mhegazy commented Aug 29, 2017

The completion list needs overload resolution to work first to be able to provide completions. and in this case overload resolution did not succeed. issue tracked by #8005

@mhegazy mhegazy closed this as completed Aug 29, 2017
@mhegazy mhegazy added the Duplicate An existing issue was already created label Aug 29, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

3 participants