Add test for old completion bug from prop of constraint (#54959)

This commit is contained in:
Jake Bailey 2023-07-13 14:38:50 -07:00 committed by GitHub
parent 3b6e35c536
commit c468960578
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 217 additions and 0 deletions

View File

@ -0,0 +1,194 @@
=== /tests/cases/fourslash/completionPropertyFromConstraint.ts ===
// 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: {
// '': ''
//
// | ----------------------------------------------------------------------
// | (property) alignContent?: string
// | (property) alignItems?: string
// | (property) alignmentBaseline?: string
// | ----------------------------------------------------------------------
// }
// });
[
{
"marker": {
"fileName": "/tests/cases/fourslash/completionPropertyFromConstraint.ts",
"position": 300,
"name": "1"
},
"item": {
"isGlobalCompletion": false,
"isMemberCompletion": true,
"isNewIdentifierLocation": false,
"optionalReplacementSpan": {
"start": 300,
"length": 0
},
"entries": [
{
"name": "alignContent",
"kind": "property",
"kindModifiers": "optional",
"sortText": "11",
"replacementSpan": {
"start": 300,
"length": 0
},
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "property",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "alignContent",
"kind": "propertyName"
},
{
"text": "?",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
}
],
"documentation": []
},
{
"name": "alignItems",
"kind": "property",
"kindModifiers": "optional",
"sortText": "11",
"replacementSpan": {
"start": 300,
"length": 0
},
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "property",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "alignItems",
"kind": "propertyName"
},
{
"text": "?",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
}
],
"documentation": []
},
{
"name": "alignmentBaseline",
"kind": "property",
"kindModifiers": "optional",
"sortText": "11",
"replacementSpan": {
"start": 300,
"length": 0
},
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "property",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "alignmentBaseline",
"kind": "propertyName"
},
{
"text": "?",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "string",
"kind": "keyword"
}
],
"documentation": []
}
]
}
}
]

View File

@ -0,0 +1,23 @@
/// <reference path="fourslash.ts"/>
//// 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*/': ''
//// }
//// });
verify.baselineCompletions();