Skip to content

JSX prop autocompletion missing props once certain ones are assigned #34957

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

Closed
wnayes opened this issue Nov 6, 2019 · 0 comments · Fixed by #35803
Closed

JSX prop autocompletion missing props once certain ones are assigned #34957

wnayes opened this issue Nov 6, 2019 · 0 comments · Fixed by #35803
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@wnayes
Copy link
Contributor

wnayes commented Nov 6, 2019

TypeScript Version: 3.7.x-dev.201xxxxx

Search Terms: jsx intellisense autocomplete

Code

import React from "react";

interface KlassComponentProps {
    one?: string;
    two?: number;
    problematic?: any;
}

/**
 * A component that can be used directly, or subclassed.
 * Any derived components can have additional props, but must at least have
 * the props from `KlassComponentProps`.
 * */
class KlassComponent<TProps extends KlassComponentProps = KlassComponentProps>
    extends React.Component<TProps>
{
}

function TestComponent() {
    // Problem: autocomplete options (ctrl+space) do not include `one` or `two`
    // once the `problematic` prop is assigned
    const badcase = <KlassComponent problematic="test"></KlassComponent>;

    // Without `problematic`, prop autocomplete shows `one` and `two`.
    const okcase = <KlassComponent></KlassComponent>;
}

Expected behavior:
With both usages of KlassComponent, bringing up editor autocomplete should include the one and two props in the list of remaining props.

Actual behavior:
The one and two prop are not shown once the problematic prop is assigned.

Playground Link: Link

Related Issues: #29017

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Nov 8, 2019
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.8.0 milestone Nov 8, 2019
@andrewbranch andrewbranch added the Fix Available A PR has been opened for this issue label Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants