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

Unexpected generic type inference error #17432

Closed
mjbvz opened this issue Jul 26, 2017 · 1 comment
Closed

Unexpected generic type inference error #17432

mjbvz opened this issue Jul 26, 2017 · 1 comment
Labels
Needs Investigation This issue needs a team member to investigate its status. VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Jul 26, 2017

From: microsoft/vscode#30819

TypeScript Version: 2.4.2

Code
In a vscode extension:

import *  as vscode from 'vscode'

interface MyPickItem extends vscode.QuickPickItem { }
var items:MyPickItem[];
vscode.window.showQuickPick(items, { 
    placeHolder: "(placeholder)", 
    onDidSelectItem: (item:MyPickItem) => {
        /* Wont copile, error:
            Argument of type '{ placeHolder: string; onDidSelectItem: (item: MyPickItem) => void; }' is not assignable to parameter of type 'QuickPickOptions'.
            Types of property 'onDidSelectItem' are incompatible.
                Type '(item: MyPickItem) => void' is not assignable to type '<T extends QuickPickItem>(item: string | T) => any'.
                Types of parameters 'item' and 'item' are incompatible.
                    Type 'string | T' is not assignable to type 'MyPickItem'.
                    Type 'string' is not assignable to type 'MyPickItem'.
        */
    }
});

Expected behavior:
Since MyPickItem extends QuickPickItem, the above call to vscode.window.showQuickPick should be valid

Actual behavior:
Compiler error

More information about this issue:
From: microsoft/vscode#30819

@mjbvz mjbvz added the VS Code Tracked There is a VS Code equivalent to this issue label Jul 26, 2017
@mhegazy mhegazy added the Needs Investigation This issue needs a team member to investigate its status. label Aug 29, 2017
@mjbvz
Copy link
Contributor Author

mjbvz commented Jul 17, 2018

No longer seems applicable. Fixed either due to changes in VS Code API or in TypeScript

@mjbvz mjbvz closed this as completed Jul 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status. VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

2 participants