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

Typescript hover hints show wrong types #48785

Closed
burabure opened this issue Apr 26, 2018 · 1 comment
Closed

Typescript hover hints show wrong types #48785

burabure opened this issue Apr 26, 2018 · 1 comment
Assignees
Labels
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@burabure
Copy link

burabure commented Apr 26, 2018

Issue Type: Bug

I managed to confuse the ts language type hints, when you hover over the variables it shows a generic type, but forcing a type error on the same variable shows the correct type on the error.
This caused a couple hours of me looking over complex types trying to figure out why it showed me a variable as a generic one.

tsvscode

Here's the code that reproduces the error:

import React from 'react'

interface IFooProps<S> {
  children: (state: S) => JSX.Element
  initialState: S,
}

class Foo<S extends {}> extends React.Component<IFooProps<S>,S> {
  state = this.props.initialState

  public render() {
    return <>{this.props.children(this.state)}</>
  }
}

interface IBarProps {
  test: 'hello',
} 

const Bar = (props: IBarProps) => (
  <Foo initialState={props} >
    {(state) => <>{state.test}</>}
  </Foo>
)

using these deps for example:

{
  "typescript": "^2.8.1",
  "react": "^16.3.1",
  "@types/react": "^16.3.12",
}

VS Code version: Code 1.22.2 (3aeede7, 2018-04-12T16:34:44.222Z)
OS version: Linux x64 4.13.0-37-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz (4 x 2593)
Load (avg) 4, 4, 4
Memory (System) 19.31GB (0.66GB free)
Process Argv /usr/share/code/code .
Screen Reader no
VM 0%
Extensions (9)
Extension Author (truncated) Version
Bookmarks ale 0.19.0
npm-intellisense chr 1.3.0
githistory don 0.4.0
tslint eg2 1.0.28
prettier-vscode esb 1.3.1
atom-keybindings ms- 3.0.4
debugger-for-chrome msj 4.3.0
snippet-creator nik 0.0.4
code-spell-checker str 1.6.9

(2 theme extensions excluded)

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 27, 2018

This issue was moved to microsoft/TypeScript#23747

@mjbvz mjbvz closed this as completed Apr 27, 2018
@mjbvz mjbvz added upstream Issue identified as 'upstream' component related (exists outside of VS Code) typescript Typescript support issues and removed javascript JavaScript support issues labels Apr 27, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants