@microsoft/api-extractor
Version:
Validate, document, and review the exported API for a TypeScript library
27 lines • 1.2 kB
JavaScript
;
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
const node_core_library_1 = require("@microsoft/node-core-library");
const AstItem_1 = require("./AstItem");
/**
* This class is part of the AstItem abstract syntax tree. It represents parameters of a function declaration
*/
class AstParameter extends AstItem_1.AstItem {
constructor(options, docComment) {
super(options);
this.kind = AstItem_1.AstItemKind.Parameter;
const parameterDeclaration = options.declaration;
this.isOptional = !!parameterDeclaration.questionToken || !!parameterDeclaration.initializer;
if (parameterDeclaration.type) {
this.type = node_core_library_1.Text.convertToLf(parameterDeclaration.type.getText());
}
else {
this.hasIncompleteTypes = true;
this.type = 'any';
}
this.isSpread = !!parameterDeclaration.dotDotDotToken;
}
}
exports.AstParameter = AstParameter;
//# sourceMappingURL=AstParameter.js.map