UNPKG

2.82 kBTypeScriptView Raw
1/**
2 * Helpers for validating various text string formats.
3 */
4export declare class StringChecks {
5 private static readonly _tsdocTagNameRegExp;
6 private static readonly _urlSchemeRegExp;
7 private static readonly _urlSchemeAfterRegExp;
8 private static readonly _htmlNameRegExp;
9 private static readonly _identifierBadCharRegExp;
10 private static readonly _identifierNumberStartRegExp;
11 private static readonly _validPackageNameRegExp;
12 private static readonly _systemSelectors;
13 /**
14 * Tests whether the input string is a valid TSDoc tag name; if not, returns an error message.
15 * TSDoc tag names start with an at-sign ("@") followed by ASCII letters using
16 * "camelCase" capitalization.
17 */
18 static explainIfInvalidTSDocTagName(tagName: string): string | undefined;
19 /**
20 * Throws an exception if the input string is not a valid TSDoc tag name.
21 * TSDoc tag names start with an at-sign ("@") followed by ASCII letters using
22 * "camelCase" capitalization.
23 */
24 static validateTSDocTagName(tagName: string): void;
25 /**
26 * Tests whether the input string is a URL form supported inside an "@link" tag; if not,
27 * returns an error message.
28 */
29 static explainIfInvalidLinkUrl(url: string): string | undefined;
30 /**
31 * Tests whether the input string is a valid HTML element or attribute name.
32 */
33 static explainIfInvalidHtmlName(htmlName: string): string | undefined;
34 /**
35 * Throws an exception if the input string is a not valid HTML element or attribute name.
36 */
37 static validateHtmlName(htmlName: string): void;
38 /**
39 * Tests whether the input string is a valid NPM package name.
40 */
41 static explainIfInvalidPackageName(packageName: string): string | undefined;
42 /**
43 * Tests whether the input string is a valid declaration reference import path.
44 */
45 static explainIfInvalidImportPath(importPath: string, prefixedByPackageName: boolean): string | undefined;
46 /**
47 * Returns true if the input string is a TSDoc system selector.
48 */
49 static isSystemSelector(selector: string): boolean;
50 /**
51 * Tests whether the input string is a valid ECMAScript identifier.
52 * A precise check is extremely complicated and highly dependent on the standard version
53 * and how faithfully the interpreter implements it, so here we use a conservative heuristic.
54 */
55 static explainIfInvalidUnquotedIdentifier(identifier: string): string | undefined;
56 /**
57 * Tests whether the input string can be used without quotes as a member identifier in a declaration reference.
58 * If not, it should be enclosed in quotes.
59 */
60 static explainIfInvalidUnquotedMemberIdentifier(identifier: string): string | undefined;
61}
62//# sourceMappingURL=StringChecks.d.ts.map
\No newline at end of file