diff --git a/src/compiler/expressionToTypeNode.ts b/src/compiler/expressionToTypeNode.ts index 7f54ab49406..9582de99ada 100644 --- a/src/compiler/expressionToTypeNode.ts +++ b/src/compiler/expressionToTypeNode.ts @@ -1114,7 +1114,7 @@ export function createSyntacticTypeNodeBuilder( function ensureParameter(p: ParameterDeclaration, context: SyntacticTypeNodeBuilderContext) { return factory.updateParameterDeclaration( p, - [], + p.modifiers, reuseNode(context, p.dotDotDotToken), resolver.serializeNameOfParameter(context, p), resolver.isOptionalParameter(p) ? factory.createToken(SyntaxKind.QuestionToken) : undefined, diff --git a/tests/cases/fourslash/completionEntryClassMembersWithInferredFunctionReturnType1.ts b/tests/cases/fourslash/completionEntryClassMembersWithInferredFunctionReturnType1.ts new file mode 100644 index 00000000000..902022da8a1 --- /dev/null +++ b/tests/cases/fourslash/completionEntryClassMembersWithInferredFunctionReturnType1.ts @@ -0,0 +1,31 @@ +/// + +// @filename: /tokenizer.ts +//// export default abstract class Tokenizer { +//// errorBuilder() { +//// return (pos: number, lineStart: number, curLine: number) => {}; +//// } +//// } + +// @filename: /expression.ts +//// import Tokenizer from "./tokenizer.js"; +//// +//// export default abstract class ExpressionParser extends Tokenizer { +//// /**/ +//// } + +verify.completions({ + marker: "", + includes: [ + { + name: "errorBuilder", + insertText: "errorBuilder(): (pos: number, lineStart: number, curLine: number) => void {\n}", + filterText: "errorBuilder", + }, + ], + preferences: { + includeCompletionsWithInsertText: true, + includeCompletionsWithClassMemberSnippets: true, + }, + isNewIdentifierLocation: true, +});