UNPKG

3.15 kBTypeScriptView Raw
1import { DocNodeKind, DocNode, IDocNodeParsedParameters, IDocNodeParameters } from './DocNode';
2import { TokenSequence } from '../parser/TokenSequence';
3/**
4 * Kinds of TSDoc selectors.
5 */
6export declare const enum SelectorKind {
7 /**
8 * Used in cases where the parser encounters a string that is incorrect but
9 * valid enough that a DocMemberSelector node was created.
10 */
11 Error = "error",
12 /**
13 * System selectors are always all lower-case and belong to a set of predefined label names.
14 */
15 System = "system",
16 /**
17 * Index selectors are integer numbers. They provide an alternative way of referencing
18 * overloaded functions, based on the order in which the declarations appear in
19 * a source file.
20 *
21 * @remarks
22 * Warning: Index selectors are not recommended; they are intended to provide a temporary
23 * workaround for situations where an external library neglected to declare a `{@label}` tag
24 * and cannot be easily fixed.
25 */
26 Index = "index",
27 /**
28 * Label selectors refer to labels created using the `{@label}` TSDoc tag.
29 * The labels are always comprised of upper-case letters or numbers separated by underscores,
30 * and the first character cannot be a number.
31 */
32 Label = "label"
33}
34/**
35 * Constructor parameters for {@link DocMemberSelector}.
36 */
37export interface IDocMemberSelectorParameters extends IDocNodeParameters {
38 selector: string;
39}
40/**
41 * Constructor parameters for {@link DocMemberSelector}.
42 */
43export interface IDocMemberSelectorParsedParameters extends IDocNodeParsedParameters {
44 selectorExcerpt: TokenSequence;
45}
46/**
47 */
48export declare class DocMemberSelector extends DocNode {
49 private static readonly _likeIndexSelectorRegExp;
50 private static readonly _indexSelectorRegExp;
51 private static readonly _likeLabelSelectorRegExp;
52 private static readonly _labelSelectorRegExp;
53 private static readonly _likeSystemSelectorRegExp;
54 private readonly _selector;
55 private _selectorExcerpt;
56 private readonly _selectorKind;
57 private readonly _errorMessage;
58 /**
59 * Don't call this directly. Instead use {@link TSDocParser}
60 * @internal
61 */
62 constructor(parameters: IDocMemberSelectorParameters | IDocMemberSelectorParsedParameters);
63 /** @override */
64 get kind(): DocNodeKind | string;
65 /**
66 * The text representation of the selector.
67 *
68 * @remarks
69 * For system selectors, it will be a predefined lower case name.
70 * For label selectors, it will be an upper case name defined using the `{@label}` tag.
71 * For index selectors, it will be a positive integer.
72 */
73 get selector(): string;
74 /**
75 * Indicates the kind of selector.
76 */
77 get selectorKind(): SelectorKind;
78 /**
79 * If the `selectorKind` is `SelectorKind.Error`, this string will be defined and provide
80 * more detail about why the string was not valid.
81 */
82 get errorMessage(): string | undefined;
83 /** @override */
84 protected onGetChildNodes(): ReadonlyArray<DocNode | undefined>;
85}
86//# sourceMappingURL=DocMemberSelector.d.ts.map
\No newline at end of file