diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 94f95641fedcd..ac13a2c790447 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -366,7 +366,7 @@ namespace ts.SignatureHelp { return invocation.kind === InvocationKind.Call ? getInvokedExpression(invocation.node) : invocation.called; } - const signatureHelpNodeBuilderFlags = NodeBuilderFlags.OmitParameterModifiers | NodeBuilderFlags.IgnoreErrors; + const signatureHelpNodeBuilderFlags = NodeBuilderFlags.OmitParameterModifiers | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope; function createSignatureHelpItems(candidates: ReadonlyArray, resolvedSignature: Signature, argumentListInfo: ArgumentListInfo, sourceFile: SourceFile, typeChecker: TypeChecker): SignatureHelpItems { const { argumentCount, argumentsSpan: applicableSpan, invocation, argumentIndex } = argumentListInfo; const isTypeParameterList = argumentListInfo.kind === ArgumentListKind.TypeArguments; diff --git a/tests/cases/fourslash/signatureHelpForNonlocalTypeDoesNotUseImportType.ts b/tests/cases/fourslash/signatureHelpForNonlocalTypeDoesNotUseImportType.ts new file mode 100644 index 0000000000000..42efddb65f491 --- /dev/null +++ b/tests/cases/fourslash/signatureHelpForNonlocalTypeDoesNotUseImportType.ts @@ -0,0 +1,15 @@ +/// + +// @Filename: exporter.ts +////export interface Thing {} +////export const Foo: () => Thing = null as any; + +// @Filename: usage.ts +////import {Foo} from "./exporter" +////function f(p = Foo()): void {} +////f(/*1*/ + +verify.signatureHelp({ + marker: "1", + text: "f(p?: Thing): void" +}); \ No newline at end of file