-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Completion ListsThe issue relates to showing completion lists in an editorThe issue relates to showing completion lists in an editor
Milestone
Description
TypeScript Version: 2.8.0-dev.20180220
Search Terms:
index signature completion
constraint completion
Code
interface Styles {
alignContent: string | null;
alignItems: string | null;
alignmentBaseline: string | null;
// etc..
[key: string]: any
}
interface StyleMap {
[name: string]: Partial<Styles>
}
declare function createStyles<T extends StyleMap>(styles: T): T
createStyles({
x: {
'/*1*/': ''
}
});Expected behavior:
Requesting completions at 1 shows property names from Styles.
Actual behavior:
Requesting completions at 1 shows generic words from the file.
Remove the index signature from StyleMap and the properties show up.
Related Issues:
#9900 -- that seems to be fixed since removing the index signature fixes this even with everything else optional. Adding a required property to Styles restores completions though.
The usefulness of this is kind of predicated on #12968 as far as the quotes being required to trigger completions.
eps1lon, franklixuefei, RemyRylan and antoineol
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Completion ListsThe issue relates to showing completion lists in an editorThe issue relates to showing completion lists in an editor