(signature, kind, context, options)
| 53254 | /*decorators*/ undefined, indexInfo.isReadonly ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); |
| 53255 | } |
| 53256 | function signatureToSignatureDeclarationHelper(signature, kind, context, options) { |
| 53257 | var _a, _b, _c, _d; |
| 53258 | var suppressAny = context.flags & 256 /* NodeBuilderFlags.SuppressAnyReturnType */; |
| 53259 | if (suppressAny) |
| 53260 | context.flags &= ~256 /* NodeBuilderFlags.SuppressAnyReturnType */; // suppress only toplevel `any`s |
| 53261 | context.approximateLength += 3; // Usually a signature contributes a few more characters than this, but 3 is the minimum |
| 53262 | var typeParameters; |
| 53263 | var typeArguments; |
| 53264 | if (context.flags & 32 /* NodeBuilderFlags.WriteTypeArgumentsOfSignature */ && signature.target && signature.mapper && signature.target.typeParameters) { |
| 53265 | typeArguments = signature.target.typeParameters.map(function (parameter) { return typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context); }); |
| 53266 | } |
| 53267 | else { |
| 53268 | typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); }); |
| 53269 | } |
| 53270 | var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0]; |
| 53271 | // If the expanded parameter list had a variadic in a non-trailing position, don't expand it |
| 53272 | var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); |
| 53273 | var thisParameter = tryGetThisParameterDeclaration(signature, context); |
| 53274 | if (thisParameter) { |
| 53275 | parameters.unshift(thisParameter); |
| 53276 | } |
| 53277 | var returnTypeNode; |
| 53278 | var typePredicate = getTypePredicateOfSignature(signature); |
| 53279 | if (typePredicate) { |
| 53280 | var assertsModifier = typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? |
| 53281 | ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : |
| 53282 | undefined; |
| 53283 | var parameterName = typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? |
| 53284 | ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216 /* EmitFlags.NoAsciiEscaping */) : |
| 53285 | ts.factory.createThisTypeNode(); |
| 53286 | var typeNode = typePredicate.type && typeToTypeNodeHelper(typePredicate.type, context); |
| 53287 | returnTypeNode = ts.factory.createTypePredicateNode(assertsModifier, parameterName, typeNode); |
| 53288 | } |
| 53289 | else { |
| 53290 | var returnType = getReturnTypeOfSignature(signature); |
| 53291 | if (returnType && !(suppressAny && isTypeAny(returnType))) { |
| 53292 | returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); |
| 53293 | } |
| 53294 | else if (!suppressAny) { |
| 53295 | returnTypeNode = ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); |
| 53296 | } |
| 53297 | } |
| 53298 | var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; |
| 53299 | if ((kind === 180 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { |
| 53300 | var flags = ts.modifiersToFlags(modifiers); |
| 53301 | modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128 /* ModifierFlags.Abstract */); |
| 53302 | } |
| 53303 | var node = kind === 174 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : |
| 53304 | kind === 175 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : |
| 53305 | kind === 168 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : |
| 53306 | kind === 169 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(/*decorators*/ undefined, modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : |
| 53307 | kind === 171 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(/*decorators*/ undefined, modifiers, parameters, /*body*/ undefined) : |
| 53308 | kind === 172 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(/*decorators*/ undefined, modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : |
| 53309 | kind === 173 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(/*decorators*/ undefined, modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : |
| 53310 | kind === 176 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(/*decorators*/ undefined, modifiers, parameters, returnTypeNode) : |
| 53311 | kind === 317 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : |
| 53312 | kind === 179 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : |
| 53313 | kind === 180 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : |
no test coverage detected
searching dependent graphs…