From 132f4ccdbf00526533b774b1ed9fa0b0eefd2e65 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 10 Jul 2023 13:35:54 -0700 Subject: [PATCH] Add test for old completion bug from prop of constraint --- .../completionPropertyFromConstraint.baseline | 194 ++++++++++++++++++ .../completionPropertyFromConstraint.ts | 23 +++ 2 files changed, 217 insertions(+) create mode 100644 tests/baselines/reference/completionPropertyFromConstraint.baseline create mode 100644 tests/cases/fourslash/completionPropertyFromConstraint.ts diff --git a/tests/baselines/reference/completionPropertyFromConstraint.baseline b/tests/baselines/reference/completionPropertyFromConstraint.baseline new file mode 100644 index 0000000000000..3d360ab3eff1c --- /dev/null +++ b/tests/baselines/reference/completionPropertyFromConstraint.baseline @@ -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 +// } +// +// declare function createStyles(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": [] + } + ] + } + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/completionPropertyFromConstraint.ts b/tests/cases/fourslash/completionPropertyFromConstraint.ts new file mode 100644 index 0000000000000..14ad657d64921 --- /dev/null +++ b/tests/cases/fourslash/completionPropertyFromConstraint.ts @@ -0,0 +1,23 @@ +/// + +//// interface Styles { +//// alignContent: string | null; +//// alignItems: string | null; +//// alignmentBaseline: string | null; +//// // etc.. +//// [key: string]: any +//// } +//// +//// interface StyleMap { +//// [name: string]: Partial +//// } +//// +//// declare function createStyles(styles: T): T +//// +//// createStyles({ +//// x: { +//// '/*1*/': '' +//// } +//// }); + +verify.baselineCompletions();