Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/services/symbolDisplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,10 @@ namespace ts.SymbolDisplay {
const fullSymbolDisplayParts = symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined,
SymbolFormatFlags.WriteTypeParametersOrArguments | SymbolFormatFlags.UseOnlyExternalAliasing | SymbolFormatFlags.AllowAnyNodeKind);
addRange(displayParts, fullSymbolDisplayParts);

if (symbol.flags & SymbolFlags.Optional) {
displayParts.push(punctuationPart(SyntaxKind.QuestionToken));
}
}

function addPrefixForAnyFunctionOrVar(symbol: Symbol, symbolKind: string) {
Expand Down
4 changes: 2 additions & 2 deletions tests/cases/fourslash/findAllRefsForObjectSpread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ const [r0, r1, r2, r3] = ranges;

// members of spread types only refer to themselves and the resulting property
verify.referenceGroups(r0, [{ definition: "(property) A1.a: string", ranges: [r0, r2, r3] }]);
verify.referenceGroups(r1, [{ definition: "(property) A2.a: number", ranges: [r1, r2] }]);
verify.referenceGroups(r1, [{ definition: "(property) A2.a?: number", ranges: [r1, r2] }]);

// but the resulting property refers to everything
verify.referenceGroups(r2, [
{ definition: "(property) A1.a: string", ranges: [r0, r2, r3] },
{ definition: "(property) A2.a: number", ranges: [r1] },
{ definition: "(property) A2.a?: number", ranges: [r1] },
]);

verify.referenceGroups(r3, [{ definition: "(property) A1.a: string", ranges: [r0, r2, r3] }]);
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
////function f ({ [|next|]: { [|next|]: x} }: Recursive) {
////}

verify.singleReferenceGroup("(property) Recursive.next: Recursive");
verify.singleReferenceGroup("(property) Recursive.next?: Recursive");
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
////}

for (const marker of test.markerNames()) {
verify.quickInfoAt(marker, "(property) Recursive.next: Recursive");
verify.quickInfoAt(marker, "(property) Recursive.next?: Recursive");
}