UNPKG

388 kBTypeScriptView Raw
1import * as ts from "typescript";
2import { SyntaxKind, CompilerOptions, EmitHint, ScriptKind, NewLineKind, LanguageVariant, ScriptTarget, TypeFlags, ObjectFlags, SymbolFlags, TypeFormatFlags, DiagnosticCategory, EditorSettings, ModuleResolutionKind } from "typescript";
3import { CodeBlockWriter } from "./code-block-writer";
4
5export declare class Directory {
6 private __context;
7 private _path;
8 private _pathParts;
9 private constructor();
10 /**
11 * Checks if this directory is an ancestor of the provided directory.
12 * @param possibleDescendant - Directory or source file that's a possible descendant.
13 */
14 isAncestorOf(possibleDescendant: Directory | SourceFile): boolean;
15 /**
16 * Checks if this directory is a descendant of the provided directory.
17 * @param possibleAncestor - Directory or source file that's a possible ancestor.
18 */
19 isDescendantOf(possibleAncestor: Directory): boolean;
20 /**
21 * Gets the path to the directory.
22 */
23 getPath(): string;
24 /**
25 * Gets the directory path's base name.
26 */
27 getBaseName(): string;
28 /**
29 * Gets the parent directory or throws if it doesn't exist or was never added to the project.
30 */
31 getParentOrThrow(): Directory;
32 /**
33 * Gets the parent directory if it exists and was added to the project.
34 */
35 getParent(): Directory | undefined;
36 /**
37 * Gets a child directory with the specified path or throws if not found.
38 * @param path - Relative path from this directory or absolute path.
39 */
40 getDirectoryOrThrow(path: string): Directory;
41 /**
42 * Gets a child directory by the specified condition or throws if not found.
43 * @param condition - Condition to check the directory with.
44 */
45 getDirectoryOrThrow(condition: (directory: Directory) => boolean): Directory;
46 /**
47 * Gets a directory with the specified path or undefined if not found.
48 * @param path - Relative path from this directory or absolute path.
49 */
50 getDirectory(path: string): Directory | undefined;
51 /**
52 * Gets a child directory by the specified condition or undefined if not found.
53 * @param condition - Condition to check the directory with.
54 */
55 getDirectory(condition: (directory: Directory) => boolean): Directory | undefined;
56 /**
57 * Gets a child source file with the specified path or throws if not found.
58 * @param path - Relative or absolute path to the file.
59 */
60 getSourceFileOrThrow(path: string): SourceFile;
61 /**
62 * Gets a child source file by the specified condition or throws if not found.
63 * @param condition - Condition to check the source file with.
64 */
65 getSourceFileOrThrow(condition: (sourceFile: SourceFile) => boolean): SourceFile;
66 /**
67 * Gets a child source file with the specified path or undefined if not found.
68 * @param path - Relative or absolute path to the file.
69 */
70 getSourceFile(path: string): SourceFile | undefined;
71 /**
72 * Gets a child source file by the specified condition or undefined if not found.
73 * @param condition - Condition to check the source file with.
74 */
75 getSourceFile(condition: (sourceFile: SourceFile) => boolean): SourceFile | undefined;
76 /**
77 * Gets the child directories.
78 */
79 getDirectories(): Directory[];
80 /**
81 * Gets the source files within this directory.
82 */
83 getSourceFiles(): SourceFile[];
84 /**
85 * Gets the source files in the current directory and all the descendant directories.
86 */
87 getDescendantSourceFiles(): SourceFile[];
88 /**
89 * Gets the descendant directories.
90 */
91 getDescendantDirectories(): Directory[];
92 /**
93 * Add source files based on file globs.
94 * @param fileGlobs - File glob or globs to add files based on.
95 * @returns The matched source files.
96 */
97 addExistingSourceFiles(fileGlobs: string | ReadonlyArray<string>): SourceFile[];
98 /**
99 * Adds an existing directory from the relative path or directory name, or returns undefined if it doesn't exist.
100 *
101 * Will return the directory if it was already added.
102 * @param dirPath - Directory name or path to the directory that should be added.
103 * @param options - Options.
104 */
105 addExistingDirectoryIfExists(dirPath: string, options?: DirectoryAddOptions): Directory | undefined;
106 /**
107 * Adds an existing directory from the relative path or directory name, or throws if it doesn't exist.
108 *
109 * Will return the directory if it was already added.
110 * @param dirPath - Directory name or path to the directory that should be added.
111 * @throws DirectoryNotFoundError if the directory does not exist.
112 */
113 addExistingDirectory(dirPath: string, options?: DirectoryAddOptions): Directory;
114 /**
115 * Creates a directory if it doesn't exist.
116 * @param dirPath - Relative or absolute path to the directory that should be created.
117 */
118 createDirectory(dirPath: string): Directory;
119 /**
120 * Creates a source file, relative to this directory.
121 *
122 * Note: The file will not be created and saved to the file system until .save() is called on the source file.
123 * @param relativeFilePath - Relative file path of the source file to create.
124 * @param sourceFileText - Text, structure, or writer function to create the source file text with.
125 * @param options - Options.
126 * @throws - InvalidOperationError if a source file already exists at the provided file name.
127 */
128 createSourceFile(relativeFilePath: string, sourceFileText?: string | SourceFileStructure | WriterFunction, options?: SourceFileCreateOptions): SourceFile;
129 /**
130 * Adds an existing source file, relative to this directory, or returns undefined.
131 *
132 * Will return the source file if it was already added.
133 * @param relativeFilePath - Relative file path to add.
134 */
135 addExistingSourceFileIfExists(relativeFilePath: string): SourceFile | undefined;
136 /**
137 * Adds an existing source file, relative to this directory, or throws if it doesn't exist.
138 *
139 * Will return the source file if it was already added.
140 * @param relativeFilePath - Relative file path to add.
141 * @throws FileNotFoundError when the file doesn't exist.
142 */
143 addExistingSourceFile(relativeFilePath: string): SourceFile;
144 /**
145 * Emits the files in the directory.
146 * @param options - Options for emitting.
147 */
148 emit(options?: {
149 emitOnlyDtsFiles?: boolean;
150 outDir?: string;
151 declarationDir?: string;
152 }): Promise<DirectoryEmitResult>;
153 /**
154 * Emits the files in the directory synchronously.
155 *
156 * Remarks: This might be very slow compared to the asynchronous version if there are a lot of files.
157 * @param options - Options for emitting.
158 */
159 emitSync(options?: {
160 emitOnlyDtsFiles?: boolean;
161 outDir?: string;
162 declarationDir?: string;
163 }): DirectoryEmitResult;
164 private _emitInternal;
165 /**
166 * Copies the directory to a subdirectory of the specified directory.
167 * @param dirPathOrDirectory Directory path or directory object to copy the directory to.
168 * @param options Options for copying.
169 * @returns The new copied directory.
170 */
171 copyToDirectory(dirPathOrDirectory: string | Directory, options?: DirectoryCopyOptions): Directory;
172 /**
173 * Copies the directory to a new directory.
174 * @param relativeOrAbsolutePath - The relative or absolute path to the new directory.
175 * @param options - Options.
176 * @returns The directory the copy was made to.
177 */
178 copy(relativeOrAbsolutePath: string, options?: DirectoryCopyOptions): Directory;
179 /**
180 * Immediately copies the directory to the specified path asynchronously.
181 * @param relativeOrAbsolutePath - Directory path as an absolute or relative path.
182 * @param options - Options for moving the directory.
183 * @remarks If includeTrackedFiles is true, then it will execute the pending operations in the current directory.
184 */
185 copyImmediately(relativeOrAbsolutePath: string, options?: DirectoryCopyOptions): Promise<Directory>;
186 /**
187 * Immediately copies the directory to the specified path synchronously.
188 * @param relativeOrAbsolutePath - Directory path as an absolute or relative path.
189 * @param options - Options for moving the directory.
190 * @remarks If includeTrackedFiles is true, then it will execute the pending operations in the current directory.
191 */
192 copyImmediatelySync(relativeOrAbsolutePath: string, options?: DirectoryCopyOptions): Directory;
193 /**
194 * Moves the directory to a subdirectory of the specified directory.
195 * @param dirPathOrDirectory Directory path or directory object to move the directory to.
196 * @param options Options for moving.
197 */
198 moveToDirectory(dirPathOrDirectory: string | Directory, options?: DirectoryMoveOptions): this;
199 /**
200 * Moves the directory to a new path.
201 * @param relativeOrAbsolutePath - Directory path as an absolute or relative path.
202 * @param options - Options for moving the directory.
203 */
204 move(relativeOrAbsolutePath: string, options?: DirectoryMoveOptions): this;
205 /**
206 * Immediately moves the directory to a new path asynchronously.
207 * @param relativeOrAbsolutePath - Directory path as an absolute or relative path.
208 * @param options - Options for moving the directory.
209 */
210 moveImmediately(relativeOrAbsolutePath: string, options?: DirectoryMoveOptions): Promise<this>;
211 /**
212 * Immediately moves the directory to a new path synchronously.
213 * @param relativeOrAbsolutePath - Directory path as an absolute or relative path.
214 * @param options - Options for moving the directory.
215 */
216 moveImmediatelySync(relativeOrAbsolutePath: string, options?: DirectoryMoveOptions): this;
217 /**
218 * Queues a deletion of the directory to the file system.
219 *
220 * The directory will be deleted when calling ast.save(). If you wish to delete the file immediately, then use deleteImmediately().
221 */
222 delete(): void;
223 /**
224 * Asyncronously deletes the directory and all its descendants from the file system.
225 */
226 deleteImmediately(): Promise<void>;
227 /**
228 * Synchronously deletes the directory and all its descendants from the file system.
229 */
230 deleteImmediatelySync(): void;
231 /**
232 * Forgets the directory and all its descendants from the Project.
233 *
234 * Note: Does not delete the directory from the file system.
235 */
236 forget(): void;
237 /**
238 * Asynchronously saves the directory and all the unsaved source files to the disk.
239 */
240 save(): Promise<void>;
241 /**
242 * Synchronously saves the directory and all the unsaved source files to the disk.
243 */
244 saveSync(): void;
245 /**
246 * Gets the relative path to another source file.
247 * @param sourceFile - Source file.
248 */
249 getRelativePathTo(sourceFile: SourceFile): string;
250 /**
251 * Gets the relative path to another directory.
252 * @param directory - Directory.
253 */
254 getRelativePathTo(directory: Directory): string;
255 /**
256 * Gets the relative path to the specified source file as a module specifier.
257 * @param sourceFile - Source file.
258 */
259 getRelativePathAsModuleSpecifierTo(sourceFile: SourceFile): string;
260 /**
261 * Gets the relative path to the specified directory as a module specifier.
262 * @param directory - Directory.
263 */
264 getRelativePathAsModuleSpecifierTo(directory: Directory): string;
265 /**
266 * Gets if the directory was forgotten.
267 */
268 wasForgotten(): boolean;
269}
270
271export interface DirectoryAddOptions {
272 /**
273 * Whether to also recursively add all the directory's descendant directories.
274 * @remarks Defaults to false.
275 */
276 recursive?: boolean;
277}
278
279export interface DirectoryCopyOptions extends SourceFileCopyOptions {
280 /**
281 * Includes all the files in the directory and sub-directory when copying.
282 * @remarks - Defaults to true.
283 */
284 includeUntrackedFiles?: boolean;
285}
286export declare class DirectoryEmitResult {
287 private readonly _emitSkipped;
288 private readonly _outputFilePaths;
289 private constructor();
290 /**
291 * Gets if the emit was skipped.
292 */
293 getEmitSkipped(): boolean;
294 /**
295 * Gets the output file paths.
296 */
297 getOutputFilePaths(): string[];
298}
299
300export interface DirectoryMoveOptions extends SourceFileMoveOptions {
301}
302export interface FileSystemHost {
303 delete(path: string): Promise<void>;
304 deleteSync(path: string): void;
305 readDirSync(dirPath: string): string[];
306 readFile(filePath: string, encoding?: string): Promise<string>;
307 readFileSync(filePath: string, encoding?: string): string;
308 writeFile(filePath: string, fileText: string): Promise<void>;
309 writeFileSync(filePath: string, fileText: string): void;
310 mkdir(dirPath: string): Promise<void>;
311 mkdirSync(dirPath: string): void;
312 move(srcPath: string, destPath: string): Promise<void>;
313 moveSync(srcPath: string, destPath: string): void;
314 copy(srcPath: string, destPath: string): Promise<void>;
315 copySync(srcPath: string, destPath: string): void;
316 fileExists(filePath: string): Promise<boolean>;
317 fileExistsSync(filePath: string): boolean;
318 directoryExists(dirPath: string): Promise<boolean>;
319 directoryExistsSync(dirPath: string): boolean;
320 getCurrentDirectory(): string;
321 glob(patterns: ReadonlyArray<string>): string[];
322}
323
324export interface ProjectOptions {
325 /** Compiler options */
326 compilerOptions?: CompilerOptions;
327 /** File path to the tsconfig.json file */
328 tsConfigFilePath?: string;
329 /** Whether to add the source files from the specified tsconfig.json or not. Defaults to true. */
330 addFilesFromTsConfig?: boolean;
331 /** Manipulation settings */
332 manipulationSettings?: Partial<ManipulationSettings>;
333 /** Skip resolving file dependencies when providing a ts config file path and adding the files from tsconfig. */
334 skipFileDependencyResolution?: boolean;
335 /** Whether to use a virtual file system. */
336 useVirtualFileSystem?: boolean;
337 /**
338 * Optional file system host. Useful for mocking access to the file system.
339 * @remarks Consider using `useVirtualFileSystem` instead.
340 */
341 fileSystem?: FileSystemHost;
342}
343
344/**
345 * Project that holds source files.
346 */
347export declare class Project {
348 /**
349 * Initializes a new instance.
350 * @param options - Optional options.
351 */
352 constructor(options?: ProjectOptions);
353 /** Gets the manipulation settings. */
354 readonly manipulationSettings: ManipulationSettingsContainer;
355 /** Gets the compiler options for modification. */
356 readonly compilerOptions: CompilerOptionsContainer;
357 /**
358 * Adds the source files the project's source files depend on to the project.
359 * @returns The added source files.
360 * @remarks
361 * * This should be done after source files are added to the project, preferably once to
362 * avoid doing more work than necessary.
363 * * This is done by default when creating a Project and providing a tsconfig.json and
364 * not specifying to not add the source files.
365 */
366 resolveSourceFileDependencies(): SourceFile[];
367 /**
368 * Adds an existing directory from the path or returns undefined if it doesn't exist.
369 *
370 * Will return the directory if it was already added.
371 * @param dirPath - Path to add the directory at.
372 * @param options - Options.
373 */
374 addExistingDirectoryIfExists(dirPath: string, options?: DirectoryAddOptions): Directory | undefined;
375 /**
376 * Adds an existing directory from the path or throws if it doesn't exist.
377 *
378 * Will return the directory if it was already added.
379 * @param dirPath - Path to add the directory at.
380 * @param options - Options.
381 * @throws DirectoryNotFoundError when the directory does not exist.
382 */
383 addExistingDirectory(dirPath: string, options?: DirectoryAddOptions): Directory;
384 /**
385 * Creates a directory at the specified path.
386 * @param dirPath - Path to create the directory at.
387 */
388 createDirectory(dirPath: string): Directory;
389 /**
390 * Gets a directory by the specified path or throws if it doesn't exist.
391 * @param dirPath - Path to create the directory at.
392 */
393 getDirectoryOrThrow(dirPath: string): Directory;
394 /**
395 * Gets a directory by the specified path or returns undefined if it doesn't exist.
396 * @param dirPath - Directory path.
397 */
398 getDirectory(dirPath: string): Directory | undefined;
399 /**
400 * Gets all the directories.
401 */
402 getDirectories(): Directory[];
403 /**
404 * Gets the directories without a parent.
405 */
406 getRootDirectories(): Directory[];
407 /**
408 * Adds source files based on file globs.
409 * @param fileGlobs - File glob or globs to add files based on.
410 * @returns The matched source files.
411 */
412 addExistingSourceFiles(fileGlobs: string | ReadonlyArray<string>): SourceFile[];
413 /**
414 * Adds a source file from a file path if it exists or returns undefined.
415 *
416 * Will return the source file if it was already added.
417 * @param filePath - File path to get the file from.
418 */
419 addExistingSourceFileIfExists(filePath: string): SourceFile | undefined;
420 /**
421 * Adds an existing source file from a file path or throws if it doesn't exist.
422 *
423 * Will return the source file if it was already added.
424 * @param filePath - File path to get the file from.
425 * @throws FileNotFoundError when the file is not found.
426 */
427 addExistingSourceFile(filePath: string): SourceFile;
428 /**
429 * Adds all the source files from the specified tsconfig.json.
430 *
431 * Note that this is done by default when specifying a tsconfig file in the constructor and not explicitly setting the
432 * addFilesFromTsConfig option to false.
433 * @param tsConfigFilePath - File path to the tsconfig.json file.
434 */
435 addSourceFilesFromTsConfig(tsConfigFilePath: string): SourceFile[];
436 /**
437 * Creates a source file at the specified file path with the specified text.
438 *
439 * Note: The file will not be created and saved to the file system until .save() is called on the source file.
440 * @param filePath - File path of the source file.
441 * @param sourceFileText - Text, structure, or writer function for the source file text.
442 * @param options - Options.
443 * @throws - InvalidOperationError if a source file already exists at the provided file path.
444 */
445 createSourceFile(filePath: string, sourceFileText?: string | SourceFileStructure | WriterFunction, options?: SourceFileCreateOptions): SourceFile;
446 /**
447 * Removes a source file from the AST.
448 * @param sourceFile - Source file to remove.
449 * @returns True if removed.
450 */
451 removeSourceFile(sourceFile: SourceFile): boolean;
452 /**
453 * Gets a source file by a file name or file path. Throws an error if it doesn't exist.
454 * @param fileNameOrPath - File name or path that the path could end with or equal.
455 */
456 getSourceFileOrThrow(fileNameOrPath: string): SourceFile;
457 /**
458 * Gets a source file by a search function. Throws an erorr if it doesn't exist.
459 * @param searchFunction - Search function.
460 */
461 getSourceFileOrThrow(searchFunction: (file: SourceFile) => boolean): SourceFile;
462 /**
463 * Gets a source file by a file name or file path. Returns undefined if none exists.
464 * @param fileNameOrPath - File name or path that the path could end with or equal.
465 */
466 getSourceFile(fileNameOrPath: string): SourceFile | undefined;
467 /**
468 * Gets a source file by a search function. Returns undefined if none exists.
469 * @param searchFunction - Search function.
470 */
471 getSourceFile(searchFunction: (file: SourceFile) => boolean): SourceFile | undefined;
472 /**
473 * Gets all the source files added to the project.
474 * @param globPattern - Glob pattern for filtering out the source files.
475 */
476 getSourceFiles(): SourceFile[];
477 /**
478 * Gets all the source files added to the project that match a pattern.
479 * @param globPattern - Glob pattern for filtering out the source files.
480 */
481 getSourceFiles(globPattern: string): SourceFile[];
482 /**
483 * Gets all the source files added to the project that match the passed in patterns.
484 * @param globPatterns - Glob patterns for filtering out the source files.
485 */
486 getSourceFiles(globPatterns: ReadonlyArray<string>): SourceFile[];
487 /**
488 * Gets the specified ambient module symbol or returns undefined if not found.
489 * @param moduleName - The ambient module name with or without quotes.
490 */
491 getAmbientModule(moduleName: string): Symbol | undefined;
492 /**
493 * Gets the specified ambient module symbol or throws if not found.
494 * @param moduleName - The ambient module name with or without quotes.
495 */
496 getAmbientModuleOrThrow(moduleName: string): Symbol;
497 /**
498 * Gets the ambient module symbols (ex. modules in the @types folder or node_modules).
499 */
500 getAmbientModules(): Symbol[];
501 /**
502 * Saves all the unsaved source files to the file system and deletes all deleted files.
503 */
504 save(): Promise<void>;
505 /**
506 * Synchronously saves all the unsaved source files to the file system and deletes all deleted files.
507 *
508 * Remarks: This might be very slow compared to the asynchronous version if there are a lot of files.
509 */
510 saveSync(): void;
511 /**
512 * Enables logging to the console.
513 * @param enabled - Enabled.
514 */
515 enableLogging(enabled?: boolean): void;
516 private _getUnsavedSourceFiles;
517 /**
518 * Gets the pre-emit diagnostics.
519 */
520 getPreEmitDiagnostics(): Diagnostic[];
521 /**
522 * Gets the language service.
523 */
524 getLanguageService(): LanguageService;
525 /**
526 * Gets the program.
527 */
528 getProgram(): Program;
529 /**
530 * Gets the type checker.
531 */
532 getTypeChecker(): TypeChecker;
533 /**
534 * Gets the file system.
535 */
536 getFileSystem(): FileSystemHost;
537 /**
538 * Emits all the source files.
539 * @param emitOptions - Optional emit options.
540 */
541 emit(emitOptions?: EmitOptions): EmitResult;
542 /**
543 * Emits all the source files to memory.
544 * @param emitOptions - Optional emit options.
545 */
546 emitToMemory(emitOptions?: EmitOptions): MemoryEmitResult;
547 /**
548 * Gets the compiler options.
549 */
550 getCompilerOptions(): CompilerOptions;
551 /**
552 * Creates a writer with the current manipulation settings.
553 * @remarks Generally it's best to use a provided writer, but this may be useful in some scenarios.
554 */
555 createWriter(): CodeBlockWriter;
556 /**
557 * Forgets the nodes created in the scope of the passed in block.
558 *
559 * This is an advanced method that can be used to easily "forget" all the nodes created within the scope of the block.
560 * @param block - Block of code to run.
561 */
562 forgetNodesCreatedInBlock(block: (remember: (...node: Node[]) => void) => void): void;
563 /**
564 * Forgets the nodes created in the scope of the passed in block asynchronously.
565 *
566 * This is an advanced method that can be used to easily "forget" all the nodes created within the scope of the block.
567 * @param block - Block of code to run.
568 */
569 forgetNodesCreatedInBlock(block: (remember: (...node: Node[]) => void) => Promise<void>): void;
570 /**
571 * Formats an array of diagnostics with their color and context into a string.
572 * @param diagnostics - Diagnostics to get a string of.
573 * @param options - Collection of options. For exmaple, the new line character to use (defaults to the OS' new line character).
574 */
575 formatDiagnosticsWithColorAndContext(diagnostics: ReadonlyArray<Diagnostic>, opts?: {
576 newLineChar?: "\n" | "\r\n";
577 }): string;
578 /**
579 * Applies the given file text changes to this project. This modifies and possibly creates new SourceFiles.
580 *
581 * WARNING: This will forget any previously navigated descendant nodes of changed files. It's best to do
582 * this when you're all done.
583 * @param fileTextChanges - Collections of file changes to apply to this project.
584 * @param options - Options for applying the text changes.
585 */
586 applyFileTextChanges(fileTextChanges: ReadonlyArray<FileTextChanges>, options?: {
587 overwrite?: boolean;
588 }): void;
589}
590
591export interface SourceFileCreateOptions {
592 overwrite?: boolean;
593}
594
595export declare type Constructor<T> = new (...args: any[]) => T;
596
597export declare type WriterFunction = (writer: CodeBlockWriter) => void;
598
599/**
600 * Creates a wrapped node from a compiler node.
601 * @param node - Node to create a wrapped node from.
602 * @param info - Info for creating the wrapped node.
603 */
604export declare function createWrappedNode<T extends ts.Node = ts.Node>(node: T, opts?: CreateWrappedNodeOptions): CompilerNodeToWrappedType<T>;
605
606export interface CreateWrappedNodeOptions {
607 /**
608 * Compiler options.
609 */
610 compilerOptions?: CompilerOptions;
611 /**
612 * Optional source file of the node. Will make it not bother going up the tree to find the source file.
613 */
614 sourceFile?: ts.SourceFile;
615 /**
616 * Type checker.
617 */
618 typeChecker?: ts.TypeChecker;
619}
620
621/**
622 * Prints the provided node using the compiler's printer.
623 * @param node - Compiler node.
624 * @param options - Options.
625 * @remarks If the node was not constructed with the compiler API factory methods and the node
626 * does not have parents set, then use the other overload that accepts a source file.
627 */
628export declare function printNode(node: ts.Node, options?: PrintNodeOptions): string;
629
630/**
631 * Prints the provided node using the compiler's printer.
632 * @param node - Compiler node.
633 * @param sourceFile - Compiler source file.
634 * @param options - Options.
635 */
636export declare function printNode(node: ts.Node, sourceFile: ts.SourceFile, options?: PrintNodeOptions): string;
637
638/**
639 * Options for printing a node.
640 */
641export interface PrintNodeOptions {
642 /**
643 * Whether to remove comments or not.
644 */
645 removeComments?: boolean;
646 /**
647 * New line kind.
648 *
649 * Defaults to line feed.
650 */
651 newLineKind?: NewLineKind;
652 /**
653 * From the compiler api: "A value indicating the purpose of a node. This is primarily used to
654 * distinguish between an `Identifier` used in an expression position, versus an
655 * `Identifier` used as an `IdentifierName` as part of a declaration. For most nodes you
656 * should just pass `Unspecified`."
657 *
658 * Defaults to `Unspecified`.
659 */
660 emitHint?: EmitHint;
661 /**
662 * The script kind.
663 *
664 * @remarks This is only useful when passing in a compiler node that was constructed
665 * with the compiler API factory methods.
666 *
667 * Defaults to TSX.
668 */
669 scriptKind?: ScriptKind;
670}
671
672export declare type SourceFileReferencingNodes = ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration | CallExpression;
673
674export interface CompilerOptionsFromTsConfigOptions {
675 encoding?: string;
676 fileSystem?: FileSystemHost;
677}
678
679export interface CompilerOptionsFromTsConfigResult {
680 options: CompilerOptions;
681 errors: Diagnostic[];
682}
683
684/**
685 * Gets the compiler options from a specified tsconfig.json
686 * @param filePath - File path to the tsconfig.json.
687 * @param options - Options.
688 */
689export declare function getCompilerOptionsFromTsConfig(filePath: string, options?: CompilerOptionsFromTsConfigOptions): CompilerOptionsFromTsConfigResult;
690
691/**
692 * Type guards for checking the type of a node.
693 */
694export declare class TypeGuards {
695 private constructor();
696 /**
697 * Gets if the node has an expression.
698 * @param node - Node to check.
699 */
700 static hasExpression(node: Node): node is Node & {
701 getExpression(): Expression;
702 };
703 /**
704 * Gets if the node has a name.
705 * @param node - Node to check.
706 */
707 static hasName(node: Node): node is Node & {
708 getName(): string;
709 getNameNode(): Node;
710 };
711 /**
712 * Gets if the node has a body.
713 * @param node - Node to check.
714 */
715 static hasBody(node: Node): node is Node & {
716 getBody(): Node;
717 };
718 /**
719 * Gets if the node is an AbstractableNode.
720 * @param node - Node to check.
721 */
722 static isAbstractableNode(node: Node): node is AbstractableNode & AbstractableNodeExtensionType;
723 /**
724 * Gets if the node is an AmbientableNode.
725 * @param node - Node to check.
726 */
727 static isAmbientableNode(node: Node): node is AmbientableNode & AmbientableNodeExtensionType;
728 /**
729 * Gets if the node is an AnyKeyword.
730 * @param node - Node to check.
731 */
732 static isAnyKeyword(node: Node): node is Expression;
733 /**
734 * Gets if the node is an ArgumentedNode.
735 * @param node - Node to check.
736 */
737 static isArgumentedNode(node: Node): node is ArgumentedNode & ArgumentedNodeExtensionType;
738 /**
739 * Gets if the node is an ArrayBindingPattern.
740 * @param node - Node to check.
741 */
742 static isArrayBindingPattern(node: Node): node is ArrayBindingPattern;
743 /**
744 * Gets if the node is an ArrayLiteralExpression.
745 * @param node - Node to check.
746 */
747 static isArrayLiteralExpression(node: Node): node is ArrayLiteralExpression;
748 /**
749 * Gets if the node is an ArrayTypeNode.
750 * @param node - Node to check.
751 */
752 static isArrayTypeNode(node: Node): node is ArrayTypeNode;
753 /**
754 * Gets if the node is an ArrowFunction.
755 * @param node - Node to check.
756 */
757 static isArrowFunction(node: Node): node is ArrowFunction;
758 /**
759 * Gets if the node is an AsExpression.
760 * @param node - Node to check.
761 */
762 static isAsExpression(node: Node): node is AsExpression;
763 /**
764 * Gets if the node is an AsyncableNode.
765 * @param node - Node to check.
766 */
767 static isAsyncableNode(node: Node): node is AsyncableNode & AsyncableNodeExtensionType;
768 /**
769 * Gets if the node is an AwaitExpression.
770 * @param node - Node to check.
771 */
772 static isAwaitExpression(node: Node): node is AwaitExpression;
773 /**
774 * Gets if the node is an AwaitableNode.
775 * @param node - Node to check.
776 */
777 static isAwaitableNode(node: Node): node is AwaitableNode & AwaitableNodeExtensionType;
778 /**
779 * Gets if the node is a BinaryExpression.
780 * @param node - Node to check.
781 */
782 static isBinaryExpression(node: Node): node is BinaryExpression;
783 /**
784 * Gets if the node is a BindingElement.
785 * @param node - Node to check.
786 */
787 static isBindingElement(node: Node): node is BindingElement;
788 /**
789 * Gets if the node is a BindingNamedNode.
790 * @param node - Node to check.
791 */
792 static isBindingNamedNode(node: Node): node is BindingNamedNode & BindingNamedNodeExtensionType;
793 /**
794 * Gets if the node is a Block.
795 * @param node - Node to check.
796 */
797 static isBlock(node: Node): node is Block;
798 /**
799 * Gets if the node is a BodiedNode.
800 * @param node - Node to check.
801 */
802 static isBodiedNode(node: Node): node is BodiedNode & BodiedNodeExtensionType;
803 /**
804 * Gets if the node is a BodyableNode.
805 * @param node - Node to check.
806 */
807 static isBodyableNode(node: Node): node is BodyableNode & BodyableNodeExtensionType;
808 /**
809 * Gets if the node is a BooleanKeyword.
810 * @param node - Node to check.
811 */
812 static isBooleanKeyword(node: Node): node is Expression;
813 /**
814 * Gets if the node is a BooleanLiteral.
815 * @param node - Node to check.
816 */
817 static isBooleanLiteral(node: Node): node is BooleanLiteral;
818 /**
819 * Gets if the node is a BreakStatement.
820 * @param node - Node to check.
821 */
822 static isBreakStatement(node: Node): node is BreakStatement;
823 /**
824 * Gets if the node is a CallExpression.
825 * @param node - Node to check.
826 */
827 static isCallExpression(node: Node): node is CallExpression;
828 /**
829 * Gets if the node is a CallSignatureDeclaration.
830 * @param node - Node to check.
831 */
832 static isCallSignatureDeclaration(node: Node): node is CallSignatureDeclaration;
833 /**
834 * Gets if the node is a CaseBlock.
835 * @param node - Node to check.
836 */
837 static isCaseBlock(node: Node): node is CaseBlock;
838 /**
839 * Gets if the node is a CaseClause.
840 * @param node - Node to check.
841 */
842 static isCaseClause(node: Node): node is CaseClause;
843 /**
844 * Gets if the node is a CatchClause.
845 * @param node - Node to check.
846 */
847 static isCatchClause(node: Node): node is CatchClause;
848 /**
849 * Gets if the node is a ChildOrderableNode.
850 * @param node - Node to check.
851 */
852 static isChildOrderableNode(node: Node): node is ChildOrderableNode & ChildOrderableNodeExtensionType;
853 /**
854 * Gets if the node is a ClassDeclaration.
855 * @param node - Node to check.
856 */
857 static isClassDeclaration(node: Node): node is ClassDeclaration;
858 /**
859 * Gets if the node is a ClassExpression.
860 * @param node - Node to check.
861 */
862 static isClassExpression(node: Node): node is ClassExpression;
863 /**
864 * Gets if the node is a ClassLikeDeclarationBase.
865 * @param node - Node to check.
866 */
867 static isClassLikeDeclarationBase(node: Node): node is ClassLikeDeclarationBase & ClassLikeDeclarationBaseExtensionType;
868 /**
869 * Gets if the node is a CommaListExpression.
870 * @param node - Node to check.
871 */
872 static isCommaListExpression(node: Node): node is CommaListExpression;
873 /**
874 * Gets if the node is a ComputedPropertyName.
875 * @param node - Node to check.
876 */
877 static isComputedPropertyName(node: Node): node is ComputedPropertyName;
878 /**
879 * Gets if the node is a ConditionalExpression.
880 * @param node - Node to check.
881 */
882 static isConditionalExpression(node: Node): node is ConditionalExpression;
883 /**
884 * Gets if the node is a ConstructSignatureDeclaration.
885 * @param node - Node to check.
886 */
887 static isConstructSignatureDeclaration(node: Node): node is ConstructSignatureDeclaration;
888 /**
889 * Gets if the node is a ConstructorDeclaration.
890 * @param node - Node to check.
891 */
892 static isConstructorDeclaration(node: Node): node is ConstructorDeclaration;
893 /**
894 * Gets if the node is a ConstructorTypeNode.
895 * @param node - Node to check.
896 */
897 static isConstructorTypeNode(node: Node): node is ConstructorTypeNode;
898 /**
899 * Gets if the node is a ContinueStatement.
900 * @param node - Node to check.
901 */
902 static isContinueStatement(node: Node): node is ContinueStatement;
903 /**
904 * Gets if the node is a DebuggerStatement.
905 * @param node - Node to check.
906 */
907 static isDebuggerStatement(node: Node): node is DebuggerStatement;
908 /**
909 * Gets if the node is a DeclarationNamedNode.
910 * @param node - Node to check.
911 */
912 static isDeclarationNamedNode(node: Node): node is DeclarationNamedNode & DeclarationNamedNodeExtensionType;
913 /**
914 * Gets if the node is a DecoratableNode.
915 * @param node - Node to check.
916 */
917 static isDecoratableNode(node: Node): node is DecoratableNode & DecoratableNodeExtensionType;
918 /**
919 * Gets if the node is a Decorator.
920 * @param node - Node to check.
921 */
922 static isDecorator(node: Node): node is Decorator;
923 /**
924 * Gets if the node is a DefaultClause.
925 * @param node - Node to check.
926 */
927 static isDefaultClause(node: Node): node is DefaultClause;
928 /**
929 * Gets if the node is a DeleteExpression.
930 * @param node - Node to check.
931 */
932 static isDeleteExpression(node: Node): node is DeleteExpression;
933 /**
934 * Gets if the node is a DoStatement.
935 * @param node - Node to check.
936 */
937 static isDoStatement(node: Node): node is DoStatement;
938 /**
939 * Gets if the node is an ElementAccessExpression.
940 * @param node - Node to check.
941 */
942 static isElementAccessExpression(node: Node): node is ElementAccessExpression;
943 /**
944 * Gets if the node is an EmptyStatement.
945 * @param node - Node to check.
946 */
947 static isEmptyStatement(node: Node): node is EmptyStatement;
948 /**
949 * Gets if the node is an EnumDeclaration.
950 * @param node - Node to check.
951 */
952 static isEnumDeclaration(node: Node): node is EnumDeclaration;
953 /**
954 * Gets if the node is an EnumMember.
955 * @param node - Node to check.
956 */
957 static isEnumMember(node: Node): node is EnumMember;
958 /**
959 * Gets if the node is an ExclamationTokenableNode.
960 * @param node - Node to check.
961 */
962 static isExclamationTokenableNode(node: Node): node is ExclamationTokenableNode & ExclamationTokenableNodeExtensionType;
963 /**
964 * Gets if the node is an ExportAssignment.
965 * @param node - Node to check.
966 */
967 static isExportAssignment(node: Node): node is ExportAssignment;
968 /**
969 * Gets if the node is an ExportDeclaration.
970 * @param node - Node to check.
971 */
972 static isExportDeclaration(node: Node): node is ExportDeclaration;
973 /**
974 * Gets if the node is an ExportSpecifier.
975 * @param node - Node to check.
976 */
977 static isExportSpecifier(node: Node): node is ExportSpecifier;
978 /**
979 * Gets if the node is an ExportableNode.
980 * @param node - Node to check.
981 */
982 static isExportableNode(node: Node): node is ExportableNode & ExportableNodeExtensionType;
983 /**
984 * Gets if the node is an Expression.
985 * @param node - Node to check.
986 */
987 static isExpression(node: Node): node is Expression;
988 /**
989 * Gets if the node is an ExpressionStatement.
990 * @param node - Node to check.
991 */
992 static isExpressionStatement(node: Node): node is ExpressionStatement;
993 /**
994 * Gets if the node is an ExpressionWithTypeArguments.
995 * @param node - Node to check.
996 */
997 static isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments;
998 /**
999 * Gets if the node is an ExpressionedNode.
1000 * @param node - Node to check.
1001 */
1002 static isExpressionedNode(node: Node): node is ExpressionedNode & ExpressionedNodeExtensionType;
1003 /**
1004 * Gets if the node is an ExtendsClauseableNode.
1005 * @param node - Node to check.
1006 */
1007 static isExtendsClauseableNode(node: Node): node is ExtendsClauseableNode & ExtendsClauseableNodeExtensionType;
1008 /**
1009 * Gets if the node is an ExternalModuleReference.
1010 * @param node - Node to check.
1011 */
1012 static isExternalModuleReference(node: Node): node is ExternalModuleReference;
1013 /**
1014 * Gets if the node is a FalseKeyword.
1015 * @param node - Node to check.
1016 */
1017 static isFalseKeyword(node: Node): node is BooleanLiteral;
1018 /**
1019 * Gets if the node is a ForInStatement.
1020 * @param node - Node to check.
1021 */
1022 static isForInStatement(node: Node): node is ForInStatement;
1023 /**
1024 * Gets if the node is a ForOfStatement.
1025 * @param node - Node to check.
1026 */
1027 static isForOfStatement(node: Node): node is ForOfStatement;
1028 /**
1029 * Gets if the node is a ForStatement.
1030 * @param node - Node to check.
1031 */
1032 static isForStatement(node: Node): node is ForStatement;
1033 /**
1034 * Gets if the node is a FunctionDeclaration.
1035 * @param node - Node to check.
1036 */
1037 static isFunctionDeclaration(node: Node): node is FunctionDeclaration;
1038 /**
1039 * Gets if the node is a FunctionExpression.
1040 * @param node - Node to check.
1041 */
1042 static isFunctionExpression(node: Node): node is FunctionExpression;
1043 /**
1044 * Gets if the node is a FunctionLikeDeclaration.
1045 * @param node - Node to check.
1046 */
1047 static isFunctionLikeDeclaration(node: Node): node is FunctionLikeDeclaration & FunctionLikeDeclarationExtensionType;
1048 /**
1049 * Gets if the node is a FunctionOrConstructorTypeNodeBase.
1050 * @param node - Node to check.
1051 */
1052 static isFunctionOrConstructorTypeNodeBase(node: Node): node is FunctionOrConstructorTypeNodeBase;
1053 /**
1054 * Gets if the node is a FunctionTypeNode.
1055 * @param node - Node to check.
1056 */
1057 static isFunctionTypeNode(node: Node): node is FunctionTypeNode;
1058 /**
1059 * Gets if the node is a GeneratorableNode.
1060 * @param node - Node to check.
1061 */
1062 static isGeneratorableNode(node: Node): node is GeneratorableNode & GeneratorableNodeExtensionType;
1063 /**
1064 * Gets if the node is a GetAccessorDeclaration.
1065 * @param node - Node to check.
1066 */
1067 static isGetAccessorDeclaration(node: Node): node is GetAccessorDeclaration;
1068 /**
1069 * Gets if the node is a HeritageClause.
1070 * @param node - Node to check.
1071 */
1072 static isHeritageClause(node: Node): node is HeritageClause;
1073 /**
1074 * Gets if the node is a HeritageClauseableNode.
1075 * @param node - Node to check.
1076 */
1077 static isHeritageClauseableNode(node: Node): node is HeritageClauseableNode & HeritageClauseableNodeExtensionType;
1078 /**
1079 * Gets if the node is a Identifier.
1080 * @param node - Node to check.
1081 */
1082 static isIdentifier(node: Node): node is Identifier;
1083 /**
1084 * Gets if the node is a IfStatement.
1085 * @param node - Node to check.
1086 */
1087 static isIfStatement(node: Node): node is IfStatement;
1088 /**
1089 * Gets if the node is a ImplementsClauseableNode.
1090 * @param node - Node to check.
1091 */
1092 static isImplementsClauseableNode(node: Node): node is ImplementsClauseableNode & ImplementsClauseableNodeExtensionType;
1093 /**
1094 * Gets if the node is a ImportClause.
1095 * @param node - Node to check.
1096 */
1097 static isImportClause(node: Node): node is ImportClause;
1098 /**
1099 * Gets if the node is a ImportDeclaration.
1100 * @param node - Node to check.
1101 */
1102 static isImportDeclaration(node: Node): node is ImportDeclaration;
1103 /**
1104 * Gets if the node is a ImportEqualsDeclaration.
1105 * @param node - Node to check.
1106 */
1107 static isImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration;
1108 /**
1109 * Gets if the node is a ImportExpression.
1110 * @param node - Node to check.
1111 */
1112 static isImportExpression(node: Node): node is ImportExpression;
1113 /**
1114 * Gets if the node is a ImportSpecifier.
1115 * @param node - Node to check.
1116 */
1117 static isImportSpecifier(node: Node): node is ImportSpecifier;
1118 /**
1119 * Gets if the node is a ImportTypeNode.
1120 * @param node - Node to check.
1121 */
1122 static isImportTypeNode(node: Node): node is ImportTypeNode;
1123 /**
1124 * Gets if the node is a IndexSignatureDeclaration.
1125 * @param node - Node to check.
1126 */
1127 static isIndexSignatureDeclaration(node: Node): node is IndexSignatureDeclaration;
1128 /**
1129 * Gets if the node is a InitializerExpressionableNode.
1130 * @param node - Node to check.
1131 */
1132 static isInitializerExpressionableNode(node: Node): node is InitializerExpressionableNode & InitializerExpressionableNodeExtensionType;
1133 /**
1134 * Gets if the node is a InitializerGetExpressionableNode.
1135 * @param node - Node to check.
1136 */
1137 static isInitializerGetExpressionableNode(node: Node): node is InitializerGetExpressionableNode & InitializerGetExpressionableNodeExtensionType;
1138 /**
1139 * Gets if the node is a InitializerSetExpressionableNode.
1140 * @param node - Node to check.
1141 */
1142 static isInitializerSetExpressionableNode(node: Node): node is InitializerSetExpressionableNode & InitializerSetExpressionableNodeExtensionType;
1143 /**
1144 * Gets if the node is a InterfaceDeclaration.
1145 * @param node - Node to check.
1146 */
1147 static isInterfaceDeclaration(node: Node): node is InterfaceDeclaration;
1148 /**
1149 * Gets if the node is a IntersectionTypeNode.
1150 * @param node - Node to check.
1151 */
1152 static isIntersectionTypeNode(node: Node): node is IntersectionTypeNode;
1153 /**
1154 * Gets if the node is a IterationStatement.
1155 * @param node - Node to check.
1156 */
1157 static isIterationStatement(node: Node): node is IterationStatement;
1158 /**
1159 * Gets if the node is a JSDoc.
1160 * @param node - Node to check.
1161 */
1162 static isJSDoc(node: Node): node is JSDoc;
1163 /**
1164 * Gets if the node is a JSDocAugmentsTag.
1165 * @param node - Node to check.
1166 */
1167 static isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag;
1168 /**
1169 * Gets if the node is a JSDocClassTag.
1170 * @param node - Node to check.
1171 */
1172 static isJSDocClassTag(node: Node): node is JSDocClassTag;
1173 /**
1174 * Gets if the node is a JSDocParameterTag.
1175 * @param node - Node to check.
1176 */
1177 static isJSDocParameterTag(node: Node): node is JSDocParameterTag;
1178 /**
1179 * Gets if the node is a JSDocPropertyLikeTag.
1180 * @param node - Node to check.
1181 */
1182 static isJSDocPropertyLikeTag(node: Node): node is JSDocPropertyLikeTag & JSDocPropertyLikeTagExtensionType;
1183 /**
1184 * Gets if the node is a JSDocPropertyTag.
1185 * @param node - Node to check.
1186 */
1187 static isJSDocPropertyTag(node: Node): node is JSDocPropertyTag;
1188 /**
1189 * Gets if the node is a JSDocReturnTag.
1190 * @param node - Node to check.
1191 */
1192 static isJSDocReturnTag(node: Node): node is JSDocReturnTag;
1193 /**
1194 * Gets if the node is a JSDocTag.
1195 * @param node - Node to check.
1196 */
1197 static isJSDocTag(node: Node): node is JSDocTag;
1198 /**
1199 * Gets if the node is a JSDocTypeTag.
1200 * @param node - Node to check.
1201 */
1202 static isJSDocTypeTag(node: Node): node is JSDocTypeTag;
1203 /**
1204 * Gets if the node is a JSDocTypedefTag.
1205 * @param node - Node to check.
1206 */
1207 static isJSDocTypedefTag(node: Node): node is JSDocTypedefTag;
1208 /**
1209 * Gets if the node is a JSDocUnknownTag.
1210 * @param node - Node to check.
1211 */
1212 static isJSDocUnknownTag(node: Node): node is JSDocUnknownTag;
1213 /**
1214 * Gets if the node is a JSDocableNode.
1215 * @param node - Node to check.
1216 */
1217 static isJSDocableNode(node: Node): node is JSDocableNode & JSDocableNodeExtensionType;
1218 /**
1219 * Gets if the node is a JsxAttribute.
1220 * @param node - Node to check.
1221 */
1222 static isJsxAttribute(node: Node): node is JsxAttribute;
1223 /**
1224 * Gets if the node is a JsxAttributedNode.
1225 * @param node - Node to check.
1226 */
1227 static isJsxAttributedNode(node: Node): node is JsxAttributedNode & JsxAttributedNodeExtensionType;
1228 /**
1229 * Gets if the node is a JsxClosingElement.
1230 * @param node - Node to check.
1231 */
1232 static isJsxClosingElement(node: Node): node is JsxClosingElement;
1233 /**
1234 * Gets if the node is a JsxClosingFragment.
1235 * @param node - Node to check.
1236 */
1237 static isJsxClosingFragment(node: Node): node is JsxClosingFragment;
1238 /**
1239 * Gets if the node is a JsxElement.
1240 * @param node - Node to check.
1241 */
1242 static isJsxElement(node: Node): node is JsxElement;
1243 /**
1244 * Gets if the node is a JsxExpression.
1245 * @param node - Node to check.
1246 */
1247 static isJsxExpression(node: Node): node is JsxExpression;
1248 /**
1249 * Gets if the node is a JsxFragment.
1250 * @param node - Node to check.
1251 */
1252 static isJsxFragment(node: Node): node is JsxFragment;
1253 /**
1254 * Gets if the node is a JsxOpeningElement.
1255 * @param node - Node to check.
1256 */
1257 static isJsxOpeningElement(node: Node): node is JsxOpeningElement;
1258 /**
1259 * Gets if the node is a JsxOpeningFragment.
1260 * @param node - Node to check.
1261 */
1262 static isJsxOpeningFragment(node: Node): node is JsxOpeningFragment;
1263 /**
1264 * Gets if the node is a JsxSelfClosingElement.
1265 * @param node - Node to check.
1266 */
1267 static isJsxSelfClosingElement(node: Node): node is JsxSelfClosingElement;
1268 /**
1269 * Gets if the node is a JsxSpreadAttribute.
1270 * @param node - Node to check.
1271 */
1272 static isJsxSpreadAttribute(node: Node): node is JsxSpreadAttribute;
1273 /**
1274 * Gets if the node is a JsxTagNamedNode.
1275 * @param node - Node to check.
1276 */
1277 static isJsxTagNamedNode(node: Node): node is JsxTagNamedNode & JsxTagNamedNodeExtensionType;
1278 /**
1279 * Gets if the node is a JsxText.
1280 * @param node - Node to check.
1281 */
1282 static isJsxText(node: Node): node is JsxText;
1283 /**
1284 * Gets if the node is a LabeledStatement.
1285 * @param node - Node to check.
1286 */
1287 static isLabeledStatement(node: Node): node is LabeledStatement;
1288 /**
1289 * Gets if the node is a LeftHandSideExpression.
1290 * @param node - Node to check.
1291 */
1292 static isLeftHandSideExpression(node: Node): node is LeftHandSideExpression;
1293 /**
1294 * Gets if the node is a LeftHandSideExpressionedNode.
1295 * @param node - Node to check.
1296 */
1297 static isLeftHandSideExpressionedNode(node: Node): node is LeftHandSideExpressionedNode & LeftHandSideExpressionedNodeExtensionType;
1298 /**
1299 * Gets if the node is a LiteralExpression.
1300 * @param node - Node to check.
1301 */
1302 static isLiteralExpression(node: Node): node is LiteralExpression;
1303 /**
1304 * Gets if the node is a LiteralLikeNode.
1305 * @param node - Node to check.
1306 */
1307 static isLiteralLikeNode(node: Node): node is LiteralLikeNode & LiteralLikeNodeExtensionType;
1308 /**
1309 * Gets if the node is a LiteralTypeNode.
1310 * @param node - Node to check.
1311 */
1312 static isLiteralTypeNode(node: Node): node is LiteralTypeNode;
1313 /**
1314 * Gets if the node is a MemberExpression.
1315 * @param node - Node to check.
1316 */
1317 static isMemberExpression(node: Node): node is MemberExpression;
1318 /**
1319 * Gets if the node is a MetaProperty.
1320 * @param node - Node to check.
1321 */
1322 static isMetaProperty(node: Node): node is MetaProperty;
1323 /**
1324 * Gets if the node is a MethodDeclaration.
1325 * @param node - Node to check.
1326 */
1327 static isMethodDeclaration(node: Node): node is MethodDeclaration;
1328 /**
1329 * Gets if the node is a MethodSignature.
1330 * @param node - Node to check.
1331 */
1332 static isMethodSignature(node: Node): node is MethodSignature;
1333 /**
1334 * Gets if the node is a ModifierableNode.
1335 * @param node - Node to check.
1336 */
1337 static isModifierableNode(node: Node): node is ModifierableNode & ModifierableNodeExtensionType;
1338 /**
1339 * Gets if the node is a ModuleBlock.
1340 * @param node - Node to check.
1341 */
1342 static isModuleBlock(node: Node): node is ModuleBlock;
1343 /**
1344 * Gets if the node is a ModuledNode.
1345 * @param node - Node to check.
1346 */
1347 static isModuledNode(node: Node): node is ModuledNode & ModuledNodeExtensionType;
1348 /**
1349 * Gets if the node is a NameableNode.
1350 * @param node - Node to check.
1351 */
1352 static isNameableNode(node: Node): node is NameableNode & NameableNodeExtensionType;
1353 /**
1354 * Gets if the node is a NamedExports.
1355 * @param node - Node to check.
1356 */
1357 static isNamedExports(node: Node): node is NamedExports;
1358 /**
1359 * Gets if the node is a NamedImports.
1360 * @param node - Node to check.
1361 */
1362 static isNamedImports(node: Node): node is NamedImports;
1363 /**
1364 * Gets if the node is a NamedNode.
1365 * @param node - Node to check.
1366 */
1367 static isNamedNode(node: Node): node is NamedNode & NamedNodeExtensionType;
1368 /**
1369 * Gets if the node is a NamespaceChildableNode.
1370 * @param node - Node to check.
1371 */
1372 static isNamespaceChildableNode(node: Node): node is NamespaceChildableNode & NamespaceChildableNodeExtensionType;
1373 /**
1374 * Gets if the node is a NamespaceDeclaration.
1375 * @param node - Node to check.
1376 */
1377 static isNamespaceDeclaration(node: Node): node is NamespaceDeclaration;
1378 /**
1379 * Gets if the node is a NamespaceImport.
1380 * @param node - Node to check.
1381 */
1382 static isNamespaceImport(node: Node): node is NamespaceImport;
1383 /**
1384 * Gets if the node is a NeverKeyword.
1385 * @param node - Node to check.
1386 */
1387 static isNeverKeyword(node: Node): node is Expression;
1388 /**
1389 * Gets if the node is a NewExpression.
1390 * @param node - Node to check.
1391 */
1392 static isNewExpression(node: Node): node is NewExpression;
1393 /**
1394 * Gets if the node is a NoSubstitutionTemplateLiteral.
1395 * @param node - Node to check.
1396 */
1397 static isNoSubstitutionTemplateLiteral(node: Node): node is NoSubstitutionTemplateLiteral;
1398 /**
1399 * Gets if the node is a NonNullExpression.
1400 * @param node - Node to check.
1401 */
1402 static isNonNullExpression(node: Node): node is NonNullExpression;
1403 /**
1404 * Gets if the node is a NotEmittedStatement.
1405 * @param node - Node to check.
1406 */
1407 static isNotEmittedStatement(node: Node): node is NotEmittedStatement;
1408 /**
1409 * Gets if the node is a NullLiteral.
1410 * @param node - Node to check.
1411 */
1412 static isNullLiteral(node: Node): node is NullLiteral;
1413 /**
1414 * Gets if the node is a NumberKeyword.
1415 * @param node - Node to check.
1416 */
1417 static isNumberKeyword(node: Node): node is Expression;
1418 /**
1419 * Gets if the node is a NumericLiteral.
1420 * @param node - Node to check.
1421 */
1422 static isNumericLiteral(node: Node): node is NumericLiteral;
1423 /**
1424 * Gets if the node is a ObjectBindingPattern.
1425 * @param node - Node to check.
1426 */
1427 static isObjectBindingPattern(node: Node): node is ObjectBindingPattern;
1428 /**
1429 * Gets if the node is a ObjectKeyword.
1430 * @param node - Node to check.
1431 */
1432 static isObjectKeyword(node: Node): node is Expression;
1433 /**
1434 * Gets if the node is a ObjectLiteralExpression.
1435 * @param node - Node to check.
1436 */
1437 static isObjectLiteralExpression(node: Node): node is ObjectLiteralExpression;
1438 /**
1439 * Gets if the node is a OmittedExpression.
1440 * @param node - Node to check.
1441 */
1442 static isOmittedExpression(node: Node): node is OmittedExpression;
1443 /**
1444 * Gets if the node is a OverloadableNode.
1445 * @param node - Node to check.
1446 */
1447 static isOverloadableNode(node: Node): node is OverloadableNode & OverloadableNodeExtensionType;
1448 /**
1449 * Gets if the node is a ParameterDeclaration.
1450 * @param node - Node to check.
1451 */
1452 static isParameterDeclaration(node: Node): node is ParameterDeclaration;
1453 /**
1454 * Gets if the node is a ParameteredNode.
1455 * @param node - Node to check.
1456 */
1457 static isParameteredNode(node: Node): node is ParameteredNode & ParameteredNodeExtensionType;
1458 /**
1459 * Gets if the node is a ParenthesizedExpression.
1460 * @param node - Node to check.
1461 */
1462 static isParenthesizedExpression(node: Node): node is ParenthesizedExpression;
1463 /**
1464 * Gets if the node is a ParenthesizedTypeNode.
1465 * @param node - Node to check.
1466 */
1467 static isParenthesizedTypeNode(node: Node): node is ParenthesizedTypeNode;
1468 /**
1469 * Gets if the node is a PartiallyEmittedExpression.
1470 * @param node - Node to check.
1471 */
1472 static isPartiallyEmittedExpression(node: Node): node is PartiallyEmittedExpression;
1473 /**
1474 * Gets if the node is a PostfixUnaryExpression.
1475 * @param node - Node to check.
1476 */
1477 static isPostfixUnaryExpression(node: Node): node is PostfixUnaryExpression;
1478 /**
1479 * Gets if the node is a PrefixUnaryExpression.
1480 * @param node - Node to check.
1481 */
1482 static isPrefixUnaryExpression(node: Node): node is PrefixUnaryExpression;
1483 /**
1484 * Gets if the node is a PrimaryExpression.
1485 * @param node - Node to check.
1486 */
1487 static isPrimaryExpression(node: Node): node is PrimaryExpression;
1488 /**
1489 * Gets if the node is a PropertyAccessExpression.
1490 * @param node - Node to check.
1491 */
1492 static isPropertyAccessExpression(node: Node): node is PropertyAccessExpression;
1493 /**
1494 * Gets if the node is a PropertyAssignment.
1495 * @param node - Node to check.
1496 */
1497 static isPropertyAssignment(node: Node): node is PropertyAssignment;
1498 /**
1499 * Gets if the node is a PropertyDeclaration.
1500 * @param node - Node to check.
1501 */
1502 static isPropertyDeclaration(node: Node): node is PropertyDeclaration;
1503 /**
1504 * Gets if the node is a PropertyNamedNode.
1505 * @param node - Node to check.
1506 */
1507 static isPropertyNamedNode(node: Node): node is PropertyNamedNode & PropertyNamedNodeExtensionType;
1508 /**
1509 * Gets if the node is a PropertySignature.
1510 * @param node - Node to check.
1511 */
1512 static isPropertySignature(node: Node): node is PropertySignature;
1513 /**
1514 * Gets if the node is a QualifiedName.
1515 * @param node - Node to check.
1516 */
1517 static isQualifiedName(node: Node): node is QualifiedName;
1518 /**
1519 * Gets if the node is a QuestionTokenableNode.
1520 * @param node - Node to check.
1521 */
1522 static isQuestionTokenableNode(node: Node): node is QuestionTokenableNode & QuestionTokenableNodeExtensionType;
1523 /**
1524 * Gets if the node is a ReadonlyableNode.
1525 * @param node - Node to check.
1526 */
1527 static isReadonlyableNode(node: Node): node is ReadonlyableNode & ReadonlyableNodeExtensionType;
1528 /**
1529 * Gets if the node is a ReferenceFindableNode.
1530 * @param node - Node to check.
1531 */
1532 static isReferenceFindableNode(node: Node): node is ReferenceFindableNode & ReferenceFindableNodeExtensionType;
1533 /**
1534 * Gets if the node is a RegularExpressionLiteral.
1535 * @param node - Node to check.
1536 */
1537 static isRegularExpressionLiteral(node: Node): node is RegularExpressionLiteral;
1538 /**
1539 * Gets if the node is a RenameableNode.
1540 * @param node - Node to check.
1541 */
1542 static isRenameableNode(node: Node): node is RenameableNode & RenameableNodeExtensionType;
1543 /**
1544 * Gets if the node is a ReturnStatement.
1545 * @param node - Node to check.
1546 */
1547 static isReturnStatement(node: Node): node is ReturnStatement;
1548 /**
1549 * Gets if the node is a ReturnTypedNode.
1550 * @param node - Node to check.
1551 */
1552 static isReturnTypedNode(node: Node): node is ReturnTypedNode & ReturnTypedNodeExtensionType;
1553 /**
1554 * Gets if the node is a ScopeableNode.
1555 * @param node - Node to check.
1556 */
1557 static isScopeableNode(node: Node): node is ScopeableNode & ScopeableNodeExtensionType;
1558 /**
1559 * Gets if the node is a ScopedNode.
1560 * @param node - Node to check.
1561 */
1562 static isScopedNode(node: Node): node is ScopedNode & ScopedNodeExtensionType;
1563 /**
1564 * Gets if the node is a SemicolonToken.
1565 * @param node - Node to check.
1566 */
1567 static isSemicolonToken(node: Node): node is Node;
1568 /**
1569 * Gets if the node is a SetAccessorDeclaration.
1570 * @param node - Node to check.
1571 */
1572 static isSetAccessorDeclaration(node: Node): node is SetAccessorDeclaration;
1573 /**
1574 * Gets if the node is a ShorthandPropertyAssignment.
1575 * @param node - Node to check.
1576 */
1577 static isShorthandPropertyAssignment(node: Node): node is ShorthandPropertyAssignment;
1578 /**
1579 * Gets if the node is a SignaturedDeclaration.
1580 * @param node - Node to check.
1581 */
1582 static isSignaturedDeclaration(node: Node): node is SignaturedDeclaration & SignaturedDeclarationExtensionType;
1583 /**
1584 * Gets if the node is a SourceFile.
1585 * @param node - Node to check.
1586 */
1587 static isSourceFile(node: Node): node is SourceFile;
1588 /**
1589 * Gets if the node is a SpreadAssignment.
1590 * @param node - Node to check.
1591 */
1592 static isSpreadAssignment(node: Node): node is SpreadAssignment;
1593 /**
1594 * Gets if the node is a SpreadElement.
1595 * @param node - Node to check.
1596 */
1597 static isSpreadElement(node: Node): node is SpreadElement;
1598 /**
1599 * Gets if the node is a Statement.
1600 * @param node - Node to check.
1601 */
1602 static isStatement(node: Node): node is Statement;
1603 /**
1604 * Gets if the node is a StatementedNode.
1605 * @param node - Node to check.
1606 */
1607 static isStatementedNode(node: Node): node is StatementedNode & StatementedNodeExtensionType;
1608 /**
1609 * Gets if the node is a StaticableNode.
1610 * @param node - Node to check.
1611 */
1612 static isStaticableNode(node: Node): node is StaticableNode & StaticableNodeExtensionType;
1613 /**
1614 * Gets if the node is a StringKeyword.
1615 * @param node - Node to check.
1616 */
1617 static isStringKeyword(node: Node): node is Expression;
1618 /**
1619 * Gets if the node is a StringLiteral.
1620 * @param node - Node to check.
1621 */
1622 static isStringLiteral(node: Node): node is StringLiteral;
1623 /**
1624 * Gets if the node is a SuperExpression.
1625 * @param node - Node to check.
1626 */
1627 static isSuperExpression(node: Node): node is SuperExpression;
1628 /**
1629 * Gets if the node is a SwitchStatement.
1630 * @param node - Node to check.
1631 */
1632 static isSwitchStatement(node: Node): node is SwitchStatement;
1633 /**
1634 * Gets if the node is a SymbolKeyword.
1635 * @param node - Node to check.
1636 */
1637 static isSymbolKeyword(node: Node): node is Expression;
1638 /**
1639 * Gets if the node is a SyntaxList.
1640 * @param node - Node to check.
1641 */
1642 static isSyntaxList(node: Node): node is SyntaxList;
1643 /**
1644 * Gets if the node is a TaggedTemplateExpression.
1645 * @param node - Node to check.
1646 */
1647 static isTaggedTemplateExpression(node: Node): node is TaggedTemplateExpression;
1648 /**
1649 * Gets if the node is a TemplateExpression.
1650 * @param node - Node to check.
1651 */
1652 static isTemplateExpression(node: Node): node is TemplateExpression;
1653 /**
1654 * Gets if the node is a TemplateHead.
1655 * @param node - Node to check.
1656 */
1657 static isTemplateHead(node: Node): node is TemplateHead;
1658 /**
1659 * Gets if the node is a TemplateMiddle.
1660 * @param node - Node to check.
1661 */
1662 static isTemplateMiddle(node: Node): node is TemplateMiddle;
1663 /**
1664 * Gets if the node is a TemplateSpan.
1665 * @param node - Node to check.
1666 */
1667 static isTemplateSpan(node: Node): node is TemplateSpan;
1668 /**
1669 * Gets if the node is a TemplateTail.
1670 * @param node - Node to check.
1671 */
1672 static isTemplateTail(node: Node): node is TemplateTail;
1673 /**
1674 * Gets if the node is a TextInsertableNode.
1675 * @param node - Node to check.
1676 */
1677 static isTextInsertableNode(node: Node): node is TextInsertableNode & TextInsertableNodeExtensionType;
1678 /**
1679 * Gets if the node is a ThisExpression.
1680 * @param node - Node to check.
1681 */
1682 static isThisExpression(node: Node): node is ThisExpression;
1683 /**
1684 * Gets if the node is a ThrowStatement.
1685 * @param node - Node to check.
1686 */
1687 static isThrowStatement(node: Node): node is ThrowStatement;
1688 /**
1689 * Gets if the node is a TrueKeyword.
1690 * @param node - Node to check.
1691 */
1692 static isTrueKeyword(node: Node): node is BooleanLiteral;
1693 /**
1694 * Gets if the node is a TryStatement.
1695 * @param node - Node to check.
1696 */
1697 static isTryStatement(node: Node): node is TryStatement;
1698 /**
1699 * Gets if the node is a TupleTypeNode.
1700 * @param node - Node to check.
1701 */
1702 static isTupleTypeNode(node: Node): node is TupleTypeNode;
1703 /**
1704 * Gets if the node is a TypeAliasDeclaration.
1705 * @param node - Node to check.
1706 */
1707 static isTypeAliasDeclaration(node: Node): node is TypeAliasDeclaration;
1708 /**
1709 * Gets if the node is a TypeArgumentedNode.
1710 * @param node - Node to check.
1711 */
1712 static isTypeArgumentedNode(node: Node): node is TypeArgumentedNode & TypeArgumentedNodeExtensionType;
1713 /**
1714 * Gets if the node is a TypeAssertion.
1715 * @param node - Node to check.
1716 */
1717 static isTypeAssertion(node: Node): node is TypeAssertion;
1718 /**
1719 * Gets if the node is a TypeElement.
1720 * @param node - Node to check.
1721 */
1722 static isTypeElement(node: Node): node is TypeElement;
1723 /**
1724 * Gets if the node is a TypeElementMemberedNode.
1725 * @param node - Node to check.
1726 */
1727 static isTypeElementMemberedNode(node: Node): node is TypeElementMemberedNode & TypeElementMemberedNodeExtensionType;
1728 /**
1729 * Gets if the node is a TypeLiteralNode.
1730 * @param node - Node to check.
1731 */
1732 static isTypeLiteralNode(node: Node): node is TypeLiteralNode;
1733 /**
1734 * Gets if the node is a TypeNode.
1735 * @param node - Node to check.
1736 */
1737 static isTypeNode(node: Node): node is TypeNode;
1738 /**
1739 * Gets if the node is a TypeOfExpression.
1740 * @param node - Node to check.
1741 */
1742 static isTypeOfExpression(node: Node): node is TypeOfExpression;
1743 /**
1744 * Gets if the node is a TypeParameterDeclaration.
1745 * @param node - Node to check.
1746 */
1747 static isTypeParameterDeclaration(node: Node): node is TypeParameterDeclaration;
1748 /**
1749 * Gets if the node is a TypeParameteredNode.
1750 * @param node - Node to check.
1751 */
1752 static isTypeParameteredNode(node: Node): node is TypeParameteredNode & TypeParameteredNodeExtensionType;
1753 /**
1754 * Gets if the node is a TypeReferenceNode.
1755 * @param node - Node to check.
1756 */
1757 static isTypeReferenceNode(node: Node): node is TypeReferenceNode;
1758 /**
1759 * Gets if the node is a TypedNode.
1760 * @param node - Node to check.
1761 */
1762 static isTypedNode(node: Node): node is TypedNode & TypedNodeExtensionType;
1763 /**
1764 * Gets if the node is a UnaryExpression.
1765 * @param node - Node to check.
1766 */
1767 static isUnaryExpression(node: Node): node is UnaryExpression;
1768 /**
1769 * Gets if the node is a UnaryExpressionedNode.
1770 * @param node - Node to check.
1771 */
1772 static isUnaryExpressionedNode(node: Node): node is UnaryExpressionedNode & UnaryExpressionedNodeExtensionType;
1773 /**
1774 * Gets if the node is a UndefinedKeyword.
1775 * @param node - Node to check.
1776 */
1777 static isUndefinedKeyword(node: Node): node is Expression;
1778 /**
1779 * Gets if the node is a UnionTypeNode.
1780 * @param node - Node to check.
1781 */
1782 static isUnionTypeNode(node: Node): node is UnionTypeNode;
1783 /**
1784 * Gets if the node is a UnwrappableNode.
1785 * @param node - Node to check.
1786 */
1787 static isUnwrappableNode(node: Node): node is UnwrappableNode & UnwrappableNodeExtensionType;
1788 /**
1789 * Gets if the node is a UpdateExpression.
1790 * @param node - Node to check.
1791 */
1792 static isUpdateExpression(node: Node): node is UpdateExpression;
1793 /**
1794 * Gets if the node is a VariableDeclaration.
1795 * @param node - Node to check.
1796 */
1797 static isVariableDeclaration(node: Node): node is VariableDeclaration;
1798 /**
1799 * Gets if the node is a VariableDeclarationList.
1800 * @param node - Node to check.
1801 */
1802 static isVariableDeclarationList(node: Node): node is VariableDeclarationList;
1803 /**
1804 * Gets if the node is a VariableStatement.
1805 * @param node - Node to check.
1806 */
1807 static isVariableStatement(node: Node): node is VariableStatement;
1808 /**
1809 * Gets if the node is a VoidExpression.
1810 * @param node - Node to check.
1811 */
1812 static isVoidExpression(node: Node): node is VoidExpression;
1813 /**
1814 * Gets if the node is a WhileStatement.
1815 * @param node - Node to check.
1816 */
1817 static isWhileStatement(node: Node): node is WhileStatement;
1818 /**
1819 * Gets if the node is a WithStatement.
1820 * @param node - Node to check.
1821 */
1822 static isWithStatement(node: Node): node is WithStatement;
1823 /**
1824 * Gets if the node is a YieldExpression.
1825 * @param node - Node to check.
1826 */
1827 static isYieldExpression(node: Node): node is YieldExpression;
1828}
1829
1830/**
1831 * Functions for writing.
1832 * @remarks These functions are currently very experimental.
1833 */
1834export declare class WriterFunctions {
1835 private constructor();
1836 /**
1837 * Gets a writer function for writing the provided object as an object literal expression.
1838 * @param obj - Object to write.
1839 */
1840 static object(obj: {
1841 [key: string]: string | number | WriterFunction | undefined;
1842 }): WriterFunction;
1843}
1844
1845export declare type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName;
1846
1847export declare type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration;
1848
1849export declare type ArrayBindingElement = BindingElement | OmittedExpression;
1850
1851export declare type BindingName = Identifier | BindingPattern;
1852
1853export declare type BindingPattern = ObjectBindingPattern | ArrayBindingPattern;
1854
1855export declare type EntityName = Identifier | QualifiedName;
1856
1857export declare type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment;
1858
1859export declare type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute;
1860
1861export declare type JsxTagNameExpression = Identifier | ThisExpression | JsxTagNamePropertyAccess;
1862
1863export interface JsxTagNamePropertyAccess extends PropertyAccessExpression {
1864 getExpression(): JsxTagNameExpression;
1865}
1866
1867export declare type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | MethodDeclaration | AccessorDeclaration;
1868
1869export declare type CaseOrDefaultClause = CaseClause | DefaultClause;
1870
1871export declare type ModuleReference = EntityName | ExternalModuleReference;
1872
1873export declare type TypeElementTypes = PropertySignature | MethodSignature | ConstructSignatureDeclaration | CallSignatureDeclaration | IndexSignatureDeclaration;
1874
1875export declare type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral;
1876
1877export declare function AmbientableNode<T extends Constructor<AmbientableNodeExtensionType>>(Base: T): Constructor<AmbientableNode> & T;
1878
1879export interface AmbientableNode {
1880 /**
1881 * If the node has the declare keyword.
1882 */
1883 hasDeclareKeyword(): boolean;
1884 /**
1885 * Gets the declare keyword or undefined if none exists.
1886 */
1887 getDeclareKeyword(): Node | undefined;
1888 /**
1889 * Gets the declare keyword or throws if it doesn't exist.
1890 */
1891 getDeclareKeywordOrThrow(): Node;
1892 /**
1893 * Gets if the node is ambient.
1894 */
1895 isAmbient(): boolean;
1896 /**
1897 * Sets if this node has a declare keyword.
1898 * @param value - To add the declare keyword or not.
1899 */
1900 setHasDeclareKeyword(value?: boolean): this;
1901}
1902
1903declare type AmbientableNodeExtensionType = Node & ModifierableNode;
1904
1905export declare function ArgumentedNode<T extends Constructor<ArgumentedNodeExtensionType>>(Base: T): Constructor<ArgumentedNode> & T;
1906
1907export interface ArgumentedNode {
1908 /**
1909 * Gets all the arguments of the node.
1910 */
1911 getArguments(): Node[];
1912 /**
1913 * Adds an argument.
1914 * @param argumentText - Argument text to add.
1915 */
1916 addArgument(argumentText: string | WriterFunction): Node;
1917 /**
1918 * Adds arguments.
1919 * @param argumentTexts - Argument texts to add.
1920 */
1921 addArguments(argumentTexts: ReadonlyArray<string | WriterFunction> | WriterFunction): Node[];
1922 /**
1923 * Inserts an argument.
1924 * @param index - Child index to insert at.
1925 * @param argumentText - Argument text to insert.
1926 */
1927 insertArgument(index: number, argumentText: string | WriterFunction): Node;
1928 /**
1929 * Inserts arguments.
1930 * @param index - Child index to insert at.
1931 * @param argumentTexts - Argument texts to insert.
1932 */
1933 insertArguments(index: number, argumentTexts: ReadonlyArray<string | WriterFunction> | WriterFunction): Node[];
1934 /**
1935 * Removes an argument.
1936 * @param arg - Argument to remove.
1937 */
1938 removeArgument(arg: Node): this;
1939 /**
1940 * Removes an argument.
1941 * @param index - Index to remove.
1942 */
1943 removeArgument(index: number): this;
1944}
1945
1946declare type ArgumentedNodeExtensionType = Node<ts.Node & {
1947 arguments: ts.NodeArray<ts.Node>;
1948}>;
1949
1950export declare function AsyncableNode<T extends Constructor<AsyncableNodeExtensionType>>(Base: T): Constructor<AsyncableNode> & T;
1951
1952export interface AsyncableNode {
1953 /**
1954 * If it's async.
1955 */
1956 isAsync(): boolean;
1957 /**
1958 * Gets the async keyword or undefined if none exists.
1959 */
1960 getAsyncKeyword(): Node<ts.Modifier> | undefined;
1961 /**
1962 * Gets the async keyword or throws if none exists.
1963 */
1964 getAsyncKeywordOrThrow(): Node<ts.Modifier>;
1965 /**
1966 * Sets if the node is async.
1967 * @param value - If it should be async or not.
1968 */
1969 setIsAsync(value: boolean): this;
1970}
1971
1972declare type AsyncableNodeExtensionType = Node & ModifierableNode;
1973
1974export declare function AwaitableNode<T extends Constructor<AwaitableNodeExtensionType>>(Base: T): Constructor<AwaitableNode> & T;
1975
1976export interface AwaitableNode {
1977 /**
1978 * If it's an awaited node.
1979 */
1980 isAwaited(): boolean;
1981 /**
1982 * Gets the await token or undefined if none exists.
1983 */
1984 getAwaitKeyword(): Node<ts.AwaitKeywordToken> | undefined;
1985 /**
1986 * Gets the await token or throws if none exists.
1987 */
1988 getAwaitKeywordOrThrow(): Node<ts.AwaitKeywordToken>;
1989 /**
1990 * Sets if the node is awaited.
1991 * @param value - If it should be awaited or not.
1992 */
1993 setIsAwaited(value: boolean): this;
1994}
1995
1996declare type AwaitableNodeExtensionType = Node<ts.Node & {
1997 awaitModifier?: ts.AwaitKeywordToken;
1998}>;
1999
2000export declare function BodiedNode<T extends Constructor<BodiedNodeExtensionType>>(Base: T): Constructor<BodiedNode> & T;
2001
2002export interface BodiedNode {
2003 /**
2004 * Gets the body.
2005 */
2006 getBody(): Node;
2007 /**
2008 * Sets the body text.
2009 * @param textOrWriterFunction - Text or writer function to set as the body.
2010 */
2011 setBodyText(textOrWriterFunction: string | WriterFunction): this;
2012 /**
2013 * Gets the body text without leading whitespace, leading indentation, or trailing whitespace.
2014 */
2015 getBodyText(): string;
2016}
2017
2018declare type BodiedNodeExtensionType = Node<ts.Node & {
2019 body: ts.Node;
2020}>;
2021
2022export declare function BodyableNode<T extends Constructor<BodyableNodeExtensionType>>(Base: T): Constructor<BodyableNode> & T;
2023
2024export interface BodyableNode {
2025 /**
2026 * Gets the body or throws an error if it doesn't exist.
2027 */
2028 getBodyOrThrow(): Node;
2029 /**
2030 * Gets the body if it exists.
2031 */
2032 getBody(): Node | undefined;
2033 /**
2034 * Gets the body text without leading whitespace, leading indentation, or trailing whitespace. Returns undefined if there is no body.
2035 */
2036 getBodyText(): string | undefined;
2037 /**
2038 * Gets if the node has a body.
2039 */
2040 hasBody(): boolean;
2041 /**
2042 * Sets the body text. A body is required to do this operation.
2043 * @param textOrWriterFunction - Text or writer function to set as the body.
2044 */
2045 setBodyText(textOrWriterFunction: string | WriterFunction): this;
2046 /**
2047 * Adds a body if it doesn't exists.
2048 */
2049 addBody(): this;
2050 /**
2051 * Removes the body if it exists.
2052 */
2053 removeBody(): this;
2054}
2055
2056declare type BodyableNodeExtensionType = Node<ts.Node & {
2057 body?: ts.Node;
2058}>;
2059
2060export declare function ChildOrderableNode<T extends Constructor<ChildOrderableNodeExtensionType>>(Base: T): Constructor<ChildOrderableNode> & T;
2061
2062export interface ChildOrderableNode {
2063 /**
2064 * Sets the child order of the node within the parent.
2065 */
2066 setOrder(order: number): this;
2067}
2068
2069declare type ChildOrderableNodeExtensionType = Node;
2070
2071export declare function DecoratableNode<T extends Constructor<DecoratableNodeExtensionType>>(Base: T): Constructor<DecoratableNode> & T;
2072
2073export interface DecoratableNode {
2074 /**
2075 * Gets a decorator or undefined if it doesn't exist.
2076 * @param name - Name of the parameter.
2077 */
2078 getDecorator(name: string): Decorator | undefined;
2079 /**
2080 * Gets a decorator or undefined if it doesn't exist.
2081 * @param findFunction - Function to use to find the parameter.
2082 */
2083 getDecorator(findFunction: (declaration: Decorator) => boolean): Decorator | undefined;
2084 /**
2085 * Gets a decorator or throws if it doesn't exist.
2086 * @param name - Name of the parameter.
2087 */
2088 getDecoratorOrThrow(name: string): Decorator;
2089 /**
2090 * Gets a decorator or throws if it doesn't exist.
2091 * @param findFunction - Function to use to find the parameter.
2092 */
2093 getDecoratorOrThrow(findFunction: (declaration: Decorator) => boolean): Decorator;
2094 /**
2095 * Gets all the decorators of the node.
2096 */
2097 getDecorators(): Decorator[];
2098 /**
2099 * Adds a decorator.
2100 * @param structure - Structure of the decorator.
2101 */
2102 addDecorator(structure: DecoratorStructure): Decorator;
2103 /**
2104 * Adds decorators.
2105 * @param structures - Structures of the decorators.
2106 */
2107 addDecorators(structures: ReadonlyArray<DecoratorStructure>): Decorator[];
2108 /**
2109 * Inserts a decorator.
2110 * @param index - Child index to insert at. Specify a negative index to insert from the reverse.
2111 * @param structure - Structure of the decorator.
2112 */
2113 insertDecorator(index: number, structure: DecoratorStructure): Decorator;
2114 /**
2115 * Insert decorators.
2116 * @param index - Child index to insert at.
2117 * @param structures - Structures to insert.
2118 */
2119 insertDecorators(index: number, structures: ReadonlyArray<DecoratorStructure>): Decorator[];
2120}
2121
2122declare type DecoratableNodeExtensionType = Node<ts.Node>;
2123
2124export declare function ExclamationTokenableNode<T extends Constructor<ExclamationTokenableNodeExtensionType>>(Base: T): Constructor<ExclamationTokenableNode> & T;
2125
2126export interface ExclamationTokenableNode {
2127 /**
2128 * If it has a exclamation token.
2129 */
2130 hasExclamationToken(): boolean;
2131 /**
2132 * Gets the exclamation token node or returns undefined if it doesn't exist.
2133 */
2134 getExclamationTokenNode(): Node<ts.ExclamationToken> | undefined;
2135 /**
2136 * Gets the exclamation token node or throws.
2137 */
2138 getExclamationTokenNodeOrThrow(): Node<ts.ExclamationToken>;
2139 /**
2140 * Sets if this node has a exclamation token.
2141 * @param value - If it should have a exclamation token or not.
2142 */
2143 setHasExclamationToken(value: boolean): this;
2144}
2145
2146declare type ExclamationTokenableNodeExtensionType = Node<ts.Node & {
2147 exclamationToken?: ts.ExclamationToken;
2148}>;
2149
2150export declare function ExportableNode<T extends Constructor<ExportableNodeExtensionType>>(Base: T): Constructor<ExportableNode> & T;
2151
2152export interface ExportableNode {
2153 /**
2154 * If the node has the export keyword.
2155 */
2156 hasExportKeyword(): boolean;
2157 /**
2158 * Gets the export keyword or undefined if none exists.
2159 */
2160 getExportKeyword(): Node | undefined;
2161 /**
2162 * Gets the export keyword or throws if none exists.
2163 */
2164 getExportKeywordOrThrow(): Node;
2165 /**
2166 * If the node has the default keyword.
2167 */
2168 hasDefaultKeyword(): boolean;
2169 /**
2170 * Gets the default keyword or undefined if none exists.
2171 */
2172 getDefaultKeyword(): Node | undefined;
2173 /**
2174 * Gets the default keyword or throws if none exists.
2175 */
2176 getDefaultKeywordOrThrow(): Node;
2177 /**
2178 * Gets if the node is exported from a namespace, is a default export, or is a named export.
2179 */
2180 isExported(): boolean;
2181 /**
2182 * Gets if this node is a default export of a file.
2183 */
2184 isDefaultExport(): boolean;
2185 /**
2186 * Gets if this node is a named export of a file.
2187 */
2188 isNamedExport(): boolean;
2189 /**
2190 * Sets if this node is a default export of a file.
2191 * @param value - If it should be a default export or not.
2192 */
2193 setIsDefaultExport(value: boolean): this;
2194 /**
2195 * Sets if the node is exported.
2196 *
2197 * Note: Will remove the default keyword if set.
2198 * @param value - If it should be exported or not.
2199 */
2200 setIsExported(value: boolean): this;
2201}
2202
2203declare type ExportableNodeExtensionType = Node & ModifierableNode;
2204
2205export declare function ExtendsClauseableNode<T extends Constructor<ExtendsClauseableNodeExtensionType>>(Base: T): Constructor<ExtendsClauseableNode> & T;
2206
2207export interface ExtendsClauseableNode {
2208 /**
2209 * Gets the extends clauses.
2210 */
2211 getExtends(): ExpressionWithTypeArguments[];
2212 /**
2213 * Adds multiple extends clauses.
2214 * @param texts - Texts to add for the extends clause.
2215 */
2216 addExtends(texts: ReadonlyArray<string | WriterFunction> | WriterFunction): ExpressionWithTypeArguments[];
2217 /**
2218 * Adds an extends clause.
2219 * @param text - Text to add for the extends clause.
2220 */
2221 addExtends(text: string): ExpressionWithTypeArguments;
2222 /**
2223 * Inserts multiple extends clauses.
2224 * @param texts - Texts to insert for the extends clause.
2225 */
2226 insertExtends(index: number, texts: ReadonlyArray<string | WriterFunction> | WriterFunction): ExpressionWithTypeArguments[];
2227 /**
2228 * Inserts an extends clause.
2229 * @param text - Text to insert for the extends clause.
2230 */
2231 insertExtends(index: number, text: string): ExpressionWithTypeArguments;
2232 /**
2233 * Removes the extends at the specified index.
2234 * @param index - Index to remove.
2235 */
2236 removeExtends(index: number): this;
2237 /**
2238 * Removes the specified extends.
2239 * @param extendsNode - Node of the extend to remove.
2240 */
2241 removeExtends(extendsNode: ExpressionWithTypeArguments): this;
2242}
2243
2244declare type ExtendsClauseableNodeExtensionType = Node & HeritageClauseableNode;
2245
2246export declare function GeneratorableNode<T extends Constructor<GeneratorableNodeExtensionType>>(Base: T): Constructor<GeneratorableNode> & T;
2247
2248export interface GeneratorableNode {
2249 /**
2250 * If it's a generator function.
2251 */
2252 isGenerator(): boolean;
2253 /**
2254 * Gets the asterisk token or undefined if none exists.
2255 */
2256 getAsteriskToken(): Node<ts.AsteriskToken> | undefined;
2257 /**
2258 * Gets the asterisk token or throws if none exists.
2259 */
2260 getAsteriskTokenOrThrow(): Node<ts.AsteriskToken>;
2261 /**
2262 * Sets if the node is a generator.
2263 * @param value - If it should be a generator or not.
2264 */
2265 setIsGenerator(value: boolean): this;
2266}
2267
2268declare type GeneratorableNodeExtensionType = Node<ts.Node & {
2269 asteriskToken?: ts.AsteriskToken;
2270}>;
2271
2272export declare function HeritageClauseableNode<T extends Constructor<HeritageClauseableNodeExtensionType>>(Base: T): Constructor<HeritageClauseableNode> & T;
2273
2274export interface HeritageClauseableNode {
2275 /**
2276 * Gets the heritage clauses of the node.
2277 */
2278 getHeritageClauses(): HeritageClause[];
2279 /**
2280 * Gets the heritage clause by kind.
2281 * @kind - Kind of heritage clause.
2282 */
2283 getHeritageClauseByKind(kind: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword): HeritageClause | undefined;
2284 /**
2285 * Gets the heritage clause by kind or throws if it doesn't exist.
2286 * @kind - Kind of heritage clause.
2287 */
2288 getHeritageClauseByKindOrThrow(kind: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword): HeritageClause;
2289}
2290
2291declare type HeritageClauseableNodeExtensionType = Node<ts.Node & {
2292 heritageClauses?: ts.NodeArray<ts.HeritageClause>;
2293}>;
2294
2295export declare function ImplementsClauseableNode<T extends Constructor<ImplementsClauseableNodeExtensionType>>(Base: T): Constructor<ImplementsClauseableNode> & T;
2296
2297export interface ImplementsClauseableNode {
2298 /**
2299 * Gets the implements clauses.
2300 */
2301 getImplements(): ExpressionWithTypeArguments[];
2302 /**
2303 * Adds an implements clause.
2304 * @param text - Text to add for the implements clause.
2305 */
2306 addImplements(text: string): ExpressionWithTypeArguments;
2307 /**
2308 * Adds multiple implements clauses.
2309 * @param text - Texts to add for the implements clause.
2310 */
2311 addImplements(text: ReadonlyArray<string | WriterFunction> | WriterFunction): ExpressionWithTypeArguments[];
2312 /**
2313 * Inserts an implements clause.
2314 * @param text - Text to insert for the implements clause.
2315 */
2316 insertImplements(index: number, texts: ReadonlyArray<string | WriterFunction> | WriterFunction): ExpressionWithTypeArguments[];
2317 /**
2318 * Inserts multiple implements clauses.
2319 * @param text - Texts to insert for the implements clause.
2320 */
2321 insertImplements(index: number, text: string): ExpressionWithTypeArguments;
2322 /**
2323 * Removes the implements at the specified index.
2324 * @param index - Index to remove.
2325 */
2326 removeImplements(index: number): this;
2327 /**
2328 * Removes the specified implements.
2329 * @param implementsNode - Node of the implements to remove.
2330 */
2331 removeImplements(implementsNode: ExpressionWithTypeArguments): this;
2332}
2333
2334declare type ImplementsClauseableNodeExtensionType = Node & HeritageClauseableNode;
2335
2336export declare function InitializerExpressionableNode<T extends Constructor<InitializerExpressionableNodeExtensionType>>(Base: T): Constructor<InitializerExpressionableNode> & T;
2337
2338export interface InitializerExpressionableNode extends InitializerGetExpressionableNode, InitializerSetExpressionableNode {
2339}
2340
2341declare type InitializerExpressionableNodeExtensionType = Node<ts.Node & {
2342 initializer?: ts.Expression;
2343}>;
2344
2345export declare function InitializerGetExpressionableNode<T extends Constructor<InitializerGetExpressionableNodeExtensionType>>(Base: T): Constructor<InitializerGetExpressionableNode> & T;
2346
2347export interface InitializerGetExpressionableNode {
2348 /**
2349 * Gets if node has an initializer.
2350 */
2351 hasInitializer(): boolean;
2352 /**
2353 * Gets the initializer.
2354 */
2355 getInitializer(): Expression | undefined;
2356 /**
2357 * Gets the initializer if it's a certain kind or throws.
2358 */
2359 getInitializerIfKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToExpressionMappings[TKind];
2360 /**
2361 * Gets the initializer if it's a certain kind.
2362 */
2363 getInitializerIfKind<TKind extends SyntaxKind>(kind: TKind): KindToExpressionMappings[TKind] | undefined;
2364 /**
2365 * Gets the initializer or throw.
2366 */
2367 getInitializerOrThrow(): Expression;
2368}
2369
2370declare type InitializerGetExpressionableNodeExtensionType = Node<ts.Node & {
2371 initializer?: ts.Expression;
2372}>;
2373
2374export declare function InitializerSetExpressionableNode<T extends Constructor<InitializerSetExpressionableNodeExtensionType>>(Base: T): Constructor<InitializerSetExpressionableNode> & T;
2375
2376export interface InitializerSetExpressionableNode {
2377 /**
2378 * Removes the initailizer.
2379 */
2380 removeInitializer(): this;
2381 /**
2382 * Sets the initializer.
2383 * @param text - Text or writer function to set for the initializer.
2384 */
2385 setInitializer(textOrWriterFunction: string | WriterFunction): this;
2386}
2387
2388declare type InitializerSetExpressionableNodeExtensionType = Node<ts.Node & {
2389 initializer?: ts.Expression;
2390}> & InitializerGetExpressionableNode;
2391
2392export declare function JSDocableNode<T extends Constructor<JSDocableNodeExtensionType>>(Base: T): Constructor<JSDocableNode> & T;
2393
2394export interface JSDocableNode {
2395 /**
2396 * Gets the JS doc nodes.
2397 */
2398 getJsDocs(): JSDoc[];
2399 /**
2400 * Adds a JS doc.
2401 * @param structure - Structure to add.
2402 */
2403 addJsDoc(structure: JSDocStructure | string | WriterFunction): JSDoc;
2404 /**
2405 * Adds JS docs.
2406 * @param structures - Structures to add.
2407 */
2408 addJsDocs(structures: ReadonlyArray<JSDocStructure | string | WriterFunction>): JSDoc[];
2409 /**
2410 * Inserts a JS doc.
2411 * @param index - Child index to insert at.
2412 * @param structure - Structure to insert.
2413 */
2414 insertJsDoc(index: number, structure: JSDocStructure | string | WriterFunction): JSDoc;
2415 /**
2416 * Inserts JS docs.
2417 * @param index - Child index to insert at.
2418 * @param structures - Structures to insert.
2419 */
2420 insertJsDocs(index: number, structures: ReadonlyArray<JSDocStructure | string | WriterFunction>): JSDoc[];
2421}
2422
2423declare type JSDocableNodeExtensionType = Node<ts.Node & {
2424 jsDoc?: ts.NodeArray<ts.JSDoc>;
2425}>;
2426
2427export declare function LiteralLikeNode<T extends Constructor<LiteralLikeNodeExtensionType>>(Base: T): Constructor<LiteralLikeNode> & T;
2428
2429export interface LiteralLikeNode {
2430 /**
2431 * Get text of the literal.
2432 */
2433 getLiteralText(): string;
2434 /**
2435 * Gets if the literal is terminated.
2436 */
2437 isTerminated(): boolean;
2438 /**
2439 * Gets if the literal has an extended unicode escape.
2440 */
2441 hasExtendedUnicodeEscape(): boolean;
2442}
2443
2444declare type LiteralLikeNodeExtensionType = Node<ts.LiteralLikeNode>;
2445
2446export declare function ModifierableNode<T extends Constructor<ModifierableNodeExtensionType>>(Base: T): Constructor<ModifierableNode> & T;
2447
2448export interface ModifierableNode {
2449 /**
2450 * Gets the node's modifiers.
2451 */
2452 getModifiers(): Node[];
2453 /**
2454 * Gets the first modifier of the specified syntax kind or throws if none found.
2455 * @param kind - Syntax kind.
2456 */
2457 getFirstModifierByKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind];
2458 /**
2459 * Gets the first modifier of the specified syntax kind or undefined if none found.
2460 * @param kind - Syntax kind.
2461 */
2462 getFirstModifierByKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind] | undefined;
2463 /**
2464 * Gets if it has the specified modifier.
2465 * @param kind - Syntax kind to check for.
2466 */
2467 hasModifier(kind: SyntaxKind): boolean;
2468 /**
2469 * Gets if it has the specified modifier.
2470 * @param text - Text to check for.
2471 */
2472 hasModifier(text: ModifierTexts): boolean;
2473 /**
2474 * Toggles a modifier.
2475 * @param text - Text to toggle the modifier for.
2476 * @param value - Optional toggling value.
2477 */
2478 toggleModifier(text: ModifierTexts, value?: boolean): this;
2479}
2480
2481declare type ModifierableNodeExtensionType = Node;
2482
2483export declare type ModifierTexts = "export" | "default" | "declare" | "abstract" | "public" | "protected" | "private" | "readonly" | "static" | "async" | "const";
2484
2485export declare function ModuledNode<T extends Constructor<ModuledNodeExtensionType>>(Base: T): Constructor<ModuledNode> & T;
2486
2487export interface ModuledNode {
2488 /**
2489 * Adds an import.
2490 * @param structure - Structure that represents the import.
2491 */
2492 addImportDeclaration(structure: ImportDeclarationStructure): ImportDeclaration;
2493 /**
2494 * Adds imports.
2495 * @param structures - Structures that represent the imports.
2496 */
2497 addImportDeclarations(structures: ReadonlyArray<ImportDeclarationStructure>): ImportDeclaration[];
2498 /**
2499 * Insert an import.
2500 * @param index - Child index to insert at.
2501 * @param structure - Structure that represents the import.
2502 */
2503 insertImportDeclaration(index: number, structure: ImportDeclarationStructure): ImportDeclaration;
2504 /**
2505 * Inserts imports.
2506 * @param index - Child index to insert at.
2507 * @param structures - Structures that represent the imports to insert.
2508 */
2509 insertImportDeclarations(index: number, structures: ReadonlyArray<ImportDeclarationStructure>): ImportDeclaration[];
2510 /**
2511 * Gets the first import declaration that matches a condition, or undefined if it doesn't exist.
2512 * @param condition - Condition to get the import declaration by.
2513 */
2514 getImportDeclaration(condition: (importDeclaration: ImportDeclaration) => boolean): ImportDeclaration | undefined;
2515 /**
2516 * Gets the first import declaration that matches a module specifier, or undefined if it doesn't exist.
2517 * @param module - Module specifier to get the import declaration by.
2518 */
2519 getImportDeclaration(moduleSpecifier: string): ImportDeclaration | undefined;
2520 /**
2521 * Gets the first import declaration that matches a condition, or throws if it doesn't exist.
2522 * @param condition - Condition to get the import declaration by.
2523 */
2524 getImportDeclarationOrThrow(condition: (importDeclaration: ImportDeclaration) => boolean): ImportDeclaration;
2525 /**
2526 * Gets the first import declaration that matches a module specifier, or throws if it doesn't exist.
2527 * @param module - Module specifier to get the import declaration by.
2528 */
2529 getImportDeclarationOrThrow(moduleSpecifier: string): ImportDeclaration;
2530 /**
2531 * Get the module's import declarations.
2532 */
2533 getImportDeclarations(): ImportDeclaration[];
2534 /**
2535 * Add export declarations.
2536 * @param structure - Structure that represents the export.
2537 */
2538 addExportDeclaration(structure: ExportDeclarationStructure): ExportDeclaration;
2539 /**
2540 * Add export declarations.
2541 * @param structures - Structures that represent the exports.
2542 */
2543 addExportDeclarations(structures: ReadonlyArray<ExportDeclarationStructure>): ExportDeclaration[];
2544 /**
2545 * Insert an export declaration.
2546 * @param index - Child index to insert at.
2547 * @param structure - Structure that represents the export.
2548 */
2549 insertExportDeclaration(index: number, structure: ExportDeclarationStructure): ExportDeclaration;
2550 /**
2551 * Insert export declarations.
2552 * @param index - Child index to insert at.
2553 * @param structures - Structures that represent the exports to insert.
2554 */
2555 insertExportDeclarations(index: number, structures: ReadonlyArray<ExportDeclarationStructure>): ExportDeclaration[];
2556 getExportDeclaration(condition: (exportDeclaration: ExportDeclaration) => boolean): ExportDeclaration | undefined;
2557 /**
2558 * Gets the first export declaration that matches a module specifier, or undefined if it doesn't exist.
2559 * @param module - Module specifier to get the export declaration by.
2560 */
2561 getExportDeclaration(moduleSpecifier: string): ExportDeclaration | undefined;
2562 /**
2563 * Gets the first export declaration that matches a condition, or throws if it doesn't exist.
2564 * @param condition - Condition to get the export declaration by.
2565 */
2566 getExportDeclarationOrThrow(condition: (exportDeclaration: ExportDeclaration) => boolean): ExportDeclaration;
2567 /**
2568 * Gets the first export declaration that matches a module specifier, or throws if it doesn't exist.
2569 * @param module - Module specifier to get the export declaration by.
2570 */
2571 getExportDeclarationOrThrow(moduleSpecifier: string): ExportDeclaration;
2572 /**
2573 * Get the export declarations.
2574 */
2575 getExportDeclarations(): ExportDeclaration[];
2576 /**
2577 * Add export assignments.
2578 * @param structure - Structure that represents the export.
2579 */
2580 addExportAssignment(structure: ExportAssignmentStructure): ExportAssignment;
2581 /**
2582 * Add export assignments.
2583 * @param structures - Structures that represent the exports.
2584 */
2585 addExportAssignments(structures: ReadonlyArray<ExportAssignmentStructure>): ExportAssignment[];
2586 /**
2587 * Insert an export assignment.
2588 * @param index - Child index to insert at.
2589 * @param structure - Structure that represents the export.
2590 */
2591 insertExportAssignment(index: number, structure: ExportAssignmentStructure): ExportAssignment;
2592 /**
2593 * Insert export assignments into a file.
2594 * @param index - Child index to insert at.
2595 * @param structures - Structures that represent the exports to insert.
2596 */
2597 insertExportAssignments(index: number, structures: ReadonlyArray<ExportAssignmentStructure>): ExportAssignment[];
2598 /**
2599 * Gets the first export assignment that matches a condition, or undefined if it doesn't exist.
2600 * @param condition - Condition to get the export assignment by.
2601 */
2602 getExportAssignment(condition: (exportAssignment: ExportAssignment) => boolean): ExportAssignment | undefined;
2603 /**
2604 * Gets the first export assignment that matches a condition, or throws if it doesn't exist.
2605 * @param condition - Condition to get the export assignment by.
2606 */
2607 getExportAssignmentOrThrow(condition: (exportAssignment: ExportAssignment) => boolean): ExportAssignment;
2608 /**
2609 * Get the file's export assignments.
2610 */
2611 getExportAssignments(): ExportAssignment[];
2612 /**
2613 * Gets the default export symbol.
2614 */
2615 getDefaultExportSymbol(): Symbol | undefined;
2616 /**
2617 * Gets the default export symbol or throws if it doesn't exist.
2618 */
2619 getDefaultExportSymbolOrThrow(): Symbol;
2620 /**
2621 * Gets the export symbols.
2622 */
2623 getExportSymbols(): Symbol[];
2624 /**
2625 * Gets all the declarations that are exported from the module.
2626 *
2627 * This will include declarations that are transitively exported from other modules. If you mean to get the export
2628 * declarations then use `.getExportDeclarations()`.
2629 */
2630 getExportedDeclarations(): Node[];
2631 /**
2632 * Removes any "export default".
2633 */
2634 removeDefaultExport(defaultExportSymbol?: Symbol | undefined): this;
2635}
2636
2637declare type ModuledNodeExtensionType = Node<ts.SourceFile | ts.NamespaceDeclaration> & StatementedNode;
2638
2639export declare function BindingNamedNode<T extends Constructor<BindingNamedNodeExtensionType>>(Base: T): Constructor<BindingNamedNode> & T;
2640
2641export interface BindingNamedNode extends BindingNamedNodeSpecific, ReferenceFindableNode, RenameableNode {
2642}
2643
2644declare type BindingNamedNodeExtensionType = NamedNodeBaseExtensionType<ts.BindingName>;
2645
2646export declare type BindingNamedNodeSpecific = NamedNodeSpecificBase<BindingName>;
2647
2648export declare function DeclarationNamedNode<T extends Constructor<DeclarationNamedNodeExtensionType>>(Base: T): Constructor<DeclarationNamedNode> & T;
2649
2650export interface DeclarationNamedNode extends DeclarationNamedNodeSpecific, ReferenceFindableNode, RenameableNode {
2651}
2652
2653declare type DeclarationNamedNodeExtensionType = Node<ts.NamedDeclaration>;
2654
2655export interface DeclarationNamedNodeSpecific {
2656 /**
2657 * Gets the name node.
2658 */
2659 getNameNode(): Identifier | undefined;
2660 /**
2661 * Gets the name node or throws an error if it doesn't exists.
2662 */
2663 getNameNodeOrThrow(): Identifier;
2664 /**
2665 * Gets the name.
2666 */
2667 getName(): string | undefined;
2668 /**
2669 * Gets the name or throws if it doens't exist.
2670 */
2671 getNameOrThrow(): string;
2672}
2673
2674export declare function NameableNode<T extends Constructor<NameableNodeExtensionType>>(Base: T): Constructor<NameableNode> & T;
2675
2676export interface NameableNode extends NameableNodeSpecific, ReferenceFindableNode, RenameableNode {
2677}
2678
2679declare type NameableNodeExtensionType = Node<ts.Node & {
2680 name?: ts.Identifier;
2681}>;
2682
2683export interface NameableNodeSpecific {
2684 /**
2685 * Gets the name node if it exists.
2686 */
2687 getNameNode(): Identifier | undefined;
2688 /**
2689 * Gets the name node if it exists, or throws.
2690 */
2691 getNameNodeOrThrow(): Identifier;
2692 /**
2693 * Gets the name if it exists.
2694 */
2695 getName(): string | undefined;
2696 /**
2697 * Gets the name if it exists, or throws.
2698 */
2699 getNameOrThrow(): string;
2700 /**
2701 * Removes the name from the node.
2702 */
2703 removeName(): this;
2704}
2705
2706export declare function NamedNodeBase<TCompilerNode extends ts.Node, U extends Constructor<NamedNodeBaseExtensionType<TCompilerNode>>>(Base: U): Constructor<NamedNodeSpecificBase<CompilerNodeToWrappedType<TCompilerNode>>> & U;
2707
2708export interface NamedNodeSpecificBase<TNode extends Node> {
2709 /**
2710 * Gets the name node.
2711 */
2712 getNameNode(): TNode;
2713 /**
2714 * Gets the name.
2715 */
2716 getName(): string;
2717}
2718
2719declare type NamedNodeBaseExtensionType<TCompilerNode extends ts.Node> = Node<ts.Node & {
2720 name: TCompilerNode;
2721}>;
2722
2723export declare function NamedNode<T extends Constructor<NamedNodeExtensionType>>(Base: T): Constructor<NamedNode> & T;
2724
2725export interface NamedNode extends NamedNodeSpecific, ReferenceFindableNode, RenameableNode {
2726}
2727
2728declare type NamedNodeExtensionType = NamedNodeBaseExtensionType<ts.Identifier>;
2729
2730export declare type NamedNodeSpecific = NamedNodeSpecificBase<Identifier>;
2731
2732export declare function PropertyNamedNode<T extends Constructor<PropertyNamedNodeExtensionType>>(Base: T): Constructor<PropertyNamedNode> & T;
2733
2734export interface PropertyNamedNode extends PropertyNamedNodeSpecific, ReferenceFindableNode, RenameableNode {
2735}
2736
2737declare type PropertyNamedNodeExtensionType = NamedNodeBaseExtensionType<ts.PropertyName>;
2738
2739export declare type PropertyNamedNodeSpecific = NamedNodeSpecificBase<PropertyName>;
2740
2741export declare function ReferenceFindableNode<T extends Constructor<ReferenceFindableNodeExtensionType>>(Base: T): Constructor<ReferenceFindableNode> & T;
2742
2743export interface ReferenceFindableNode {
2744 /**
2745 * Finds the references of the definition of the node.
2746 */
2747 findReferences(): ReferencedSymbol[];
2748 /**
2749 * Finds the nodes that reference the definition of the node.
2750 */
2751 findReferencesAsNodes(): Node[];
2752}
2753
2754declare type ReferenceFindableNodeExtensionType = Node<ts.Node & {
2755 name?: ts.PropertyName | ts.BindingName | ts.DeclarationName;
2756}>;
2757
2758export declare function RenameableNode<T extends Constructor<RenameableNodeExtensionType>>(Base: T): Constructor<RenameableNode> & T;
2759
2760export interface RenameableNode {
2761 /**
2762 * Renames the name of the node.
2763 * @param newName - New name.
2764 * @param options - Options for renaming.
2765 */
2766 rename(newName: string, options?: RenameOptions): this;
2767}
2768
2769declare type RenameableNodeExtensionType = Node<ts.Node>;
2770
2771export declare function ParameteredNode<T extends Constructor<ParameteredNodeExtensionType>>(Base: T): Constructor<ParameteredNode> & T;
2772
2773export interface ParameteredNode {
2774 /**
2775 * Gets a parameter or undefined if it doesn't exist.
2776 * @param name - Name of the parameter.
2777 */
2778 getParameter(name: string): ParameterDeclaration | undefined;
2779 /**
2780 * Gets a parameter or undefined if it doesn't exist.
2781 * @param findFunction - Function to use to find the parameter.
2782 */
2783 getParameter(findFunction: (declaration: ParameterDeclaration) => boolean): ParameterDeclaration | undefined;
2784 /**
2785 * Gets a parameter or throws if it doesn't exist.
2786 * @param name - Name of the parameter.
2787 */
2788 getParameterOrThrow(name: string): ParameterDeclaration;
2789 /**
2790 * Gets a parameter or throws if it doesn't exist.
2791 * @param findFunction - Function to use to find the parameter.
2792 */
2793 getParameterOrThrow(findFunction: (declaration: ParameterDeclaration) => boolean): ParameterDeclaration;
2794 /**
2795 * Gets all the parameters of the node.
2796 */
2797 getParameters(): ParameterDeclaration[];
2798 /**
2799 * Adds a parameter.
2800 * @param structure - Structure of the parameter.
2801 */
2802 addParameter(structure: ParameterDeclarationStructure): ParameterDeclaration;
2803 /**
2804 * Adds parameters.
2805 * @param structures - Structures of the parameters.
2806 */
2807 addParameters(structures: ReadonlyArray<ParameterDeclarationStructure>): ParameterDeclaration[];
2808 /**
2809 * Inserts parameters.
2810 * @param index - Child index to insert at.
2811 * @param structures - Parameters to insert.
2812 */
2813 insertParameters(index: number, structures: ReadonlyArray<ParameterDeclarationStructure>): ParameterDeclaration[];
2814 /**
2815 * Inserts a parameter.
2816 * @param index - Child index to insert at.
2817 * @param structures - Parameter to insert.
2818 */
2819 insertParameter(index: number, structure: ParameterDeclarationStructure): ParameterDeclaration;
2820}
2821
2822declare type ParameteredNodeExtensionType = Node<ts.Node & {
2823 parameters: ts.NodeArray<ts.ParameterDeclaration>;
2824}>;
2825
2826export declare function QuestionTokenableNode<T extends Constructor<QuestionTokenableNodeExtensionType>>(Base: T): Constructor<QuestionTokenableNode> & T;
2827
2828export interface QuestionTokenableNode {
2829 /**
2830 * If it has a question token.
2831 */
2832 hasQuestionToken(): boolean;
2833 /**
2834 * Gets the question token node or returns undefined if it doesn't exist.
2835 */
2836 getQuestionTokenNode(): Node<ts.QuestionToken> | undefined;
2837 /**
2838 * Gets the question token node or throws.
2839 */
2840 getQuestionTokenNodeOrThrow(): Node<ts.QuestionToken>;
2841 /**
2842 * Sets if this node has a question token.
2843 * @param value - If it should have a question token or not.
2844 */
2845 setHasQuestionToken(value: boolean): this;
2846}
2847
2848declare type QuestionTokenableNodeExtensionType = Node<ts.Node & {
2849 questionToken?: ts.QuestionToken;
2850}>;
2851
2852export declare function ReadonlyableNode<T extends Constructor<ReadonlyableNodeExtensionType>>(Base: T): Constructor<ReadonlyableNode> & T;
2853
2854export interface ReadonlyableNode {
2855 /**
2856 * Gets if it's readonly.
2857 */
2858 isReadonly(): boolean;
2859 /**
2860 * Gets the readonly keyword, or undefined if none exists.
2861 */
2862 getReadonlyKeyword(): Node | undefined;
2863 /**
2864 * Gets the readonly keyword, or throws if none exists.
2865 */
2866 getReadonlyKeywordOrThrow(): Node;
2867 /**
2868 * Sets if this node is readonly.
2869 * @param value - If readonly or not.
2870 */
2871 setIsReadonly(value: boolean): this;
2872}
2873
2874declare type ReadonlyableNodeExtensionType = Node & ModifierableNode;
2875
2876export declare function ReturnTypedNode<T extends Constructor<ReturnTypedNodeExtensionType>>(Base: T): Constructor<ReturnTypedNode> & T;
2877
2878export interface ReturnTypedNode {
2879 /**
2880 * Gets the return type.
2881 */
2882 getReturnType(): Type;
2883 /**
2884 * Gets the return type node or undefined if none exists.
2885 */
2886 getReturnTypeNode(): TypeNode | undefined;
2887 /**
2888 * Gets the return type node or throws if none exists.
2889 */
2890 getReturnTypeNodeOrThrow(): TypeNode;
2891 /**
2892 * Sets the return type of the node.
2893 * @param textOrWriterFunction - Text or writer function to set the return type with.
2894 */
2895 setReturnType(textOrWriterFunction: string | WriterFunction): this;
2896 /**
2897 * Removes the return type.
2898 */
2899 removeReturnType(): this;
2900 /**
2901 * Gets the signature of the node from the type checker.
2902 */
2903 getSignature(): Signature;
2904}
2905
2906declare type ReturnTypedNodeExtensionType = Node<ts.SignatureDeclaration>;
2907
2908export declare function ScopeableNode<T extends Constructor<ScopeableNodeExtensionType>>(Base: T): Constructor<ScopeableNode> & T;
2909
2910export interface ScopeableNode {
2911 /**
2912 * Gets the scope.
2913 */
2914 getScope(): Scope | undefined;
2915 /**
2916 * Sets the scope.
2917 * @param scope - Scope to set to.
2918 */
2919 setScope(scope: Scope | undefined): this;
2920 /**
2921 * Gets if the node has a scope keyword.
2922 */
2923 hasScopeKeyword(): boolean;
2924}
2925
2926declare type ScopeableNodeExtensionType = Node & ModifierableNode;
2927
2928export declare function ScopedNode<T extends Constructor<ScopedNodeExtensionType>>(Base: T): Constructor<ScopedNode> & T;
2929
2930export interface ScopedNode {
2931 /**
2932 * Gets the scope.
2933 */
2934 getScope(): Scope;
2935 /**
2936 * Sets the scope.
2937 * @param scope - Scope to set to.
2938 */
2939 setScope(scope: Scope | undefined): this;
2940 /**
2941 * Gets if the node has a scope keyword.
2942 */
2943 hasScopeKeyword(): boolean;
2944}
2945
2946declare type ScopedNodeExtensionType = Node & ModifierableNode;
2947
2948export declare function SignaturedDeclaration<T extends Constructor<SignaturedDeclarationExtensionType>>(Base: T): Constructor<SignaturedDeclaration> & T;
2949
2950export interface SignaturedDeclaration extends ParameteredNode, ReturnTypedNode {
2951}
2952
2953declare type SignaturedDeclarationExtensionType = Node<ts.SignatureDeclaration>;
2954
2955export declare function StaticableNode<T extends Constructor<StaticableNodeExtensionType>>(Base: T): Constructor<StaticableNode> & T;
2956
2957export interface StaticableNode {
2958 /**
2959 * Gets if it's static.
2960 */
2961 isStatic(): boolean;
2962 /**
2963 * Gets the static keyword, or undefined if none exists.
2964 */
2965 getStaticKeyword(): Node | undefined;
2966 /**
2967 * Gets the static keyword, or throws if none exists.
2968 */
2969 getStaticKeywordOrThrow(): Node;
2970 /**
2971 * Sets if the node is static.
2972 * @param value - If it should be static or not.
2973 */
2974 setIsStatic(value: boolean): this;
2975}
2976
2977declare type StaticableNodeExtensionType = Node & ModifierableNode;
2978
2979export declare function TextInsertableNode<T extends Constructor<TextInsertableNodeExtensionType>>(Base: T): Constructor<TextInsertableNode> & T;
2980
2981export interface TextInsertableNode {
2982 /**
2983 * Inserts text within the body of the node.
2984 *
2985 * WARNING: This will forget any previously navigated descendant nodes.
2986 * @param pos - Position to insert at.
2987 * @param textOrWriterFunction - Text to insert.
2988 */
2989 insertText(pos: number, textOrWriterFunction: string | WriterFunction): this;
2990 /**
2991 * Replaces text within the body of the node.
2992 *
2993 * WARNING: This will forget any previously navigated descendant nodes.
2994 * @param range - Start and end position of the text to replace.
2995 * @param textOrWriterFunction - Text to replace the range with.
2996 */
2997 replaceText(range: [number, number], textOrWriterFunction: string | WriterFunction): this;
2998 /**
2999 * Removes all the text within the node
3000 */
3001 removeText(): this;
3002 /**
3003 * Removes text within the body of the node.
3004 *
3005 * WARNING: This will forget any previously navigated descendant nodes.
3006 * @param pos - Start position to remove.
3007 * @param end - End position to remove.
3008 */
3009 removeText(pos: number, end: number): this;
3010}
3011
3012declare type TextInsertableNodeExtensionType = Node;
3013
3014export declare function TypeArgumentedNode<T extends Constructor<TypeArgumentedNodeExtensionType>>(Base: T): Constructor<TypeArgumentedNode> & T;
3015
3016export interface TypeArgumentedNode {
3017 /**
3018 * Gets all the type arguments of the node.
3019 */
3020 getTypeArguments(): TypeNode[];
3021 /**
3022 * Adds a type argument.
3023 * @param argumentText - Argument text to add.
3024 */
3025 addTypeArgument(argumentText: string): TypeNode;
3026 /**
3027 * Adds type arguments.
3028 * @param argumentTexts - Argument texts to add.
3029 */
3030 addTypeArguments(argumentTexts: ReadonlyArray<string>): TypeNode[];
3031 /**
3032 * Inserts a type argument.
3033 * @param index - Child index to insert at.
3034 * @param argumentText - Argument text to insert.
3035 */
3036 insertTypeArgument(index: number, argumentText: string): TypeNode;
3037 /**
3038 * Inserts type arguments.
3039 * @param index - Child index to insert at.
3040 * @param argumentTexts - Argument texts to insert.
3041 */
3042 insertTypeArguments(index: number, argumentTexts: ReadonlyArray<string>): TypeNode[];
3043 /**
3044 * Removes a type argument.
3045 * @param typeArg - Type argument to remove.
3046 */
3047 removeTypeArgument(typeArg: Node): this;
3048 /**
3049 * Removes a type argument.
3050 * @param index - Index to remove.
3051 */
3052 removeTypeArgument(index: number): this;
3053}
3054
3055declare type TypeArgumentedNodeExtensionType = Node<ts.Node & {
3056 typeArguments?: ts.NodeArray<ts.TypeNode>;
3057}>;
3058
3059export declare function TypedNode<T extends Constructor<TypedNodeExtensionType>>(Base: T): Constructor<TypedNode> & T;
3060
3061export interface TypedNode {
3062 /**
3063 * Gets the type node or undefined if none exists.
3064 */
3065 getTypeNode(): TypeNode | undefined;
3066 /**
3067 * Gets the type node or throws if none exists.
3068 */
3069 getTypeNodeOrThrow(): TypeNode;
3070 /**
3071 * Sets the type.
3072 * @param textOrWriterFunction - Text or writer function to set the type with.
3073 */
3074 setType(textOrWriterFunction: string | WriterFunction): this;
3075 /**
3076 * Removes the type.
3077 */
3078 removeType(): this;
3079}
3080
3081declare type TypedNodeExtensionType = Node<ts.Node & {
3082 type?: ts.TypeNode;
3083}>;
3084
3085export declare function TypeElementMemberedNode<T extends Constructor<TypeElementMemberedNodeExtensionType>>(Base: T): Constructor<TypeElementMemberedNode> & T;
3086
3087export interface TypeElementMemberedNode {
3088 /**
3089 * Add construct signature.
3090 * @param structure - Structure representing the construct signature.
3091 */
3092 addConstructSignature(structure: ConstructSignatureDeclarationStructure): ConstructSignatureDeclaration;
3093 /**
3094 * Add construct signatures.
3095 * @param structures - Structures representing the construct signatures.
3096 */
3097 addConstructSignatures(structures: ReadonlyArray<ConstructSignatureDeclarationStructure>): ConstructSignatureDeclaration[];
3098 /**
3099 * Insert construct signature.
3100 * @param index - Child index to insert at.
3101 * @param structure - Structure representing the construct signature.
3102 */
3103 insertConstructSignature(index: number, structure: ConstructSignatureDeclarationStructure): ConstructSignatureDeclaration;
3104 /**
3105 * Insert construct signatures.
3106 * @param index - Child index to insert at.
3107 * @param structures - Structures representing the construct signatures.
3108 */
3109 insertConstructSignatures(index: number, structures: ReadonlyArray<ConstructSignatureDeclarationStructure>): ConstructSignatureDeclaration[];
3110 /**
3111 * Gets the first construct signature by a find function.
3112 * @param findFunction - Function to find the construct signature by.
3113 */
3114 getConstructSignature(findFunction: (member: ConstructSignatureDeclaration) => boolean): ConstructSignatureDeclaration | undefined;
3115 /**
3116 * Gets the first construct signature by a find function or throws if not found.
3117 * @param findFunction - Function to find the construct signature by.
3118 */
3119 getConstructSignatureOrThrow(findFunction: (member: ConstructSignatureDeclaration) => boolean): ConstructSignatureDeclaration;
3120 /**
3121 * Gets the interface construct signatures.
3122 */
3123 getConstructSignatures(): ConstructSignatureDeclaration[];
3124 /**
3125 * Add call signature.
3126 * @param structure - Structure representing the call signature.
3127 */
3128 addCallSignature(structure: CallSignatureDeclarationStructure): CallSignatureDeclaration;
3129 /**
3130 * Add call signatures.
3131 * @param structures - Structures representing the call signatures.
3132 */
3133 addCallSignatures(structures: ReadonlyArray<CallSignatureDeclarationStructure>): CallSignatureDeclaration[];
3134 /**
3135 * Insert call signature.
3136 * @param index - Child index to insert at.
3137 * @param structure - Structure representing the call signature.
3138 */
3139 insertCallSignature(index: number, structure: CallSignatureDeclarationStructure): CallSignatureDeclaration;
3140 /**
3141 * Insert call signatures.
3142 * @param index - Child index to insert at.
3143 * @param structures - Structures representing the call signatures.
3144 */
3145 insertCallSignatures(index: number, structures: ReadonlyArray<CallSignatureDeclarationStructure>): CallSignatureDeclaration[];
3146 /**
3147 * Gets the first call signature by a find function.
3148 * @param findFunction - Function to find the call signature by.
3149 */
3150 getCallSignature(findFunction: (member: CallSignatureDeclaration) => boolean): CallSignatureDeclaration | undefined;
3151 /**
3152 * Gets the first call signature by a find function or throws if not found.
3153 * @param findFunction - Function to find the call signature by.
3154 */
3155 getCallSignatureOrThrow(findFunction: (member: CallSignatureDeclaration) => boolean): CallSignatureDeclaration;
3156 /**
3157 * Gets the interface call signatures.
3158 */
3159 getCallSignatures(): CallSignatureDeclaration[];
3160 /**
3161 * Add index signature.
3162 * @param structure - Structure representing the index signature.
3163 */
3164 addIndexSignature(structure: IndexSignatureDeclarationStructure): IndexSignatureDeclaration;
3165 /**
3166 * Add index signatures.
3167 * @param structures - Structures representing the index signatures.
3168 */
3169 addIndexSignatures(structures: ReadonlyArray<IndexSignatureDeclarationStructure>): IndexSignatureDeclaration[];
3170 /**
3171 * Insert index signature.
3172 * @param index - Child index to insert at.
3173 * @param structure - Structure representing the index signature.
3174 */
3175 insertIndexSignature(index: number, structure: IndexSignatureDeclarationStructure): IndexSignatureDeclaration;
3176 /**
3177 * Insert index signatures.
3178 * @param index - Child index to insert at.
3179 * @param structures - Structures representing the index signatures.
3180 */
3181 insertIndexSignatures(index: number, structures: ReadonlyArray<IndexSignatureDeclarationStructure>): IndexSignatureDeclaration[];
3182 /**
3183 * Gets the first index signature by a find function.
3184 * @param findFunction - Function to find the index signature by.
3185 */
3186 getIndexSignature(findFunction: (member: IndexSignatureDeclaration) => boolean): IndexSignatureDeclaration | undefined;
3187 /**
3188 * Gets the first index signature by a find function or throws if not found.
3189 * @param findFunction - Function to find the index signature by.
3190 */
3191 getIndexSignatureOrThrow(findFunction: (member: IndexSignatureDeclaration) => boolean): IndexSignatureDeclaration;
3192 /**
3193 * Gets the interface index signatures.
3194 */
3195 getIndexSignatures(): IndexSignatureDeclaration[];
3196 /**
3197 * Add method.
3198 * @param structure - Structure representing the method.
3199 */
3200 addMethod(structure: MethodSignatureStructure): MethodSignature;
3201 /**
3202 * Add methods.
3203 * @param structures - Structures representing the methods.
3204 */
3205 addMethods(structures: ReadonlyArray<MethodSignatureStructure>): MethodSignature[];
3206 /**
3207 * Insert method.
3208 * @param index - Child index to insert at.
3209 * @param structure - Structure representing the method.
3210 */
3211 insertMethod(index: number, structure: MethodSignatureStructure): MethodSignature;
3212 /**
3213 * Insert methods.
3214 * @param index - Child index to insert at.
3215 * @param structures - Structures representing the methods.
3216 */
3217 insertMethods(index: number, structures: ReadonlyArray<MethodSignatureStructure>): MethodSignature[];
3218 /**
3219 * Gets the first method by name.
3220 * @param name - Name.
3221 */
3222 getMethod(name: string): MethodSignature | undefined;
3223 /**
3224 * Gets the first method by a find function.
3225 * @param findFunction - Function to find the method by.
3226 */
3227 getMethod(findFunction: (member: MethodSignature) => boolean): MethodSignature | undefined;
3228 /**
3229 * Gets the first method by name or throws if not found.
3230 * @param name - Name.
3231 */
3232 getMethodOrThrow(name: string): MethodSignature;
3233 /**
3234 * Gets the first method by a find function or throws if not found.
3235 * @param findFunction - Function to find the method by.
3236 */
3237 getMethodOrThrow(findFunction: (member: MethodSignature) => boolean): MethodSignature;
3238 /**
3239 * Gets the interface method signatures.
3240 */
3241 getMethods(): MethodSignature[];
3242 /**
3243 * Add property.
3244 * @param structure - Structure representing the property.
3245 */
3246 addProperty(structure: PropertySignatureStructure): PropertySignature;
3247 /**
3248 * Add properties.
3249 * @param structures - Structures representing the properties.
3250 */
3251 addProperties(structures: ReadonlyArray<PropertySignatureStructure>): PropertySignature[];
3252 /**
3253 * Insert property.
3254 * @param index - Child index to insert at.
3255 * @param structure - Structure representing the property.
3256 */
3257 insertProperty(index: number, structure: PropertySignatureStructure): PropertySignature;
3258 /**
3259 * Insert properties.
3260 * @param index - Child index to insert at.
3261 * @param structures - Structures representing the properties.
3262 */
3263 insertProperties(index: number, structures: ReadonlyArray<PropertySignatureStructure>): PropertySignature[];
3264 /**
3265 * Gets the first property by name.
3266 * @param name - Name.
3267 */
3268 getProperty(name: string): PropertySignature | undefined;
3269 /**
3270 * Gets the first property by a find function.
3271 * @param findFunction - Function to find the property by.
3272 */
3273 getProperty(findFunction: (member: PropertySignature) => boolean): PropertySignature | undefined;
3274 /**
3275 * Gets the first property by name or throws if not found.
3276 * @param name - Name.
3277 */
3278 getPropertyOrThrow(name: string): PropertySignature;
3279 /**
3280 * Gets the first property by a find function or throws if not found.
3281 * @param findFunction - Function to find the property by.
3282 */
3283 getPropertyOrThrow(findFunction: (member: PropertySignature) => boolean): PropertySignature;
3284 /**
3285 * Gets the interface property signatures.
3286 */
3287 getProperties(): PropertySignature[];
3288 /**
3289 * Gets all the members.
3290 */
3291 getMembers(): TypeElementTypes[];
3292}
3293
3294declare type TypeElementMemberedNodeExtensionType = Node<ts.Node & {
3295 members: ts.TypeElement[];
3296}>;
3297
3298export declare function TypeParameteredNode<T extends Constructor<TypeParameteredNodeExtensionType>>(Base: T): Constructor<TypeParameteredNode> & T;
3299
3300export interface TypeParameteredNode {
3301 /**
3302 * Gets a type parameter or undefined if it doesn't exist.
3303 * @param name - Name of the parameter.
3304 */
3305 getTypeParameter(name: string): TypeParameterDeclaration | undefined;
3306 /**
3307 * Gets a type parameter or undefined if it doesn't exist.
3308 * @param findFunction - Function to use to find the type parameter.
3309 */
3310 getTypeParameter(findFunction: (declaration: TypeParameterDeclaration) => boolean): TypeParameterDeclaration | undefined;
3311 /**
3312 * Gets a type parameter or throws if it doesn't exist.
3313 * @param name - Name of the parameter.
3314 */
3315 getTypeParameterOrThrow(name: string): TypeParameterDeclaration;
3316 /**
3317 * Gets a type parameter or throws if it doesn't exist.
3318 * @param findFunction - Function to use to find the type parameter.
3319 */
3320 getTypeParameterOrThrow(findFunction: (declaration: TypeParameterDeclaration) => boolean): TypeParameterDeclaration;
3321 /**
3322 * Gets the type parameters.
3323 */
3324 getTypeParameters(): TypeParameterDeclaration[];
3325 /**
3326 * Adds a type parameter.
3327 * @param structure - Structure of the type parameter.
3328 */
3329 addTypeParameter(structure: TypeParameterDeclarationStructure | string): TypeParameterDeclaration;
3330 /**
3331 * Adds type parameters.
3332 * @param structures - Structures of the type parameters.
3333 */
3334 addTypeParameters(structures: ReadonlyArray<TypeParameterDeclarationStructure | string>): TypeParameterDeclaration[];
3335 /**
3336 * Inserts a type parameter.
3337 * @param index - Child index to insert at. Specify a negative index to insert from the reverse.
3338 * @param structure - Structure of the type parameter.
3339 */
3340 insertTypeParameter(index: number, structure: TypeParameterDeclarationStructure | string): TypeParameterDeclaration;
3341 /**
3342 * Inserts type parameters.
3343 * @param index - Child index to insert at. Specify a negative index to insert from the reverse.
3344 * @param structures - Structures of the type parameters.
3345 */
3346 insertTypeParameters(index: number, structures: ReadonlyArray<TypeParameterDeclarationStructure | string>): TypeParameterDeclaration[];
3347}
3348
3349declare type TypeParameteredNodeExtensionType = Node<ts.Node & {
3350 typeParameters?: ts.NodeArray<ts.TypeParameterDeclaration>;
3351}>;
3352
3353export declare function UnwrappableNode<T extends Constructor<UnwrappableNodeExtensionType>>(Base: T): Constructor<UnwrappableNode> & T;
3354
3355export interface UnwrappableNode {
3356 /**
3357 * Replaces the node's text with its body's statements.
3358 */
3359 unwrap(): void;
3360}
3361
3362declare type UnwrappableNodeExtensionType = Node;
3363
3364export declare class ArrayBindingPattern extends Node<ts.ArrayBindingPattern> {
3365 /**
3366 * Gets the array binding pattern's elements.
3367 */
3368 getElements(): (BindingElement | OmittedExpression)[];
3369}
3370
3371declare const BindingElementBase: Constructor<InitializerExpressionableNode> & Constructor<BindingNamedNode> & typeof Node;
3372
3373export declare class BindingElement extends BindingElementBase<ts.BindingElement> {
3374 /**
3375 * Gets the binding element's dot dot dot token (...) if it exists or throws if not.
3376 */
3377 getDotDotDotTokenOrThrow(): Node<ts.Token<SyntaxKind.DotDotDotToken>>;
3378 /**
3379 * Gets the binding element's dot dot dot token (...) if it exists or returns undefined.
3380 */
3381 getDotDotDotToken(): Node<ts.Token<SyntaxKind.DotDotDotToken>> | undefined;
3382 /**
3383 * Gets binding element's property name node or throws if not found.
3384 *
3385 * For example in `const { a: b } = { a: 5 }`, `a` would be the property name.
3386 */
3387 getPropertyNameNodeOrThrow(): PropertyName;
3388 /**
3389 * Gets binding element's property name node or returns undefined if not found.
3390 *
3391 * For example in `const { a: b } = { a: 5 }`, `a` would be the property name.
3392 */
3393 getPropertyNameNode(): Identifier | NumericLiteral | StringLiteral | ComputedPropertyName | undefined;
3394}
3395
3396export declare class ObjectBindingPattern extends Node<ts.ObjectBindingPattern> {
3397 /**
3398 * Gets the object binding pattern's elements.
3399 */
3400 getElements(): BindingElement[];
3401}
3402
3403export declare function AbstractableNode<T extends Constructor<AbstractableNodeExtensionType>>(Base: T): Constructor<AbstractableNode> & T;
3404
3405export interface AbstractableNode {
3406 /**
3407 * Gets if the node is abstract.
3408 */
3409 isAbstract(): boolean;
3410 /**
3411 * Gets the abstract keyword or undefined if it doesn't exist.
3412 */
3413 getAbstractKeyword(): Node | undefined;
3414 /**
3415 * Gets the abstract keyword or throws if it doesn't exist.
3416 */
3417 getAbstractKeywordOrThrow(): Node;
3418 /**
3419 * Sets if the node is abstract.
3420 * @param isAbstract - If it should be abstract or not.
3421 */
3422 setIsAbstract(isAbstract: boolean): this;
3423}
3424
3425declare type AbstractableNodeExtensionType = Node & ModifierableNode;
3426
3427export declare function ClassLikeDeclarationBase<T extends Constructor<ClassLikeDeclarationBaseExtensionType>>(Base: T): Constructor<ClassLikeDeclarationBase> & T;
3428
3429export interface ClassLikeDeclarationBase extends NameableNode, TextInsertableNode, ImplementsClauseableNode, HeritageClauseableNode, AbstractableNode, JSDocableNode, TypeParameteredNode, DecoratableNode, ModifierableNode, ClassLikeDeclarationBaseSpecific {
3430}
3431
3432declare function ClassLikeDeclarationBaseSpecific<T extends Constructor<ClassLikeDeclarationBaseSpecificExtensionType>>(Base: T): Constructor<ClassLikeDeclarationBaseSpecific> & T;
3433
3434interface ClassLikeDeclarationBaseSpecific {
3435 /**
3436 * Sets the extends expression.
3437 * @param text - Text to set as the extends expression.
3438 */
3439 setExtends(text: string | WriterFunction): this;
3440 /**
3441 * Removes the extends expression, if it exists.
3442 */
3443 removeExtends(): this;
3444 /**
3445 * Gets the extends expression or throws if it doesn't exist.
3446 */
3447 getExtendsOrThrow(): ExpressionWithTypeArguments;
3448 /**
3449 * Gets the extends expression or returns undefined if it doesn't exist.
3450 */
3451 getExtends(): ExpressionWithTypeArguments | undefined;
3452 /**
3453 * Adds a constructor.
3454 * @param structure - Structure of the constructor.
3455 */
3456 addConstructor(structure?: ConstructorDeclarationStructure): ConstructorDeclaration;
3457 /**
3458 * Adds constructors.
3459 * @param structures - Structures of the constructor.
3460 */
3461 addConstructors(structures: ReadonlyArray<ConstructorDeclarationStructure>): ConstructorDeclaration[];
3462 /**
3463 * Inserts a constructor.
3464 * @param index - Child index to insert at.
3465 * @param structure - Structure of the constructor.
3466 */
3467 insertConstructor(index: number, structure?: ConstructorDeclarationStructure): ConstructorDeclaration;
3468 /**
3469 * Inserts constructors.
3470 * @param index - Child index to insert at.
3471 * @param structures - Structures of the constructor.
3472 */
3473 insertConstructors(index: number, structures: ReadonlyArray<ConstructorDeclarationStructure>): ConstructorDeclaration[];
3474 /**
3475 * Gets the constructor declarations.
3476 */
3477 getConstructors(): ConstructorDeclaration[];
3478 /**
3479 * Add get accessor.
3480 * @param structure - Structure representing the get accessor.
3481 */
3482 addGetAccessor(structure: GetAccessorDeclarationStructure): GetAccessorDeclaration;
3483 /**
3484 * Add properties.
3485 * @param structures - Structures representing the properties.
3486 */
3487 addGetAccessors(structures: ReadonlyArray<GetAccessorDeclarationStructure>): GetAccessorDeclaration[];
3488 /**
3489 * Insert get accessor.
3490 * @param index - Child index to insert at.
3491 * @param structure - Structure representing the get accessor.
3492 */
3493 insertGetAccessor(index: number, structure: GetAccessorDeclarationStructure): GetAccessorDeclaration;
3494 /**
3495 * Insert properties.
3496 * @param index - Child index to insert at.
3497 * @param structures - Structures representing the properties.
3498 */
3499 insertGetAccessors(index: number, structures: ReadonlyArray<GetAccessorDeclarationStructure>): GetAccessorDeclaration[];
3500 /**
3501 * Add set accessor.
3502 * @param structure - Structure representing the set accessor.
3503 */
3504 addSetAccessor(structure: SetAccessorDeclarationStructure): SetAccessorDeclaration;
3505 /**
3506 * Add properties.
3507 * @param structures - Structures representing the properties.
3508 */
3509 addSetAccessors(structures: ReadonlyArray<SetAccessorDeclarationStructure>): SetAccessorDeclaration[];
3510 /**
3511 * Insert set accessor.
3512 * @param index - Child index to insert at.
3513 * @param structure - Structure representing the set accessor.
3514 */
3515 insertSetAccessor(index: number, structure: SetAccessorDeclarationStructure): SetAccessorDeclaration;
3516 /**
3517 * Insert properties.
3518 * @param index - Child index to insert at.
3519 * @param structures - Structures representing the properties.
3520 */
3521 insertSetAccessors(index: number, structures: ReadonlyArray<SetAccessorDeclarationStructure>): SetAccessorDeclaration[];
3522 /**
3523 * Add property.
3524 * @param structure - Structure representing the property.
3525 */
3526 addProperty(structure: PropertyDeclarationStructure): PropertyDeclaration;
3527 /**
3528 * Add properties.
3529 * @param structures - Structures representing the properties.
3530 */
3531 addProperties(structures: ReadonlyArray<PropertyDeclarationStructure>): PropertyDeclaration[];
3532 /**
3533 * Insert property.
3534 * @param index - Child index to insert at.
3535 * @param structure - Structure representing the property.
3536 */
3537 insertProperty(index: number, structure: PropertyDeclarationStructure): PropertyDeclaration;
3538 /**
3539 * Insert properties.
3540 * @param index - Child index to insert at.
3541 * @param structures - Structures representing the properties.
3542 */
3543 insertProperties(index: number, structures: ReadonlyArray<PropertyDeclarationStructure>): PropertyDeclaration[];
3544 /**
3545 * Gets the first instance property by name.
3546 * @param name - Name.
3547 */
3548 getInstanceProperty(name: string): ClassInstancePropertyTypes | undefined;
3549 /**
3550 * Gets the first instance property by a find function.
3551 * @param findFunction - Function to find an instance property by.
3552 */
3553 getInstanceProperty(findFunction: (prop: ClassInstancePropertyTypes) => boolean): ClassInstancePropertyTypes | undefined;
3554 /**
3555 * Gets the first instance property by name or throws if not found.
3556 * @param name - Name.
3557 */
3558 getInstancePropertyOrThrow(name: string): ClassInstancePropertyTypes;
3559 /**
3560 * Gets the first instance property by a find function or throws if not found.
3561 * @param findFunction - Function to find an instance property by.
3562 */
3563 getInstancePropertyOrThrow(findFunction: (prop: ClassInstancePropertyTypes) => boolean): ClassInstancePropertyTypes;
3564 /**
3565 * Gets the class instance property declarations.
3566 */
3567 getInstanceProperties(): ClassInstancePropertyTypes[];
3568 /**
3569 * Gets the first static property by name.
3570 * @param name - Name.
3571 */
3572 getStaticProperty(name: string): ClassStaticPropertyTypes | undefined;
3573 /**
3574 * Gets the first static property by a find function.
3575 * @param findFunction - Function to find a static property by.
3576 */
3577 getStaticProperty(findFunction: (prop: ClassStaticPropertyTypes) => boolean): ClassStaticPropertyTypes | undefined;
3578 /**
3579 * Gets the first static property by name or throws if not found.
3580 * @param name - Name.
3581 */
3582 getStaticPropertyOrThrow(name: string): ClassStaticPropertyTypes;
3583 /**
3584 * Gets the first static property by a find function. or throws if not found.
3585 * @param findFunction - Function to find a static property by.
3586 */
3587 getStaticPropertyOrThrow(findFunction: (prop: ClassStaticPropertyTypes) => boolean): ClassStaticPropertyTypes;
3588 /**
3589 * Gets the class instance property declarations.
3590 */
3591 getStaticProperties(): ClassStaticPropertyTypes[];
3592 /**
3593 * Gets the first property declaration by name.
3594 * @param name - Name.
3595 */
3596 getProperty(name: string): PropertyDeclaration | undefined;
3597 /**
3598 * Gets the first property declaration by a find function.
3599 * @param findFunction - Function to find a property declaration by.
3600 */
3601 getProperty(findFunction: (property: PropertyDeclaration) => boolean): PropertyDeclaration | undefined;
3602 /**
3603 * Gets the first property declaration by name or throws if it doesn't exist.
3604 * @param name - Name.
3605 */
3606 getPropertyOrThrow(name: string): PropertyDeclaration;
3607 /**
3608 * Gets the first property declaration by a find function or throws if it doesn't exist.
3609 * @param findFunction - Function to find a property declaration by.
3610 */
3611 getPropertyOrThrow(findFunction: (property: PropertyDeclaration) => boolean): PropertyDeclaration;
3612 /**
3613 * Gets the class property declarations regardless of whether it's an instance of static property.
3614 */
3615 getProperties(): PropertyDeclaration[];
3616 /**
3617 * Gets the first get accessor declaration by name.
3618 * @param name - Name.
3619 */
3620 getGetAccessor(name: string): GetAccessorDeclaration | undefined;
3621 /**
3622 * Gets the first get accessor declaration by a find function.
3623 * @param findFunction - Function to find a get accessor declaration by.
3624 */
3625 getGetAccessor(findFunction: (getAccessor: GetAccessorDeclaration) => boolean): GetAccessorDeclaration | undefined;
3626 /**
3627 * Gets the first get accessor declaration by name or throws if it doesn't exist.
3628 * @param name - Name.
3629 */
3630 getGetAccessorOrThrow(name: string): GetAccessorDeclaration;
3631 /**
3632 * Gets the first get accessor declaration by a find function or throws if it doesn't exist.
3633 * @param findFunction - Function to find a get accessor declaration by.
3634 */
3635 getGetAccessorOrThrow(findFunction: (getAccessor: GetAccessorDeclaration) => boolean): GetAccessorDeclaration;
3636 /**
3637 * Gets the class get accessor declarations regardless of whether it's an instance of static getAccessor.
3638 */
3639 getGetAccessors(): GetAccessorDeclaration[];
3640 /**
3641 * Sets the first set accessor declaration by name.
3642 * @param name - Name.
3643 */
3644 getSetAccessor(name: string): SetAccessorDeclaration | undefined;
3645 /**
3646 * Sets the first set accessor declaration by a find function.
3647 * @param findFunction - Function to find a set accessor declaration by.
3648 */
3649 getSetAccessor(findFunction: (setAccessor: SetAccessorDeclaration) => boolean): SetAccessorDeclaration | undefined;
3650 /**
3651 * Sets the first set accessor declaration by name or throws if it doesn't exist.
3652 * @param name - Name.
3653 */
3654 getSetAccessorOrThrow(name: string): SetAccessorDeclaration;
3655 /**
3656 * Sets the first set accessor declaration by a find function or throws if it doesn't exist.
3657 * @param findFunction - Function to find a set accessor declaration by.
3658 */
3659 getSetAccessorOrThrow(findFunction: (setAccessor: SetAccessorDeclaration) => boolean): SetAccessorDeclaration;
3660 /**
3661 * Sets the class set accessor declarations regardless of whether it's an instance of static setAccessor.
3662 */
3663 getSetAccessors(): SetAccessorDeclaration[];
3664 /**
3665 * Add method.
3666 * @param structure - Structure representing the method.
3667 */
3668 addMethod(structure: MethodDeclarationStructure): MethodDeclaration;
3669 /**
3670 * Add methods.
3671 * @param structures - Structures representing the methods.
3672 */
3673 addMethods(structures: ReadonlyArray<MethodDeclarationStructure>): MethodDeclaration[];
3674 /**
3675 * Insert method.
3676 * @param index - Child index to insert at.
3677 * @param structure - Structure representing the method.
3678 */
3679 insertMethod(index: number, structure: MethodDeclarationStructure): MethodDeclaration;
3680 /**
3681 * Insert methods.
3682 * @param index - Child index to insert at.
3683 * @param structures - Structures representing the methods.
3684 */
3685 insertMethods(index: number, structures: ReadonlyArray<MethodDeclarationStructure>): MethodDeclaration[];
3686 /**
3687 * Gets the first method declaration by name.
3688 * @param name - Name.
3689 */
3690 getMethod(name: string): MethodDeclaration | undefined;
3691 /**
3692 * Gets the first method declaration by a find function.
3693 * @param findFunction - Function to find a method declaration by.
3694 */
3695 getMethod(findFunction: (method: MethodDeclaration) => boolean): MethodDeclaration | undefined;
3696 /**
3697 * Gets the first method declaration by name or throws if it doesn't exist.
3698 * @param name - Name.
3699 */
3700 getMethodOrThrow(name: string): MethodDeclaration;
3701 /**
3702 * Gets the first method declaration by a find function or throws if it doesn't exist.
3703 * @param findFunction - Function to find a method declaration by.
3704 */
3705 getMethodOrThrow(findFunction: (method: MethodDeclaration) => boolean): MethodDeclaration;
3706 /**
3707 * Gets the class method declarations regardless of whether it's an instance of static method.
3708 */
3709 getMethods(): MethodDeclaration[];
3710 /**
3711 * Gets the first instance method by name.
3712 * @param name - Name.
3713 */
3714 getInstanceMethod(name: string): MethodDeclaration | undefined;
3715 /**
3716 * Gets the first instance method by a find function.
3717 * @param findFunction - Function to find an instance method by.
3718 */
3719 getInstanceMethod(findFunction: (method: MethodDeclaration) => boolean): MethodDeclaration | undefined;
3720 /**
3721 * Gets the first instance method by name or throws if not found.
3722 * @param name - Name.
3723 */
3724 getInstanceMethodOrThrow(name: string): MethodDeclaration;
3725 /**
3726 * Gets the first instance method by a find function. or throws if not found.
3727 * @param findFunction - Function to find an instance method by.
3728 */
3729 getInstanceMethodOrThrow(findFunction: (method: MethodDeclaration) => boolean): MethodDeclaration;
3730 /**
3731 * Gets the class instance method declarations.
3732 */
3733 getInstanceMethods(): MethodDeclaration[];
3734 /**
3735 * Gets the first static method by name.
3736 * @param name - Name.
3737 */
3738 getStaticMethod(name: string): MethodDeclaration | undefined;
3739 /**
3740 * Gets the first static method by a find function.
3741 * @param findFunction - Function to find a static method by.
3742 */
3743 getStaticMethod(findFunction: (method: MethodDeclaration) => boolean): MethodDeclaration | undefined;
3744 /**
3745 * Gets the first static method by name or throws if not found.
3746 * @param name - Name.
3747 */
3748 getStaticMethodOrThrow(name: string): MethodDeclaration;
3749 /**
3750 * Gets the first static method by a find function. or throws if not found.
3751 * @param findFunction - Function to find a static method by.
3752 */
3753 getStaticMethodOrThrow(findFunction: (method: MethodDeclaration) => boolean): MethodDeclaration;
3754 /**
3755 * Gets the class instance method declarations.
3756 */
3757 getStaticMethods(): MethodDeclaration[];
3758 /**
3759 * Gets the first instance member by name.
3760 * @param name - Name.
3761 */
3762 getInstanceMember(name: string): ClassInstanceMemberTypes | undefined;
3763 /**
3764 * Gets the first instance member by a find function.
3765 * @param findFunction - Function to find the instance member by.
3766 */
3767 getInstanceMember(findFunction: (member: ClassInstanceMemberTypes) => boolean): ClassInstanceMemberTypes | undefined;
3768 /**
3769 * Gets the first instance member by name or throws if not found.
3770 * @param name - Name.
3771 */
3772 getInstanceMemberOrThrow(name: string): ClassInstanceMemberTypes;
3773 /**
3774 * Gets the first instance member by a find function. or throws if not found.
3775 * @param findFunction - Function to find the instance member by.
3776 */
3777 getInstanceMemberOrThrow(findFunction: (member: ClassInstanceMemberTypes) => boolean): ClassInstanceMemberTypes;
3778 /**
3779 * Gets the instance members.
3780 */
3781 getInstanceMembers(): ClassInstanceMemberTypes[];
3782 /**
3783 * Gets the first static member by name.
3784 * @param name - Name.
3785 */
3786 getStaticMember(name: string): ClassStaticMemberTypes | undefined;
3787 /**
3788 * Gets the first static member by a find function.
3789 * @param findFunction - Function to find an static method by.
3790 */
3791 getStaticMember(findFunction: (member: ClassStaticMemberTypes) => boolean): ClassStaticMemberTypes | undefined;
3792 /**
3793 * Gets the first static member by name or throws if not found.
3794 * @param name - Name.
3795 */
3796 getStaticMemberOrThrow(name: string): ClassStaticMemberTypes;
3797 /**
3798 * Gets the first static member by a find function. or throws if not found.
3799 * @param findFunction - Function to find an static method by.
3800 */
3801 getStaticMemberOrThrow(findFunction: (member: ClassStaticMemberTypes) => boolean): ClassStaticMemberTypes;
3802 /**
3803 * Gets the static members.
3804 */
3805 getStaticMembers(): ClassStaticMemberTypes[];
3806 /**
3807 * Gets the class' members regardless of whether it's an instance of static member.
3808 */
3809 getMembers(): ClassMemberTypes[];
3810 /**
3811 * Gets the first member by name.
3812 * @param name - Name.
3813 */
3814 getMember(name: string): ClassMemberTypes | undefined;
3815 /**
3816 * Gets the first member by a find function.
3817 * @param findFunction - Function to find an method by.
3818 */
3819 getMember(findFunction: (member: ClassMemberTypes) => boolean): ClassMemberTypes | undefined;
3820 /**
3821 * Gets the first member by name or throws if not found.
3822 * @param name - Name.
3823 */
3824 getMemberOrThrow(name: string): ClassMemberTypes;
3825 /**
3826 * Gets the first member by a find function. or throws if not found.
3827 * @param findFunction - Function to find an method by.
3828 */
3829 getMemberOrThrow(findFunction: (member: ClassMemberTypes) => boolean): ClassMemberTypes;
3830 /**
3831 * Gets the base types.
3832 *
3833 * This is useful to use if the base could possibly be a mixin.
3834 */
3835 getBaseTypes(): Type[];
3836 /**
3837 * Gets the base class or throws.
3838 *
3839 * Note: Use getBaseTypes if you need to get the mixins.
3840 */
3841 getBaseClassOrThrow(): ClassDeclaration;
3842 /**
3843 * Gets the base class.
3844 *
3845 * Note: Use getBaseTypes if you need to get the mixins.
3846 */
3847 getBaseClass(): ClassDeclaration | undefined;
3848 /**
3849 * Gets all the derived classes.
3850 */
3851 getDerivedClasses(): ClassDeclaration[];
3852}
3853
3854export declare type ClassPropertyTypes = PropertyDeclaration | GetAccessorDeclaration | SetAccessorDeclaration;
3855
3856export declare type ClassInstancePropertyTypes = ClassPropertyTypes | ParameterDeclaration;
3857
3858export declare type ClassInstanceMemberTypes = MethodDeclaration | ClassInstancePropertyTypes;
3859
3860export declare type ClassStaticPropertyTypes = PropertyDeclaration | GetAccessorDeclaration | SetAccessorDeclaration;
3861
3862export declare type ClassStaticMemberTypes = MethodDeclaration | ClassStaticPropertyTypes;
3863
3864export declare type ClassMemberTypes = MethodDeclaration | PropertyDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration;
3865
3866declare type ClassLikeDeclarationBaseExtensionType = Node<ts.ClassLikeDeclarationBase>;
3867
3868declare type ClassLikeDeclarationBaseSpecificExtensionType = Node<ts.ClassLikeDeclarationBase> & HeritageClauseableNode & ModifierableNode & NameableNode;
3869
3870declare const ClassDeclarationBase: Constructor<ChildOrderableNode> & Constructor<NamespaceChildableNode> & Constructor<AmbientableNode> & Constructor<ExportableNode> & Constructor<ClassLikeDeclarationBase> & typeof Statement;
3871
3872export declare class ClassDeclaration extends ClassDeclarationBase<ts.ClassDeclaration> {
3873 /**
3874 * Sets the node from a structure.
3875 * @param structure - Structure to set the node with.
3876 */
3877 set(structure: Partial<ClassDeclarationStructure>): this;
3878 /**
3879 * Gets the structure equivalent to this node.
3880 */
3881 getStructure(): ClassDeclarationStructure;
3882 /**
3883 * Extracts an interface declaration structure from the class.
3884 * @param name - Name of the interface. Falls back to the same name as the class and then the filepath's base name.
3885 */
3886 extractInterface(name?: string): InterfaceDeclarationStructure;
3887 /**
3888 * Extracts an interface declaration structure from the static part of the class.
3889 * @param name - Name of the interface.
3890 */
3891 extractStaticInterface(name: string): InterfaceDeclarationStructure;
3892}
3893
3894declare const ClassExpressionBase: Constructor<ClassLikeDeclarationBase> & typeof PrimaryExpression;
3895
3896export declare class ClassExpression extends ClassExpressionBase<ts.ClassExpression> {
3897}
3898
3899declare const ConstructorDeclarationBase: Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<OverloadableNode> & Constructor<ScopedNode> & Constructor<FunctionLikeDeclaration> & Constructor<BodyableNode> & typeof Node;
3900
3901declare const ConstructorDeclarationOverloadBase: Constructor<TypeParameteredNode> & Constructor<JSDocableNode> & Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<ScopedNode> & Constructor<ModifierableNode> & Constructor<SignaturedDeclaration> & typeof Node;
3902
3903export declare class ConstructorDeclaration extends ConstructorDeclarationBase<ts.ConstructorDeclaration> {
3904 /**
3905 * Sets the node from a structure.
3906 * @param structure - Structure to set the node with.
3907 */
3908 set(structure: Partial<ConstructorDeclarationStructure>): this;
3909 /**
3910 * Add a constructor overload.
3911 * @param structure - Structure to add.
3912 */
3913 addOverload(structure: ConstructorDeclarationOverloadStructure): ConstructorDeclaration;
3914 /**
3915 * Add constructor overloads.
3916 * @param structures - Structures to add.
3917 */
3918 addOverloads(structures: ReadonlyArray<ConstructorDeclarationOverloadStructure>): ConstructorDeclaration[];
3919 /**
3920 * Inserts a constructor overload.
3921 * @param index - Child index to insert at.
3922 * @param structure - Structures to insert.
3923 */
3924 insertOverload(index: number, structure: ConstructorDeclarationOverloadStructure): ConstructorDeclaration;
3925 /**
3926 * Inserts constructor overloads.
3927 * @param index - Child index to insert at.
3928 * @param structures - Structures to insert.
3929 */
3930 insertOverloads(index: number, structures: ReadonlyArray<ConstructorDeclarationOverloadStructure>): ConstructorDeclaration[];
3931 /**
3932 * Remove the constructor.
3933 */
3934 remove(): void;
3935 /**
3936 * Gets the structure equivalent to this node.
3937 */
3938 getStructure(): ConstructorDeclarationStructure | ConstructorDeclarationOverloadStructure;
3939}
3940
3941declare const GetAccessorDeclarationBase: Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<DecoratableNode> & Constructor<AbstractableNode> & Constructor<ScopedNode> & Constructor<StaticableNode> & Constructor<FunctionLikeDeclaration> & Constructor<BodyableNode> & Constructor<PropertyNamedNode> & typeof Node;
3942
3943export declare class GetAccessorDeclaration extends GetAccessorDeclarationBase<ts.GetAccessorDeclaration> {
3944 /**
3945 * Sets the node from a structure.
3946 * @param structure - Structure to set the node with.
3947 */
3948 set(structure: Partial<GetAccessorDeclarationStructure>): this;
3949 /**
3950 * Gets the corresponding set accessor if one exists.
3951 */
3952 getSetAccessor(): SetAccessorDeclaration | undefined;
3953 /**
3954 * Gets the corresponding set accessor or throws if not exists.
3955 */
3956 getSetAccessorOrThrow(): SetAccessorDeclaration;
3957 /**
3958 * Removes the get accessor.
3959 */
3960 remove(): void;
3961 /**
3962 * Gets the structure equivalent to this node.
3963 */
3964 getStructure(): GetAccessorDeclarationStructure;
3965}
3966
3967declare const MethodDeclarationBase: Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<OverloadableNode> & Constructor<BodyableNode> & Constructor<DecoratableNode> & Constructor<AbstractableNode> & Constructor<ScopedNode> & Constructor<QuestionTokenableNode> & Constructor<StaticableNode> & Constructor<AsyncableNode> & Constructor<GeneratorableNode> & Constructor<FunctionLikeDeclaration> & Constructor<PropertyNamedNode> & typeof Node;
3968
3969declare const MethodDeclarationOverloadBase: Constructor<JSDocableNode> & Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<ScopedNode> & Constructor<TypeParameteredNode> & Constructor<AbstractableNode> & Constructor<QuestionTokenableNode> & Constructor<StaticableNode> & Constructor<AsyncableNode> & Constructor<ModifierableNode> & Constructor<GeneratorableNode> & Constructor<SignaturedDeclaration> & typeof Node;
3970
3971export declare class MethodDeclaration extends MethodDeclarationBase<ts.MethodDeclaration> {
3972 /**
3973 * Sets the node from a structure.
3974 * @param structure - Structure to set the node with.
3975 */
3976 set(structure: Partial<MethodDeclarationStructure>): this;
3977 /**
3978 * Add a method overload.
3979 * @param structure - Structure to add.
3980 */
3981 addOverload(structure: MethodDeclarationOverloadStructure): MethodDeclaration;
3982 /**
3983 * Add method overloads.
3984 * @param structures - Structures to add.
3985 */
3986 addOverloads(structures: ReadonlyArray<MethodDeclarationOverloadStructure>): MethodDeclaration[];
3987 /**
3988 * Inserts a method overload.
3989 * @param index - Child index to insert at.
3990 * @param structure - Structures to insert.
3991 */
3992 insertOverload(index: number, structure: MethodDeclarationOverloadStructure): MethodDeclaration;
3993 /**
3994 * Inserts method overloads.
3995 * @param index - Child index to insert at.
3996 * @param structures - Structures to insert.
3997 */
3998 insertOverloads(index: number, structures: ReadonlyArray<MethodDeclarationOverloadStructure>): MethodDeclaration[];
3999 /**
4000 * Removes the method.
4001 */
4002 remove(): void;
4003 /**
4004 * Gets the structure equivalent to this node.
4005 */
4006 getStructure(): MethodDeclarationStructure | MethodDeclarationOverloadStructure;
4007}
4008
4009declare const PropertyDeclarationBase: Constructor<ChildOrderableNode> & Constructor<DecoratableNode> & Constructor<AbstractableNode> & Constructor<ScopedNode> & Constructor<StaticableNode> & Constructor<JSDocableNode> & Constructor<ReadonlyableNode> & Constructor<ExclamationTokenableNode> & Constructor<QuestionTokenableNode> & Constructor<InitializerExpressionableNode> & Constructor<TypedNode> & Constructor<PropertyNamedNode> & Constructor<ModifierableNode> & typeof Node;
4010
4011export declare class PropertyDeclaration extends PropertyDeclarationBase<ts.PropertyDeclaration> {
4012 /**
4013 * Sets the node from a structure.
4014 * @param structure - Structure to set the node with.
4015 */
4016 set(structure: Partial<PropertyDeclarationStructure>): this;
4017 /**
4018 * Removes the property.
4019 */
4020 remove(): void;
4021 /**
4022 * Gets the structure equivalent to this node.
4023 */
4024 getStructure(): PropertyDeclarationStructure;
4025}
4026
4027declare const SetAccessorDeclarationBase: Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<DecoratableNode> & Constructor<AbstractableNode> & Constructor<ScopedNode> & Constructor<StaticableNode> & Constructor<FunctionLikeDeclaration> & Constructor<BodyableNode> & Constructor<PropertyNamedNode> & typeof Node;
4028
4029export declare class SetAccessorDeclaration extends SetAccessorDeclarationBase<ts.SetAccessorDeclaration> {
4030 /**
4031 * Sets the node from a structure.
4032 * @param structure - Structure to set the node with.
4033 */
4034 set(structure: Partial<SetAccessorDeclarationStructure>): this;
4035 /**
4036 * Gets the corresponding get accessor if one exists.
4037 */
4038 getGetAccessor(): GetAccessorDeclaration | undefined;
4039 /**
4040 * Gets the corresponding get accessor or throws if not exists.
4041 */
4042 getGetAccessorOrThrow(): GetAccessorDeclaration;
4043 /**
4044 * Removes the set accessor.
4045 */
4046 remove(): void;
4047 /**
4048 * Gets the structure equivalent to this node.
4049 */
4050 getStructure(): SetAccessorDeclarationStructure;
4051}
4052
4053export declare class CommentRange {
4054 private constructor();
4055 /**
4056 * Gets the underlying compiler object.
4057 */
4058 readonly compilerObject: ts.CommentRange;
4059 /**
4060 * Gets the source file of the comment range.
4061 */
4062 getSourceFile(): SourceFile;
4063 /**
4064 * Gets the comment syntax kind.
4065 */
4066 getKind(): ts.CommentKind;
4067 /**
4068 * Gets the position.
4069 */
4070 getPos(): number;
4071 /**
4072 * Gets the end.
4073 */
4074 getEnd(): number;
4075 /**
4076 * Gets the width of the comment range.
4077 */
4078 getWidth(): number;
4079 /**
4080 * Gets the text of the comment range.
4081 */
4082 getText(): string;
4083 /**
4084 * Gets if the comment range was forgotten.
4085 *
4086 * This will be true after any manipulations have occured to the source file this comment range was generated from.
4087 */
4088 wasForgotten(): boolean;
4089 private _throwIfForgotten;
4090}
4091
4092export declare class ComputedPropertyName extends Node<ts.ComputedPropertyName> {
4093 /**
4094 * Gets the expression.
4095 */
4096 getExpression(): Expression;
4097}
4098
4099declare const IdentifierBase: Constructor<ReferenceFindableNode> & Constructor<RenameableNode> & typeof PrimaryExpression;
4100
4101export declare class Identifier extends IdentifierBase<ts.Identifier> {
4102 /**
4103 * Gets the text for the identifier.
4104 */
4105 getText(): string;
4106 /**
4107 * Gets the definition nodes of the identifier.
4108 * @remarks This is similar to "go to definition" and `.getDefinitions()`, but only returns the nodes.
4109 */
4110 getDefinitionNodes(): Node[];
4111 /**
4112 * Gets the definitions of the identifier.
4113 * @remarks This is similar to "go to definition." Use `.getDefinitionNodes()` if you only care about the nodes.
4114 */
4115 getDefinitions(): DefinitionInfo[];
4116 /**
4117 * Gets the implementations of the identifier.
4118 *
4119 * This is similar to "go to implementation."
4120 */
4121 getImplementations(): ImplementationLocation[];
4122}
4123
4124export interface ForEachChildTraversalControl {
4125 /**
4126 * Stops traversal.
4127 */
4128 stop(): void;
4129}
4130
4131export interface ForEachDescendantTraversalControl extends ForEachChildTraversalControl {
4132 /**
4133 * Skips traversal of the current node's descendants.
4134 */
4135 skip(): void;
4136 /**
4137 * Skips traversal of the current node, siblings, and all their descendants.
4138 */
4139 up(): void;
4140}
4141
4142export interface TransformTraversalControl {
4143 /**
4144 * The node currently being transformed.
4145 * @remarks Use the result of `.visitChildren()` instead before transforming if visiting the children.
4146 */
4147 currentNode: ts.Node;
4148 /**
4149 * Visits the children of the current node and returns a new node for the current node.
4150 */
4151 visitChildren(): ts.Node;
4152}
4153
4154export declare type NodePropertyToWrappedType<NodeType extends ts.Node, KeyName extends keyof NodeType, NonNullableNodeType = NonNullable<NodeType[KeyName]>> = NodeType[KeyName] extends ts.NodeArray<infer ArrayNodeTypeForNullable> | undefined ? CompilerNodeToWrappedType<ArrayNodeTypeForNullable>[] | undefined : NodeType[KeyName] extends ts.NodeArray<infer ArrayNodeType> ? CompilerNodeToWrappedType<ArrayNodeType>[] : NodeType[KeyName] extends ts.Node ? CompilerNodeToWrappedType<NodeType[KeyName]> : NonNullableNodeType extends ts.Node ? CompilerNodeToWrappedType<NonNullableNodeType> | undefined : NodeType[KeyName];
4155
4156export declare type NodeParentType<NodeType extends ts.Node> = NodeType extends ts.SourceFile ? CompilerNodeToWrappedType<NodeType["parent"]> | undefined : ts.Node extends NodeType ? CompilerNodeToWrappedType<NodeType["parent"]> | undefined : CompilerNodeToWrappedType<NodeType["parent"]>;
4157
4158export interface TextRange {
4159 getPos(): number;
4160 getEnd(): number;
4161}
4162
4163export declare class Node<NodeType extends ts.Node = ts.Node> implements TextRange {
4164 /**
4165 * Gets the underlying compiler node.
4166 */
4167 readonly compilerNode: NodeType;
4168 protected constructor();
4169 /**
4170 * Releases the node and all its descendants from the underlying node cache and ast.
4171 *
4172 * This is useful if you want to improve the performance of manipulation by not tracking this node anymore.
4173 */
4174 forget(): void;
4175 /**
4176 * Forgets the descendants of this node.
4177 */
4178 forgetDescendants(): this;
4179 /**
4180 * Gets if the compiler node was forgotten.
4181 *
4182 * This will be true when the compiler node was forgotten or removed.
4183 */
4184 wasForgotten(): boolean;
4185 /**
4186 * Gets the syntax kind.
4187 */
4188 getKind(): SyntaxKind;
4189 /**
4190 * Gets the syntax kind name.
4191 */
4192 getKindName(): string;
4193 /**
4194 * Prints the node using the compiler's printer.
4195 * @param options - Options.
4196 */
4197 print(options?: PrintNodeOptions): string;
4198 /**
4199 * Gets the symbol or throws an error if it doesn't exist.
4200 */
4201 getSymbolOrThrow(): Symbol;
4202 /**
4203 * Gets the compiler symbol or undefined if it doesn't exist.
4204 */
4205 getSymbol(): Symbol | undefined;
4206 /**
4207 * Gets the type of the node.
4208 */
4209 getType(): Type;
4210 /**
4211 * If the node contains the provided range (inclusive).
4212 * @param pos - Start position.
4213 * @param end - End position.
4214 */
4215 containsRange(pos: number, end: number): boolean;
4216 /**
4217 * Gets if the specified position is within a string.
4218 * @param pos - Position.
4219 */
4220 isInStringAtPos(pos: number): boolean;
4221 /**
4222 * Gets the first child by a condition or throws.
4223 * @param condition - Condition.
4224 */
4225 getFirstChildOrThrow<T extends Node>(condition?: (node: Node) => node is T): T;
4226 /**
4227 * Gets the first child by a condition or throws.
4228 * @param condition - Condition.
4229 */
4230 getFirstChildOrThrow(condition?: (node: Node) => boolean): Node;
4231 /**
4232 * Gets the first child by a condition.
4233 * @param condition - Condition.
4234 */
4235 getFirstChild<T extends Node>(condition?: (node: Node) => node is T): T | undefined;
4236 /**
4237 * Gets the first child by a condition.
4238 * @param condition - Condition.
4239 */
4240 getFirstChild(condition?: (node: Node) => boolean): Node | undefined;
4241 /**
4242 * Gets the last child by a condition or throws.
4243 * @param condition - Condition.
4244 */
4245 getLastChildOrThrow<T extends Node>(condition?: (node: Node) => node is T): T;
4246 /**
4247 * Gets the last child by a condition or throws.
4248 * @param condition - Condition.
4249 */
4250 getLastChildOrThrow(condition?: (node: Node) => boolean): Node;
4251 /**
4252 * Gets the last child by a condition.
4253 * @param condition - Condition.
4254 */
4255 getLastChild<T extends Node>(condition?: (node: Node) => node is T): T | undefined;
4256 /**
4257 * Gets the last child by a condition.
4258 * @param condition - Condition.
4259 */
4260 getLastChild(condition?: (node: Node) => boolean): Node | undefined;
4261 /**
4262 * Gets the first descendant by a condition or throws.
4263 * @param condition - Condition.
4264 */
4265 getFirstDescendantOrThrow<T extends Node>(condition?: (node: Node) => node is T): T;
4266 /**
4267 * Gets the first descendant by a condition or throws.
4268 * @param condition - Condition.
4269 */
4270 getFirstDescendantOrThrow(condition?: (node: Node) => boolean): Node;
4271 /**
4272 * Gets the first descendant by a condition.
4273 * @param condition - Condition.
4274 */
4275 getFirstDescendant<T extends Node>(condition?: (node: Node) => node is T): T | undefined;
4276 /**
4277 * Gets the first descendant by a condition.
4278 * @param condition - Condition.
4279 */
4280 getFirstDescendant(condition?: (node: Node) => boolean): Node | undefined;
4281 /**
4282 * Gets the previous sibling or throws.
4283 * @param condition - Optional condition for getting the previous sibling.
4284 */
4285 getPreviousSiblingOrThrow<T extends Node>(condition?: (node: Node) => node is T): T;
4286 /**
4287 * Gets the previous sibling or throws.
4288 * @param condition - Optional condition for getting the previous sibling.
4289 */
4290 getPreviousSiblingOrThrow(condition?: (node: Node) => boolean): Node;
4291 /**
4292 * Gets the previous sibling.
4293 * @param condition - Optional condition for getting the previous sibling.
4294 */
4295 getPreviousSibling<T extends Node>(condition?: (node: Node) => node is T): T | undefined;
4296 /**
4297 * Gets the previous sibling.
4298 * @param condition - Optional condition for getting the previous sibling.
4299 */
4300 getPreviousSibling(condition?: (node: Node) => boolean): Node | undefined;
4301 /**
4302 * Gets the next sibling or throws.
4303 * @param condition - Optional condition for getting the next sibling.
4304 */
4305 getNextSiblingOrThrow<T extends Node>(condition?: (node: Node) => node is T): T;
4306 /**
4307 * Gets the next sibling or throws.
4308 * @param condition - Optional condition for getting the next sibling.
4309 */
4310 getNextSiblingOrThrow(condition?: (node: Node) => boolean): Node;
4311 /**
4312 * Gets the next sibling.
4313 * @param condition - Optional condition for getting the next sibling.
4314 */
4315 getNextSibling<T extends Node>(condition?: (node: Node) => node is T): T | undefined;
4316 /**
4317 * Gets the next sibling.
4318 * @param condition - Optional condition for getting the next sibling.
4319 */
4320 getNextSibling(condition?: (node: Node) => boolean): Node | undefined;
4321 /**
4322 * Gets the previous siblings.
4323 *
4324 * Note: Closest sibling is the zero index.
4325 */
4326 getPreviousSiblings(): Node[];
4327 /**
4328 * Gets the next siblings.
4329 *
4330 * Note: Closest sibling is the zero index.
4331 */
4332 getNextSiblings(): Node[];
4333 /**
4334 * Gets all the children of the node.
4335 */
4336 getChildren(): Node[];
4337 /**
4338 * Gets the child at the specified index.
4339 * @param index - Index of the child.
4340 */
4341 getChildAtIndex(index: number): Node;
4342 /**
4343 * Gets the child syntax list or throws if it doesn't exist.
4344 */
4345 getChildSyntaxListOrThrow(): SyntaxList;
4346 /**
4347 * Gets the child syntax list if it exists.
4348 */
4349 getChildSyntaxList(): SyntaxList | undefined;
4350 /**
4351 * Invokes the `cbNode` callback for each child and the `cbNodeArray` for every array of nodes stored in properties of the node.
4352 * If `cbNodeArray` is not defined, then it will pass every element of the array to `cbNode`.
4353 *
4354 * @remarks There exists a `traversal.stop()` function on the second parameter that allows stopping iteration.
4355 * @param cbNode - Callback invoked for each child.
4356 * @param cbNodeArray - Callback invoked for each array of nodes.
4357 */
4358 forEachChild(cbNode: (node: Node, traversal: ForEachChildTraversalControl) => void, cbNodeArray?: (nodes: Node[], traversal: ForEachChildTraversalControl) => void): void;
4359 /**
4360 * Invokes the `cbNode` callback for each descendant and the `cbNodeArray` for every array of nodes stored in properties of the node and descendant nodes.
4361 * If `cbNodeArray` is not defined, then it will pass every element of the array to `cbNode`.
4362 *
4363 * @remarks There exists a `traversal` object on the second parameter that allows various control of iteration.
4364 * @param cbNode - Callback invoked for each descendant.
4365 * @param cbNodeArray - Callback invoked for each array of nodes.
4366 */
4367 forEachDescendant(cbNode: (node: Node, traversal: ForEachDescendantTraversalControl) => void, cbNodeArray?: (nodes: Node[], traversal: ForEachDescendantTraversalControl) => void): void;
4368 /**
4369 * Gets the node's descendants.
4370 */
4371 getDescendants(): Node[];
4372 /**
4373 * Gets the node's descendant statements.
4374 */
4375 getDescendantStatements(): Statement[];
4376 /**
4377 * Gets the number of children the node has.
4378 */
4379 getChildCount(): number;
4380 /**
4381 * Gets the child at the provided text position, or undefined if not found.
4382 * @param pos - Text position to search for.
4383 */
4384 getChildAtPos(pos: number): Node | undefined;
4385 /**
4386 * Gets the most specific descendant at the provided text position, or undefined if not found.
4387 * @param pos - Text position to search for.
4388 */
4389 getDescendantAtPos(pos: number): Node | undefined;
4390 /**
4391 * Gets the most specific descendant at the provided start text position with the specified width, or undefined if not found.
4392 * @param start - Start text position to search for.
4393 * @param width - Text length of the node to search for.
4394 */
4395 getDescendantAtStartWithWidth(start: number, width: number): Node | undefined;
4396 /**
4397 * Gets the source file text position where the node starts that includes the leading trivia (comments and whitespace).
4398 */
4399 getPos(): number;
4400 /**
4401 * Gets the source file text position where the node ends.
4402 *
4403 * @remarks This does not include the following trivia (comments and whitespace).
4404 */
4405 getEnd(): number;
4406 /**
4407 * Gets the source file text position where the node starts that does not include the leading trivia (comments and whitespace).
4408 * @param includeJsDocComment - Whether to include the JS doc comment.
4409 */
4410 getStart(includeJsDocComment?: boolean): number;
4411 /**
4412 * Gets the source file text position of the end of the last significant token or the start of the source file.
4413 */
4414 getFullStart(): number;
4415 /**
4416 * Gets the first source file text position that is not whitespace.
4417 */
4418 getNonWhitespaceStart(): number;
4419 /**
4420 * Gets the text length of the node without trivia.
4421 */
4422 getWidth(): number;
4423 /**
4424 * Gets the text length of the node with trivia.
4425 */
4426 getFullWidth(): number;
4427 /**
4428 * Gets the node's leading trivia's text length.
4429 */
4430 getLeadingTriviaWidth(): number;
4431 /**
4432 * Gets the text length from the end of the current node to the next significant token or new line.
4433 */
4434 getTrailingTriviaWidth(): number;
4435 /**
4436 * Gets the text position of the next significant token or new line.
4437 */
4438 getTrailingTriviaEnd(): number;
4439 /**
4440 * Gets the text without leading trivia (comments and whitespace).
4441 * @param includeJsDocComment
4442 */
4443 getText(includeJsDocComment?: boolean): string;
4444 /**
4445 * Gets the full text with leading trivia (comments and whitespace).
4446 */
4447 getFullText(): string;
4448 /**
4449 * Gets the combined modifier flags.
4450 */
4451 getCombinedModifierFlags(): ts.ModifierFlags;
4452 /**
4453 * Gets the source file.
4454 */
4455 getSourceFile(): SourceFile;
4456 /**
4457 * Gets a compiler node property wrapped in a Node.
4458 * @param propertyName - Property name.
4459 */
4460 getNodeProperty<KeyType extends keyof LocalNodeType, LocalNodeType extends ts.Node = NodeType>(propertyName: KeyType): NodePropertyToWrappedType<LocalNodeType, KeyType>;
4461 /**
4462 * Goes up the tree getting all the parents in ascending order.
4463 */
4464 getAncestors(): Node[];
4465 /**
4466 * Get the node's parent.
4467 */
4468 getParent<T extends Node | undefined = NodeParentType<NodeType>>(): T;
4469 /**
4470 * Gets the parent or throws an error if it doesn't exist.
4471 */
4472 getParentOrThrow<T extends Node | undefined = NodeParentType<NodeType>>(): NonNullable<T>;
4473 /**
4474 * Goes up the parents (ancestors) of the node while a condition is true.
4475 * Throws if the initial parent doesn't match the condition.
4476 * @param condition - Condition that tests the parent to see if the expression is true.
4477 */
4478 getParentWhileOrThrow<T extends Node>(condition: (node: Node) => node is T): T;
4479 /**
4480 * Goes up the parents (ancestors) of the node while a condition is true.
4481 * Throws if the initial parent doesn't match the condition.
4482 * @param condition - Condition that tests the parent to see if the expression is true.
4483 */
4484 getParentWhileOrThrow(condition: (node: Node) => boolean): Node;
4485 /**
4486 * Goes up the parents (ancestors) of the node while a condition is true.
4487 * Returns undefined if the initial parent doesn't match the condition.
4488 * @param condition - Condition that tests the parent to see if the expression is true.
4489 */
4490 getParentWhile<T extends Node>(condition: (node: Node) => node is T): T | undefined;
4491 /**
4492 * Goes up the parents (ancestors) of the node while a condition is true.
4493 * Returns undefined if the initial parent doesn't match the condition.
4494 * @param condition - Condition that tests the parent to see if the expression is true.
4495 */
4496 getParentWhile(condition: (node: Node) => boolean): Node | undefined;
4497 /**
4498 * Goes up the parents (ancestors) of the node while the parent is the specified syntax kind.
4499 * Throws if the initial parent is not the specified syntax kind.
4500 * @param kind - Syntax kind to check for.
4501 */
4502 getParentWhileKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind];
4503 /**
4504 * Goes up the parents (ancestors) of the node while the parent is the specified syntax kind.
4505 * Returns undefined if the initial parent is not the specified syntax kind.
4506 * @param kind - Syntax kind to check for.
4507 */
4508 getParentWhileKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind] | undefined;
4509 /**
4510 * Gets the last token of this node. Usually this is a close brace.
4511 */
4512 getLastToken(): Node;
4513 /**
4514 * Gets if this node is in a syntax list.
4515 */
4516 isInSyntaxList(): boolean;
4517 /**
4518 * Gets the parent if it's a syntax list or throws an error otherwise.
4519 */
4520 getParentSyntaxListOrThrow(): SyntaxList;
4521 /**
4522 * Gets the parent if it's a syntax list.
4523 */
4524 getParentSyntaxList(): SyntaxList | undefined;
4525 /**
4526 * Gets the child index of this node relative to the parent.
4527 */
4528 getChildIndex(): number;
4529 /**
4530 * Gets the indentation level of the current node.
4531 */
4532 getIndentationLevel(): number;
4533 /**
4534 * Gets the child indentation level of the current node.
4535 */
4536 getChildIndentationLevel(): number;
4537 /**
4538 * Gets the indentation text.
4539 * @param offset - Optional number of levels of indentation to add or remove.
4540 */
4541 getIndentationText(offset?: number): string;
4542 /**
4543 * Gets the next indentation level text.
4544 * @param offset - Optional number of levels of indentation to add or remove.
4545 */
4546 getChildIndentationText(offset?: number): string;
4547 /**
4548 * Gets the position of the start of the line that this node starts on.
4549 * @param includeJsDocComment - Whether to include the JS doc comment or not.
4550 */
4551 getStartLinePos(includeJsDocComment?: boolean): number;
4552 /**
4553 * Gets the line number at the start of the node.
4554 * @param includeJsDocComment - Whether to include the JS doc comment or not.
4555 */
4556 getStartLineNumber(includeJsDocComment?: boolean): number;
4557 /**
4558 * Gets the line number of the end of the node.
4559 */
4560 getEndLineNumber(): number;
4561 /**
4562 * Gets if this is the first node on the current line.
4563 */
4564 isFirstNodeOnLine(): boolean;
4565 /**
4566 * Replaces the text of the current node with new text.
4567 *
4568 * This will forget the current node and return a new node that can be asserted or type guarded to the correct type.
4569 * @param textOrWriterFunction - Text or writer function to replace with.
4570 * @returns The new node.
4571 */
4572 replaceWithText(textOrWriterFunction: string | WriterFunction): Node;
4573 /**
4574 * Prepends the specified whitespace to current node.
4575 * @param textOrWriterFunction - Text or writer function.
4576 */
4577 prependWhitespace(textOrWriterFunction: string | WriterFunction): void;
4578 /**
4579 * Appends the specified whitespace to current node.
4580 * @param textOrWriterFunction - Text or writer function.
4581 */
4582 appendWhitespace(textOrWriterFunction: string | WriterFunction): void;
4583 /**
4584 * Formats the node's text using the internal TypeScript formatting API.
4585 * @param settings - Format code settings.
4586 */
4587 formatText(settings?: FormatCodeSettings): void;
4588 /**
4589 * Transforms the node using the compiler api nodes and functions (experimental).
4590 *
4591 * WARNING: This will forget descendants of transformed nodes.
4592 * @example Increments all the numeric literals in a source file.
4593 * ```ts
4594 * sourceFile.transform(traversal => {
4595 * const node = traversal.visitChildren(); // recommend always visiting the children first (post order)
4596 * if (ts.isNumericLiteral(node))
4597 * return ts.createNumericLiteral((parseInt(node.text, 10) + 1).toString());
4598 * return node;
4599 * });
4600 * ```
4601 * @example Updates the class declaration node without visiting the children.
4602 * ```ts
4603 * const classDec = sourceFile.getClassOrThrow("MyClass");
4604 * classDec.transform(traversal => {
4605 * const node = traversal.currentNode;
4606 * return ts.updateClassDeclaration(node, undefined, undefined, ts.createIdentifier("MyUpdatedClass"), undefined, undefined, []);
4607 * });
4608 * ```
4609 */
4610 transform(visitNode: (traversal: TransformTraversalControl) => ts.Node): this;
4611 /**
4612 * Gets the leading comment ranges of the current node.
4613 */
4614 getLeadingCommentRanges(): CommentRange[];
4615 /**
4616 * Gets the trailing comment ranges of the current node.
4617 */
4618 getTrailingCommentRanges(): CommentRange[];
4619 /**
4620 * Gets the children based on a kind.
4621 * @param kind - Syntax kind.
4622 */
4623 getChildrenOfKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind][];
4624 /**
4625 * Gets the first child by syntax kind or throws an error if not found.
4626 * @param kind - Syntax kind.
4627 */
4628 getFirstChildByKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind];
4629 /**
4630 * Gets the first child by syntax kind.
4631 * @param kind - Syntax kind.
4632 */
4633 getFirstChildByKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind] | undefined;
4634 /**
4635 * Gets the first child if it matches the specified syntax kind or throws an error if not found.
4636 * @param kind - Syntax kind.
4637 */
4638 getFirstChildIfKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind];
4639 /**
4640 * Gets the first child if it matches the specified syntax kind.
4641 * @param kind - Syntax kind.
4642 */
4643 getFirstChildIfKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind] | undefined;
4644 /**
4645 * Gets the last child by syntax kind or throws an error if not found.
4646 * @param kind - Syntax kind.
4647 */
4648 getLastChildByKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind];
4649 /**
4650 * Gets the last child by syntax kind.
4651 * @param kind - Syntax kind.
4652 */
4653 getLastChildByKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind] | undefined;
4654 /**
4655 * Gets the last child if it matches the specified syntax kind or throws an error if not found.
4656 * @param kind - Syntax kind.
4657 */
4658 getLastChildIfKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind];
4659 /**
4660 * Gets the last child if it matches the specified syntax kind.
4661 * @param kind - Syntax kind.
4662 */
4663 getLastChildIfKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind] | undefined;
4664 /**
4665 * Gets the child at the specified index if it's the specified kind or throws an exception.
4666 * @param index - Child index to get.
4667 * @param kind - Expected kind.
4668 */
4669 getChildAtIndexIfKindOrThrow<TKind extends SyntaxKind>(index: number, kind: TKind): KindToNodeMappings[TKind];
4670 /**
4671 * Gets the child at the specified index if it's the specified kind or returns undefined.
4672 * @param index - Child index to get.
4673 * @param kind - Expected kind.
4674 */
4675 getChildAtIndexIfKind<TKind extends SyntaxKind>(index: number, kind: TKind): KindToNodeMappings[TKind] | undefined;
4676 /**
4677 * Gets the previous sibiling if it matches the specified kind, or throws.
4678 * @param kind - Kind to check.
4679 */
4680 getPreviousSiblingIfKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind];
4681 /**
4682 * Gets the next sibiling if it matches the specified kind, or throws.
4683 * @param kind - Kind to check.
4684 */
4685 getNextSiblingIfKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind];
4686 /**
4687 * Gets the previous sibling if it matches the specified kind.
4688 * @param kind - Kind to check.
4689 */
4690 getPreviousSiblingIfKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind] | undefined;
4691 /**
4692 * Gets the next sibling if it matches the specified kind.
4693 * @param kind - Kind to check.
4694 */
4695 getNextSiblingIfKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind] | undefined;
4696 /**
4697 * Gets the parent if it's a certain syntax kind.
4698 */
4699 getParentIfKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind] | undefined;
4700 /**
4701 * Gets the parent if it's a certain syntax kind of throws.
4702 */
4703 getParentIfKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind];
4704 /**
4705 * Gets the first ancestor by syntax kind or throws if not found.
4706 * @param kind - Syntax kind.
4707 */
4708 getFirstAncestorByKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind];
4709 /**
4710 * Get the first ancestor by syntax kind.
4711 * @param kind - Syntax kind.
4712 */
4713 getFirstAncestorByKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind] | undefined;
4714 /**
4715 * Gets the first ancestor that matches the provided condition or throws if not found.
4716 * @param condition - Condition to match.
4717 */
4718 getFirstAncestorOrThrow<T extends Node>(condition?: (node: Node) => node is T): T;
4719 /**
4720 * Gets the first ancestor that matches the provided condition or throws if not found.
4721 * @param condition - Condition to match.
4722 */
4723 getFirstAncestorOrThrow(condition?: (node: Node) => boolean): Node;
4724 /**
4725 * Gets the first ancestor that matches the provided condition or returns undefined if not found.
4726 * @param condition - Condition to match.
4727 */
4728 getFirstAncestor<T extends Node>(condition?: (node: Node) => node is T): T | undefined;
4729 /**
4730 * Gets the first ancestor that matches the provided condition or returns undefined if not found.
4731 * @param condition - Condition to match.
4732 */
4733 getFirstAncestor(condition?: (node: Node) => boolean): Node | undefined;
4734 /**
4735 * Gets the descendants that match a specified syntax kind.
4736 * @param kind - Kind to check.
4737 */
4738 getDescendantsOfKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind][];
4739 /**
4740 * Gets the first descendant by syntax kind or throws.
4741 * @param kind - Syntax kind.
4742 */
4743 getFirstDescendantByKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind];
4744 /**
4745 * Gets the first descendant by syntax kind.
4746 * @param kind - Syntax kind.
4747 */
4748 getFirstDescendantByKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind] | undefined;
4749}
4750
4751export declare class QualifiedName extends Node<ts.QualifiedName> {
4752 /**
4753 * Gets the left side of the qualified name.
4754 */
4755 getLeft(): EntityName;
4756 /**
4757 * Gets the right identifier of the qualified name.
4758 */
4759 getRight(): Identifier;
4760}
4761export declare enum Scope {
4762 Public = "public",
4763 Protected = "protected",
4764 Private = "private"
4765}
4766
4767export declare class SyntaxList extends Node<ts.SyntaxList> {
4768 /**
4769 * Adds text at the end of the current children.
4770 * @param textOrWriterFunction - Text to add or function that provides a writer to write with.
4771 * @returns The children that were added.
4772 */
4773 addChildText(textOrWriterFunction: string | WriterFunction): Node<ts.Node>[];
4774 /**
4775 * Inserts text at the specified child index.
4776 * @param index - Child index to insert at.
4777 * @param textOrWriterFunction - Text to insert or function that provides a writer to write with.
4778 * @returns The children that were inserted.
4779 */
4780 insertChildText(index: number, textOrWriterFunction: string | WriterFunction): Node<ts.Node>[];
4781}
4782
4783export declare type CompilerNodeToWrappedType<T extends ts.Node> = T extends ts.ObjectDestructuringAssignment ? ObjectDestructuringAssignment : T extends ts.ArrayDestructuringAssignment ? ArrayDestructuringAssignment : T extends ts.SuperElementAccessExpression ? SuperElementAccessExpression : T extends ts.SuperPropertyAccessExpression ? SuperPropertyAccessExpression : T extends ts.AssignmentExpression<infer U> ? AssignmentExpression<ts.AssignmentExpression<U>> : T["kind"] extends keyof ImplementedKindToNodeMappings ? ImplementedKindToNodeMappings[T["kind"]] : T extends ts.SyntaxList ? SyntaxList : T extends ts.TypeNode ? TypeNode : T extends ts.TypeElement ? TypeElement : T extends ts.JSDocTag ? JSDocTag : T extends ts.LiteralExpression ? LiteralExpression : T extends ts.PrimaryExpression ? PrimaryExpression : T extends ts.MemberExpression ? MemberExpression : T extends ts.LeftHandSideExpression ? LeftHandSideExpression : T extends ts.UpdateExpression ? UpdateExpression : T extends ts.UnaryExpression ? UnaryExpression : T extends ts.Expression ? Expression : T extends ts.IterationStatement ? IterationStatement : T extends ts.Statement ? Statement : Node<T>;
4784
4785declare const DecoratorBase: typeof Node;
4786
4787export declare class Decorator extends DecoratorBase<ts.Decorator> {
4788 /**
4789 * Gets the decorator name.
4790 */
4791 getName(): string;
4792 /**
4793 * Gets the name node of the decorator.
4794 */
4795 getNameNode(): Identifier;
4796 /**
4797 * Gets the full decorator name.
4798 */
4799 getFullName(): string;
4800 /**
4801 * Gets if the decorator is a decorator factory.
4802 */
4803 isDecoratorFactory(): boolean;
4804 /**
4805 * Set if this decorator is a decorator factory.
4806 * @param isDecoratorFactory - If it should be a decorator factory or not.
4807 */
4808 setIsDecoratorFactory(isDecoratorFactory: boolean): this;
4809 /**
4810 * Gets the call expression if a decorator factory, or throws.
4811 */
4812 getCallExpressionOrThrow(): CallExpression;
4813 /**
4814 * Gets the call expression if a decorator factory.
4815 */
4816 getCallExpression(): CallExpression | undefined;
4817 /**
4818 * Gets the expression.
4819 */
4820 getExpression(): Expression<ts.LeftHandSideExpression>;
4821 /**
4822 * Gets the decorator's arguments from its call expression.
4823 */
4824 getArguments(): Node[];
4825 /**
4826 * Gets the decorator's type arguments from its call expression.
4827 */
4828 getTypeArguments(): TypeNode[];
4829 /**
4830 * Adds a type argument.
4831 * @param argumentTexts - Argument text.
4832 */
4833 addTypeArgument(argumentText: string): TypeNode<ts.TypeNode>;
4834 /**
4835 * Adds type arguments.
4836 * @param argumentTexts - Argument texts.
4837 */
4838 addTypeArguments(argumentTexts: ReadonlyArray<string>): TypeNode<ts.TypeNode>[];
4839 /**
4840 * Inserts a type argument.
4841 * @param index - Child index to insert at.
4842 * @param argumentTexts - Argument text.
4843 */
4844 insertTypeArgument(index: number, argumentText: string): TypeNode<ts.TypeNode>;
4845 /**
4846 * Inserts type arguments.
4847 * @param index - Child index to insert at.
4848 * @param argumentTexts - Argument texts.
4849 */
4850 insertTypeArguments(index: number, argumentTexts: ReadonlyArray<string>): TypeNode<ts.TypeNode>[];
4851 /**
4852 * Removes a type argument.
4853 * @param typeArg - Type argument to remove.
4854 */
4855 removeTypeArgument(typeArg: Node): this;
4856 /**
4857 * Removes a type argument.
4858 * @param index - Index to remove.
4859 */
4860 removeTypeArgument(index: number): this;
4861 /**
4862 * Adds an argument.
4863 * @param argumentTexts - Argument text.
4864 */
4865 addArgument(argumentText: string | WriterFunction): Node<ts.Node>;
4866 /**
4867 * Adds arguments.
4868 * @param argumentTexts - Argument texts.
4869 */
4870 addArguments(argumentTexts: ReadonlyArray<string | WriterFunction> | WriterFunction): Node<ts.Node>[];
4871 /**
4872 * Inserts an argument.
4873 * @param index - Child index to insert at.
4874 * @param argumentTexts - Argument text.
4875 */
4876 insertArgument(index: number, argumentText: string | WriterFunction): Node<ts.Node>;
4877 /**
4878 * Inserts arguments.
4879 * @param index - Child index to insert at.
4880 * @param argumentTexts - Argument texts.
4881 */
4882 insertArguments(index: number, argumentTexts: ReadonlyArray<string | WriterFunction> | WriterFunction): Node<ts.Node>[];
4883 /**
4884 * Removes an argument based on the node.
4885 * @param node - Argument's node to remove.
4886 */
4887 removeArgument(node: Node): this;
4888 /**
4889 * Removes an argument based on the specified index.
4890 * @param index - Index to remove.
4891 */
4892 removeArgument(index: number): this;
4893 /**
4894 * Removes this decorator.
4895 */
4896 remove(): void;
4897 /**
4898 * Sets the node from a structure.
4899 * @param structure - Structure to set the node with.
4900 */
4901 set(structure: Partial<DecoratorStructure>): this;
4902 /**
4903 * Gets the structure equivalent to this node.
4904 */
4905 getStructure(): DecoratorStructure;
4906}
4907
4908export declare function JSDocPropertyLikeTag<T extends Constructor<JSDocPropertyLikeTagExtensionType>>(Base: T): Constructor<JSDocPropertyLikeTag> & T;
4909
4910export interface JSDocPropertyLikeTag {
4911 /** Gets the name of the JS doc property like tag. */
4912 getName(): string;
4913 /** Gets the name node of the JS doc property like tag. */
4914 getNameNode(): EntityName;
4915}
4916
4917declare type JSDocPropertyLikeTagExtensionType = Node<ts.JSDocPropertyLikeTag> & JSDocTag;
4918
4919declare const JSDocBase: typeof Node;
4920
4921/**
4922 * JS doc node.
4923 */
4924export declare class JSDoc extends JSDocBase<ts.JSDoc> {
4925 /**
4926 * Gets the tags of the JSDoc.
4927 */
4928 getTags(): JSDocTag[];
4929 /**
4930 * Gets the comment.
4931 */
4932 getComment(): string | undefined;
4933 /**
4934 * Gets the JSDoc's text without the surrounding comment.
4935 */
4936 getInnerText(): string;
4937 /**
4938 * Sets the comment.
4939 * @param textOrWriterFunction - Text or writer function to set.
4940 */
4941 setComment(textOrWriterFunction: string | WriterFunction): this;
4942 /**
4943 * Removes this JSDoc.
4944 */
4945 remove(): void;
4946 /**
4947 * Sets the node from a structure.
4948 * @param structure - Structure to set the node with.
4949 */
4950 set(structure: Partial<JSDocStructure>): this;
4951 /**
4952 * Gets the structure equivalent to this node.
4953 */
4954 getStructure(): JSDocStructure;
4955}
4956
4957/**
4958 * JS doc augments tag node.
4959 */
4960export declare class JSDocAugmentsTag extends JSDocTag<ts.JSDocAugmentsTag> {
4961}
4962
4963/**
4964 * JS doc class tag node.
4965 */
4966export declare class JSDocClassTag extends JSDocTag<ts.JSDocClassTag> {
4967}
4968
4969declare const JSDocParameterTagBase: Constructor<JSDocPropertyLikeTag> & typeof JSDocTag;
4970
4971/**
4972 * JS doc parameter tag node.
4973 */
4974export declare class JSDocParameterTag extends JSDocParameterTagBase<ts.JSDocParameterTag> {
4975}
4976
4977declare const JSDocPropertyTagBase: Constructor<JSDocPropertyLikeTag> & typeof JSDocTag;
4978
4979/**
4980 * JS doc property tag node.
4981 */
4982export declare class JSDocPropertyTag extends JSDocPropertyTagBase<ts.JSDocPropertyTag> {
4983}
4984
4985/**
4986 * JS doc return tag node.
4987 */
4988export declare class JSDocReturnTag extends JSDocTag<ts.JSDocReturnTag> {
4989}
4990
4991/**
4992 * JS doc tag node.
4993 */
4994export declare class JSDocTag<NodeType extends ts.JSDocTag = ts.JSDocTag> extends Node<NodeType> {
4995 /**
4996 * Gets the tag's name as a string.
4997 */
4998 getTagName(): string;
4999 /**
5000 * Gets the tag name node.
5001 */
5002 getTagNameNode(): Identifier;
5003 /**
5004 * Gets the tag's comment.
5005 */
5006 getComment(): string | undefined;
5007}
5008
5009/**
5010 * JS doc tag info.
5011 */
5012export declare class JSDocTagInfo {
5013 private constructor();
5014 /** Gets the compiler JS doc tag info. */
5015 readonly compilerObject: ts.JSDocTagInfo;
5016 /**
5017 * Gets the name.
5018 */
5019 getName(): string;
5020 /**
5021 * Gets the text.
5022 */
5023 getText(): string | undefined;
5024}
5025
5026/**
5027 * JS doc type def tag node.
5028 */
5029export declare class JSDocTypedefTag extends JSDocTag<ts.JSDocTypedefTag> {
5030}
5031
5032/**
5033 * JS doc type tag node.
5034 */
5035export declare class JSDocTypeTag extends JSDocTag<ts.JSDocTypeTag> {
5036}
5037
5038/**
5039 * JS doc unknown tag node.
5040 */
5041export declare class JSDocUnknownTag extends JSDocTag<ts.JSDocUnknownTag> {
5042}
5043
5044declare const EnumDeclarationBase: Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<NamespaceChildableNode> & Constructor<JSDocableNode> & Constructor<AmbientableNode> & Constructor<ExportableNode> & Constructor<ModifierableNode> & Constructor<NamedNode> & typeof Statement;
5045
5046export declare class EnumDeclaration extends EnumDeclarationBase<ts.EnumDeclaration> {
5047 /**
5048 * Sets the node from a structure.
5049 * @param structure - Structure to set the node with.
5050 */
5051 set(structure: Partial<EnumDeclarationStructure>): this;
5052 /**
5053 * Adds a member to the enum.
5054 * @param structure - Structure of the enum.
5055 */
5056 addMember(structure: EnumMemberStructure): EnumMember;
5057 /**
5058 * Adds members to the enum.
5059 * @param structures - Structures of the enums.
5060 */
5061 addMembers(structures: ReadonlyArray<EnumMemberStructure>): EnumMember[];
5062 /**
5063 * Inserts a member to the enum.
5064 * @param index - Child index to insert at.
5065 * @param structure - Structure of the enum.
5066 */
5067 insertMember(index: number, structure: EnumMemberStructure): EnumMember;
5068 /**
5069 * Inserts members to an enum.
5070 * @param index - Child index to insert at.
5071 * @param structures - Structures of the enums.
5072 */
5073 insertMembers(index: number, structures: ReadonlyArray<EnumMemberStructure>): EnumMember[];
5074 /**
5075 * Gets an enum member.
5076 * @param name - Name of the member.
5077 */
5078 getMember(name: string): EnumMember | undefined;
5079 /**
5080 * Gets an enum member.
5081 * @param findFunction - Function to use to find the member.
5082 */
5083 getMember(findFunction: (declaration: EnumMember) => boolean): EnumMember | undefined;
5084 /**
5085 * Gets an enum member or throws if not found.
5086 * @param name - Name of the member.
5087 */
5088 getMemberOrThrow(name: string): EnumMember;
5089 /**
5090 * Gets an enum member or throws if not found.
5091 * @param findFunction - Function to use to find the member.
5092 */
5093 getMemberOrThrow(findFunction: (declaration: EnumMember) => boolean): EnumMember;
5094 /**
5095 * Gets the enum's members.
5096 */
5097 getMembers(): EnumMember[];
5098 /**
5099 * Toggle if it's a const enum.
5100 */
5101 setIsConstEnum(value: boolean): this;
5102 /**
5103 * Gets if it's a const enum.
5104 */
5105 isConstEnum(): boolean;
5106 /**
5107 * Gets the const enum keyword or undefined if not exists.
5108 */
5109 getConstKeyword(): Node<ts.Node> | undefined;
5110 /**
5111 * Gets the structure equivalent to this node.
5112 */
5113 getStructure(): EnumDeclarationStructure;
5114}
5115
5116declare const EnumMemberBase: Constructor<JSDocableNode> & Constructor<InitializerExpressionableNode> & Constructor<PropertyNamedNode> & typeof Node;
5117
5118export declare class EnumMember extends EnumMemberBase<ts.EnumMember> {
5119 /**
5120 * Gets the constant value of the enum.
5121 */
5122 getValue(): string | number | undefined;
5123 /**
5124 * Sets the enum value.
5125 * @param value - Enum value.
5126 */
5127 setValue(value: string | number): this;
5128 /**
5129 * Removes this enum member.
5130 */
5131 remove(): void;
5132 /**
5133 * Sets the node from a structure.
5134 * @param structure - Structure to set the node with.
5135 */
5136 set(structure: Partial<EnumMemberStructure>): this;
5137 /**
5138 * Gets the structure equivalent to this node.
5139 */
5140 getStructure(): EnumMemberStructure;
5141}
5142
5143declare const ArrayDestructuringAssignmentBase: typeof AssignmentExpression;
5144
5145export declare class ArrayDestructuringAssignment extends ArrayDestructuringAssignmentBase<ts.ArrayDestructuringAssignment> {
5146 /**
5147 * Gets the left array literal expression of the array destructuring assignment.
5148 */
5149 getLeft(): ArrayLiteralExpression;
5150}
5151
5152export declare class ArrayLiteralExpression extends PrimaryExpression<ts.ArrayLiteralExpression> {
5153 /**
5154 * Gets the array's elements.
5155 */
5156 getElements(): Expression[];
5157 /**
5158 * Adds an element to the array.
5159 * @param textOrWriterFunction - Text to add as an element.
5160 * @param options - Options.
5161 */
5162 addElement(textOrWriterFunction: string | WriterFunction, options?: {
5163 useNewLines?: boolean;
5164 }): Expression<ts.Expression>;
5165 /**
5166 * Adds elements to the array.
5167 * @param textsOrWriterFunction - Texts to add as elements.
5168 * @param options - Options.
5169 */
5170 addElements(textsOrWriterFunction: ReadonlyArray<string | WriterFunction> | WriterFunction, options?: {
5171 useNewLines?: boolean;
5172 }): Expression<ts.Expression>[];
5173 /**
5174 * Insert an element into the array.
5175 * @param index - Child index to insert at.
5176 * @param text - Text to insert as an element.
5177 * @param options - Options.
5178 */
5179 insertElement(index: number, textOrWriterFunction: string | WriterFunction, options?: {
5180 useNewLines?: boolean;
5181 }): Expression<ts.Expression>;
5182 /**
5183 * Insert elements into the array.
5184 * @param index - Child index to insert at.
5185 * @param textsOrWriterFunction - Texts to insert as elements.
5186 * @param options - Options.
5187 */
5188 insertElements(index: number, textsOrWriterFunction: ReadonlyArray<string | WriterFunction> | WriterFunction, options?: {
5189 useNewLines?: boolean;
5190 }): Expression<ts.Expression>[];
5191 /**
5192 * Removes an element from the array.
5193 * @param index - Index to remove from.
5194 */
5195 removeElement(index: number): void;
5196 /**
5197 * Removes an element from the array.
5198 * @param element - Element to remove.
5199 */
5200 removeElement(element: Expression): void;
5201}
5202
5203declare const AsExpressionBase: Constructor<TypedNode> & Constructor<ExpressionedNode> & typeof Expression;
5204
5205export declare class AsExpression extends AsExpressionBase<ts.AsExpression> {
5206}
5207
5208declare const AssignmentExpressionBase: typeof BinaryExpression;
5209
5210export declare class AssignmentExpression<T extends ts.AssignmentExpression<ts.AssignmentOperatorToken> = ts.AssignmentExpression<ts.AssignmentOperatorToken>> extends AssignmentExpressionBase<T> {
5211 /**
5212 * Gets the operator token of the assignment expression.
5213 */
5214 getOperatorToken(): Node<ts.Token<ts.AssignmentOperator>>;
5215}
5216
5217declare const AwaitExpressionBase: Constructor<UnaryExpressionedNode> & typeof UnaryExpression;
5218
5219export declare class AwaitExpression extends AwaitExpressionBase<ts.AwaitExpression> {
5220}
5221
5222declare const BinaryExpressionBase: typeof Expression;
5223
5224export declare class BinaryExpression<T extends ts.BinaryExpression = ts.BinaryExpression> extends BinaryExpressionBase<T> {
5225 /**
5226 * Gets the left side of the binary expression.
5227 */
5228 getLeft(): Expression;
5229 /**
5230 * Gets the operator token of the binary expression.
5231 */
5232 getOperatorToken(): Node<ts.Token<ts.BinaryOperator>>;
5233 /**
5234 * Gets the right side of the binary expression.
5235 */
5236 getRight(): Expression;
5237}
5238
5239declare const CallExpressionBase: Constructor<TypeArgumentedNode> & Constructor<ArgumentedNode> & Constructor<LeftHandSideExpressionedNode> & typeof LeftHandSideExpression;
5240
5241export declare class CallExpression<T extends ts.CallExpression = ts.CallExpression> extends CallExpressionBase<T> {
5242 /**
5243 * Gets the return type of the call expression.
5244 */
5245 getReturnType(): Type;
5246}
5247
5248declare const CommaListExpressionBase: typeof Expression;
5249
5250export declare class CommaListExpression extends CommaListExpressionBase<ts.CommaListExpression> {
5251 /**
5252 * Gets the elements.
5253 */
5254 getElements(): Expression[];
5255}
5256
5257declare const ConditionalExpressionBase: typeof Expression;
5258
5259export declare class ConditionalExpression extends ConditionalExpressionBase<ts.ConditionalExpression> {
5260 /**
5261 * Gets the condition of the conditional expression.
5262 */
5263 getCondition(): Expression;
5264 /**
5265 * Gets the question token of the conditional expression.
5266 */
5267 getQuestionToken(): Node<ts.Token<SyntaxKind.QuestionToken>>;
5268 /**
5269 * Gets the when true expression of the conditional expression.
5270 */
5271 getWhenTrue(): Expression;
5272 /**
5273 * Gets the colon token of the conditional expression.
5274 */
5275 getColonToken(): Node<ts.Token<SyntaxKind.ColonToken>>;
5276 /**
5277 * Gets the when false expression of the conditional expression.
5278 */
5279 getWhenFalse(): Expression;
5280}
5281
5282declare const DeleteExpressionBase: Constructor<UnaryExpressionedNode> & typeof UnaryExpression;
5283
5284export declare class DeleteExpression extends DeleteExpressionBase<ts.DeleteExpression> {
5285}
5286
5287declare const ElementAccessExpressionBase: Constructor<LeftHandSideExpressionedNode> & typeof MemberExpression;
5288
5289export declare class ElementAccessExpression<T extends ts.ElementAccessExpression = ts.ElementAccessExpression> extends ElementAccessExpressionBase<T> {
5290 /**
5291 * Gets this element access expression's argument expression or undefined if none exists.
5292 */
5293 getArgumentExpression(): Expression | undefined;
5294 /**
5295 * Gets this element access expression's argument expression or throws if none exists.
5296 */
5297 getArgumentExpressionOrThrow(): Expression<ts.Expression>;
5298}
5299
5300export declare class Expression<T extends ts.Expression = ts.Expression> extends Node<T> {
5301 /**
5302 * Gets the contextual type of the expression.
5303 */
5304 getContextualType(): Type | undefined;
5305}
5306
5307export declare function ExpressionedNode<T extends Constructor<ExpressionedNodeExtensionType>>(Base: T): Constructor<ExpressionedNode> & T;
5308
5309export interface ExpressionedNode {
5310 /**
5311 * Gets the expression.
5312 */
5313 getExpression(): Expression;
5314 /**
5315 * Sets the expression.
5316 * @param textOrWriterFunction - Text to set the expression with.
5317 */
5318 setExpression(textOrWriterFunction: string | WriterFunction): this;
5319}
5320
5321declare type ExpressionedNodeExtensionType = Node<ts.Node & {
5322 expression: ts.Expression;
5323}>;
5324
5325export declare function ImportExpressionedNode<T extends Constructor<ImportExpressionedNodeExtensionType>>(Base: T): Constructor<ImportExpressionedNode> & T;
5326
5327export interface ImportExpressionedNode {
5328 /**
5329 * Gets the expression.
5330 */
5331 getExpression(): ImportExpression;
5332}
5333
5334declare type ImportExpressionedNodeExtensionType = Node<ts.Node & {
5335 expression: ts.ImportExpression;
5336}>;
5337
5338export declare function LeftHandSideExpressionedNode<T extends Constructor<LeftHandSideExpressionedNodeExtensionType>>(Base: T): Constructor<LeftHandSideExpressionedNode> & T;
5339
5340export interface LeftHandSideExpressionedNode {
5341 /**
5342 * Gets the expression.
5343 */
5344 getExpression(): LeftHandSideExpression;
5345}
5346
5347declare type LeftHandSideExpressionedNodeExtensionType = Node<ts.Node & {
5348 expression: ts.LeftHandSideExpression;
5349}>;
5350
5351export declare function SuperExpressionedNode<T extends Constructor<SuperExpressionedNodeExtensionType>>(Base: T): Constructor<SuperExpressionedNode> & T;
5352
5353export interface SuperExpressionedNode {
5354 /**
5355 * Gets the expression.
5356 */
5357 getExpression(): SuperExpression;
5358}
5359
5360declare type SuperExpressionedNodeExtensionType = Node<ts.Node & {
5361 expression: ts.SuperExpression;
5362}>;
5363
5364export declare function UnaryExpressionedNode<T extends Constructor<UnaryExpressionedNodeExtensionType>>(Base: T): Constructor<UnaryExpressionedNode> & T;
5365
5366export interface UnaryExpressionedNode {
5367 /**
5368 * Gets the expression.
5369 */
5370 getExpression(): UnaryExpression;
5371}
5372
5373declare type UnaryExpressionedNodeExtensionType = Node<ts.Node & {
5374 expression: ts.UnaryExpression;
5375}>;
5376
5377declare const ImportExpressionBase: typeof PrimaryExpression;
5378
5379export declare class ImportExpression extends ImportExpressionBase<ts.ImportExpression> {
5380}
5381
5382export declare class LeftHandSideExpression<T extends ts.LeftHandSideExpression = ts.LeftHandSideExpression> extends UpdateExpression<T> {
5383}
5384
5385declare const LiteralExpressionBase: Constructor<LiteralLikeNode> & typeof PrimaryExpression;
5386
5387export declare class LiteralExpression<T extends ts.LiteralExpression = ts.LiteralExpression> extends LiteralExpressionBase<T> {
5388}
5389
5390export declare class MemberExpression<T extends ts.MemberExpression = ts.MemberExpression> extends LeftHandSideExpression<T> {
5391}
5392
5393declare const MetaPropertyBase: Constructor<NamedNode> & typeof PrimaryExpression;
5394
5395export declare class MetaProperty extends MetaPropertyBase<ts.MetaProperty> {
5396 /**
5397 * Gets the keyword token.
5398 */
5399 getKeywordToken(): SyntaxKind.ImportKeyword | SyntaxKind.NewKeyword;
5400}
5401
5402declare const NewExpressionBase: Constructor<TypeArgumentedNode> & Constructor<ArgumentedNode> & Constructor<LeftHandSideExpressionedNode> & typeof PrimaryExpression;
5403
5404export declare class NewExpression extends NewExpressionBase<ts.NewExpression> {
5405}
5406
5407declare const NonNullExpressionBase: Constructor<ExpressionedNode> & typeof LeftHandSideExpression;
5408
5409export declare class NonNullExpression extends NonNullExpressionBase<ts.NonNullExpression> {
5410}
5411
5412declare const ObjectDestructuringAssignmentBase: typeof AssignmentExpression;
5413
5414export declare class ObjectDestructuringAssignment extends ObjectDestructuringAssignmentBase<ts.ObjectDestructuringAssignment> {
5415 /**
5416 * Gets the left object literal expression of the object destructuring assignment.
5417 */
5418 getLeft(): ObjectLiteralExpression;
5419}
5420
5421declare const ObjectLiteralExpressionBase: typeof PrimaryExpression;
5422
5423export declare class ObjectLiteralExpression extends ObjectLiteralExpressionBase<ts.ObjectLiteralExpression> {
5424 /**
5425 * Gets the first property by the provided name or throws.
5426 * @param name - Name of the property.
5427 */
5428 getPropertyOrThrow(name: string): ObjectLiteralElementLike;
5429 /**
5430 * Gets the first property that matches the provided find function or throws.
5431 * @param findFunction - Find function.
5432 */
5433 getPropertyOrThrow(findFunction: (property: ObjectLiteralElementLike) => boolean): ObjectLiteralElementLike;
5434 /**
5435 * Gets the first property by the provided name or returns undefined.
5436 * @param name - Name of the property.
5437 */
5438 getProperty(name: string): ObjectLiteralElementLike | undefined;
5439 /**
5440 * Gets the first property that matches the provided find function or returns undefined.
5441 * @param findFunction - Find function.
5442 */
5443 getProperty(findFunction: (property: ObjectLiteralElementLike) => boolean): ObjectLiteralElementLike | undefined;
5444 /**
5445 * Gets the properties.
5446 */
5447 getProperties(): ObjectLiteralElementLike[];
5448 /**
5449 * Adds a property assignment.
5450 * @param structure - Structure that represents the property assignment to add.
5451 */
5452 addPropertyAssignment(structure: PropertyAssignmentStructure): PropertyAssignment;
5453 /**
5454 * Adds property assignments.
5455 * @param structures - Structure that represents the property assignments to add.
5456 */
5457 addPropertyAssignments(structures: ReadonlyArray<PropertyAssignmentStructure>): PropertyAssignment[];
5458 /**
5459 * Inserts a property assignment at the specified index.
5460 * @param index - Child index to insert at.
5461 * @param structure - Structure that represents the property assignment to insert.
5462 */
5463 insertPropertyAssignment(index: number, structure: PropertyAssignmentStructure): PropertyAssignment;
5464 /**
5465 * Inserts property assignments at the specified index.
5466 * @param index - Child index to insert at.
5467 * @param structures - Structures that represent the property assignments to insert.
5468 */
5469 insertPropertyAssignments(index: number, structures: ReadonlyArray<PropertyAssignmentStructure>): PropertyAssignment[];
5470 /**
5471 * Adds a shorthand property assignment.
5472 * @param structure - Structure that represents the shorthand property assignment to add.
5473 */
5474 addShorthandPropertyAssignment(structure: ShorthandPropertyAssignmentStructure): ShorthandPropertyAssignment;
5475 /**
5476 * Adds shorthand property assignments.
5477 * @param structures - Structure that represents the shorthand property assignments to add.
5478 */
5479 addShorthandPropertyAssignments(structures: ReadonlyArray<ShorthandPropertyAssignmentStructure>): ShorthandPropertyAssignment[];
5480 /**
5481 * Inserts a shorthand property assignment at the specified index.
5482 * @param index - Child index to insert at.
5483 * @param structure - Structure that represents the shorthand property assignment to insert.
5484 */
5485 insertShorthandPropertyAssignment(index: number, structure: ShorthandPropertyAssignmentStructure): ShorthandPropertyAssignment;
5486 /**
5487 * Inserts shorthand property assignments at the specified index.
5488 * @param index - Child index to insert at.
5489 * @param structures - Structures that represent the shorthand property assignments to insert.
5490 */
5491 insertShorthandPropertyAssignments(index: number, structures: ReadonlyArray<ShorthandPropertyAssignmentStructure>): ShorthandPropertyAssignment[];
5492 /**
5493 * Adds a spread assignment.
5494 * @param structure - Structure that represents the spread assignment to add.
5495 */
5496 addSpreadAssignment(structure: SpreadAssignmentStructure): SpreadAssignment;
5497 /**
5498 * Adds spread assignments.
5499 * @param structures - Structure that represents the spread assignments to add.
5500 */
5501 addSpreadAssignments(structures: ReadonlyArray<SpreadAssignmentStructure>): SpreadAssignment[];
5502 /**
5503 * Inserts a spread assignment at the specified index.
5504 * @param index - Child index to insert at.
5505 * @param structure - Structure that represents the spread assignment to insert.
5506 */
5507 insertSpreadAssignment(index: number, structure: SpreadAssignmentStructure): SpreadAssignment;
5508 /**
5509 * Inserts spread assignments at the specified index.
5510 * @param index - Child index to insert at.
5511 * @param structures - Structures that represent the spread assignments to insert.
5512 */
5513 insertSpreadAssignments(index: number, structures: ReadonlyArray<SpreadAssignmentStructure>): SpreadAssignment[];
5514 /**
5515 * Adds a method.
5516 * @param structure - Structure that represents the method to add.
5517 */
5518 addMethod(structure: MethodDeclarationStructure): MethodDeclaration;
5519 /**
5520 * Adds methods.
5521 * @param structures - Structure that represents the methods to add.
5522 */
5523 addMethods(structures: ReadonlyArray<MethodDeclarationStructure>): MethodDeclaration[];
5524 /**
5525 * Inserts a method at the specified index.
5526 * @param index - Child index to insert at.
5527 * @param structure - Structure that represents the method to insert.
5528 */
5529 insertMethod(index: number, structure: MethodDeclarationStructure): MethodDeclaration;
5530 /**
5531 * Inserts methods at the specified index.
5532 * @param index - Child index to insert at.
5533 * @param structures - Structures that represent the methods to insert.
5534 */
5535 insertMethods(index: number, structures: ReadonlyArray<MethodDeclarationStructure>): MethodDeclaration[];
5536 /**
5537 * Adds a get accessor.
5538 * @param structure - Structure that represents the property assignment to add.
5539 */
5540 addGetAccessor(structure: GetAccessorDeclarationStructure): GetAccessorDeclaration;
5541 /**
5542 * Adds get accessors.
5543 * @param structures - Structure that represents the get accessors to add.
5544 */
5545 addGetAccessors(structures: ReadonlyArray<GetAccessorDeclarationStructure>): GetAccessorDeclaration[];
5546 /**
5547 * Inserts a get accessor at the specified index.
5548 * @param index - Child index to insert at.
5549 * @param structure - Structure that represents the get accessor to insert.
5550 */
5551 insertGetAccessor(index: number, structure: GetAccessorDeclarationStructure): GetAccessorDeclaration;
5552 /**
5553 * Inserts get accessors at the specified index.
5554 * @param index - Child index to insert at.
5555 * @param structures - Structures that represent the get accessors to insert.
5556 */
5557 insertGetAccessors(index: number, structures: ReadonlyArray<GetAccessorDeclarationStructure>): GetAccessorDeclaration[];
5558 /**
5559 * Adds a set accessor.
5560 * @param structure - Structure that represents the property assignment to add.
5561 */
5562 addSetAccessor(structure: SetAccessorDeclarationStructure): SetAccessorDeclaration;
5563 /**
5564 * Adds set accessors.
5565 * @param structures - Structure that represents the set accessors to add.
5566 */
5567 addSetAccessors(structures: ReadonlyArray<SetAccessorDeclarationStructure>): SetAccessorDeclaration[];
5568 /**
5569 * Inserts a set accessor at the specified index.
5570 * @param index - Child index to insert at.
5571 * @param structure - Structure that represents the set accessor to insert.
5572 */
5573 insertSetAccessor(index: number, structure: SetAccessorDeclarationStructure): SetAccessorDeclaration;
5574 /**
5575 * Inserts set accessors at the specified index.
5576 * @param index - Child index to insert at.
5577 * @param structures - Structures that represent the set accessors to insert.
5578 */
5579 insertSetAccessors(index: number, structures: ReadonlyArray<SetAccessorDeclarationStructure>): SetAccessorDeclaration[];
5580}
5581
5582declare const PropertyAssignmentBase: Constructor<InitializerGetExpressionableNode> & Constructor<QuestionTokenableNode> & Constructor<PropertyNamedNode> & typeof Node;
5583
5584export declare class PropertyAssignment extends PropertyAssignmentBase<ts.PropertyAssignment> {
5585 /**
5586 * Removes the initializer and returns the new shorthand property assignment.
5587 *
5588 * Note: The current node will no longer be valid because it's no longer a property assignment.
5589 */
5590 removeInitializer(): ShorthandPropertyAssignment;
5591 /**
5592 * Sets the initializer.
5593 * @param textOrWriterFunction - New text ot set for the initializer.
5594 */
5595 setInitializer(textOrWriterFunction: string | WriterFunction): this;
5596 /**
5597 * Removes this property.
5598 */
5599 remove(): void;
5600 /**
5601 * Sets the node from a structure.
5602 * @param structure - Structure to set the node with.
5603 */
5604 set(structure: Partial<PropertyAssignmentStructure>): this | ShorthandPropertyAssignment;
5605 /**
5606 * Gets the structure equivalent to this node.
5607 */
5608 getStructure(): PropertyAssignmentStructure;
5609}
5610
5611declare const ShorthandPropertyAssignmentBase: Constructor<InitializerGetExpressionableNode> & Constructor<QuestionTokenableNode> & Constructor<NamedNode> & typeof Node;
5612
5613export declare class ShorthandPropertyAssignment extends ShorthandPropertyAssignmentBase<ts.ShorthandPropertyAssignment> {
5614 /**
5615 * Gets if the shorthand property assignment has an object assignment initializer.
5616 */
5617 hasObjectAssignmentInitializer(): boolean;
5618 /**
5619 * Gets the object assignment initializer or throws if it doesn't exist.
5620 */
5621 getObjectAssignmentInitializerOrThrow(): Expression<ts.Expression>;
5622 /**
5623 * Gets the object assignment initializer if it exists.
5624 */
5625 getObjectAssignmentInitializer(): Expression | undefined;
5626 /**
5627 * Gets the equals token or throws if it doesn't exist.
5628 */
5629 getEqualsTokenOrThrow(): Node<ts.Token<SyntaxKind.EqualsToken>>;
5630 /**
5631 * Gets the equals token if it exists.
5632 */
5633 getEqualsToken(): Node<ts.Token<SyntaxKind.EqualsToken>> | undefined;
5634 /**
5635 * Remove the object assignment initializer.
5636 *
5637 * This is only useful to remove bad code.
5638 */
5639 removeObjectAssignmentInitializer(): this;
5640 /**
5641 * Sets the initializer.
5642 *
5643 * Note: The current node will no longer be valid because it's no longer a shorthand property assignment.
5644 * @param text - New text to set for the initializer.
5645 */
5646 setInitializer(text: string): PropertyAssignment;
5647 /**
5648 * Removes this property.
5649 */
5650 remove(): void;
5651 /**
5652 * Sets the node from a structure.
5653 * @param structure - Structure to set the node with.
5654 */
5655 set(structure: Partial<ShorthandPropertyAssignmentStructure>): this;
5656 /**
5657 * Gets the structure equivalent to this node.
5658 */
5659 getStructure(): ShorthandPropertyAssignmentStructure;
5660}
5661
5662declare const SpreadAssignmentBase: Constructor<ExpressionedNode> & typeof Node;
5663
5664export declare class SpreadAssignment extends SpreadAssignmentBase<ts.SpreadAssignment> {
5665 /**
5666 * Removes this property.
5667 */
5668 remove(): void;
5669 /**
5670 * Sets the node from a structure.
5671 * @param structure - Structure to set the node with.
5672 */
5673 set(structure: Partial<SpreadAssignmentStructure>): this;
5674 /**
5675 * Gets the structure equivalent to this node.
5676 */
5677 getStructure(): SpreadAssignmentStructure;
5678}
5679
5680declare const OmittedExpressionBase: typeof Expression;
5681
5682export declare class OmittedExpression extends OmittedExpressionBase<ts.OmittedExpression> {
5683}
5684
5685declare const ParenthesizedExpressionBase: Constructor<ExpressionedNode> & typeof Expression;
5686
5687export declare class ParenthesizedExpression extends ParenthesizedExpressionBase<ts.ParenthesizedExpression> {
5688}
5689
5690declare const PartiallyEmittedExpressionBase: Constructor<ExpressionedNode> & typeof Expression;
5691
5692export declare class PartiallyEmittedExpression extends PartiallyEmittedExpressionBase<ts.PartiallyEmittedExpression> {
5693}
5694
5695declare const PostfixUnaryExpressionBase: typeof UnaryExpression;
5696
5697export declare class PostfixUnaryExpression extends PostfixUnaryExpressionBase<ts.PostfixUnaryExpression> {
5698 /**
5699 * Gets the operator token of the postfix unary expression.
5700 */
5701 getOperatorToken(): ts.PostfixUnaryOperator;
5702 /**
5703 * Gets the operand of the postfix unary expression.
5704 */
5705 getOperand(): LeftHandSideExpression;
5706}
5707
5708declare const PrefixUnaryExpressionBase: typeof UnaryExpression;
5709
5710export declare class PrefixUnaryExpression extends PrefixUnaryExpressionBase<ts.PrefixUnaryExpression> {
5711 /**
5712 * Gets the operator token of the prefix unary expression.
5713 */
5714 getOperatorToken(): ts.PrefixUnaryOperator;
5715 /**
5716 * Gets the operand of the prefix unary expression.
5717 */
5718 getOperand(): UnaryExpression;
5719}
5720
5721export declare class PrimaryExpression<T extends ts.PrimaryExpression = ts.PrimaryExpression> extends MemberExpression<T> {
5722}
5723
5724declare const PropertyAccessExpressionBase: Constructor<NamedNode> & Constructor<LeftHandSideExpressionedNode> & typeof MemberExpression;
5725
5726export declare class PropertyAccessExpression<T extends ts.PropertyAccessExpression = ts.PropertyAccessExpression> extends PropertyAccessExpressionBase<T> {
5727}
5728
5729declare const SpreadElementBase: Constructor<ExpressionedNode> & typeof Expression;
5730
5731export declare class SpreadElement extends SpreadElementBase<ts.SpreadElement> {
5732}
5733
5734declare const SuperElementAccessExpressionBase: Constructor<SuperExpressionedNode> & typeof ElementAccessExpression;
5735
5736export declare class SuperElementAccessExpression extends SuperElementAccessExpressionBase<ts.SuperElementAccessExpression> {
5737}
5738
5739declare const SuperExpressionBase: typeof PrimaryExpression;
5740
5741export declare class SuperExpression extends SuperExpressionBase<ts.SuperExpression> {
5742}
5743
5744declare const SuperPropertyAccessExpressionBase: Constructor<SuperExpressionedNode> & typeof PropertyAccessExpression;
5745
5746export declare class SuperPropertyAccessExpression extends SuperPropertyAccessExpressionBase<ts.SuperPropertyAccessExpression> {
5747}
5748
5749declare const ThisExpressionBase: typeof PrimaryExpression;
5750
5751export declare class ThisExpression extends ThisExpressionBase<ts.ThisExpression> {
5752}
5753
5754declare const TypeAssertionBase: Constructor<TypedNode> & Constructor<UnaryExpressionedNode> & typeof UnaryExpression;
5755
5756export declare class TypeAssertion extends TypeAssertionBase<ts.TypeAssertion> {
5757}
5758
5759declare const TypeOfExpressionBase: Constructor<UnaryExpressionedNode> & typeof UnaryExpression;
5760
5761export declare class TypeOfExpression extends TypeOfExpressionBase<ts.TypeOfExpression> {
5762}
5763
5764export declare class UnaryExpression<T extends ts.UnaryExpression = ts.UnaryExpression> extends Expression<T> {
5765}
5766
5767export declare class UpdateExpression<T extends ts.UpdateExpression = ts.UpdateExpression> extends UnaryExpression<T> {
5768}
5769
5770declare const VoidExpressionBase: Constructor<UnaryExpressionedNode> & typeof UnaryExpression;
5771
5772export declare class VoidExpression extends VoidExpressionBase<ts.VoidExpression> {
5773}
5774
5775declare const YieldExpressionBase: Constructor<GeneratorableNode> & typeof Expression;
5776
5777export declare class YieldExpression extends YieldExpressionBase<ts.YieldExpression> {
5778 /**
5779 * Gets the expression or undefined of the yield expression.
5780 */
5781 getExpression(): Expression | undefined;
5782 /**
5783 * Gets the expression of the yield expression or throws if it does not exist.
5784 */
5785 getExpressionOrThrow(): Expression<ts.Expression>;
5786}
5787
5788declare const ArrowFunctionBase: Constructor<TextInsertableNode> & Constructor<BodiedNode> & Constructor<AsyncableNode> & Constructor<FunctionLikeDeclaration> & typeof Expression;
5789
5790export declare class ArrowFunction extends ArrowFunctionBase<ts.ArrowFunction> {
5791 /**
5792 * Gets the equals greater than token of the arrow function.
5793 */
5794 getEqualsGreaterThan(): Node<ts.Token<SyntaxKind.EqualsGreaterThanToken>>;
5795}
5796
5797declare const FunctionDeclarationBase: Constructor<ChildOrderableNode> & Constructor<UnwrappableNode> & Constructor<TextInsertableNode> & Constructor<OverloadableNode> & Constructor<BodyableNode> & Constructor<AsyncableNode> & Constructor<GeneratorableNode> & Constructor<FunctionLikeDeclaration> & Constructor<StatementedNode> & Constructor<AmbientableNode> & Constructor<NamespaceChildableNode> & Constructor<ExportableNode> & Constructor<ModifierableNode> & Constructor<NameableNode> & typeof Node;
5798
5799declare const FunctionDeclarationOverloadBase: Constructor<ChildOrderableNode> & Constructor<UnwrappableNode> & Constructor<TextInsertableNode> & Constructor<AsyncableNode> & Constructor<GeneratorableNode> & Constructor<ModifierableNode> & Constructor<SignaturedDeclaration> & Constructor<StatementedNode> & Constructor<AmbientableNode> & Constructor<NamespaceChildableNode> & Constructor<JSDocableNode> & Constructor<TypeParameteredNode> & Constructor<ExportableNode> & typeof Node;
5800
5801export declare class FunctionDeclaration extends FunctionDeclarationBase<ts.FunctionDeclaration> {
5802 /**
5803 * Adds a function overload.
5804 * @param structure - Structure of the overload.
5805 */
5806 addOverload(structure: FunctionDeclarationOverloadStructure): FunctionDeclaration;
5807 /**
5808 * Adds function overloads.
5809 * @param structures - Structures of the overloads.
5810 */
5811 addOverloads(structures: ReadonlyArray<FunctionDeclarationOverloadStructure>): FunctionDeclaration[];
5812 /**
5813 * Inserts a function overload.
5814 * @param index - Child index to insert at.
5815 * @param structure - Structure of the overload.
5816 */
5817 insertOverload(index: number, structure: FunctionDeclarationOverloadStructure): FunctionDeclaration;
5818 /**
5819 * Inserts function overloads.
5820 * @param index - Child index to insert at.
5821 * @param structure - Structures of the overloads.
5822 */
5823 insertOverloads(index: number, structures: ReadonlyArray<FunctionDeclarationOverloadStructure>): FunctionDeclaration[];
5824 /**
5825 * Removes this function declaration.
5826 */
5827 remove(): void;
5828 /**
5829 * Sets the node from a structure.
5830 * @param structure - Structure to set the node with.
5831 */
5832 set(structure: Partial<FunctionDeclarationStructure>): this;
5833 /**
5834 * Gets the structure equivalent to this node.
5835 */
5836 getStructure(): FunctionDeclarationStructure | FunctionDeclarationOverloadStructure;
5837}
5838
5839declare const FunctionExpressionBase: Constructor<JSDocableNode> & Constructor<TextInsertableNode> & Constructor<BodiedNode> & Constructor<AsyncableNode> & Constructor<GeneratorableNode> & Constructor<StatementedNode> & Constructor<TypeParameteredNode> & Constructor<SignaturedDeclaration> & Constructor<ModifierableNode> & Constructor<NameableNode> & typeof PrimaryExpression;
5840
5841export declare class FunctionExpression extends FunctionExpressionBase<ts.FunctionExpression> {
5842}
5843
5844export declare function FunctionLikeDeclaration<T extends Constructor<FunctionLikeDeclarationExtensionType>>(Base: T): Constructor<FunctionLikeDeclaration> & T;
5845
5846export interface FunctionLikeDeclaration extends JSDocableNode, TypeParameteredNode, SignaturedDeclaration, StatementedNode, ModifierableNode {
5847}
5848
5849declare type FunctionLikeDeclarationExtensionType = Node<ts.FunctionLikeDeclaration>;
5850
5851export declare function OverloadableNode<T extends Constructor<OverloadableNodeExtensionType>>(Base: T): Constructor<OverloadableNode> & T;
5852
5853/**
5854 * Node that supports overloads.
5855 */
5856export interface OverloadableNode {
5857 /**
5858 * Gets all the overloads associated with this node.
5859 */
5860 getOverloads(): this[];
5861 /**
5862 * Gets the implementation or undefined if it doesn't exist.
5863 */
5864 getImplementation(): this | undefined;
5865 /**
5866 * Gets the implementation or throws if it doesn't exist.
5867 */
5868 getImplementationOrThrow(): this;
5869 /**
5870 * Gets if this is an overload.
5871 */
5872 isOverload(): boolean;
5873 /**
5874 * Gets if this is the implementation.
5875 */
5876 isImplementation(): boolean;
5877}
5878
5879declare type OverloadableNodeExtensionType = Node & BodyableNode;
5880
5881declare const ParameterDeclarationBase: Constructor<QuestionTokenableNode> & Constructor<DecoratableNode> & Constructor<ScopeableNode> & Constructor<ReadonlyableNode> & Constructor<ModifierableNode> & Constructor<TypedNode> & Constructor<InitializerExpressionableNode> & Constructor<DeclarationNamedNode> & typeof Node;
5882
5883export declare class ParameterDeclaration extends ParameterDeclarationBase<ts.ParameterDeclaration> {
5884 /**
5885 * Gets the dot dot dot token (...) if it exists, for a rest parameter.
5886 */
5887 getDotDotDotToken(): Node<ts.Token<SyntaxKind.DotDotDotToken>> | undefined;
5888 /**
5889 * Gets if it's a rest parameter.
5890 */
5891 isRestParameter(): boolean;
5892 /**
5893 * Gets if this is a property with a scope or readonly keyword (found in class constructors).
5894 */
5895 isParameterProperty(): boolean;
5896 /**
5897 * Sets if it's a rest parameter.
5898 * @param value - Sets if it's a rest parameter or not.
5899 */
5900 setIsRestParameter(value: boolean): this;
5901 /**
5902 * Gets if it's optional.
5903 */
5904 isOptional(): boolean;
5905 /**
5906 * Remove this parameter.
5907 */
5908 remove(): void;
5909 /**
5910 * Sets the node from a structure.
5911 * @param structure - Structure to set the node with.
5912 */
5913 set(structure: Partial<ParameterDeclarationStructure>): this;
5914 /**
5915 * Gets the structure equivalent to this node.
5916 */
5917 getStructure(): ParameterDeclarationStructure;
5918 /**
5919 * Sets if this node has a question token.
5920 * @param value - If it should have a question token or not.
5921 */
5922 setHasQuestionToken(value: boolean): this;
5923 /**
5924 * Sets the initializer.
5925 * @param text - Text or writer function to set for the initializer.
5926 */
5927 setInitializer(textOrWriterFunction: string | WriterFunction): this;
5928 /**
5929 * Sets the type.
5930 * @param textOrWriterFunction - Text or writer function to set the type with.
5931 */
5932 setType(textOrWriterFunction: string | WriterFunction): this;
5933}
5934
5935export declare class HeritageClause extends Node<ts.HeritageClause> {
5936 /**
5937 * Gets all the type nodes for the heritage clause.
5938 */
5939 getTypeNodes(): ExpressionWithTypeArguments[];
5940 /**
5941 * Gets the heritage clause token.
5942 */
5943 getToken(): SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword;
5944 /**
5945 * Remove the expression from the heritage clause.
5946 * @param index - Index of the expression to remove.
5947 */
5948 removeExpression(index: number): this;
5949 /**
5950 * Removes the expression from the heritage clause.
5951 * @param expressionNode - Expression to remove.
5952 */
5953 removeExpression(expressionNode: ExpressionWithTypeArguments): this;
5954}
5955
5956declare const CallSignatureDeclarationBase: Constructor<TypeParameteredNode> & Constructor<ChildOrderableNode> & Constructor<JSDocableNode> & Constructor<SignaturedDeclaration> & typeof TypeElement;
5957
5958export declare class CallSignatureDeclaration extends CallSignatureDeclarationBase<ts.CallSignatureDeclaration> {
5959 /**
5960 * Sets the node from a structure.
5961 * @param structure - Structure to set the node with.
5962 */
5963 set(structure: Partial<CallSignatureDeclarationStructure>): this;
5964 /**
5965 * Removes this call signature.
5966 */
5967 remove(): void;
5968 /**
5969 * Gets the structure equivalent to this node.
5970 */
5971 getStructure(): CallSignatureDeclarationStructure;
5972}
5973
5974declare const ConstructSignatureDeclarationBase: Constructor<TypeParameteredNode> & Constructor<ChildOrderableNode> & Constructor<JSDocableNode> & Constructor<SignaturedDeclaration> & typeof TypeElement;
5975
5976export declare class ConstructSignatureDeclaration extends ConstructSignatureDeclarationBase<ts.ConstructSignatureDeclaration> {
5977 /**
5978 * Sets the node from a structure.
5979 * @param structure - Structure to set the node with.
5980 */
5981 set(structure: Partial<ConstructSignatureDeclarationStructure>): this;
5982 /**
5983 * Removes this construct signature.
5984 */
5985 remove(): void;
5986 /**
5987 * Gets the structure equivalent to this node.
5988 */
5989 getStructure(): ConstructSignatureDeclarationStructure;
5990}
5991
5992declare const IndexSignatureDeclarationBase: Constructor<ReturnTypedNode> & Constructor<ChildOrderableNode> & Constructor<JSDocableNode> & Constructor<ReadonlyableNode> & Constructor<ModifierableNode> & typeof TypeElement;
5993
5994export declare class IndexSignatureDeclaration extends IndexSignatureDeclarationBase<ts.IndexSignatureDeclaration> {
5995 /**
5996 * Gets the key name.
5997 */
5998 getKeyName(): string;
5999 /**
6000 * Sets the key name.
6001 * @param name - New name.
6002 */
6003 setKeyName(name: string): void;
6004 /**
6005 * Gets the key name node.
6006 */
6007 getKeyNameNode(): BindingName;
6008 /**
6009 * Gets the key type.
6010 */
6011 getKeyType(): Type;
6012 /**
6013 * Sets the key type.
6014 * @param type - Type.
6015 */
6016 setKeyType(type: string): this;
6017 /**
6018 * Gets the key type node.
6019 */
6020 getKeyTypeNode(): TypeNode;
6021 /**
6022 * Removes this index signature.
6023 */
6024 remove(): void;
6025 /**
6026 * Sets the node from a structure.
6027 * @param structure - Structure to set the node with.
6028 */
6029 set(structure: Partial<IndexSignatureDeclarationStructure>): this;
6030 /**
6031 * Gets the structure equivalent to this node.
6032 */
6033 getStructure(): IndexSignatureDeclarationStructure;
6034}
6035
6036declare const InterfaceDeclarationBase: Constructor<TypeElementMemberedNode> & Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<ExtendsClauseableNode> & Constructor<HeritageClauseableNode> & Constructor<TypeParameteredNode> & Constructor<JSDocableNode> & Constructor<AmbientableNode> & Constructor<NamespaceChildableNode> & Constructor<ExportableNode> & Constructor<ModifierableNode> & Constructor<NamedNode> & typeof Statement;
6037
6038export declare class InterfaceDeclaration extends InterfaceDeclarationBase<ts.InterfaceDeclaration> {
6039 /**
6040 * Gets the base types.
6041 */
6042 getBaseTypes(): Type[];
6043 /**
6044 * Gets the base declarations.
6045 */
6046 getBaseDeclarations(): (TypeAliasDeclaration | InterfaceDeclaration | ClassDeclaration)[];
6047 /**
6048 * Gets all the implementations of the interface.
6049 *
6050 * This is similar to "go to implementation."
6051 */
6052 getImplementations(): ImplementationLocation[];
6053 /**
6054 * Sets the node from a structure.
6055 * @param structure - Structure to set the node with.
6056 */
6057 set(structure: Partial<InterfaceDeclarationStructure>): this;
6058 /**
6059 * Gets the structure equivalent to this node.
6060 */
6061 getStructure(): InterfaceDeclarationStructure;
6062}
6063
6064declare const MethodSignatureBase: Constructor<ChildOrderableNode> & Constructor<JSDocableNode> & Constructor<QuestionTokenableNode> & Constructor<TypeParameteredNode> & Constructor<SignaturedDeclaration> & Constructor<PropertyNamedNode> & typeof TypeElement;
6065
6066export declare class MethodSignature extends MethodSignatureBase<ts.MethodSignature> {
6067 /**
6068 * Removes this method signature.
6069 */
6070 remove(): void;
6071 /**
6072 * Sets the node from a structure.
6073 * @param structure - Structure to set the node with.
6074 */
6075 set(structure: Partial<MethodSignatureStructure>): this;
6076 /**
6077 * Gets the structure equivalent to this node.
6078 */
6079 getStructure(): MethodSignatureStructure;
6080}
6081
6082declare const PropertySignatureBase: Constructor<ChildOrderableNode> & Constructor<JSDocableNode> & Constructor<ReadonlyableNode> & Constructor<QuestionTokenableNode> & Constructor<InitializerExpressionableNode> & Constructor<TypedNode> & Constructor<PropertyNamedNode> & Constructor<ModifierableNode> & typeof TypeElement;
6083
6084export declare class PropertySignature extends PropertySignatureBase<ts.PropertySignature> {
6085 /**
6086 * Removes this property signature.
6087 */
6088 remove(): void;
6089 /**
6090 * Sets the node from a structure.
6091 * @param structure - Structure to set the node with.
6092 */
6093 set(structure: Partial<PropertySignatureStructure>): this;
6094 /**
6095 * Gets the structure equivalent to this node.
6096 */
6097 getStructure(): PropertySignatureStructure;
6098}
6099
6100export declare class TypeElement<TNode extends ts.TypeElement = ts.TypeElement> extends Node<TNode> {
6101}
6102
6103export declare function JsxAttributedNode<T extends Constructor<JsxAttributedNodeExtensionType>>(Base: T): Constructor<JsxAttributedNode> & T;
6104
6105export interface JsxAttributedNode {
6106 /**
6107 * Gets the JSX element's attributes.
6108 */
6109 getAttributes(): JsxAttributeLike[];
6110 /**
6111 * Gets an attribute by name or returns undefined when it can't be found.
6112 * @param name - Name to search for.
6113 */
6114 getAttribute(name: string): JsxAttributeLike | undefined;
6115 /**
6116 * Gets an attribute by a find function or returns undefined when it can't be found.
6117 * @param findFunction - Find function.
6118 */
6119 getAttribute(findFunction: (attribute: JsxAttributeLike) => boolean): JsxAttributeLike | undefined;
6120 /**
6121 * Gets an attribute by name or throws when it can't be found.
6122 * @param name - Name to search for.
6123 */
6124 getAttributeOrThrow(name: string): JsxAttributeLike;
6125 /**
6126 * Gets an attribute by a find function or throws when it can't be found.
6127 * @param findFunction - Find function.
6128 */
6129 getAttributeOrThrow(findFunction: (attribute: JsxAttributeLike) => boolean): JsxAttributeLike;
6130 /**
6131 * Adds an attribute into the element.
6132 */
6133 addAttribute(attribute: JsxAttributeStructure | JsxSpreadAttributeStructure): JsxAttributeLike;
6134 /**
6135 * Adds attributes into the element.
6136 */
6137 addAttributes(attributes: ReadonlyArray<JsxAttributeStructure | JsxSpreadAttributeStructure>): JsxAttributeLike[];
6138 /**
6139 * Inserts an attribute into the element.
6140 */
6141 insertAttribute(index: number, attribute: JsxAttributeStructure | JsxSpreadAttributeStructure): JsxAttributeLike;
6142 /**
6143 * Inserts attributes into the element.
6144 */
6145 insertAttributes(index: number, attributes: ReadonlyArray<JsxAttributeStructure | JsxSpreadAttributeStructure>): JsxAttributeLike[];
6146}
6147
6148declare type JsxAttributedNodeExtensionType = Node<ts.Node & {
6149 attributes: ts.JsxAttributes;
6150}> & JsxTagNamedNode;
6151
6152export declare function JsxTagNamedNode<T extends Constructor<JsxTagNamedNodeExtensionType>>(Base: T): Constructor<JsxTagNamedNode> & T;
6153
6154export interface JsxTagNamedNode {
6155 /**
6156 * Gets the tag name of the JSX closing element.
6157 */
6158 getTagNameNode(): JsxTagNameExpression;
6159}
6160
6161declare type JsxTagNamedNodeExtensionType = Node<ts.Node & {
6162 tagName: ts.JsxTagNameExpression;
6163}>;
6164
6165declare const JsxAttributeBase: Constructor<NamedNode> & typeof Node;
6166
6167export declare class JsxAttribute extends JsxAttributeBase<ts.JsxAttribute> {
6168 /**
6169 * Gets the JSX attribute's initializer or throws if it doesn't exist.
6170 */
6171 getInitializerOrThrow(): StringLiteral | JsxExpression;
6172 /**
6173 * Gets the JSX attribute's initializer or returns undefined if it doesn't exist.
6174 */
6175 getInitializer(): StringLiteral | JsxExpression | undefined;
6176 /**
6177 * Sets the initializer.
6178 * @param textOrWriterFunction - Text or writer function to set the initializer with.
6179 * @remarks You need to provide the quotes or braces.
6180 */
6181 setInitializer(textOrWriterFunction: string | WriterFunction): this;
6182 /**
6183 * Removes the initializer.
6184 */
6185 removeInitializer(): this;
6186 /**
6187 * Removes the JSX attribute.
6188 */
6189 remove(): void;
6190 /**
6191 * Sets the node from a structure.
6192 * @param structure - Structure to set the node with.
6193 */
6194 set(structure: Partial<JsxAttributeStructure>): this;
6195 /**
6196 * Gets the structure equivalent to this node.
6197 */
6198 getStructure(): JsxAttributeStructure;
6199}
6200
6201declare const JsxClosingElementBase: Constructor<JsxTagNamedNode> & typeof Node;
6202
6203export declare class JsxClosingElement extends JsxClosingElementBase<ts.JsxClosingElement> {
6204}
6205
6206export declare class JsxClosingFragment extends Expression<ts.JsxClosingFragment> {
6207}
6208
6209declare const JsxElementBase: typeof PrimaryExpression;
6210
6211export declare class JsxElement extends JsxElementBase<ts.JsxElement> {
6212 /**
6213 * Gets the children of the JSX element.
6214 */
6215 getJsxChildren(): JsxChild[];
6216 /**
6217 * Gets the opening element.
6218 */
6219 getOpeningElement(): JsxOpeningElement;
6220 /**
6221 * Gets the closing element.
6222 */
6223 getClosingElement(): JsxClosingElement;
6224 /**
6225 * Sets the body text.
6226 * @param textOrWriterFunction - Text or writer function to set as the body.
6227 */
6228 setBodyText(textOrWriterFunction: string | WriterFunction): this;
6229 /**
6230 * Sets the body text without surrounding new lines.
6231 * @param textOrWriterFunction - Text to set as the body.
6232 */
6233 setBodyTextInline(textOrWriterFunction: string | WriterFunction): this;
6234 /**
6235 * Sets the node from a structure.
6236 * @param structure - Structure to set the node with.
6237 */
6238 set(structure: Partial<JsxElementStructure>): this;
6239 /**
6240 * Gets the structure equivalent to this node.
6241 */
6242 getStructure(): JsxElementStructure;
6243}
6244
6245export declare class JsxExpression extends Expression<ts.JsxExpression> {
6246 /**
6247 * Gets the dot dot dot token (...) or throws if it doesn't exist.
6248 */
6249 getDotDotDotTokenOrThrow(): Node<ts.Token<SyntaxKind.DotDotDotToken>>;
6250 /**
6251 * Gets the dot dot dot token (...) or returns undefined if it doesn't exist.
6252 */
6253 getDotDotDotToken(): Node<ts.Token<SyntaxKind.DotDotDotToken>> | undefined;
6254 /**
6255 * Gets the expression or throws if it doesn't exist.
6256 */
6257 getExpressionOrThrow(): Expression<ts.Expression>;
6258 /**
6259 * Gets the expression or returns undefined if it doesn't exist
6260 */
6261 getExpression(): Expression | undefined;
6262}
6263
6264export declare class JsxFragment extends PrimaryExpression<ts.JsxFragment> {
6265 /**
6266 * Gets the children of the JSX fragment.
6267 */
6268 getJsxChildren(): JsxChild[];
6269 /**
6270 * Gets the opening fragment.
6271 */
6272 getOpeningFragment(): JsxOpeningFragment;
6273 /**
6274 * Gets the closing fragment.
6275 */
6276 getClosingFragment(): JsxClosingFragment;
6277}
6278
6279declare const JsxOpeningElementBase: Constructor<JsxAttributedNode> & Constructor<JsxTagNamedNode> & typeof Expression;
6280
6281export declare class JsxOpeningElement extends JsxOpeningElementBase<ts.JsxOpeningElement> {
6282}
6283
6284export declare class JsxOpeningFragment extends Expression<ts.JsxOpeningFragment> {
6285}
6286
6287declare const JsxSelfClosingElementBase: Constructor<JsxAttributedNode> & Constructor<JsxTagNamedNode> & typeof PrimaryExpression;
6288
6289export declare class JsxSelfClosingElement extends JsxSelfClosingElementBase<ts.JsxSelfClosingElement> {
6290 /**
6291 * Sets the node from a structure.
6292 * @param structure - Structure to set the node with.
6293 */
6294 set(structure: Partial<JsxElementStructure>): this;
6295 /**
6296 * Gets the structure equivalent to this node.
6297 */
6298 getStructure(): JsxElementStructure;
6299}
6300
6301declare const JsxSpreadAttributeBase: typeof Node;
6302
6303export declare class JsxSpreadAttribute extends JsxSpreadAttributeBase<ts.JsxSpreadAttribute> {
6304 /**
6305 * Gets the JSX spread attribute's expression.
6306 */
6307 getExpression(): Expression<ts.Expression>;
6308 /**
6309 * Sets the expression.
6310 * @param textOrWriterFunction - Text to set the expression with.
6311 */
6312 setExpression(textOrWriterFunction: string | WriterFunction): this;
6313 /**
6314 * Removes the JSX spread attribute.
6315 */
6316 remove(): void;
6317 /**
6318 * Sets the node from a structure.
6319 * @param structure - Structure to set the node with.
6320 */
6321 set(structure: Partial<JsxSpreadAttributeStructure>): this;
6322 /**
6323 * Gets the structure equivalent to this node.
6324 */
6325 getStructure(): JsxSpreadAttributeStructure;
6326}
6327
6328export declare class JsxText extends Node<ts.JsxText> {
6329 /**
6330 * Gets if the JSX text contains only white spaces.
6331 */
6332 containsOnlyWhiteSpaces(): boolean;
6333}
6334
6335export interface ImplementedKindToNodeMappings {
6336 [SyntaxKind.SourceFile]: SourceFile;
6337 [SyntaxKind.ArrayBindingPattern]: ArrayBindingPattern;
6338 [SyntaxKind.ArrayLiteralExpression]: ArrayLiteralExpression;
6339 [SyntaxKind.ArrayType]: ArrayTypeNode;
6340 [SyntaxKind.ArrowFunction]: ArrowFunction;
6341 [SyntaxKind.AsExpression]: AsExpression;
6342 [SyntaxKind.AwaitExpression]: AwaitExpression;
6343 [SyntaxKind.BindingElement]: BindingElement;
6344 [SyntaxKind.BinaryExpression]: BinaryExpression;
6345 [SyntaxKind.Block]: Block;
6346 [SyntaxKind.BreakStatement]: BreakStatement;
6347 [SyntaxKind.CallExpression]: CallExpression;
6348 [SyntaxKind.CallSignature]: CallSignatureDeclaration;
6349 [SyntaxKind.CaseBlock]: CaseBlock;
6350 [SyntaxKind.CaseClause]: CaseClause;
6351 [SyntaxKind.CatchClause]: CatchClause;
6352 [SyntaxKind.ClassDeclaration]: ClassDeclaration;
6353 [SyntaxKind.ClassExpression]: ClassExpression;
6354 [SyntaxKind.Constructor]: ConstructorDeclaration;
6355 [SyntaxKind.ConstructorType]: ConstructorTypeNode;
6356 [SyntaxKind.ConstructSignature]: ConstructSignatureDeclaration;
6357 [SyntaxKind.ContinueStatement]: ContinueStatement;
6358 [SyntaxKind.CommaListExpression]: CommaListExpression;
6359 [SyntaxKind.ComputedPropertyName]: ComputedPropertyName;
6360 [SyntaxKind.ConditionalExpression]: ConditionalExpression;
6361 [SyntaxKind.DebuggerStatement]: DebuggerStatement;
6362 [SyntaxKind.Decorator]: Decorator;
6363 [SyntaxKind.DefaultClause]: DefaultClause;
6364 [SyntaxKind.DeleteExpression]: DeleteExpression;
6365 [SyntaxKind.DoStatement]: DoStatement;
6366 [SyntaxKind.ElementAccessExpression]: ElementAccessExpression;
6367 [SyntaxKind.EmptyStatement]: EmptyStatement;
6368 [SyntaxKind.EnumDeclaration]: EnumDeclaration;
6369 [SyntaxKind.EnumMember]: EnumMember;
6370 [SyntaxKind.ExportAssignment]: ExportAssignment;
6371 [SyntaxKind.ExportDeclaration]: ExportDeclaration;
6372 [SyntaxKind.ExportSpecifier]: ExportSpecifier;
6373 [SyntaxKind.ExpressionWithTypeArguments]: ExpressionWithTypeArguments;
6374 [SyntaxKind.ExpressionStatement]: ExpressionStatement;
6375 [SyntaxKind.ExternalModuleReference]: ExternalModuleReference;
6376 [SyntaxKind.QualifiedName]: QualifiedName;
6377 [SyntaxKind.FirstNode]: QualifiedName;
6378 [SyntaxKind.ForInStatement]: ForInStatement;
6379 [SyntaxKind.ForOfStatement]: ForOfStatement;
6380 [SyntaxKind.ForStatement]: ForStatement;
6381 [SyntaxKind.FunctionDeclaration]: FunctionDeclaration;
6382 [SyntaxKind.FunctionExpression]: FunctionExpression;
6383 [SyntaxKind.FunctionType]: FunctionTypeNode;
6384 [SyntaxKind.GetAccessor]: GetAccessorDeclaration;
6385 [SyntaxKind.HeritageClause]: HeritageClause;
6386 [SyntaxKind.Identifier]: Identifier;
6387 [SyntaxKind.IfStatement]: IfStatement;
6388 [SyntaxKind.ImportClause]: ImportClause;
6389 [SyntaxKind.ImportDeclaration]: ImportDeclaration;
6390 [SyntaxKind.ImportEqualsDeclaration]: ImportEqualsDeclaration;
6391 [SyntaxKind.ImportSpecifier]: ImportSpecifier;
6392 [SyntaxKind.ImportType]: ImportTypeNode;
6393 [SyntaxKind.LastTypeNode]: ImportTypeNode;
6394 [SyntaxKind.IndexSignature]: IndexSignatureDeclaration;
6395 [SyntaxKind.InterfaceDeclaration]: InterfaceDeclaration;
6396 [SyntaxKind.IntersectionType]: IntersectionTypeNode;
6397 [SyntaxKind.JSDocTag]: JSDocUnknownTag;
6398 [SyntaxKind.FirstJSDocTagNode]: JSDocUnknownTag;
6399 [SyntaxKind.JSDocAugmentsTag]: JSDocAugmentsTag;
6400 [SyntaxKind.JSDocClassTag]: JSDocClassTag;
6401 [SyntaxKind.JSDocReturnTag]: JSDocReturnTag;
6402 [SyntaxKind.JSDocTypeTag]: JSDocTypeTag;
6403 [SyntaxKind.JSDocTypedefTag]: JSDocTypedefTag;
6404 [SyntaxKind.JSDocParameterTag]: JSDocParameterTag;
6405 [SyntaxKind.JSDocPropertyTag]: JSDocPropertyTag;
6406 [SyntaxKind.LastJSDocNode]: JSDocPropertyTag;
6407 [SyntaxKind.LastJSDocTagNode]: JSDocPropertyTag;
6408 [SyntaxKind.JsxAttribute]: JsxAttribute;
6409 [SyntaxKind.JsxClosingElement]: JsxClosingElement;
6410 [SyntaxKind.JsxClosingFragment]: JsxClosingFragment;
6411 [SyntaxKind.JsxElement]: JsxElement;
6412 [SyntaxKind.JsxExpression]: JsxExpression;
6413 [SyntaxKind.JsxFragment]: JsxFragment;
6414 [SyntaxKind.JsxOpeningElement]: JsxOpeningElement;
6415 [SyntaxKind.JsxOpeningFragment]: JsxOpeningFragment;
6416 [SyntaxKind.JsxSelfClosingElement]: JsxSelfClosingElement;
6417 [SyntaxKind.JsxSpreadAttribute]: JsxSpreadAttribute;
6418 [SyntaxKind.JsxText]: JsxText;
6419 [SyntaxKind.LabeledStatement]: LabeledStatement;
6420 [SyntaxKind.LiteralType]: LiteralTypeNode;
6421 [SyntaxKind.MetaProperty]: MetaProperty;
6422 [SyntaxKind.MethodDeclaration]: MethodDeclaration;
6423 [SyntaxKind.MethodSignature]: MethodSignature;
6424 [SyntaxKind.ModuleBlock]: ModuleBlock;
6425 [SyntaxKind.ModuleDeclaration]: NamespaceDeclaration;
6426 [SyntaxKind.NamedExports]: NamedExports;
6427 [SyntaxKind.NamedImports]: NamedImports;
6428 [SyntaxKind.NamespaceImport]: NamespaceImport;
6429 [SyntaxKind.NewExpression]: NewExpression;
6430 [SyntaxKind.NonNullExpression]: NonNullExpression;
6431 [SyntaxKind.NotEmittedStatement]: NotEmittedStatement;
6432 [SyntaxKind.NoSubstitutionTemplateLiteral]: NoSubstitutionTemplateLiteral;
6433 [SyntaxKind.LastLiteralToken]: NoSubstitutionTemplateLiteral;
6434 [SyntaxKind.FirstTemplateToken]: NoSubstitutionTemplateLiteral;
6435 [SyntaxKind.NumericLiteral]: NumericLiteral;
6436 [SyntaxKind.FirstLiteralToken]: NumericLiteral;
6437 [SyntaxKind.ObjectBindingPattern]: ObjectBindingPattern;
6438 [SyntaxKind.ObjectLiteralExpression]: ObjectLiteralExpression;
6439 [SyntaxKind.OmittedExpression]: OmittedExpression;
6440 [SyntaxKind.Parameter]: ParameterDeclaration;
6441 [SyntaxKind.ParenthesizedExpression]: ParenthesizedExpression;
6442 [SyntaxKind.ParenthesizedType]: ParenthesizedTypeNode;
6443 [SyntaxKind.PartiallyEmittedExpression]: PartiallyEmittedExpression;
6444 [SyntaxKind.PostfixUnaryExpression]: PostfixUnaryExpression;
6445 [SyntaxKind.PrefixUnaryExpression]: PrefixUnaryExpression;
6446 [SyntaxKind.PropertyAccessExpression]: PropertyAccessExpression;
6447 [SyntaxKind.PropertyAssignment]: PropertyAssignment;
6448 [SyntaxKind.PropertyDeclaration]: PropertyDeclaration;
6449 [SyntaxKind.PropertySignature]: PropertySignature;
6450 [SyntaxKind.RegularExpressionLiteral]: RegularExpressionLiteral;
6451 [SyntaxKind.ReturnStatement]: ReturnStatement;
6452 [SyntaxKind.SetAccessor]: SetAccessorDeclaration;
6453 [SyntaxKind.ShorthandPropertyAssignment]: ShorthandPropertyAssignment;
6454 [SyntaxKind.SpreadAssignment]: SpreadAssignment;
6455 [SyntaxKind.SpreadElement]: SpreadElement;
6456 [SyntaxKind.StringLiteral]: StringLiteral;
6457 [SyntaxKind.SwitchStatement]: SwitchStatement;
6458 [SyntaxKind.SyntaxList]: SyntaxList;
6459 [SyntaxKind.TaggedTemplateExpression]: TaggedTemplateExpression;
6460 [SyntaxKind.TemplateExpression]: TemplateExpression;
6461 [SyntaxKind.TemplateHead]: TemplateHead;
6462 [SyntaxKind.TemplateMiddle]: TemplateMiddle;
6463 [SyntaxKind.TemplateSpan]: TemplateSpan;
6464 [SyntaxKind.TemplateTail]: TemplateTail;
6465 [SyntaxKind.LastTemplateToken]: TemplateTail;
6466 [SyntaxKind.ThrowStatement]: ThrowStatement;
6467 [SyntaxKind.TryStatement]: TryStatement;
6468 [SyntaxKind.TupleType]: TupleTypeNode;
6469 [SyntaxKind.TypeAliasDeclaration]: TypeAliasDeclaration;
6470 [SyntaxKind.TypeAssertionExpression]: TypeAssertion;
6471 [SyntaxKind.TypeLiteral]: TypeLiteralNode;
6472 [SyntaxKind.TypeParameter]: TypeParameterDeclaration;
6473 [SyntaxKind.TypeReference]: TypeReferenceNode;
6474 [SyntaxKind.UnionType]: UnionTypeNode;
6475 [SyntaxKind.VariableDeclaration]: VariableDeclaration;
6476 [SyntaxKind.VariableDeclarationList]: VariableDeclarationList;
6477 [SyntaxKind.VariableStatement]: VariableStatement;
6478 [SyntaxKind.JSDocComment]: JSDoc;
6479 [SyntaxKind.TypePredicate]: TypeNode;
6480 [SyntaxKind.FirstTypeNode]: TypeNode;
6481 [SyntaxKind.SemicolonToken]: Node;
6482 [SyntaxKind.TypeOfExpression]: TypeOfExpression;
6483 [SyntaxKind.WhileStatement]: WhileStatement;
6484 [SyntaxKind.WithStatement]: WithStatement;
6485 [SyntaxKind.YieldExpression]: YieldExpression;
6486 [SyntaxKind.AnyKeyword]: Expression;
6487 [SyntaxKind.BooleanKeyword]: Expression;
6488 [SyntaxKind.NeverKeyword]: Expression;
6489 [SyntaxKind.NumberKeyword]: Expression;
6490 [SyntaxKind.ObjectKeyword]: Expression;
6491 [SyntaxKind.StringKeyword]: Expression;
6492 [SyntaxKind.SymbolKeyword]: Expression;
6493 [SyntaxKind.UndefinedKeyword]: Expression;
6494 [SyntaxKind.FalseKeyword]: BooleanLiteral;
6495 [SyntaxKind.TrueKeyword]: BooleanLiteral;
6496 [SyntaxKind.ImportKeyword]: ImportExpression;
6497 [SyntaxKind.NullKeyword]: NullLiteral;
6498 [SyntaxKind.SuperKeyword]: SuperExpression;
6499 [SyntaxKind.ThisKeyword]: ThisExpression;
6500 [SyntaxKind.VoidExpression]: VoidExpression;
6501}
6502
6503export interface KindToNodeMappings extends ImplementedKindToNodeMappings {
6504 [kind: number]: Node;
6505}
6506
6507export interface KindToExpressionMappings {
6508 [kind: number]: Node;
6509 [SyntaxKind.ArrayLiteralExpression]: ArrayLiteralExpression;
6510 [SyntaxKind.ArrowFunction]: ArrowFunction;
6511 [SyntaxKind.AsExpression]: AsExpression;
6512 [SyntaxKind.AwaitExpression]: AwaitExpression;
6513 [SyntaxKind.BinaryExpression]: BinaryExpression;
6514 [SyntaxKind.CallExpression]: CallExpression;
6515 [SyntaxKind.ClassExpression]: ClassExpression;
6516 [SyntaxKind.CommaListExpression]: CommaListExpression;
6517 [SyntaxKind.ConditionalExpression]: ConditionalExpression;
6518 [SyntaxKind.DeleteExpression]: DeleteExpression;
6519 [SyntaxKind.ElementAccessExpression]: ElementAccessExpression;
6520 [SyntaxKind.FunctionExpression]: FunctionExpression;
6521 [SyntaxKind.Identifier]: Identifier;
6522 [SyntaxKind.JsxClosingFragment]: JsxClosingFragment;
6523 [SyntaxKind.JsxElement]: JsxElement;
6524 [SyntaxKind.JsxExpression]: JsxExpression;
6525 [SyntaxKind.JsxFragment]: JsxFragment;
6526 [SyntaxKind.JsxOpeningElement]: JsxOpeningElement;
6527 [SyntaxKind.JsxOpeningFragment]: JsxOpeningFragment;
6528 [SyntaxKind.JsxSelfClosingElement]: JsxSelfClosingElement;
6529 [SyntaxKind.MetaProperty]: MetaProperty;
6530 [SyntaxKind.NewExpression]: NewExpression;
6531 [SyntaxKind.NonNullExpression]: NonNullExpression;
6532 [SyntaxKind.NoSubstitutionTemplateLiteral]: NoSubstitutionTemplateLiteral;
6533 [SyntaxKind.LastLiteralToken]: NoSubstitutionTemplateLiteral;
6534 [SyntaxKind.FirstTemplateToken]: NoSubstitutionTemplateLiteral;
6535 [SyntaxKind.NumericLiteral]: NumericLiteral;
6536 [SyntaxKind.FirstLiteralToken]: NumericLiteral;
6537 [SyntaxKind.ObjectLiteralExpression]: ObjectLiteralExpression;
6538 [SyntaxKind.OmittedExpression]: OmittedExpression;
6539 [SyntaxKind.ParenthesizedExpression]: ParenthesizedExpression;
6540 [SyntaxKind.PartiallyEmittedExpression]: PartiallyEmittedExpression;
6541 [SyntaxKind.PostfixUnaryExpression]: PostfixUnaryExpression;
6542 [SyntaxKind.PrefixUnaryExpression]: PrefixUnaryExpression;
6543 [SyntaxKind.PropertyAccessExpression]: PropertyAccessExpression;
6544 [SyntaxKind.RegularExpressionLiteral]: RegularExpressionLiteral;
6545 [SyntaxKind.SpreadElement]: SpreadElement;
6546 [SyntaxKind.StringLiteral]: StringLiteral;
6547 [SyntaxKind.TaggedTemplateExpression]: TaggedTemplateExpression;
6548 [SyntaxKind.TemplateExpression]: TemplateExpression;
6549 [SyntaxKind.TypeAssertionExpression]: TypeAssertion;
6550 [SyntaxKind.TypeOfExpression]: TypeOfExpression;
6551 [SyntaxKind.YieldExpression]: YieldExpression;
6552 [SyntaxKind.AnyKeyword]: Expression;
6553 [SyntaxKind.BooleanKeyword]: Expression;
6554 [SyntaxKind.NeverKeyword]: Expression;
6555 [SyntaxKind.NumberKeyword]: Expression;
6556 [SyntaxKind.ObjectKeyword]: Expression;
6557 [SyntaxKind.StringKeyword]: Expression;
6558 [SyntaxKind.SymbolKeyword]: Expression;
6559 [SyntaxKind.UndefinedKeyword]: Expression;
6560 [SyntaxKind.FalseKeyword]: BooleanLiteral;
6561 [SyntaxKind.TrueKeyword]: BooleanLiteral;
6562 [SyntaxKind.ImportKeyword]: ImportExpression;
6563 [SyntaxKind.NullKeyword]: NullLiteral;
6564 [SyntaxKind.SuperKeyword]: SuperExpression;
6565 [SyntaxKind.ThisKeyword]: ThisExpression;
6566 [SyntaxKind.VoidExpression]: VoidExpression;
6567}
6568
6569declare const BooleanLiteralBase: typeof PrimaryExpression;
6570
6571export declare class BooleanLiteral extends BooleanLiteralBase<ts.BooleanLiteral> {
6572 /**
6573 * Gets the literal value.
6574 */
6575 getLiteralValue(): boolean;
6576 /**
6577 * Sets the literal value.
6578 *
6579 * Note: For the time being, this forgets the current node and returns the new node.
6580 * @param value - Value to set.
6581 */
6582 setLiteralValue(value: boolean): BooleanLiteral;
6583}
6584
6585declare const NullLiteralBase: typeof PrimaryExpression;
6586
6587export declare class NullLiteral extends NullLiteralBase<ts.NullLiteral> {
6588}
6589
6590declare const NumericLiteralBase: typeof LiteralExpression;
6591
6592export declare class NumericLiteral extends NumericLiteralBase<ts.NumericLiteral> {
6593 /**
6594 * Gets the literal value.
6595 */
6596 getLiteralValue(): number;
6597 /**
6598 * Sets the literal value.
6599 * @param value - Value to set.
6600 */
6601 setLiteralValue(value: number): this;
6602}
6603/** Quote type for a string literal. */
6604export declare enum QuoteKind {
6605 /** Single quote */
6606 Single = "'",
6607 /** Double quote */
6608 Double = "\""
6609}
6610
6611declare const RegularExpressionLiteralBase: typeof LiteralExpression;
6612
6613export declare class RegularExpressionLiteral extends RegularExpressionLiteralBase<ts.RegularExpressionLiteral> {
6614 /**
6615 * Gets the literal value.
6616 */
6617 getLiteralValue(): RegExp;
6618 /**
6619 * Sets the literal value according to a pattern and some flags.
6620 * @param pattern - Pattern.
6621 * @param flags - Flags.
6622 */
6623 setLiteralValue(pattern: string, flags?: string): this;
6624 /**
6625 * Sets the literal value according to a regular expression object.
6626 * @param regExp - Regular expression.
6627 */
6628 setLiteralValue(regExp: RegExp): this;
6629}
6630
6631declare const StringLiteralBase: typeof LiteralExpression;
6632
6633export declare class StringLiteral extends StringLiteralBase<ts.StringLiteral> {
6634 /**
6635 * Gets the literal value.
6636 *
6637 * This is equivalent to .getLiteralText() for string literals and only exists for consistency with other literals.
6638 */
6639 getLiteralValue(): string;
6640 /**
6641 * Sets the literal value.
6642 * @param value - Value to set.
6643 */
6644 setLiteralValue(value: string): this;
6645 /**
6646 * Gets the quote kind.
6647 */
6648 getQuoteKind(): QuoteKind;
6649}
6650
6651declare const NoSubstitutionTemplateLiteralBase: typeof LiteralExpression;
6652
6653export declare class NoSubstitutionTemplateLiteral extends NoSubstitutionTemplateLiteralBase<ts.NoSubstitutionTemplateLiteral> {
6654 /**
6655 * Gets the literal value.
6656 */
6657 getLiteralValue(): string;
6658 /**
6659 * Sets the literal value.
6660 *
6661 * Note: This could possibly replace the node if you add a tagged template.
6662 * @param value - Value to set.
6663 * @returns The new node if the kind changed; the current node otherwise.
6664 */
6665 setLiteralValue(value: string): TemplateLiteral;
6666}
6667
6668export declare class TaggedTemplateExpression extends MemberExpression<ts.TaggedTemplateExpression> {
6669 /**
6670 * Gets the tag.
6671 */
6672 getTag(): LeftHandSideExpression;
6673 /**
6674 * Gets the template literal.
6675 */
6676 getTemplate(): TemplateLiteral;
6677 /**
6678 * Removes the tag from the tagged template.
6679 * @returns The new template expression.
6680 */
6681 removeTag(): TemplateLiteral;
6682}
6683
6684declare const TemplateExpressionBase: typeof PrimaryExpression;
6685
6686export declare class TemplateExpression extends TemplateExpressionBase<ts.TemplateExpression> {
6687 /**
6688 * Gets the template head.
6689 */
6690 getHead(): TemplateHead;
6691 /**
6692 * Gets the template spans.
6693 */
6694 getTemplateSpans(): TemplateSpan[];
6695 /**
6696 * Sets the literal value.
6697 *
6698 * Note: This could possibly replace the node if you remove all the tagged templates.
6699 * @param value - Value to set.
6700 * @returns The new node if the kind changed; the current node otherwise.
6701 */
6702 setLiteralValue(value: string): TemplateLiteral;
6703}
6704
6705declare const TemplateHeadBase: Constructor<LiteralLikeNode> & typeof Node;
6706
6707export declare class TemplateHead extends TemplateHeadBase<ts.TemplateHead> {
6708}
6709
6710declare const TemplateMiddleBase: Constructor<LiteralLikeNode> & typeof Node;
6711
6712export declare class TemplateMiddle extends TemplateMiddleBase<ts.TemplateMiddle> {
6713}
6714
6715declare const TemplateSpanBase: Constructor<ExpressionedNode> & typeof Node;
6716
6717export declare class TemplateSpan extends TemplateSpanBase<ts.TemplateSpan> {
6718 /**
6719 * Gets the template literal.
6720 */
6721 getLiteral(): TemplateMiddle | TemplateTail;
6722}
6723
6724declare const TemplateTailBase: Constructor<LiteralLikeNode> & typeof Node;
6725
6726export declare class TemplateTail extends TemplateTailBase<ts.TemplateTail> {
6727}
6728
6729declare const ExportAssignmentBase: typeof Statement;
6730
6731export declare class ExportAssignment extends ExportAssignmentBase<ts.ExportAssignment> {
6732 /**
6733 * Gets if this is an export equals assignment.
6734 *
6735 * If this is false, then it's `export default`.
6736 */
6737 isExportEquals(): boolean;
6738 /**
6739 * Sets if this is an export equals assignment or export default.
6740 * @param value - Whether it should be an export equals assignment.
6741 */
6742 setIsExportEquals(value: boolean): this;
6743 /**
6744 * Gets the export assignment expression.
6745 */
6746 getExpression(): Expression;
6747 /**
6748 * Sets the expression of the export assignment.
6749 * @param textOrWriterFunction - Text or writer function to set as the export assignment expression.
6750 */
6751 setExpression(textOrWriterFunction: string | WriterFunction): this;
6752 /**
6753 * Sets the node from a structure.
6754 * @param structure - Structure to set the node with.
6755 */
6756 set(structure: Partial<ExportAssignmentStructure>): this;
6757 /**
6758 * Gets the structure equivalent to this node.
6759 */
6760 getStructure(): ExportAssignmentStructure;
6761}
6762
6763declare const ExportDeclarationBase: typeof Statement;
6764
6765export declare class ExportDeclaration extends ExportDeclarationBase<ts.ExportDeclaration> {
6766 /**
6767 * Sets the import specifier.
6768 * @param text - Text to set as the module specifier.
6769 */
6770 setModuleSpecifier(text: string): this;
6771 /**
6772 * Sets the import specifier.
6773 * @param sourceFile - Source file to set the module specifier from.
6774 */
6775 setModuleSpecifier(sourceFile: SourceFile): this;
6776 /**
6777 * Gets the module specifier or undefined if it doesn't exist.
6778 */
6779 getModuleSpecifier(): StringLiteral | undefined;
6780 /**
6781 * Gets the module specifier value or undefined if it doesn't exist.
6782 */
6783 getModuleSpecifierValue(): string | undefined;
6784 /**
6785 * Gets the source file referenced in the module specifier or throws if it can't find it or it doesn't exist.
6786 */
6787 getModuleSpecifierSourceFileOrThrow(): SourceFile;
6788 /**
6789 * Gets the source file referenced in the module specifier.
6790 */
6791 getModuleSpecifierSourceFile(): SourceFile | undefined;
6792 /**
6793 * Gets if the module specifier starts with `./` or `../`.
6794 */
6795 isModuleSpecifierRelative(): boolean;
6796 /**
6797 * Removes the module specifier.
6798 */
6799 removeModuleSpecifier(): this;
6800 /**
6801 * Gets if the module specifier exists
6802 */
6803 hasModuleSpecifier(): boolean;
6804 /**
6805 * Gets if this export declaration is a namespace export.
6806 */
6807 isNamespaceExport(): boolean;
6808 /**
6809 * Gets if the export declaration has named exports.
6810 */
6811 hasNamedExports(): boolean;
6812 /**
6813 * Adds a named export.
6814 * @param namedExport - Structure, name, or writer function to write the named export.
6815 */
6816 addNamedExport(namedExport: ExportSpecifierStructure | string | WriterFunction): ExportSpecifier;
6817 /**
6818 * Adds named exports.
6819 * @param namedExports - Structures, names, or writer function to write the named exports.
6820 */
6821 addNamedExports(namedExports: ReadonlyArray<ExportSpecifierStructure | string | WriterFunction> | WriterFunction): ExportSpecifier[];
6822 /**
6823 * Inserts a named export.
6824 * @param index - Child index to insert at.
6825 * @param namedExport - Structure, name, or writer function to write the named export.
6826 */
6827 insertNamedExport(index: number, namedExport: ExportSpecifierStructure | string | WriterFunction): ExportSpecifier;
6828 /**
6829 * Inserts named exports into the export declaration.
6830 * @param index - Child index to insert at.
6831 * @param namedExports - Structures, names, or writer funciton to write the named exports.
6832 */
6833 insertNamedExports(index: number, namedExports: ReadonlyArray<ExportSpecifierStructure | string | WriterFunction> | WriterFunction): ExportSpecifier[];
6834 /**
6835 * Gets the named exports.
6836 */
6837 getNamedExports(): ExportSpecifier[];
6838 /**
6839 * Changes the export declaration to namespace export. Removes all the named exports.
6840 */
6841 toNamespaceExport(): this;
6842 /**
6843 * Sets the node from a structure.
6844 * @param structure - Structure to set the node with.
6845 */
6846 set(structure: Partial<ExportDeclarationStructure>): this;
6847 /**
6848 * Gets the structure equivalent to this node.
6849 */
6850 getStructure(): ExportDeclarationStructure;
6851}
6852
6853declare const ExportSpecifierBase: typeof Node;
6854
6855export declare class ExportSpecifier extends ExportSpecifierBase<ts.ExportSpecifier> {
6856 /**
6857 * Sets the name of what's being exported.
6858 */
6859 setName(name: string): this;
6860 /**
6861 * Gets the name of the export specifier.
6862 */
6863 getName(): string;
6864 /**
6865 * Gets the name node of what's being exported.
6866 */
6867 getNameNode(): Identifier;
6868 /**
6869 * Sets the alias for the name being exported and renames all the usages.
6870 * @param alias - Alias to set.
6871 */
6872 renameAlias(alias: string): this;
6873 /**
6874 * Sets the alias without renaming all the usages.
6875 * @param alias - Alias to set.
6876 */
6877 setAlias(alias: string): this;
6878 /**
6879 * Removes the alias without renaming.
6880 * @remarks Use removeAliasWithRename() if you want it to rename any usages to the name of the export specifier.
6881 */
6882 removeAlias(): this;
6883 /**
6884 * Removes the alias and renames any usages to the name of the export specifier.
6885 */
6886 removeAliasWithRename(): this;
6887 /**
6888 * Gets the alias identifier, if it exists.
6889 */
6890 getAliasNode(): Identifier | undefined;
6891 /**
6892 * Gets the export declaration associated with this export specifier.
6893 */
6894 getExportDeclaration(): ExportDeclaration;
6895 /**
6896 * Gets the local target symbol of the export specifier or throws if it doesn't exist.
6897 */
6898 getLocalTargetSymbolOrThrow(): Symbol;
6899 /**
6900 * Gets the local target symbol of the export specifier or undefined if it doesn't exist.
6901 */
6902 getLocalTargetSymbol(): Symbol | undefined;
6903 /**
6904 * Gets all the declarations referenced by the export specifier.
6905 */
6906 getLocalTargetDeclarations(): Node[];
6907 /**
6908 * Removes the export specifier.
6909 */
6910 remove(): void;
6911 /**
6912 * Sets the node from a structure.
6913 * @param structure - Structure to set the node with.
6914 */
6915 set(structure: Partial<ExportSpecifierStructure>): this;
6916 /**
6917 * Gets the structure equivalent to this node.
6918 */
6919 getStructure(): ExportSpecifierStructure;
6920}
6921
6922export declare class ExternalModuleReference extends Node<ts.ExternalModuleReference> {
6923 /**
6924 * Gets the expression or undefined of the yield expression.
6925 */
6926 getExpression(): Expression | undefined;
6927 /**
6928 * Gets the expression of the yield expression or throws if it does not exist.
6929 */
6930 getExpressionOrThrow(): Expression<ts.Expression>;
6931 /**
6932 * Gets the source file referenced or throws if it can't find it.
6933 */
6934 getReferencedSourceFileOrThrow(): SourceFile;
6935 /**
6936 * Gets if the external module reference is relative.
6937 */
6938 isRelative(): boolean;
6939 /**
6940 * Gets the source file referenced or returns undefined if it can't find it.
6941 */
6942 getReferencedSourceFile(): SourceFile | undefined;
6943}
6944/**
6945 * Result of refreshing a source file from the file system.
6946 */
6947export declare enum FileSystemRefreshResult {
6948 /** The source file did not change. */
6949 NoChange = 0,
6950 /** The source file was updated from the file system. */
6951 Updated = 1,
6952 /** The source file was deleted. */
6953 Deleted = 2
6954}
6955
6956declare const ImportClauseBase: typeof Node;
6957
6958export declare class ImportClause extends ImportClauseBase<ts.ImportClause> {
6959 /**
6960 * Gets the default import or throws if it doesn't exit.
6961 */
6962 getDefaultImportOrThrow(): Identifier;
6963 /**
6964 * Gets the default import or returns undefined if it doesn't exist.
6965 */
6966 getDefaultImport(): Identifier | undefined;
6967 /**
6968 * Gets the named bindings of the import clause or throws if it doesn't exist.
6969 */
6970 getNamedBindingsOrThrow(): NamespaceImport | NamedImports;
6971 /**
6972 * Gets the named bindings of the import clause or returns undefined if it doesn't exist.
6973 */
6974 getNamedBindings(): NamespaceImport | NamedImports | undefined;
6975 /**
6976 * Gets the namespace import if it exists or throws.
6977 */
6978 getNamespaceImportOrThrow(): Identifier;
6979 /**
6980 * Gets the namespace import identifier, if it exists.
6981 */
6982 getNamespaceImport(): Identifier | undefined;
6983 /**
6984 * Gets the namespace import identifier, if it exists.
6985 */
6986 getNamedImports(): ImportSpecifier[];
6987}
6988
6989declare const ImportDeclarationBase: typeof Statement;
6990
6991export declare class ImportDeclaration extends ImportDeclarationBase<ts.ImportDeclaration> {
6992 /**
6993 * Sets the import specifier.
6994 * @param text - Text to set as the module specifier.
6995 */
6996 setModuleSpecifier(text: string): this;
6997 /**
6998 * Sets the import specifier.
6999 * @param sourceFile - Source file to set the module specifier from.
7000 */
7001 setModuleSpecifier(sourceFile: SourceFile): this;
7002 /**
7003 * Gets the module specifier.
7004 */
7005 getModuleSpecifier(): StringLiteral;
7006 /**
7007 * Gets the module specifier string literal value.
7008 */
7009 getModuleSpecifierValue(): string;
7010 /**
7011 * Gets the source file referenced in the module specifier or throws if it can't find it.
7012 */
7013 getModuleSpecifierSourceFileOrThrow(): SourceFile;
7014 /**
7015 * Gets the source file referenced in the module specifier or returns undefined if it can't find it.
7016 */
7017 getModuleSpecifierSourceFile(): SourceFile | undefined;
7018 /**
7019 * Gets if the module specifier starts with `./` or `../`.
7020 */
7021 isModuleSpecifierRelative(): boolean;
7022 /**
7023 * Sets the default import.
7024 * @param text - Text to set as the default import.
7025 * @remarks Use renameDefaultImport to rename.
7026 */
7027 setDefaultImport(text: string): this;
7028 /**
7029 * Renames or sets the provided default import.
7030 * @param text - Text to set or rename the default import with.
7031 */
7032 renameDefaultImport(text: string): this;
7033 /**
7034 * Gets the default import or throws if it doesn't exit.
7035 */
7036 getDefaultImportOrThrow(): Identifier;
7037 /**
7038 * Gets the default import or returns undefined if it doesn't exist.
7039 */
7040 getDefaultImport(): Identifier | undefined;
7041 /**
7042 * Sets the namespace import.
7043 * @param text - Text to set as the namespace import.
7044 * @throws - InvalidOperationError if a named import exists.
7045 */
7046 setNamespaceImport(text: string): this;
7047 /**
7048 * Removes the namespace import.
7049 */
7050 removeNamespaceImport(): this;
7051 /**
7052 * Removes the default import.
7053 */
7054 removeDefaultImport(): this;
7055 /**
7056 * Gets the namespace import if it exists or throws.
7057 */
7058 getNamespaceImportOrThrow(): Identifier;
7059 /**
7060 * Gets the namespace import identifier, if it exists.
7061 */
7062 getNamespaceImport(): Identifier | undefined;
7063 /**
7064 * Adds a named import.
7065 * @param namedImport - Name, structure, or writer to write the named import with.
7066 */
7067 addNamedImport(namedImport: ImportSpecifierStructure | string | WriterFunction): ImportSpecifier;
7068 /**
7069 * Adds named imports.
7070 * @param namedImport - Structures, names, or writer function to write the named import with.
7071 */
7072 addNamedImports(namedImports: ReadonlyArray<ImportSpecifierStructure | string | WriterFunction> | WriterFunction): ImportSpecifier[];
7073 /**
7074 * Inserts a named import.
7075 * @param index - Child index to insert at.
7076 * @param namedImport - Structure, name, or writer function to write the named import with.
7077 */
7078 insertNamedImport(index: number, namedImport: ImportSpecifierStructure | string | WriterFunction): ImportSpecifier;
7079 /**
7080 * Inserts named imports into the import declaration.
7081 * @param index - Child index to insert at.
7082 * @param namedImports - Structures, names, or writer function to write the named import with.
7083 */
7084 insertNamedImports(index: number, namedImports: ReadonlyArray<ImportSpecifierStructure | string | WriterFunction> | WriterFunction): ImportSpecifier[];
7085 /**
7086 * Gets the named imports.
7087 */
7088 getNamedImports(): ImportSpecifier[];
7089 /**
7090 * Removes all the named imports.
7091 */
7092 removeNamedImports(): this;
7093 /**
7094 * Gets the import clause or throws if it doesn't exist.
7095 */
7096 getImportClauseOrThrow(): ImportClause;
7097 /**
7098 * Gets the import clause or returns undefined if it doesn't exist.
7099 */
7100 getImportClause(): ImportClause | undefined;
7101 /**
7102 * Sets the node from a structure.
7103 * @param structure - Structure to set the node with.
7104 */
7105 set(structure: Partial<ImportDeclarationStructure>): this;
7106 /**
7107 * Gets the structure equivalent to this node.
7108 */
7109 getStructure(): ImportDeclarationStructure;
7110}
7111
7112declare const ImportEqualsDeclarationBase: Constructor<JSDocableNode> & Constructor<NamedNode> & typeof Statement;
7113
7114export declare class ImportEqualsDeclaration extends ImportEqualsDeclarationBase<ts.ImportEqualsDeclaration> {
7115 /**
7116 * Gets the module reference of the import equals declaration.
7117 */
7118 getModuleReference(): ModuleReference;
7119 /**
7120 * Gets if the external module reference is relative.
7121 */
7122 isExternalModuleReferenceRelative(): boolean;
7123 /**
7124 * Sets the external module reference.
7125 * @param externalModuleReference - External module reference as a string.
7126 */
7127 setExternalModuleReference(externalModuleReference: string): this;
7128 /**
7129 * Sets the external module reference.
7130 * @param sourceFile - Source file to set the external module reference to.
7131 */
7132 setExternalModuleReference(sourceFile: SourceFile): this;
7133 /**
7134 * Gets the source file referenced in the external module reference or throws if it doesn't exist.
7135 */
7136 getExternalModuleReferenceSourceFileOrThrow(): SourceFile;
7137 /**
7138 * Gets the source file referenced in the external module reference or returns undefined if it doesn't exist.
7139 */
7140 getExternalModuleReferenceSourceFile(): SourceFile | undefined;
7141}
7142
7143declare const ImportSpecifierBase: typeof Node;
7144
7145export declare class ImportSpecifier extends ImportSpecifierBase<ts.ImportSpecifier> {
7146 /**
7147 * Sets the identifier being imported.
7148 * @param name - Name being imported.
7149 */
7150 setName(name: string): this;
7151 /**
7152 * Gets the name of the import specifier.
7153 */
7154 getName(): string;
7155 /**
7156 * Gets the name node of what's being imported.
7157 */
7158 getNameNode(): Identifier;
7159 /**
7160 * Sets the alias for the name being imported and renames all the usages.
7161 * @param alias - Alias to set.
7162 */
7163 renameAlias(alias: string): this;
7164 /**
7165 * Sets the alias without renaming all the usages.
7166 * @param alias - Alias to set.
7167 */
7168 setAlias(alias: string): this;
7169 /**
7170 * Removes the alias without renaming.
7171 * @remarks Use removeAliasWithRename() if you want it to rename any usages to the name of the import specifier.
7172 */
7173 removeAlias(): this;
7174 /**
7175 * Removes the alias and renames any usages to the name of the import specifier.
7176 */
7177 removeAliasWithRename(): this;
7178 /**
7179 * Gets the alias identifier, if it exists.
7180 */
7181 getAliasNode(): Identifier | undefined;
7182 /**
7183 * Gets the import declaration associated with this import specifier.
7184 */
7185 getImportDeclaration(): ImportDeclaration;
7186 /**
7187 * Remove the import specifier.
7188 */
7189 remove(): void;
7190 /**
7191 * Sets the node from a structure.
7192 * @param structure - Structure to set the node with.
7193 */
7194 set(structure: Partial<ImportSpecifierStructure>): this;
7195 /**
7196 * Gets the structure equivalent to this node.
7197 */
7198 getStructure(): ImportSpecifierStructure;
7199}
7200
7201declare const ModuleBlockBase: Constructor<StatementedNode> & typeof Statement;
7202
7203export declare class ModuleBlock extends ModuleBlockBase<ts.ModuleBlock> {
7204}
7205
7206declare const NamedExportsBase: typeof Node;
7207
7208export declare class NamedExports extends NamedExportsBase<ts.NamedExports> {
7209 /** Gets the export specifiers. */
7210 getElements(): ExportSpecifier[];
7211}
7212
7213declare const NamedImportsBase: typeof Node;
7214
7215export declare class NamedImports extends NamedImportsBase<ts.NamedImports> {
7216 /** Gets the import specifiers. */
7217 getElements(): ImportSpecifier[];
7218}
7219
7220export declare function NamespaceChildableNode<T extends Constructor<NamespaceChildableNodeExtensionType>>(Base: T): Constructor<NamespaceChildableNode> & T;
7221
7222export interface NamespaceChildableNode {
7223 /**
7224 * Gets the parent namespace or undefined if it doesn't exist.
7225 */
7226 getParentNamespace(): NamespaceDeclaration | undefined;
7227 /**
7228 * Gets the parent namespace or throws if it doesn't exist.
7229 */
7230 getParentNamespaceOrThrow(): NamespaceDeclaration;
7231}
7232
7233declare type NamespaceChildableNodeExtensionType = Node;
7234
7235declare const NamespaceDeclarationBase: Constructor<ModuledNode> & Constructor<ChildOrderableNode> & Constructor<UnwrappableNode> & Constructor<TextInsertableNode> & Constructor<BodiedNode> & Constructor<NamespaceChildableNode> & Constructor<StatementedNode> & Constructor<JSDocableNode> & Constructor<AmbientableNode> & Constructor<ExportableNode> & Constructor<ModifierableNode> & Constructor<NamedNode> & typeof Statement;
7236
7237export declare class NamespaceDeclaration extends NamespaceDeclarationBase<ts.NamespaceDeclaration> {
7238 /**
7239 * Gets the full name of the namespace.
7240 */
7241 getName(): string;
7242 /**
7243 * Sets the name without renaming references.
7244 * @param newName - New full namespace name.
7245 */
7246 setName(newName: string): this;
7247 /**
7248 * Renames the name.
7249 * @param newName - New name.
7250 */
7251 rename(newName: string): this;
7252 /**
7253 * Gets the name nodes.
7254 */
7255 getNameNodes(): Identifier[];
7256 /**
7257 * Gets if this namespace has a namespace keyword.
7258 */
7259 hasNamespaceKeyword(): boolean;
7260 /**
7261 * Gets if this namespace has a namespace keyword.
7262 */
7263 hasModuleKeyword(): boolean;
7264 /**
7265 * Sets the namespace declaration kind.
7266 * @param kind - Kind to set.
7267 */
7268 setDeclarationKind(kind: NamespaceDeclarationKind): this;
7269 /**
7270 * Gets the namesapce declaration kind.
7271 */
7272 getDeclarationKind(): NamespaceDeclarationKind;
7273 /**
7274 * Gets the namespace or module keyword or returns undefined if it's global.
7275 */
7276 getDeclarationKindKeyword(): Node<ts.Node> | undefined;
7277 /**
7278 * Sets the node from a structure.
7279 * @param structure - Structure to set the node with.
7280 */
7281 set(structure: Partial<NamespaceDeclarationStructure>): this;
7282 /**
7283 * Gets the structure equivalent to this node.
7284 */
7285 getStructure(): NamespaceDeclarationStructure;
7286}
7287export declare enum NamespaceDeclarationKind {
7288 Namespace = "namespace",
7289 Module = "module",
7290 Global = "global"
7291}
7292
7293declare const NamespaceImportBase: Constructor<RenameableNode> & typeof Node;
7294
7295export declare class NamespaceImport extends NamespaceImportBase<ts.NamespaceImport> {
7296 /**
7297 * Sets the name of the namespace import.
7298 */
7299 setName(name: string): this;
7300 /**
7301 * Gets the name of the namespace import.
7302 */
7303 getName(): string;
7304 /**
7305 * Gets the namespace import's name node.
7306 */
7307 getNameNode(): Identifier;
7308}
7309
7310export interface SourceFileCopyOptions {
7311 overwrite?: boolean;
7312}
7313
7314export interface SourceFileMoveOptions {
7315 overwrite?: boolean;
7316}
7317
7318/**
7319 * Options for emitting a source file.
7320 */
7321export interface SourceFileEmitOptions extends EmitOptionsBase {
7322}
7323
7324declare const SourceFileBase: Constructor<ModuledNode> & Constructor<StatementedNode> & Constructor<TextInsertableNode> & typeof Node;
7325
7326export declare class SourceFile extends SourceFileBase<ts.SourceFile> {
7327 private constructor();
7328 /**
7329 * Gets the file path.
7330 */
7331 getFilePath(): string;
7332 /**
7333 * Gets the file path's base name.
7334 */
7335 getBaseName(): string;
7336 /**
7337 * Gets the file path's base name without the extension.
7338 */
7339 getBaseNameWithoutExtension(): string;
7340 /**
7341 * Gets the file path's extension.
7342 */
7343 getExtension(): string;
7344 /**
7345 * Gets the directory that the source file is contained in.
7346 */
7347 getDirectory(): Directory;
7348 /**
7349 * Gets the directory path that the source file is contained in.
7350 */
7351 getDirectoryPath(): string;
7352 /**
7353 * Gets the full text with leading trivia.
7354 */
7355 getFullText(): string;
7356 /**
7357 * Gets the line number at the provided position.
7358 * @param pos - Position
7359 */
7360 getLineNumberAtPos(pos: number): number;
7361 /**
7362 * Gets the character count from the start of the line to the provided position.
7363 * @param pos - Position.
7364 */
7365 getLengthFromLineStartAtPos(pos: number): number;
7366 /**
7367 * Copies this source file to the specified directory.
7368 *
7369 * This will modify the module specifiers in the new file, if necessary.
7370 * @param dirPathOrDirectory Directory path or directory object to copy the file to.
7371 * @param options Options for copying.
7372 * @returns The source file the copy was made to.
7373 */
7374 copyToDirectory(dirPathOrDirectory: string | Directory, options?: SourceFileCopyOptions): SourceFile;
7375 /**
7376 * Copy this source file to a new file.
7377 *
7378 * This will modify the module specifiers in the new file, if necessary.
7379 * @param filePath - New file path. Can be relative to the original file or an absolute path.
7380 * @param options - Options for copying.
7381 */
7382 copy(filePath: string, options?: SourceFileCopyOptions): SourceFile;
7383 /**
7384 * Copy this source file to a new file and immediately saves it to the file system asynchronously.
7385 *
7386 * This will modify the module specifiers in the new file, if necessary.
7387 * @param filePath - New file path. Can be relative to the original file or an absolute path.
7388 * @param options - Options for copying.
7389 */
7390 copyImmediately(filePath: string, options?: SourceFileCopyOptions): Promise<SourceFile>;
7391 /**
7392 * Copy this source file to a new file and immediately saves it to the file system synchronously.
7393 *
7394 * This will modify the module specifiers in the new file, if necessary.
7395 * @param filePath - New file path. Can be relative to the original file or an absolute path.
7396 * @param options - Options for copying.
7397 */
7398 copyImmediatelySync(filePath: string, options?: SourceFileCopyOptions): SourceFile;
7399 /**
7400 * Moves this source file to the specified directory.
7401 *
7402 * This will modify the module specifiers in other files that specify this file and the module specifiers in the current file, if necessary.
7403 * @param dirPathOrDirectory Directory path or directory object to move the file to.
7404 * @param options Options for moving.
7405 */
7406 moveToDirectory(dirPathOrDirectory: string | Directory, options?: SourceFileMoveOptions): SourceFile;
7407 /**
7408 * Moves this source file to a new file.
7409 *
7410 * This will modify the module specifiers in other files that specify this file and the module specifiers in the current file, if necessary.
7411 * @param filePath - New file path. Can be relative to the original file or an absolute path.
7412 * @param options - Options for moving.
7413 */
7414 move(filePath: string, options?: SourceFileMoveOptions): SourceFile;
7415 /**
7416 * Moves this source file to a new file and asynchronously updates the file system immediately.
7417 *
7418 * This will modify the module specifiers in other files that specify this file and the module specifiers in the current file, if necessary.
7419 * @param filePath - New file path. Can be relative to the original file or an absolute path.
7420 * @param options - Options for moving.
7421 */
7422 moveImmediately(filePath: string, options?: SourceFileMoveOptions): Promise<SourceFile>;
7423 /**
7424 * Moves this source file to a new file and synchronously updates the file system immediately.
7425 *
7426 * This will modify the module specifiers in other files that specify this file and the module specifiers in the current file, if necessary.
7427 * @param filePath - New file path. Can be relative to the original file or an absolute path.
7428 * @param options - Options for moving.
7429 */
7430 moveImmediatelySync(filePath: string, options?: SourceFileMoveOptions): SourceFile;
7431 /**
7432 * Queues a deletion of the file to the file system.
7433 *
7434 * The file will be deleted when you call ast.save(). If you wish to immediately delete the file, then use deleteImmediately().
7435 */
7436 delete(): void;
7437 /**
7438 * Asynchronously deletes the file from the file system.
7439 */
7440 deleteImmediately(): Promise<void>;
7441 /**
7442 * Synchronously deletes the file from the file system.
7443 */
7444 deleteImmediatelySync(): void;
7445 /**
7446 * Asynchronously saves this file with any changes.
7447 */
7448 save(): Promise<void>;
7449 /**
7450 * Synchronously saves this file with any changes.
7451 */
7452 saveSync(): void;
7453 /**
7454 * Gets any source files referenced via `/// <reference path="..." />` comments.
7455 */
7456 getReferencedFiles(): SourceFile[];
7457 /**
7458 * Gets any source files referenced via `/// <reference types="..." />` comments.
7459 */
7460 getTypeReferenceDirectives(): SourceFile[];
7461 /**
7462 * Get any source files that reference this source file.
7463 */
7464 getReferencingSourceFiles(): SourceFile[];
7465 /**
7466 * Gets the import and exports in other source files that reference this source file.
7467 */
7468 getReferencingNodesInOtherSourceFiles(): SourceFileReferencingNodes[];
7469 /**
7470 * Gets the string literals in other source files that reference this source file.
7471 */
7472 getReferencingLiteralsInOtherSourceFiles(): StringLiteral[];
7473 /**
7474 * Gets all the descendant string literals that reference a source file.
7475 */
7476 getImportStringLiterals(): StringLiteral[];
7477 /**
7478 * Gets the script target of the source file.
7479 */
7480 getLanguageVersion(): ScriptTarget;
7481 /**
7482 * Gets the language variant of the source file.
7483 */
7484 getLanguageVariant(): LanguageVariant;
7485 /**
7486 * Gets if this is a declaration file.
7487 */
7488 isDeclarationFile(): boolean;
7489 /**
7490 * Gets if the source file was discovered while loading an external library.
7491 */
7492 isFromExternalLibrary(): boolean;
7493 /**
7494 * Gets if the source file is a descendant of a node_modules directory.
7495 */
7496 isInNodeModules(): boolean;
7497 /**
7498 * Gets if this source file has been saved or if the latest changes have been saved.
7499 */
7500 isSaved(): boolean;
7501 /**
7502 * Gets the pre-emit diagnostics of the specified source file.
7503 */
7504 getPreEmitDiagnostics(): Diagnostic[];
7505 /**
7506 * Deindents the line at the specified position.
7507 * @param pos - Position.
7508 * @param times - Times to unindent. Specify a negative value to indent.
7509 */
7510 unindent(pos: number, times?: number): this;
7511 /**
7512 * Deindents the lines within the specified range.
7513 * @param positionRange - Position range.
7514 * @param times - Times to unindent. Specify a negative value to indent.
7515 */
7516 unindent(positionRange: [number, number], times?: number): this;
7517 /**
7518 * Indents the line at the specified position.
7519 * @param pos - Position.
7520 * @param times - Times to indent. Specify a negative value to unindent.
7521 */
7522 indent(pos: number, times?: number): this;
7523 /**
7524 * Indents the lines within the specified range.
7525 * @param positionRange - Position range.
7526 * @param times - Times to indent. Specify a negative value to unindent.
7527 */
7528 indent(positionRange: [number, number], times?: number): this;
7529 /**
7530 * Emits the source file.
7531 */
7532 emit(options?: SourceFileEmitOptions): EmitResult;
7533 /**
7534 * Gets the emit output of this source file.
7535 * @param options - Emit options.
7536 */
7537 getEmitOutput(options?: {
7538 emitOnlyDtsFiles?: boolean;
7539 }): EmitOutput;
7540 /**
7541 * Formats the source file text using the internal TypeScript formatting API.
7542 * @param settings - Format code settings.
7543 */
7544 formatText(settings?: FormatCodeSettings): void;
7545 /**
7546 * Refresh the source file from the file system.
7547 *
7548 * WARNING: When updating from the file system, this will "forget" any previously navigated nodes.
7549 * @returns What action ended up taking place.
7550 */
7551 refreshFromFileSystem(): Promise<FileSystemRefreshResult>;
7552 /**
7553 * Synchronously refreshes the source file from the file system.
7554 *
7555 * WARNING: When updating from the file system, this will "forget" any previously navigated nodes.
7556 * @returns What action ended up taking place.
7557 */
7558 refreshFromFileSystemSync(): FileSystemRefreshResult;
7559 /**
7560 * Gets the relative path to another source file.
7561 * @param sourceFile - Source file.
7562 */
7563 getRelativePathTo(sourceFile: SourceFile): string;
7564 /**
7565 * Gets the relative path to another directory.
7566 * @param directory - Directory.
7567 */
7568 getRelativePathTo(directory: Directory): string;
7569 /**
7570 * Gets the relative path to the specified source file as a module specifier.
7571 * @param sourceFile - Source file.
7572 */
7573 getRelativePathAsModuleSpecifierTo(sourceFile: SourceFile): string;
7574 /**
7575 * Gets the relative path to the specified directory as a module specifier.
7576 * @param directory - Directory.
7577 */
7578 getRelativePathAsModuleSpecifierTo(directory: Directory): string;
7579 /**
7580 * Subscribe to when the source file is modified.
7581 * @param subscription - Subscription.
7582 * @param subscribe - Optional and defaults to true. Use an explicit false to unsubscribe.
7583 */
7584 onModified(subscription: (sender: SourceFile) => void, subscribe?: boolean): this;
7585 /**
7586 * Organizes the imports in the file.
7587 *
7588 * WARNING! This will forget all the nodes in the file! It's best to do this after you're all done with the file.
7589 * @param formatSettings - Format code settings.
7590 * @param userPreferences - User preferences for refactoring.
7591 */
7592 organizeImports(formatSettings?: FormatCodeSettings, userPreferences?: UserPreferences): this;
7593 /**
7594 * Code fix to add import declarations for identifiers that are referenced, but not imported in the source file.
7595 * @param formatSettings - Format code settings.
7596 * @param userPreferences - User preferences for refactoring.
7597 */
7598 fixMissingImports(formatSettings?: FormatCodeSettings, userPreferences?: UserPreferences): this;
7599 /**
7600 * Applies the text changes to the source file.
7601 *
7602 * WARNING! This will forget all the nodes in the file! It's best to do this after you're all done with the file.
7603 * @param textChanges - Text changes.
7604 */
7605 applyTextChanges(textChanges: ReadonlyArray<TextChange>): this;
7606 /**
7607 * Sets the node from a structure.
7608 * @param structure - Structure to set the node with.
7609 */
7610 set(structure: Partial<SourceFileStructure>): this;
7611 /**
7612 * Gets the structure equivalent to this node.
7613 */
7614 getStructure(): SourceFileStructure;
7615 private _refreshFromFileSystemInternal;
7616}
7617
7618declare const BlockBase: Constructor<TextInsertableNode> & Constructor<StatementedNode> & typeof Statement;
7619
7620export declare class Block extends BlockBase<ts.Block> {
7621}
7622
7623declare const BreakStatementBase: Constructor<ChildOrderableNode> & typeof Statement;
7624
7625export declare class BreakStatement extends BreakStatementBase<ts.BreakStatement> {
7626 /**
7627 * Gets this break statement's label or undefined if it does not exist.
7628 */
7629 getLabel(): Identifier | undefined;
7630 /**
7631 * Gets this break statement's label or throw if it does not exist.
7632 */
7633 getLabelOrThrow(): Identifier;
7634}
7635
7636declare const CaseBlockBase: Constructor<TextInsertableNode> & typeof Node;
7637
7638export declare class CaseBlock extends CaseBlockBase<ts.CaseBlock> {
7639 /**
7640 * Gets the clauses.
7641 */
7642 getClauses(): CaseOrDefaultClause[];
7643 /**
7644 * Removes the clause at the specified index.
7645 * @param index - Index.
7646 */
7647 removeClause(index: number): this;
7648 /**
7649 * Removes the clauses in the specified range.
7650 * @param indexRange - Index range.
7651 */
7652 removeClauses(indexRange: [number, number]): this;
7653}
7654
7655declare const CaseClauseBase: Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<StatementedNode> & typeof Node;
7656
7657export declare class CaseClause extends CaseClauseBase<ts.CaseClause> {
7658 /**
7659 * Gets this switch statement's expression.
7660 */
7661 getExpression(): Expression;
7662 /**
7663 * Removes this case clause.
7664 */
7665 remove(): void;
7666}
7667
7668declare const CatchClauseBase: typeof Node;
7669
7670export declare class CatchClause extends CatchClauseBase<ts.CatchClause> {
7671 /**
7672 * Gets this catch clause's block.
7673 */
7674 getBlock(): Block;
7675 /**
7676 * Gets this catch clause's variable declaration or undefined if none exists.
7677 */
7678 getVariableDeclaration(): VariableDeclaration | undefined;
7679 /**
7680 * Gets this catch clause's variable declaration or throws if none exists.
7681 */
7682 getVariableDeclarationOrThrow(): VariableDeclaration;
7683}
7684
7685declare const ContinueStatementBase: Constructor<ChildOrderableNode> & typeof Statement;
7686
7687export declare class ContinueStatement extends ContinueStatementBase<ts.ContinueStatement> {
7688 /**
7689 * Gets this continue statement's label or undefined if it does not exist.
7690 */
7691 getLabel(): Identifier | undefined;
7692 /**
7693 * Gets this continue statement's label or throw if it does not exist.
7694 */
7695 getLabelOrThrow(): Identifier;
7696}
7697
7698declare const DebuggerStatementBase: typeof Statement;
7699
7700export declare class DebuggerStatement extends DebuggerStatementBase<ts.DebuggerStatement> {
7701}
7702
7703declare const DefaultClauseBase: Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<StatementedNode> & typeof Node;
7704
7705export declare class DefaultClause extends DefaultClauseBase<ts.DefaultClause> {
7706 /**
7707 * Removes the default clause.
7708 */
7709 remove(): void;
7710}
7711
7712declare const DoStatementBase: typeof IterationStatement;
7713
7714export declare class DoStatement extends DoStatementBase<ts.DoStatement> {
7715 /**
7716 * Gets this do statement's expression.
7717 */
7718 getExpression(): Expression;
7719}
7720
7721declare const EmptyStatementBase: typeof Statement;
7722
7723export declare class EmptyStatement extends EmptyStatementBase<ts.EmptyStatement> {
7724}
7725
7726declare const ExpressionStatementBase: Constructor<JSDocableNode> & Constructor<ChildOrderableNode> & typeof Statement;
7727
7728export declare class ExpressionStatement extends ExpressionStatementBase<ts.ExpressionStatement> {
7729 /**
7730 * Gets this expression statement's expression.
7731 */
7732 getExpression(): Expression;
7733}
7734
7735declare const ForInStatementBase: typeof IterationStatement;
7736
7737export declare class ForInStatement extends ForInStatementBase<ts.ForInStatement> {
7738 /**
7739 * Gets this for in statement's initializer.
7740 */
7741 getInitializer(): VariableDeclarationList | Expression;
7742 /**
7743 * Gets this for in statement's expression.
7744 */
7745 getExpression(): Expression;
7746}
7747
7748declare const ForOfStatementBase: Constructor<AwaitableNode> & typeof IterationStatement;
7749
7750export declare class ForOfStatement extends ForOfStatementBase<ts.ForOfStatement> {
7751 /**
7752 * Gets this for of statement's initializer.
7753 */
7754 getInitializer(): VariableDeclarationList | Expression;
7755 /**
7756 * Gets this for of statement's expression.
7757 */
7758 getExpression(): Expression;
7759}
7760
7761declare const ForStatementBase: typeof IterationStatement;
7762
7763export declare class ForStatement extends ForStatementBase<ts.ForStatement> {
7764 /**
7765 * Gets this for statement's initializer or undefined if none exists.
7766 */
7767 getInitializer(): VariableDeclarationList | Expression | undefined;
7768 /**
7769 * Gets this for statement's initializer or throws if none exists.
7770 */
7771 getInitializerOrThrow(): Expression<ts.Expression> | VariableDeclarationList;
7772 /**
7773 * Gets this for statement's condition or undefined if none exists.
7774 */
7775 getCondition(): Expression | undefined;
7776 /**
7777 * Gets this for statement's condition or throws if none exists.
7778 */
7779 getConditionOrThrow(): Expression<ts.Expression>;
7780 /**
7781 * Gets this for statement's incrementor.
7782 */
7783 getIncrementor(): Expression | undefined;
7784 /**
7785 * Gets this for statement's incrementor or throws if none exists.
7786 */
7787 getIncrementorOrThrow(): Expression<ts.Expression>;
7788}
7789
7790declare const IfStatementBase: Constructor<ChildOrderableNode> & typeof Statement;
7791
7792export declare class IfStatement extends IfStatementBase<ts.IfStatement> {
7793 /**
7794 * Gets this if statement's expression.
7795 */
7796 getExpression(): Expression;
7797 /**
7798 * Gets this if statement's then statement.
7799 */
7800 getThenStatement(): Statement;
7801 /**
7802 * Gets this if statement's else statement.
7803 */
7804 getElseStatement(): Statement | undefined;
7805}
7806
7807declare const IterationStatementBase: Constructor<ChildOrderableNode> & typeof Statement;
7808
7809export declare class IterationStatement<T extends ts.IterationStatement = ts.IterationStatement> extends IterationStatementBase<T> {
7810 /**
7811 * Gets this iteration statement's statement.
7812 */
7813 getStatement(): Statement;
7814}
7815
7816declare const LabeledStatementBase: Constructor<JSDocableNode> & Constructor<ChildOrderableNode> & typeof Statement;
7817
7818export declare class LabeledStatement extends LabeledStatementBase<ts.LabeledStatement> {
7819 /**
7820 * Gets this labeled statement's label
7821 */
7822 getLabel(): Identifier;
7823 /**
7824 * Gets this labeled statement's statement
7825 */
7826 getStatement(): Statement;
7827}
7828
7829declare const NotEmittedStatementBase: typeof Statement;
7830
7831export declare class NotEmittedStatement extends NotEmittedStatementBase<ts.NotEmittedStatement> {
7832}
7833
7834declare const ReturnStatementBase: Constructor<ChildOrderableNode> & typeof Statement;
7835
7836export declare class ReturnStatement extends ReturnStatementBase<ts.ReturnStatement> {
7837 /**
7838 * Gets this return statement's expression if it exists or throws.
7839 */
7840 getExpressionOrThrow(): Expression<ts.Expression>;
7841 /**
7842 * Gets this return statement's expression if it exists.
7843 */
7844 getExpression(): Expression | undefined;
7845}
7846
7847export declare class Statement<T extends ts.Statement = ts.Statement> extends Node<T> {
7848 /**
7849 * Removes the statement.
7850 */
7851 remove(): void;
7852}
7853
7854export declare function StatementedNode<T extends Constructor<StatementedNodeExtensionType>>(Base: T): Constructor<StatementedNode> & T;
7855
7856export interface StatementedNode {
7857 /**
7858 * Gets the node's statements.
7859 */
7860 getStatements(): Statement[];
7861 /**
7862 * Gets the first statement that matches the provided condition or returns undefined if it doesn't exist.
7863 * @param findFunction - Function to find the statement by.
7864 */
7865 getStatement(findFunction: (statement: Node) => boolean): Statement | undefined;
7866 /**
7867 * Gets the first statement that matches the provided condition or throws if it doesn't exist.
7868 * @param findFunction - Function to find the statement by.
7869 */
7870 getStatementOrThrow(findFunction: (statement: Node) => boolean): Statement;
7871 /**
7872 * Gets the first statement that matches the provided syntax kind or returns undefined if it doesn't exist.
7873 * @param kind - Syntax kind to find the node by.
7874 */
7875 getStatementByKind<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind] | undefined;
7876 /**
7877 * Gets the first statement that matches the provided syntax kind or throws if it doesn't exist.
7878 * @param kind - Syntax kind to find the node by.
7879 */
7880 getStatementByKindOrThrow<TKind extends SyntaxKind>(kind: TKind): KindToNodeMappings[TKind];
7881 /**
7882 * Add statements.
7883 * @param textOrWriterFunction - Text or writer function to add the statement or statements with.
7884 * @returns The statements that were added.
7885 */
7886 addStatements(textOrWriterFunction: string | WriterFunction): Statement[];
7887 /**
7888 * Inserts statements at the specified index.
7889 * @param index - Child index to insert at.
7890 * @param textOrWriterFunction - Text or writer function to write the statement or statements with.
7891 * @returns The statements that were inserted.
7892 */
7893 insertStatements(index: number, textOrWriterFunction: string | WriterFunction): Statement[];
7894 /**
7895 * Removes the statement at the specified index.
7896 * @param index - Child index to remove the statement at.
7897 */
7898 removeStatement(index: number): this;
7899 /**
7900 * Removes the statements at the specified index range.
7901 * @param indexRange - The start and end inclusive index range to remove.
7902 */
7903 removeStatements(indexRange: [number, number]): this;
7904 /**
7905 * Adds an class declaration as a child.
7906 * @param structure - Structure of the class declaration to add.
7907 */
7908 addClass(structure: ClassDeclarationStructure): ClassDeclaration;
7909 /**
7910 * Adds class declarations as a child.
7911 * @param structures - Structures of the class declarations to add.
7912 */
7913 addClasses(structures: ReadonlyArray<ClassDeclarationStructure>): ClassDeclaration[];
7914 /**
7915 * Inserts an class declaration as a child.
7916 * @param index - Child index to insert at.
7917 * @param structure - Structure of the class declaration to insert.
7918 */
7919 insertClass(index: number, structure: ClassDeclarationStructure): ClassDeclaration;
7920 /**
7921 * Inserts class declarations as a child.
7922 * @param index - Child index to insert at.
7923 * @param structures - Structures of the class declarations to insert.
7924 */
7925 insertClasses(index: number, structures: ReadonlyArray<ClassDeclarationStructure>): ClassDeclaration[];
7926 /**
7927 * Gets the direct class declaration children.
7928 */
7929 getClasses(): ClassDeclaration[];
7930 /**
7931 * Gets a class.
7932 * @param name - Name of the class.
7933 */
7934 getClass(name: string): ClassDeclaration | undefined;
7935 /**
7936 * Gets a class.
7937 * @param findFunction - Function to use to find the class.
7938 */
7939 getClass(findFunction: (declaration: ClassDeclaration) => boolean): ClassDeclaration | undefined;
7940 /**
7941 * Gets a class or throws if it doesn't exist.
7942 * @param name - Name of the class.
7943 */
7944 getClassOrThrow(name: string): ClassDeclaration;
7945 /**
7946 * Gets a class or throws if it doesn't exist.
7947 * @param findFunction - Function to use to find the class.
7948 */
7949 getClassOrThrow(findFunction: (declaration: ClassDeclaration) => boolean): ClassDeclaration;
7950 /**
7951 * Adds an enum declaration as a child.
7952 * @param structure - Structure of the enum declaration to add.
7953 */
7954 addEnum(structure: EnumDeclarationStructure): EnumDeclaration;
7955 /**
7956 * Adds enum declarations as a child.
7957 * @param structures - Structures of the enum declarations to add.
7958 */
7959 addEnums(structures: ReadonlyArray<EnumDeclarationStructure>): EnumDeclaration[];
7960 /**
7961 * Inserts an enum declaration as a child.
7962 * @param index - Child index to insert at.
7963 * @param structure - Structure of the enum declaration to insert.
7964 */
7965 insertEnum(index: number, structure: EnumDeclarationStructure): EnumDeclaration;
7966 /**
7967 * Inserts enum declarations as a child.
7968 * @param index - Child index to insert at.
7969 * @param structures - Structures of the enum declarations to insert.
7970 */
7971 insertEnums(index: number, structures: ReadonlyArray<EnumDeclarationStructure>): EnumDeclaration[];
7972 /**
7973 * Gets the direct enum declaration children.
7974 */
7975 getEnums(): EnumDeclaration[];
7976 /**
7977 * Gets an enum.
7978 * @param name - Name of the enum.
7979 */
7980 getEnum(name: string): EnumDeclaration | undefined;
7981 /**
7982 * Gets an enum.
7983 * @param findFunction - Function to use to find the enum.
7984 */
7985 getEnum(findFunction: (declaration: EnumDeclaration) => boolean): EnumDeclaration | undefined;
7986 /**
7987 * Gets an enum or throws if it doesn't exist.
7988 * @param name - Name of the enum.
7989 */
7990 getEnumOrThrow(name: string): EnumDeclaration;
7991 /**
7992 * Gets an enum or throws if it doesn't exist.
7993 * @param findFunction - Function to use to find the enum.
7994 */
7995 getEnumOrThrow(findFunction: (declaration: EnumDeclaration) => boolean): EnumDeclaration;
7996 /**
7997 * Adds a function declaration as a child.
7998 * @param structure - Structure of the function declaration to add.
7999 */
8000 addFunction(structure: FunctionDeclarationStructure): FunctionDeclaration;
8001 /**
8002 * Adds function declarations as a child.
8003 * @param structures - Structures of the function declarations to add.
8004 */
8005 addFunctions(structures: ReadonlyArray<FunctionDeclarationStructure>): FunctionDeclaration[];
8006 /**
8007 * Inserts an function declaration as a child.
8008 * @param index - Child index to insert at.
8009 * @param structure - Structure of the function declaration to insert.
8010 */
8011 insertFunction(index: number, structure: FunctionDeclarationStructure): FunctionDeclaration;
8012 /**
8013 * Inserts function declarations as a child.
8014 * @param index - Child index to insert at.
8015 * @param structures - Structures of the function declarations to insert.
8016 */
8017 insertFunctions(index: number, structures: ReadonlyArray<FunctionDeclarationStructure>): FunctionDeclaration[];
8018 /**
8019 * Gets the direct function declaration children.
8020 */
8021 getFunctions(): FunctionDeclaration[];
8022 /**
8023 * Gets a function.
8024 * @param name - Name of the function.
8025 */
8026 getFunction(name: string): FunctionDeclaration | undefined;
8027 /**
8028 * Gets a function.
8029 * @param findFunction - Function to use to find the function.
8030 */
8031 getFunction(findFunction: (declaration: FunctionDeclaration) => boolean): FunctionDeclaration | undefined;
8032 /**
8033 * Gets a function or throws if it doesn't exist.
8034 * @param name - Name of the function.
8035 */
8036 getFunctionOrThrow(name: string): FunctionDeclaration;
8037 /**
8038 * Gets a function or throws if it doesn't exist.
8039 * @param findFunction - Function to use to find the function.
8040 */
8041 getFunctionOrThrow(findFunction: (declaration: FunctionDeclaration) => boolean): FunctionDeclaration;
8042 /**
8043 * Adds a interface declaration as a child.
8044 * @param structure - Structure of the interface declaration to add.
8045 */
8046 addInterface(structure: InterfaceDeclarationStructure): InterfaceDeclaration;
8047 /**
8048 * Adds interface declarations as a child.
8049 * @param structures - Structures of the interface declarations to add.
8050 */
8051 addInterfaces(structures: ReadonlyArray<InterfaceDeclarationStructure>): InterfaceDeclaration[];
8052 /**
8053 * Inserts an interface declaration as a child.
8054 * @param index - Child index to insert at.
8055 * @param structure - Structure of the interface declaration to insert.
8056 */
8057 insertInterface(index: number, structure: InterfaceDeclarationStructure): InterfaceDeclaration;
8058 /**
8059 * Inserts interface declarations as a child.
8060 * @param index - Child index to insert at.
8061 * @param structures - Structures of the interface declarations to insert.
8062 */
8063 insertInterfaces(index: number, structures: ReadonlyArray<InterfaceDeclarationStructure>): InterfaceDeclaration[];
8064 /**
8065 * Gets the direct interface declaration children.
8066 */
8067 getInterfaces(): InterfaceDeclaration[];
8068 /**
8069 * Gets an interface.
8070 * @param name - Name of the interface.
8071 */
8072 getInterface(name: string): InterfaceDeclaration | undefined;
8073 /**
8074 * Gets an interface.
8075 * @param findFunction - Function to use to find the interface.
8076 */
8077 getInterface(findFunction: (declaration: InterfaceDeclaration) => boolean): InterfaceDeclaration | undefined;
8078 /**
8079 * Gets an interface or throws if it doesn't exist.
8080 * @param name - Name of the interface.
8081 */
8082 getInterfaceOrThrow(name: string): InterfaceDeclaration;
8083 /**
8084 * Gets an interface or throws if it doesn't exist.
8085 * @param findFunction - Function to use to find the interface.
8086 */
8087 getInterfaceOrThrow(findFunction: (declaration: InterfaceDeclaration) => boolean): InterfaceDeclaration;
8088 /**
8089 * Adds a namespace declaration as a child.
8090 * @param structure - Structure of the namespace declaration to add.
8091 */
8092 addNamespace(structure: NamespaceDeclarationStructure): NamespaceDeclaration;
8093 /**
8094 * Adds namespace declarations as a child.
8095 * @param structures - Structures of the namespace declarations to add.
8096 */
8097 addNamespaces(structures: ReadonlyArray<NamespaceDeclarationStructure>): NamespaceDeclaration[];
8098 /**
8099 * Inserts an namespace declaration as a child.
8100 * @param index - Child index to insert at.
8101 * @param structure - Structure of the namespace declaration to insert.
8102 */
8103 insertNamespace(index: number, structure: NamespaceDeclarationStructure): NamespaceDeclaration;
8104 /**
8105 * Inserts namespace declarations as a child.
8106 * @param index - Child index to insert at.
8107 * @param structures - Structures of the namespace declarations to insert.
8108 */
8109 insertNamespaces(index: number, structures: ReadonlyArray<NamespaceDeclarationStructure>): NamespaceDeclaration[];
8110 /**
8111 * Gets the direct namespace declaration children.
8112 */
8113 getNamespaces(): NamespaceDeclaration[];
8114 /**
8115 * Gets a namespace.
8116 * @param name - Name of the namespace.
8117 */
8118 getNamespace(name: string): NamespaceDeclaration | undefined;
8119 /**
8120 * Gets a namespace.
8121 * @param findFunction - Function to use to find the namespace.
8122 */
8123 getNamespace(findFunction: (declaration: NamespaceDeclaration) => boolean): NamespaceDeclaration | undefined;
8124 /**
8125 * Gets a namespace or throws if it doesn't exist.
8126 * @param name - Name of the namespace.
8127 */
8128 getNamespaceOrThrow(name: string): NamespaceDeclaration;
8129 /**
8130 * Gets a namespace or throws if it doesn't exist.
8131 * @param findFunction - Function to use to find the namespace.
8132 */
8133 getNamespaceOrThrow(findFunction: (declaration: NamespaceDeclaration) => boolean): NamespaceDeclaration;
8134 /**
8135 * Adds a type alias declaration as a child.
8136 * @param structure - Structure of the type alias declaration to add.
8137 */
8138 addTypeAlias(structure: TypeAliasDeclarationStructure): TypeAliasDeclaration;
8139 /**
8140 * Adds type alias declarations as a child.
8141 * @param structures - Structures of the type alias declarations to add.
8142 */
8143 addTypeAliases(structures: ReadonlyArray<TypeAliasDeclarationStructure>): TypeAliasDeclaration[];
8144 /**
8145 * Inserts an type alias declaration as a child.
8146 * @param index - Child index to insert at.
8147 * @param structure - Structure of the type alias declaration to insert.
8148 */
8149 insertTypeAlias(index: number, structure: TypeAliasDeclarationStructure): TypeAliasDeclaration;
8150 /**
8151 * Inserts type alias declarations as a child.
8152 * @param index - Child index to insert at.
8153 * @param structures - Structures of the type alias declarations to insert.
8154 */
8155 insertTypeAliases(index: number, structures: ReadonlyArray<TypeAliasDeclarationStructure>): TypeAliasDeclaration[];
8156 /**
8157 * Gets the direct type alias declaration children.
8158 */
8159 getTypeAliases(): TypeAliasDeclaration[];
8160 /**
8161 * Gets a type alias.
8162 * @param name - Name of the type alias.
8163 */
8164 getTypeAlias(name: string): TypeAliasDeclaration | undefined;
8165 /**
8166 * Gets a type alias.
8167 * @param findFunction - Function to use to find the type alias.
8168 */
8169 getTypeAlias(findFunction: (declaration: TypeAliasDeclaration) => boolean): TypeAliasDeclaration | undefined;
8170 /**
8171 * Gets a type alias or throws if it doesn't exist.
8172 * @param name - Name of the type alias.
8173 */
8174 getTypeAliasOrThrow(name: string): TypeAliasDeclaration;
8175 /**
8176 * Gets a type alias or throws if it doesn't exist.
8177 * @param findFunction - Function to use to find the type alias.
8178 */
8179 getTypeAliasOrThrow(findFunction: (declaration: TypeAliasDeclaration) => boolean): TypeAliasDeclaration;
8180 /**
8181 * Adds a variable statement.
8182 * @param structure - Structure of the variable statement.
8183 */
8184 addVariableStatement(structure: VariableStatementStructure): VariableStatement;
8185 /**
8186 * Adds variable statements.
8187 * @param structures - Structures of the variable statements.
8188 */
8189 addVariableStatements(structures: ReadonlyArray<VariableStatementStructure>): VariableStatement[];
8190 /**
8191 * Inserts a variable statement.
8192 * @param structure - Structure of the variable statement.
8193 */
8194 insertVariableStatement(index: number, structure: VariableStatementStructure): VariableStatement;
8195 /**
8196 * Inserts variable statements.
8197 * @param structures - Structures of the variable statements.
8198 */
8199 insertVariableStatements(index: number, structures: ReadonlyArray<VariableStatementStructure>): VariableStatement[];
8200 /**
8201 * Gets the direct variable statement children.
8202 */
8203 getVariableStatements(): VariableStatement[];
8204 /**
8205 * Gets a variable statement.
8206 * @param name - Name of one of the variable statement's declarations.
8207 */
8208 getVariableStatement(name: string): VariableStatement | undefined;
8209 /**
8210 * Gets a variable statement.
8211 * @param findFunction - Function to use to find the variable statement.
8212 */
8213 getVariableStatement(findFunction: (declaration: VariableStatement) => boolean): VariableStatement | undefined;
8214 /**
8215 * Gets a variable statement or throws if it doesn't exist.
8216 * @param name - Name of one of the variable statement's declarations.
8217 */
8218 getVariableStatementOrThrow(name: string): VariableStatement;
8219 /**
8220 * Gets a variable statement or throws if it doesn't exist.
8221 * @param findFunction - Function to use to find the variable statement.
8222 */
8223 getVariableStatementOrThrow(findFunction: (declaration: VariableStatement) => boolean): VariableStatement;
8224 /**
8225 * Gets all the variable declarations within all the variable declarations of the direct variable statement children.
8226 */
8227 getVariableDeclarations(): VariableDeclaration[];
8228 /**
8229 * Gets a variable declaration.
8230 * @param name - Name of the variable declaration.
8231 */
8232 getVariableDeclaration(name: string): VariableDeclaration | undefined;
8233 /**
8234 * Gets a variable declaration.
8235 * @param findFunction - Function to use to find the variable declaration.
8236 */
8237 getVariableDeclaration(findFunction: (declaration: VariableDeclaration) => boolean): VariableDeclaration | undefined;
8238 /**
8239 * Gets a variable declaration or throws if it doesn't exist.
8240 * @param name - Name of the variable declaration.
8241 */
8242 getVariableDeclarationOrThrow(name: string): VariableDeclaration;
8243 /**
8244 * Gets a variable declaration or throws if it doesn't exist.
8245 * @param findFunction - Function to use to find the variable declaration.
8246 */
8247 getVariableDeclarationOrThrow(findFunction: (declaration: VariableDeclaration) => boolean): VariableDeclaration;
8248}
8249
8250declare type StatementedNodeExtensionType = Node<ts.SourceFile | ts.FunctionDeclaration | ts.ModuleDeclaration | ts.FunctionLikeDeclaration | ts.CaseClause | ts.DefaultClause | ts.ModuleBlock>;
8251
8252declare const SwitchStatementBase: Constructor<ChildOrderableNode> & typeof Statement;
8253
8254export declare class SwitchStatement extends SwitchStatementBase<ts.SwitchStatement> {
8255 /**
8256 * Gets this switch statement's expression.
8257 */
8258 getExpression(): Expression;
8259 /**
8260 * Gets this switch statement's case block.
8261 */
8262 getCaseBlock(): CaseBlock;
8263 /**
8264 * Gets the switch statement's case block's clauses.
8265 */
8266 getClauses(): CaseOrDefaultClause[];
8267 /**
8268 * Removes the specified clause based on the provided index.
8269 * @param index - Index.
8270 */
8271 removeClause(index: number): CaseBlock;
8272 /**
8273 * Removes the specified clauses based on the provided index range.
8274 * @param indexRange - Index range.
8275 */
8276 removeClauses(indexRange: [number, number]): CaseBlock;
8277}
8278
8279declare const ThrowStatementBase: typeof Statement;
8280
8281export declare class ThrowStatement extends ThrowStatementBase<ts.ThrowStatement> {
8282 /**
8283 * Gets the throw statement's expression.
8284 */
8285 getExpression(): Expression | undefined;
8286 /**
8287 * Gets the throw statement's expression or throws undefined if it doesn't exist.
8288 */
8289 getExpressionOrThrow(): Expression;
8290}
8291
8292declare const TryStatementBase: typeof Statement;
8293
8294export declare class TryStatement extends TryStatementBase<ts.TryStatement> {
8295 /**
8296 * Gets this try statement's try block.
8297 */
8298 getTryBlock(): Block;
8299 /**
8300 * Gets this try statement's catch clause or undefined if none exists.
8301 */
8302 getCatchClause(): CatchClause | undefined;
8303 /**
8304 * Gets this try statement's catch clause or throws if none exists.
8305 */
8306 getCatchClauseOrThrow(): CatchClause;
8307 /**
8308 * Gets this try statement's finally block or undefined if none exists.
8309 */
8310 getFinallyBlock(): Block | undefined;
8311 /**
8312 * Gets this try statement's finally block or throws if none exists.
8313 */
8314 getFinallyBlockOrThrow(): Block;
8315}
8316
8317declare const VariableStatementBase: Constructor<ChildOrderableNode> & Constructor<NamespaceChildableNode> & Constructor<JSDocableNode> & Constructor<AmbientableNode> & Constructor<ExportableNode> & Constructor<ModifierableNode> & typeof Statement;
8318
8319export declare class VariableStatement extends VariableStatementBase<ts.VariableStatement> {
8320 /**
8321 * Get variable declaration list.
8322 */
8323 getDeclarationList(): VariableDeclarationList;
8324 /**
8325 * Get the variable declarations.
8326 */
8327 getDeclarations(): VariableDeclaration[];
8328 /**
8329 * Gets the variable declaration kind.
8330 */
8331 getDeclarationKind(): VariableDeclarationKind;
8332 /**
8333 * Gets the variable declaration kind keyword.
8334 */
8335 getDeclarationKindKeyword(): Node<ts.Node>;
8336 /**
8337 * Sets the variable declaration kind.
8338 * @param type - Type to set.
8339 */
8340 setDeclarationKind(type: VariableDeclarationKind): VariableDeclarationList;
8341 /**
8342 * Add a variable declaration to the statement.
8343 * @param structure - Structure representing the variable declaration to add.
8344 */
8345 addDeclaration(structure: VariableDeclarationStructure): VariableDeclaration;
8346 /**
8347 * Adds variable declarations to the statement.
8348 * @param structures - Structures representing the variable declarations to add.
8349 */
8350 addDeclarations(structures: ReadonlyArray<VariableDeclarationStructure>): VariableDeclaration[];
8351 /**
8352 * Inserts a variable declaration at the specified index within the statement.
8353 * @param index - Child index to insert at.
8354 * @param structure - Structure representing the variable declaration to insert.
8355 */
8356 insertDeclaration(index: number, structure: VariableDeclarationStructure): VariableDeclaration;
8357 /**
8358 * Inserts variable declarations at the specified index within the statement.
8359 * @param index - Child index to insert at.
8360 * @param structures - Structures representing the variable declarations to insert.
8361 */
8362 insertDeclarations(index: number, structures: ReadonlyArray<VariableDeclarationStructure>): VariableDeclaration[];
8363 /**
8364 * Sets the node from a structure.
8365 * @param structure - Structure to set the node with.
8366 */
8367 set(structure: Partial<VariableStatementStructure>): this;
8368 /**
8369 * Gets the structure equivalent to this node.
8370 */
8371 getStructure(): VariableStatementStructure;
8372}
8373
8374declare const WhileStatementBase: typeof IterationStatement;
8375
8376export declare class WhileStatement extends WhileStatementBase<ts.WhileStatement> {
8377 /**
8378 * Gets this while statement's expression.
8379 */
8380 getExpression(): Expression;
8381}
8382
8383declare const WithStatementBase: Constructor<ChildOrderableNode> & typeof Statement;
8384
8385export declare class WithStatement extends WithStatementBase<ts.WithStatement> {
8386 /**
8387 * Gets this with statement's expression.
8388 */
8389 getExpression(): Expression;
8390 /**
8391 * Gets this with statement's statement.
8392 */
8393 getStatement(): Statement;
8394}
8395
8396export declare class ArrayTypeNode extends TypeNode<ts.ArrayTypeNode> {
8397 /**
8398 * Gets the array type node's element type node.
8399 */
8400 getElementTypeNode(): TypeNode;
8401}
8402
8403export declare class ConstructorTypeNode extends FunctionOrConstructorTypeNodeBase<ts.ConstructorTypeNode> {
8404}
8405
8406declare const ExpressionWithTypeArgumentsBase: Constructor<LeftHandSideExpressionedNode> & typeof TypeNode;
8407
8408export declare class ExpressionWithTypeArguments extends ExpressionWithTypeArgumentsBase<ts.ExpressionWithTypeArguments> {
8409 /**
8410 * Gets the type arguments.
8411 */
8412 getTypeArguments(): TypeNode[];
8413}
8414
8415declare const FunctionTypeNodeBase: Constructor<TypeParameteredNode> & typeof FunctionOrConstructorTypeNodeBase;
8416
8417export declare class FunctionTypeNode extends FunctionTypeNodeBase<ts.FunctionTypeNode> {
8418}
8419
8420declare const FunctionOrConstructorTypeNodeBaseBase: Constructor<SignaturedDeclaration> & typeof TypeNode;
8421
8422export declare class FunctionOrConstructorTypeNodeBase<T extends ts.FunctionOrConstructorTypeNode = ts.FunctionOrConstructorTypeNode> extends FunctionOrConstructorTypeNodeBaseBase<T> {
8423}
8424
8425declare const ImportTypeNodeBase: Constructor<TypeArgumentedNode> & typeof TypeNode;
8426
8427export declare class ImportTypeNode extends ImportTypeNodeBase<ts.ImportTypeNode> {
8428 /**
8429 * Sets the argument text.
8430 * @param text - Text of the argument.
8431 */
8432 setArgument(text: string): this;
8433 /**
8434 * Gets the argument passed into the import type.
8435 */
8436 getArgument(): TypeNode;
8437 /**
8438 * Sets the qualifier text.
8439 * @param text - Text.
8440 */
8441 setQualifier(text: string): this;
8442 /**
8443 * Gets the qualifier of the import type if it exists or throws
8444 */
8445 getQualifierOrThrow(): EntityName;
8446 /**
8447 * Gets the qualifier of the import type if it exists or returns undefined.
8448 */
8449 getQualifier(): EntityName | undefined;
8450}
8451
8452export declare class IntersectionTypeNode extends TypeNode<ts.IntersectionTypeNode> {
8453 /**
8454 * Gets the intersection type nodes.
8455 */
8456 getTypeNodes(): TypeNode[];
8457}
8458
8459export declare class LiteralTypeNode extends TypeNode<ts.LiteralTypeNode> {
8460 /**
8461 * Gets the literal type node's literal.
8462 */
8463 getLiteral(): BooleanLiteral | LiteralExpression | PrefixUnaryExpression;
8464}
8465
8466export declare class ParenthesizedTypeNode extends TypeNode<ts.ParenthesizedTypeNode> {
8467 /**
8468 * Gets the node within the parentheses.
8469 */
8470 getTypeNode(): TypeNode;
8471 /**
8472 * Sets the type within the parentheses.
8473 * @param textOrWriterFunction - Text or writer function to set the type with.
8474 */
8475 setType(textOrWriterFunction: string | WriterFunction): this;
8476}
8477
8478export declare class TupleTypeNode extends TypeNode<ts.TupleTypeNode> {
8479 /**
8480 * Gets the tuple element type nodes.
8481 */
8482 getElementTypeNodes(): TypeNode[];
8483}
8484
8485declare const TypeAliasDeclarationBase: Constructor<ChildOrderableNode> & Constructor<TypeParameteredNode> & Constructor<TypedNode> & Constructor<JSDocableNode> & Constructor<AmbientableNode> & Constructor<ExportableNode> & Constructor<ModifierableNode> & Constructor<NamedNode> & typeof Statement;
8486
8487export declare class TypeAliasDeclaration extends TypeAliasDeclarationBase<ts.TypeAliasDeclaration> {
8488 /**
8489 * Sets the node from a structure.
8490 * @param structure - Structure to set the node with.
8491 */
8492 set(structure: Partial<TypeAliasDeclarationStructure>): this;
8493 /**
8494 * Gets the structure equivalent to this node.
8495 */
8496 getStructure(): TypeAliasDeclarationStructure;
8497}
8498
8499declare const TypeLiteralNodeBase: Constructor<TypeElementMemberedNode> & typeof TypeNode;
8500
8501export declare class TypeLiteralNode extends TypeLiteralNodeBase<ts.TypeLiteralNode> {
8502}
8503
8504export declare class TypeNode<T extends ts.TypeNode = ts.TypeNode> extends Node<T> {
8505}
8506
8507declare const TypeParameterDeclarationBase: Constructor<NamedNode> & typeof Node;
8508
8509export declare class TypeParameterDeclaration extends TypeParameterDeclarationBase<ts.TypeParameterDeclaration> {
8510 /**
8511 * Gets the constraint of the type parameter.
8512 */
8513 getConstraint(): TypeNode | undefined;
8514 /**
8515 * Gets the constraint of the type parameter or throws if it doesn't exist.
8516 */
8517 getConstraintOrThrow(): TypeNode<ts.TypeNode>;
8518 /**
8519 * Sets the type parameter constraint.
8520 * @param text - Text to set as the constraint.
8521 */
8522 setConstraint(text: string | WriterFunction): this;
8523 /**
8524 * Removes the constraint type node.
8525 */
8526 removeConstraint(): this;
8527 /**
8528 * Gets the default node of the type parameter.
8529 */
8530 getDefault(): TypeNode | undefined;
8531 /**
8532 * Gets the default node of the type parameter or throws if it doesn't exist.
8533 */
8534 getDefaultOrThrow(): TypeNode<ts.TypeNode>;
8535 /**
8536 * Sets the type parameter default type node.
8537 * @param text - Text to set as the default type node.
8538 */
8539 setDefault(text: string | WriterFunction): this;
8540 /**
8541 * Removes the default type node.
8542 */
8543 removeDefault(): this;
8544 /**
8545 * Removes this type parameter.
8546 */
8547 remove(): void;
8548 /**
8549 * Sets the node from a structure.
8550 * @param structure - Structure to set the node with.
8551 */
8552 set(structure: Partial<TypeParameterDeclarationStructure>): this;
8553 /**
8554 * Gets the structure equivalent to this node.
8555 */
8556 getStructure(): TypeParameterDeclarationStructure;
8557}
8558
8559export declare class TypeReferenceNode extends TypeNode<ts.TypeReferenceNode> {
8560 /**
8561 * Gets the type name.
8562 */
8563 getTypeName(): EntityName;
8564 /**
8565 * Gets the type arguments.
8566 */
8567 getTypeArguments(): TypeNode[];
8568}
8569
8570export declare class UnionTypeNode extends TypeNode<ts.UnionTypeNode> {
8571 /**
8572 * Gets the union type nodes.
8573 */
8574 getTypeNodes(): TypeNode[];
8575}
8576
8577declare const VariableDeclarationBase: Constructor<ExclamationTokenableNode> & Constructor<TypedNode> & Constructor<InitializerExpressionableNode> & Constructor<BindingNamedNode> & typeof Node;
8578
8579export declare class VariableDeclaration extends VariableDeclarationBase<ts.VariableDeclaration> {
8580 /**
8581 * Removes this variable declaration.
8582 */
8583 remove(): void;
8584 /**
8585 * Sets the node from a structure.
8586 * @param structure - Structure to set the node with.
8587 */
8588 set(structure: Partial<VariableDeclarationStructure>): this;
8589 /**
8590 * Gets the structure equivalent to this node.
8591 */
8592 getStructure(): VariableDeclarationStructure;
8593}
8594export declare enum VariableDeclarationKind {
8595 Var = "var",
8596 Let = "let",
8597 Const = "const"
8598}
8599
8600declare const VariableDeclarationListBase: Constructor<ModifierableNode> & typeof Node;
8601
8602export declare class VariableDeclarationList extends VariableDeclarationListBase<ts.VariableDeclarationList> {
8603 /**
8604 * Get the variable declarations.
8605 */
8606 getDeclarations(): VariableDeclaration[];
8607 /**
8608 * Gets the variable declaration kind.
8609 */
8610 getDeclarationKind(): VariableDeclarationKind;
8611 /**
8612 * Gets the variable declaration kind keyword.
8613 */
8614 getDeclarationKindKeyword(): Node;
8615 /**
8616 * Sets the variable declaration kind.
8617 * @param type - Type to set.
8618 */
8619 setDeclarationKind(type: VariableDeclarationKind): this;
8620 /**
8621 * Add a variable declaration to the statement.
8622 * @param structure - Structure representing the variable declaration to add.
8623 */
8624 addDeclaration(structure: VariableDeclarationStructure): VariableDeclaration;
8625 /**
8626 * Adds variable declarations to the statement.
8627 * @param structures - Structures representing the variable declarations to add.
8628 */
8629 addDeclarations(structures: ReadonlyArray<VariableDeclarationStructure>): VariableDeclaration[];
8630 /**
8631 * Inserts a variable declaration at the specified index within the statement.
8632 * @param index - Child index to insert at.
8633 * @param structure - Structure representing the variable declaration to insert.
8634 */
8635 insertDeclaration(index: number, structure: VariableDeclarationStructure): VariableDeclaration;
8636 /**
8637 * Inserts variable declarations at the specified index within the statement.
8638 * @param index - Child index to insert at.
8639 * @param structures - Structures representing the variable declarations to insert.
8640 */
8641 insertDeclarations(index: number, structures: ReadonlyArray<VariableDeclarationStructure>): VariableDeclaration[];
8642 /**
8643 * Sets the node from a structure.
8644 * @param structure - Structure to set the node with.
8645 */
8646 set(structure: Partial<VariableDeclarationListStructure>): this;
8647 /**
8648 * Gets the structure equivalent to this node.
8649 */
8650 getStructure(): VariableDeclarationListStructure;
8651}
8652
8653export declare class Signature {
8654 private constructor();
8655 /**
8656 * Gets the underlying compiler signature.
8657 */
8658 readonly compilerSignature: ts.Signature;
8659 /**
8660 * Gets the type parameters.
8661 */
8662 getTypeParameters(): TypeParameter[];
8663 /**
8664 * Gets the parameters.
8665 */
8666 getParameters(): Symbol[];
8667 /**
8668 * Gets the signature return type.
8669 */
8670 getReturnType(): Type;
8671 /**
8672 * Get the documentation comments.
8673 */
8674 getDocumentationComments(): SymbolDisplayPart[];
8675 /**
8676 * Gets the JS doc tags.
8677 */
8678 getJsDocTags(): JSDocTagInfo[];
8679}
8680
8681export declare class Symbol {
8682 /**
8683 * Gets the underlying compiler symbol.
8684 */
8685 readonly compilerSymbol: ts.Symbol;
8686 private constructor();
8687 /**
8688 * Gets the symbol name.
8689 */
8690 getName(): string;
8691 /**
8692 * Gets the escaped name.
8693 */
8694 getEscapedName(): string;
8695 /**
8696 * Gets the aliased symbol or throws if it doesn't exist.
8697 */
8698 getAliasedSymbolOrThrow(): Symbol;
8699 /**
8700 * Gets the aliased symbol or returns undefined if it doesn't exist.
8701 */
8702 getAliasedSymbol(): Symbol | undefined;
8703 /**
8704 * Gets if the symbol is an alias.
8705 */
8706 isAlias(): boolean;
8707 /**
8708 * Gets the symbol flags.
8709 */
8710 getFlags(): SymbolFlags;
8711 /**
8712 * Gets if the symbol has the specified flags.
8713 * @param flags - Flags to check if the symbol has.
8714 */
8715 hasFlags(flags: SymbolFlags): boolean;
8716 /**
8717 * Gets the value declaration of a symbol or throws if it doesn't exist.
8718 */
8719 getValueDeclarationOrThrow(): Node;
8720 /**
8721 * Gets the value declaration of the symbol or returns undefined if it doesn't exist.
8722 */
8723 getValueDeclaration(): Node | undefined;
8724 /**
8725 * Gets the symbol declarations.
8726 */
8727 getDeclarations(): Node[];
8728 /**
8729 * Gets the export of the symbol by the specified name or throws if not exists.
8730 * @param name - Name of the export.
8731 */
8732 getExportByNameOrThrow(name: string): Symbol;
8733 /**
8734 * Gets the export of the symbol by the specified name or returns undefined if not exists.
8735 * @param name - Name of the export.
8736 */
8737 getExportByName(name: string): Symbol | undefined;
8738 /**
8739 * Gets the exports from the symbol.
8740 */
8741 getExports(): Symbol[];
8742 /**
8743 * Gets the global export of the symbol by the specified name or throws if not exists.
8744 * @param name - Name of the global export.
8745 */
8746 getGlobalExportByNameOrThrow(name: string): Symbol;
8747 /**
8748 * Gets the global export of the symbol by the specified name or returns undefined if not exists.
8749 * @param name - Name of the global export.
8750 */
8751 getGlobalExportByName(name: string): Symbol | undefined;
8752 /**
8753 * Gets the global exports from the symbol.
8754 */
8755 getGlobalExports(): Symbol[];
8756 /**
8757 * Gets the member of the symbol by the specified name or throws if not exists.
8758 * @param name - Name of the export.
8759 */
8760 getMemberByNameOrThrow(name: string): Symbol;
8761 /**
8762 * Gets the member of the symbol by the specified name or returns undefined if not exists.
8763 * @param name - Name of the member.
8764 */
8765 getMemberByName(name: string): Symbol | undefined;
8766 /**
8767 * Gets the members of the symbol
8768 */
8769 getMembers(): Symbol[];
8770 /**
8771 * Gets the declared type of the symbol.
8772 */
8773 getDeclaredType(): Type;
8774 /**
8775 * Gets the type of the symbol at a location.
8776 * @param node - Location to get the type at for this symbol.
8777 */
8778 getTypeAtLocation(node: Node): Type<ts.Type>;
8779 /**
8780 * Gets the fully qualified name.
8781 */
8782 getFullyQualifiedName(): string;
8783}
8784
8785export interface FormatCodeSettings extends ts.FormatCodeSettings {
8786 ensureNewLineAtEndOfFile?: boolean;
8787}
8788/**
8789 * Options for renaming a node.
8790 */
8791export interface RenameOptions {
8792 /**
8793 * Whether comments referencing this node should be renamed.
8794 * @remarks False by default.
8795 */
8796 renameInComments?: boolean;
8797 /**
8798 * Whether strings referencing this node should be renamed.
8799 * @remarks False by default.
8800 */
8801 renameInStrings?: boolean;
8802}
8803
8804/**
8805 * User preferences for refactoring.
8806 */
8807export interface UserPreferences extends ts.UserPreferences {
8808}
8809
8810export declare class LanguageService {
8811 private readonly _compilerObject;
8812 private readonly _compilerHost;
8813 private _program;
8814 /**
8815 * Gets the compiler language service.
8816 */
8817 readonly compilerObject: ts.LanguageService;
8818 private constructor();
8819 /**
8820 * Gets the language service's program.
8821 */
8822 getProgram(): Program;
8823 /**
8824 * Rename the specified node.
8825 * @param node - Node to rename.
8826 * @param newName - New name for the node.
8827 * @param options - Options for renaming the node.
8828 */
8829 renameNode(node: Node, newName: string, options?: RenameOptions): void;
8830 /**
8831 * Rename the provided rename locations.
8832 * @param renameLocations - Rename locations.
8833 * @param newName - New name for the node.
8834 */
8835 renameLocations(renameLocations: ReadonlyArray<RenameLocation>, newName: string): void;
8836 /**
8837 * Gets the definitions for the specified node.
8838 * @param node - Node.
8839 */
8840 getDefinitions(node: Node): DefinitionInfo[];
8841 /**
8842 * Gets the definitions at the specified position.
8843 * @param sourceFile - Source file.
8844 * @param pos - Position.
8845 */
8846 getDefinitionsAtPosition(sourceFile: SourceFile, pos: number): DefinitionInfo[];
8847 /**
8848 * Gets the implementations for the specified node.
8849 * @param node - Node.
8850 */
8851 getImplementations(node: Node): ImplementationLocation[];
8852 /**
8853 * Gets the implementations at the specified position.
8854 * @param sourceFile - Source file.
8855 * @param pos - Position.
8856 */
8857 getImplementationsAtPosition(sourceFile: SourceFile, pos: number): ImplementationLocation[];
8858 /**
8859 * Finds references based on the specified node.
8860 * @param node - Node to find references for.
8861 */
8862 findReferences(node: Node): ReferencedSymbol[];
8863 /**
8864 * Finds the nodes that reference the definition(s) of the specified node.
8865 * @param node - Node.
8866 */
8867 findReferencesAsNodes(node: Node): Node<ts.Node>[];
8868 /**
8869 * Finds references based on the specified position.
8870 * @param sourceFile - Source file.
8871 * @param pos - Position to find the reference at.
8872 */
8873 findReferencesAtPosition(sourceFile: SourceFile, pos: number): ReferencedSymbol[];
8874 /**
8875 * Find the rename locations for the specified node.
8876 * @param node - Node to get the rename locations for.
8877 * @param options - Options for renaming.
8878 */
8879 findRenameLocations(node: Node, options?: RenameOptions): RenameLocation[];
8880 /**
8881 * Gets the suggestion diagnostics.
8882 * @param filePathOrSourceFile - The source file or file path to get suggestions for.
8883 */
8884 getSuggestionDiagnostics(filePathOrSourceFile: SourceFile | string): DiagnosticWithLocation[];
8885 /**
8886 * Gets the formatting edits for a range.
8887 * @param filePath - File path.
8888 * @param range - Position range.
8889 * @param formatSettings - Format code settings.
8890 */
8891 getFormattingEditsForRange(filePath: string, range: [number, number], formatSettings: FormatCodeSettings): TextChange[];
8892 /**
8893 * Gets the formatting edits for a document.
8894 * @param filePath - File path of the source file.
8895 * @param formatSettings - Format code settings.
8896 */
8897 getFormattingEditsForDocument(filePath: string, formatSettings: FormatCodeSettings): TextChange[];
8898 /**
8899 * Gets the formatted text for a document.
8900 * @param filePath - File path of the source file.
8901 * @param formatSettings - Format code settings.
8902 */
8903 getFormattedDocumentText(filePath: string, formatSettings: FormatCodeSettings): string;
8904 /**
8905 * Gets the emit output of a source file.
8906 * @param sourceFile - Source file.
8907 * @param emitOnlyDtsFiles - Whether to only emit the d.ts files.
8908 */
8909 getEmitOutput(sourceFile: SourceFile, emitOnlyDtsFiles?: boolean): EmitOutput;
8910 /**
8911 * Gets the emit output of a source file.
8912 * @param filePath - File path.
8913 * @param emitOnlyDtsFiles - Whether to only emit the d.ts files.
8914 */
8915 getEmitOutput(filePath: string, emitOnlyDtsFiles?: boolean): EmitOutput;
8916 /**
8917 * Gets the indentation at the specified position.
8918 * @param sourceFile - Source file.
8919 * @param position - Position.
8920 * @param settings - Editor settings.
8921 */
8922 getIdentationAtPosition(sourceFile: SourceFile, position: number, settings?: EditorSettings): number;
8923 /**
8924 * Gets the indentation at the specified position.
8925 * @param filePath - File path.
8926 * @param position - Position.
8927 * @param settings - Editor settings.
8928 */
8929 getIdentationAtPosition(filePath: string, position: number, settings?: EditorSettings): number;
8930 /**
8931 * Gets the file text changes for organizing the imports in a source file.
8932 *
8933 * @param sourceFile - Source file.
8934 * @param formatSettings - Format code settings.
8935 * @param userPreferences - User preferences for refactoring.
8936 */
8937 organizeImports(sourceFile: SourceFile, formatSettings?: FormatCodeSettings, userPreferences?: UserPreferences): FileTextChanges[];
8938 /**
8939 * Gets the file text changes for organizing the imports in a source file.
8940 *
8941 * @param filePath - File path of the source file.
8942 * @param formatSettings - Format code settings.
8943 * @param userPreferences - User preferences for refactoring.
8944 */
8945 organizeImports(filePath: string, formatSettings?: FormatCodeSettings, userPreferences?: UserPreferences): FileTextChanges[];
8946 /**
8947 * Gets the edit information for applying a refactor at a the provided position in a source file.
8948 * @param filePathOrSourceFile - File path or source file to get the edits for.
8949 * @param formatSettings - Fomat code settings.
8950 * @param positionOrRange - Position in the source file where to apply given refactor.
8951 * @param refactorName - Refactor name.
8952 * @param actionName - Refactor action name.
8953 * @param preferences - User preferences for refactoring.
8954 */
8955 getEditsForRefactor(filePathOrSourceFile: string | SourceFile, formatSettings: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences?: UserPreferences): RefactorEditInfo | undefined;
8956 /**
8957 * Gets file changes and actions to perform for the provided fixId.
8958 * @param filePathOrSourceFile - File path or source file to get the combined code fixes for.
8959 * @param fixId - Identifier for the code fix (ex. "fixMissingImport"). These ids are found in the `ts.codefix` namespace in the compiler api source.
8960 * @param formatSettings - Format code settings.
8961 * @param preferences - User preferences for refactoring.
8962 */
8963 getCombinedCodeFix(filePathOrSourceFile: string | SourceFile, fixId: {}, formatSettings?: FormatCodeSettings, preferences?: UserPreferences): CombinedCodeActions;
8964 /**
8965 * Gets the edit information for applying a code fix at the provided text range in a source file.
8966 * @param filePathOrSourceFile - File path or source file to get the code fixes for.
8967 * @param start - Start position of the text range to be fixed.
8968 * @param end - End position of the text range to be fixed.
8969 * @param errorCodes - One or more error codes associated with the code fixes to retrieve.
8970 * @param formatOptions - Format code settings.
8971 * @param preferences - User preferences for refactoring.
8972 */
8973 getCodeFixesAtPosition(filePathOrSourceFile: string | SourceFile, start: number, end: number, errorCodes: ReadonlyArray<number>, formatOptions?: FormatCodeSettings, preferences?: UserPreferences): CodeFixAction[];
8974 private _getFilePathFromFilePathOrSourceFile;
8975 private _getFilledSettings;
8976 private _getFilledUserPreferences;
8977}
8978
8979/**
8980 * Options for emitting from a Program.
8981 */
8982export interface ProgramEmitOptions extends EmitOptions {
8983 writeFile?: ts.WriteFileCallback;
8984}
8985
8986/**
8987 * Options for emitting.
8988 */
8989export interface EmitOptions extends EmitOptionsBase {
8990 /**
8991 * Optional source file to only emit.
8992 */
8993 targetSourceFile?: SourceFile;
8994}
8995
8996export interface EmitOptionsBase {
8997 /**
8998 * Whether only .d.ts files should be emitted.
8999 */
9000 emitOnlyDtsFiles?: boolean;
9001 /**
9002 * Transformers to act on the files when emitting.
9003 */
9004 customTransformers?: ts.CustomTransformers;
9005}
9006
9007/**
9008 * Wrapper around Program.
9009 */
9010export declare class Program {
9011 private constructor();
9012 /**
9013 * Gets the underlying compiler program.
9014 */
9015 readonly compilerObject: ts.Program;
9016 /**
9017 * Get the program's type checker.
9018 */
9019 getTypeChecker(): TypeChecker;
9020 /**
9021 * Emits the TypeScript files to JavaScript files.
9022 * @param options - Options for emitting.
9023 */
9024 emit(options?: ProgramEmitOptions): EmitResult;
9025 /**
9026 * Emits the TypeScript files to JavaScript files to memory.
9027 * @param options - Options for emitting.
9028 */
9029 emitToMemory(options?: EmitOptions): MemoryEmitResult;
9030 /**
9031 * Gets the syntactic diagnostics.
9032 * @param sourceFile - Optional source file to filter by.
9033 */
9034 getSyntacticDiagnostics(sourceFile?: SourceFile): DiagnosticWithLocation[];
9035 /**
9036 * Gets the semantic diagnostics.
9037 * @param sourceFile - Optional source file to filter by.
9038 */
9039 getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
9040 /**
9041 * Gets the declaration diagnostics.
9042 * @param sourceFile - Optional source file to filter by.
9043 */
9044 getDeclarationDiagnostics(sourceFile?: SourceFile): DiagnosticWithLocation[];
9045 /**
9046 * Gets the global diagnostics.
9047 */
9048 getGlobalDiagnostics(): Diagnostic[];
9049 /**
9050 * Gets the emit module resolution kind.
9051 */
9052 getEmitModuleResolutionKind(): ModuleResolutionKind;
9053 /**
9054 * Gets if the provided source file was discovered while loading an external library.
9055 * @param sourceFile - Source file.
9056 */
9057 isSourceFileFromExternalLibrary(sourceFile: SourceFile): boolean;
9058}
9059
9060/**
9061 * Represents a code action.
9062 */
9063export declare class CodeAction<TCompilerObject extends ts.CodeAction = ts.CodeAction> {
9064 protected constructor();
9065 /** Gets the compiler object. */
9066 readonly compilerObject: TCompilerObject;
9067 /** Description of the code action. */
9068 getDescription(): string;
9069 /** Text changes to apply to each file as part of the code action. */
9070 getChanges(): FileTextChanges[];
9071}
9072
9073/**
9074 * Represents file changes.
9075 *
9076 * Commands are currently not implemented.
9077 */
9078export declare class CombinedCodeActions {
9079 private constructor();
9080 /** Gets the compiler object. */
9081 readonly compilerObject: ts.CombinedCodeActions;
9082 /** Text changes to apply to each file. */
9083 getChanges(): FileTextChanges[];
9084}
9085
9086/**
9087 * Represents a code fix action.
9088 */
9089export declare class CodeFixAction extends CodeAction<ts.CodeFixAction> {
9090 /**
9091 * Short name to identify the fix, for use by telemetry.
9092 */
9093 getFixName(): string;
9094 /**
9095 * If present, one may call 'getCombinedCodeFix' with this fixId.
9096 * This may be omitted to indicate that the code fix can't be applied in a group.
9097 */
9098 getFixId(): {} | undefined;
9099 /**
9100 * Gets the description of the code fix when fixing everything.
9101 */
9102 getFixAllDescription(): string | undefined;
9103}
9104
9105/**
9106 * Definition info.
9107 */
9108export declare class DefinitionInfo<TCompilerObject extends ts.DefinitionInfo = ts.DefinitionInfo> extends DocumentSpan<TCompilerObject> {
9109 protected constructor();
9110 /**
9111 * Gets the kind.
9112 */
9113 getKind(): ts.ScriptElementKind;
9114 /**
9115 * Gets the name.
9116 */
9117 getName(): string;
9118 /**
9119 * Gets the container kind.
9120 */
9121 getContainerKind(): ts.ScriptElementKind;
9122 /**
9123 * Gets the container name.
9124 */
9125 getContainerName(): string;
9126 /**
9127 * Gets the declaration node.
9128 */
9129 getDeclarationNode(): Node | undefined;
9130}
9131
9132/**
9133 * Diagnostic.
9134 */
9135export declare class Diagnostic<TCompilerObject extends ts.Diagnostic = ts.Diagnostic> {
9136 protected constructor();
9137 /**
9138 * Gets the underlying compiler diagnostic.
9139 */
9140 readonly compilerObject: TCompilerObject;
9141 /**
9142 * Gets the source file.
9143 */
9144 getSourceFile(): SourceFile | undefined;
9145 /**
9146 * Gets the message text.
9147 */
9148 getMessageText(): string | DiagnosticMessageChain;
9149 /**
9150 * Gets the line number.
9151 */
9152 getLineNumber(): number | undefined;
9153 /**
9154 * Gets the start.
9155 */
9156 getStart(): number | undefined;
9157 /**
9158 * Gets the length.
9159 */
9160 getLength(): number | undefined;
9161 /**
9162 * Gets the diagnostic category.
9163 */
9164 getCategory(): DiagnosticCategory;
9165 /**
9166 * Gets the code of the diagnostic.
9167 */
9168 getCode(): number;
9169 /**
9170 * Gets the source.
9171 */
9172 getSource(): string | undefined;
9173}
9174
9175/**
9176 * Diagnostic message chain.
9177 */
9178export declare class DiagnosticMessageChain {
9179 private constructor();
9180 /**
9181 * Gets the underlying compiler object.
9182 */
9183 readonly compilerObject: ts.DiagnosticMessageChain;
9184 /**
9185 * Gets the message text.
9186 */
9187 getMessageText(): string;
9188 /**
9189 * Gets th enext diagnostic message chain in the chain.
9190 */
9191 getNext(): DiagnosticMessageChain | undefined;
9192 /**
9193 * Gets the code of the diagnostic message chain.
9194 */
9195 getCode(): number;
9196 /**
9197 * Gets the category of the diagnostic message chain.
9198 */
9199 getCategory(): DiagnosticCategory;
9200}
9201
9202export declare class DiagnosticWithLocation extends Diagnostic<ts.DiagnosticWithLocation> {
9203 private constructor();
9204 /**
9205 * Gets the line number.
9206 */
9207 getLineNumber(): number;
9208 /**
9209 * Gets the start.
9210 */
9211 getStart(): number;
9212 /**
9213 * Gets the length
9214 */
9215 getLength(): number;
9216 /**
9217 * Gets the source file.
9218 */
9219 getSourceFile(): SourceFile;
9220}
9221
9222/**
9223 * Document span.
9224 */
9225export declare class DocumentSpan<TCompilerObject extends ts.DocumentSpan = ts.DocumentSpan> {
9226 protected constructor();
9227 /**
9228 * Gets the compiler object.
9229 */
9230 readonly compilerObject: TCompilerObject;
9231 /**
9232 * Gets the source file this reference is in.
9233 */
9234 getSourceFile(): SourceFile;
9235 /**
9236 * Gets the text span.
9237 */
9238 getTextSpan(): TextSpan;
9239 /**
9240 * Gets the node at the start of the text span.
9241 */
9242 getNode(): Node<ts.Node>;
9243 /**
9244 * Gets the original text span if the span represents a location that was remapped.
9245 */
9246 getOriginalTextSpan(): TextSpan | undefined;
9247 /**
9248 * Gets the original file name if the span represents a location that was remapped.
9249 */
9250 getOriginalFileName(): string | undefined;
9251}
9252
9253/**
9254 * Output of an emit on a single file.
9255 */
9256export declare class EmitOutput {
9257 private readonly _filePath;
9258 private constructor();
9259 /**
9260 * TypeScript compiler emit result.
9261 */
9262 readonly compilerObject: ts.EmitOutput;
9263 /**
9264 * Gets if the emit was skipped.
9265 */
9266 getEmitSkipped(): boolean;
9267 /**
9268 * Gets the output files.
9269 */
9270 getOutputFiles(): OutputFile[];
9271}
9272
9273/**
9274 * Result of an emit.
9275 */
9276export declare class EmitResult {
9277 protected constructor();
9278 /**
9279 * TypeScript compiler emit result.
9280 */
9281 readonly compilerObject: ts.EmitResult;
9282 /**
9283 * If the emit was skipped.
9284 */
9285 getEmitSkipped(): boolean;
9286 /**
9287 * Contains declaration emit diagnostics.
9288 *
9289 * This is the semantic, syntactic, global, options, and if enabled declaration diagnostics.
9290 */
9291 getDiagnostics(): Diagnostic<ts.Diagnostic>[];
9292}
9293
9294/**
9295 * The emitted file in memory.
9296 */
9297export interface MemoryEmitResultFile {
9298 /**
9299 * File path that was emitted to.
9300 */
9301 filePath: string;
9302 /**
9303 * The text that was emitted.
9304 */
9305 text: string;
9306 /**
9307 * Whether the byte order mark should be written.
9308 */
9309 writeByteOrderMark: boolean;
9310}
9311
9312/**
9313 * Result of an emit to memory.
9314 */
9315export declare class MemoryEmitResult extends EmitResult {
9316 private readonly _files;
9317 private constructor();
9318 /**
9319 * Gets the files that were emitted to memory.
9320 */
9321 getFiles(): MemoryEmitResultFile[];
9322}
9323
9324export declare class FileTextChanges {
9325 private constructor();
9326 /**
9327 * Gets the file path.
9328 */
9329 getFilePath(): string;
9330 /**
9331 * Gets the source file if it was in the cache at the time of this class' creation.
9332 */
9333 getSourceFile(): SourceFile | undefined;
9334 /**
9335 * Gets the text changes
9336 */
9337 getTextChanges(): TextChange[];
9338 /**
9339 * Gets if this change is for creating a new file.
9340 */
9341 isNewFile(): boolean;
9342}
9343
9344export declare class ImplementationLocation extends DocumentSpan<ts.ImplementationLocation> {
9345 private constructor();
9346 /**
9347 * Gets the kind.
9348 */
9349 getKind(): ts.ScriptElementKind;
9350 /**
9351 * Gets the display parts.
9352 */
9353 getDisplayParts(): SymbolDisplayPart[];
9354}
9355
9356/**
9357 * Output file of an emit.
9358 */
9359export declare class OutputFile {
9360 private constructor();
9361 /**
9362 * TypeScript compiler output file.
9363 */
9364 readonly compilerObject: ts.OutputFile;
9365 /**
9366 * Gets the file path.
9367 */
9368 getFilePath(): string;
9369 /**
9370 * Gets whether the byte order mark should be written.
9371 */
9372 getWriteByteOrderMark(): boolean;
9373 /**
9374 * Gets the file text.
9375 */
9376 getText(): string;
9377}
9378
9379/**
9380 * Set of edits to make in response to a refactor action, plus an optional location where renaming should be invoked from.
9381 */
9382export declare class RefactorEditInfo {
9383 private constructor();
9384 /** Gets the compiler refactor edit info. */
9385 readonly compilerObject: ts.RefactorEditInfo;
9386 /**
9387 * Gets refactor file text changes
9388 */
9389 getEdits(): FileTextChanges[];
9390 /**
9391 * Gets the file path for a rename refactor.
9392 */
9393 getRenameFilePath(): string | undefined;
9394 /**
9395 * Location where renaming should be invoked from.
9396 */
9397 getRenameLocation(): number | undefined;
9398}
9399
9400/**
9401 * Referenced symbol.
9402 */
9403export declare class ReferencedSymbol {
9404 private constructor();
9405 /**
9406 * Gets the compiler referenced symbol.
9407 */
9408 readonly compilerObject: ts.ReferencedSymbol;
9409 /**
9410 * Gets the definition.
9411 */
9412 getDefinition(): ReferencedSymbolDefinitionInfo;
9413 /**
9414 * Gets the references.
9415 */
9416 getReferences(): ReferenceEntry[];
9417}
9418
9419export declare class ReferencedSymbolDefinitionInfo extends DefinitionInfo<ts.ReferencedSymbolDefinitionInfo> {
9420 private constructor();
9421 /**
9422 * Gets the display parts.
9423 */
9424 getDisplayParts(): SymbolDisplayPart[];
9425}
9426
9427export declare class ReferenceEntry extends DocumentSpan<ts.ReferenceEntry> {
9428 private constructor();
9429 isWriteAccess(): boolean;
9430 /**
9431 * If this is the definition reference.
9432 */
9433 isDefinition(): boolean;
9434 isInString(): true | undefined;
9435}
9436
9437/**
9438 * Rename location.
9439 */
9440export declare class RenameLocation extends DocumentSpan<ts.RenameLocation> {
9441}
9442
9443/**
9444 * Symbol display part.
9445 */
9446export declare class SymbolDisplayPart {
9447 private constructor();
9448 /** Gets the compiler symbol display part. */
9449 readonly compilerObject: ts.SymbolDisplayPart;
9450 /**
9451 * Gets the text.
9452 */
9453 getText(): string;
9454 /**
9455 * Gets the kind.
9456 *
9457 * Examples: "text", "lineBreak"
9458 */
9459 getKind(): string;
9460}
9461
9462/**
9463 * Represents a text change.
9464 */
9465export declare class TextChange {
9466 private constructor();
9467 /** Gets the compiler text change. */
9468 readonly compilerObject: ts.TextChange;
9469 /**
9470 * Gets the text span.
9471 */
9472 getSpan(): TextSpan;
9473 /**
9474 * Gets the new text.
9475 */
9476 getNewText(): string;
9477}
9478
9479/**
9480 * Represents a span of text.
9481 */
9482export declare class TextSpan {
9483 private constructor();
9484 /** Gets the compiler text span. */
9485 readonly compilerObject: ts.TextSpan;
9486 /**
9487 * Gets the start.
9488 */
9489 getStart(): number;
9490 /**
9491 * Gets the start + length.
9492 */
9493 getEnd(): number;
9494 /**
9495 * Gets the length.
9496 */
9497 getLength(): number;
9498}
9499
9500/**
9501 * Wrapper around the TypeChecker.
9502 */
9503export declare class TypeChecker {
9504 private constructor();
9505 /**
9506 * Gets the compiler's TypeChecker.
9507 */
9508 readonly compilerObject: ts.TypeChecker;
9509 /**
9510 * Gets the ambient module symbols (ex. modules in the @types folder or node_modules).
9511 */
9512 getAmbientModules(): Symbol[];
9513 /**
9514 * Gets the apparent type of a type.
9515 * @param type - Type to get the apparent type of.
9516 */
9517 getApparentType(type: Type): Type<ts.Type>;
9518 /**
9519 * Gets the constant value of a declaration.
9520 * @param node - Node to get the constant value from.
9521 */
9522 getConstantValue(node: EnumMember): string | number | undefined;
9523 /**
9524 * Gets the fully qualified name of a symbol.
9525 * @param symbol - Symbol to get the fully qualified name of.
9526 */
9527 getFullyQualifiedName(symbol: Symbol): string;
9528 /**
9529 * Gets the type at the specified location.
9530 * @param node - Node to get the type for.
9531 */
9532 getTypeAtLocation(node: Node): Type;
9533 /**
9534 * Gets the contextual type of an expression.
9535 * @param expression - Expression.
9536 */
9537 getContextualType(expression: Expression): Type | undefined;
9538 /**
9539 * Gets the type of a symbol at the specified location.
9540 * @param symbol - Symbol to get the type for.
9541 * @param node - Location to get the type for.
9542 */
9543 getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
9544 /**
9545 * Gets the declared type of a symbol.
9546 * @param symbol - Symbol to get the type for.
9547 */
9548 getDeclaredTypeOfSymbol(symbol: Symbol): Type;
9549 /**
9550 * Gets the symbol at the specified location or undefined if none exists.
9551 * @param node - Node to get the symbol for.
9552 */
9553 getSymbolAtLocation(node: Node): Symbol | undefined;
9554 /**
9555 * Gets the aliased symbol of a symbol.
9556 * @param symbol - Symbol to get the alias symbol of.
9557 */
9558 getAliasedSymbol(symbol: Symbol): Symbol | undefined;
9559 /**
9560 * Gets the properties of a type.
9561 * @param type - Type.
9562 */
9563 getPropertiesOfType(type: Type): Symbol[];
9564 /**
9565 * Gets the type text
9566 * @param type - Type to get the text of.
9567 * @param enclosingNode - Enclosing node.
9568 * @param typeFormatFlags - Type format flags.
9569 */
9570 getTypeText(type: Type, enclosingNode?: Node, typeFormatFlags?: TypeFormatFlags): string;
9571 /**
9572 * Gets the return type of a signature.
9573 * @param signature - Signature to get the return type of.
9574 */
9575 getReturnTypeOfSignature(signature: Signature): Type;
9576 /**
9577 * Gets a signature from a node.
9578 * @param node - Node to get the signature from.
9579 */
9580 getSignatureFromNode(node: Node<ts.SignatureDeclaration>): Signature | undefined;
9581 /**
9582 * Gets the exports of a module.
9583 * @param moduleSymbol - Module symbol.
9584 */
9585 getExportsOfModule(moduleSymbol: Symbol): Symbol[];
9586 /**
9587 * Gets the local target symbol of the provided export specifier.
9588 * @param exportSpecifier - Export specifier.
9589 */
9590 getExportSpecifierLocalTargetSymbol(exportSpecifier: ExportSpecifier): Symbol | undefined;
9591 /**
9592 * Gets the base type of a literal type.
9593 *
9594 * For example, for a number literal type it will return the number type.
9595 * @param type - Literal type to get the base type of.
9596 */
9597 getBaseTypeOfLiteralType(type: Type): Type<ts.Type>;
9598 private _getDefaultTypeFormatFlags;
9599}
9600
9601export declare class Type<TType extends ts.Type = ts.Type> {
9602 /**
9603 * Gets the underlying compiler type.
9604 */
9605 readonly compilerType: TType;
9606 protected constructor();
9607 /**
9608 * Gets the type text.
9609 * @param enclosingNode - The enclosing node.
9610 * @param typeFormatFlags - Format flags for the type text.
9611 */
9612 getText(enclosingNode?: Node, typeFormatFlags?: TypeFormatFlags): string;
9613 /**
9614 * Gets the alias symbol if it exists.
9615 */
9616 getAliasSymbol(): Symbol | undefined;
9617 /**
9618 * Gets the alias symbol if it exists, or throws.
9619 */
9620 getAliasSymbolOrThrow(): Symbol;
9621 /**
9622 * Gets the alias type arguments.
9623 */
9624 getAliasTypeArguments(): Type[];
9625 /**
9626 * Gets the apparent type.
9627 */
9628 getApparentType(): Type;
9629 /**
9630 * Gets the array type
9631 */
9632 getArrayType(): Type<ts.Type> | undefined;
9633 /**
9634 * Gets the base types.
9635 */
9636 getBaseTypes(): Type<ts.BaseType>[];
9637 /**
9638 * Gets the base type of a literal type.
9639 *
9640 * For example, for a number literal type it will return the number type.
9641 */
9642 getBaseTypeOfLiteralType(): Type<ts.Type>;
9643 /**
9644 * Gets the call signatures.
9645 */
9646 getCallSignatures(): Signature[];
9647 /**
9648 * Gets the construct signatures.
9649 */
9650 getConstructSignatures(): Signature[];
9651 /**
9652 * Gets the constraint or throws if it doesn't exist.
9653 */
9654 getConstraintOrThrow(): Type<ts.Type>;
9655 /**
9656 * Gets the constraint or returns undefined if it doesn't exist.
9657 */
9658 getConstraint(): Type<ts.Type> | undefined;
9659 /**
9660 * Gets the default type or throws if it doesn't exist.
9661 */
9662 getDefaultOrThrow(): Type<ts.Type>;
9663 /**
9664 * Gets the default type or returns undefined if it doesn't exist.
9665 */
9666 getDefault(): Type<ts.Type> | undefined;
9667 /**
9668 * Gets the properties of the type.
9669 */
9670 getProperties(): Symbol[];
9671 /**
9672 * Gets a property.
9673 * @param name - By a name.
9674 * @param findFunction - Function for searching for a property.
9675 */
9676 getProperty(name: string): Symbol | undefined;
9677 getProperty(findFunction: (declaration: Symbol) => boolean): Symbol | undefined;
9678 /**
9679 * Gets the apparent properties of the type.
9680 */
9681 getApparentProperties(): Symbol[];
9682 /**
9683 * Gets an apparent property.
9684 * @param name - By a name.
9685 * @param findFunction - Function for searching for an apparent property.
9686 */
9687 getApparentProperty(name: string): Symbol | undefined;
9688 getApparentProperty(findFunction: (declaration: Symbol) => boolean): Symbol | undefined;
9689 /**
9690 * Gets if the type is possibly null or undefined.
9691 */
9692 isNullable(): boolean;
9693 /**
9694 * Gets the non-nullable type.
9695 */
9696 getNonNullableType(): Type;
9697 /**
9698 * Gets the number index type.
9699 */
9700 getNumberIndexType(): Type | undefined;
9701 /**
9702 * Gets the string index type.
9703 */
9704 getStringIndexType(): Type | undefined;
9705 /**
9706 * Gets the target type of a type reference if it exists.
9707 */
9708 getTargetType(): Type<ts.GenericType> | undefined;
9709 /**
9710 * Gets the target type of a type reference or throws if it doesn't exist.
9711 */
9712 getTargetTypeOrThrow(): Type<ts.GenericType>;
9713 /**
9714 * Gets type arguments.
9715 */
9716 getTypeArguments(): Type[];
9717 /**
9718 * Gets the individual element types of the tuple.
9719 */
9720 getTupleElements(): Type[];
9721 /**
9722 * Gets the union types.
9723 */
9724 getUnionTypes(): Type[];
9725 /**
9726 * Gets the intersection types.
9727 */
9728 getIntersectionTypes(): Type[];
9729 /**
9730 * Gets the symbol of the type.
9731 */
9732 getSymbol(): Symbol | undefined;
9733 /**
9734 * Gets the symbol of the type or throws.
9735 */
9736 getSymbolOrThrow(): Symbol;
9737 /**
9738 * Gets if this is an anonymous type.
9739 */
9740 isAnonymous(): boolean;
9741 /**
9742 * Gets if this is an array type.
9743 */
9744 isArray(): boolean;
9745 /**
9746 * Gets if this is a boolean type.
9747 */
9748 isBoolean(): boolean;
9749 /**
9750 * Gets if this is a string type.
9751 */
9752 isString(): boolean;
9753 /**
9754 * Gets if this is a number type.
9755 */
9756 isNumber(): boolean;
9757 /**
9758 * Gets if this is a literal type.
9759 */
9760 isLiteral(): boolean;
9761 /**
9762 * Gets if this is a boolean literal type.
9763 */
9764 isBooleanLiteral(): boolean;
9765 /**
9766 * Gets if this is an enum literal type.
9767 */
9768 isEnumLiteral(): boolean;
9769 /**
9770 * Gets if this is a number literal type.
9771 */
9772 isNumberLiteral(): boolean;
9773 /**
9774 * Gets if this is a string literal type.
9775 */
9776 isStringLiteral(): boolean;
9777 /**
9778 * Gets if this is a class type.
9779 */
9780 isClass(): boolean;
9781 /**
9782 * Gets if this is a class or interface type.
9783 */
9784 isClassOrInterface(): boolean;
9785 /**
9786 * Gets if this is an enum type.
9787 */
9788 isEnum(): boolean;
9789 /**
9790 * Gets if this is an interface type.
9791 */
9792 isInterface(): boolean;
9793 /**
9794 * Gets if this is an object type.
9795 */
9796 isObject(): boolean;
9797 /**
9798 * Gets if this is a type parameter.
9799 */
9800 isTypeParameter(): this is TypeParameter;
9801 /**
9802 * Gets if this is a tuple type.
9803 */
9804 isTuple(): boolean;
9805 /**
9806 * Gets if this is a union type.
9807 */
9808 isUnion(): boolean;
9809 /**
9810 * Gets if this is an intersection type.
9811 */
9812 isIntersection(): boolean;
9813 /**
9814 * Gets if this is a union or intersection type.
9815 */
9816 isUnionOrIntersection(): boolean;
9817 /**
9818 * Gets if this is the null type.
9819 */
9820 isNull(): boolean;
9821 /**
9822 * Gets if this is the undefined type.
9823 */
9824 isUndefined(): boolean;
9825 /**
9826 * Gets the type flags.
9827 */
9828 getFlags(): TypeFlags;
9829 /**
9830 * Gets the object flags.
9831 * @remarks Returns 0 for a non-object type.
9832 */
9833 getObjectFlags(): ObjectFlags | 0;
9834 private _hasTypeFlag;
9835 private _hasAnyTypeFlag;
9836 private _hasObjectFlag;
9837}
9838
9839export declare class TypeParameter extends Type<ts.TypeParameter> {
9840 /**
9841 * Gets the constraint or throws if it doesn't exist.
9842 */
9843 getConstraintOrThrow(): Type;
9844 /**
9845 * Gets the constraint type.
9846 */
9847 getConstraint(): Type | undefined;
9848 /**
9849 * Gets the default type or throws if it doesn't exist.
9850 */
9851 getDefaultOrThrow(): Type;
9852 /**
9853 * Gets the default type or undefined if it doesn't exist.
9854 */
9855 getDefault(): Type | undefined;
9856}
9857
9858export declare class ArgumentError extends BaseError {
9859 protected constructor();
9860}
9861
9862export declare class ArgumentNullOrWhitespaceError extends ArgumentError {
9863 private constructor();
9864}
9865
9866export declare class ArgumentOutOfRangeError extends ArgumentError {
9867 private constructor();
9868}
9869
9870export declare class ArgumentTypeError extends ArgumentError {
9871 private constructor();
9872}
9873export declare abstract class BaseError extends Error {
9874 readonly message: string;
9875 protected constructor();
9876}
9877
9878export declare class DirectoryNotFoundError extends PathNotFoundError {
9879 private constructor();
9880}
9881
9882export declare class FileNotFoundError extends PathNotFoundError {
9883 private constructor();
9884}
9885
9886export declare class InvalidOperationError extends BaseError {
9887 private constructor();
9888}
9889
9890export declare class NotImplementedError extends BaseError {
9891 private constructor();
9892}
9893
9894export declare class NotSupportedError extends BaseError {
9895 private constructor();
9896}
9897
9898export declare class PathNotFoundError extends BaseError {
9899 readonly path: string;
9900 protected constructor();
9901 readonly code: "ENOENT";
9902}
9903
9904/**
9905 * Holds the compiler options.
9906 */
9907export declare class CompilerOptionsContainer extends SettingsContainer<CompilerOptions> {
9908 constructor();
9909 /**
9910 * Sets one or all of the compiler options.
9911 *
9912 * WARNING: Setting the compiler options will cause a complete reparse of all the source files.
9913 * @param settings - Compiler options to set.
9914 */
9915 set(settings: Partial<CompilerOptions>): void;
9916}
9917
9918/** Kinds of indentation */
9919export declare enum IndentationText {
9920 /** Two spaces */
9921 TwoSpaces = " ",
9922 /** Four spaces */
9923 FourSpaces = " ",
9924 /** Eight spaces */
9925 EightSpaces = " ",
9926 /** Tab */
9927 Tab = "\t"
9928}
9929
9930/**
9931 * Manipulation settings.
9932 */
9933export interface ManipulationSettings extends SupportedFormatCodeSettingsOnly {
9934 /** Indentation text */
9935 indentationText: IndentationText;
9936 /** New line kind */
9937 newLineKind: NewLineKind;
9938 /** Quote type used for string literals. */
9939 quoteKind: QuoteKind;
9940}
9941
9942/**
9943 * FormatCodeSettings that are currently supported in the library.
9944 */
9945export interface SupportedFormatCodeSettings extends SupportedFormatCodeSettingsOnly, EditorSettings {
9946}
9947
9948/**
9949 * FormatCodeSettings that are currently supported in the library.
9950 */
9951export interface SupportedFormatCodeSettingsOnly {
9952 /**
9953 * Whether to insert a space after opening and before closing non-empty braces.
9954 *
9955 * ex. `import { Item } from "./Item";` or `import {Item} from "./Item";`
9956 */
9957 insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: boolean;
9958}
9959
9960/**
9961 * Holds the manipulation settings.
9962 */
9963export declare class ManipulationSettingsContainer extends SettingsContainer<ManipulationSettings> {
9964 private _editorSettings;
9965 private _formatCodeSettings;
9966 private _userPreferences;
9967 constructor();
9968 /**
9969 * Gets the editor settings based on the current manipulation settings.
9970 */
9971 getEditorSettings(): Readonly<EditorSettings>;
9972 /**
9973 * Gets the format code settings.
9974 */
9975 getFormatCodeSettings(): Readonly<SupportedFormatCodeSettings>;
9976 /**
9977 * Gets the user preferences.
9978 */
9979 getUserPreferences(): Readonly<UserPreferences>;
9980 /**
9981 * Gets the quote kind used for string literals.
9982 */
9983 getQuoteKind(): QuoteKind;
9984 /**
9985 * Gets the new line kind.
9986 */
9987 getNewLineKind(): NewLineKind;
9988 /**
9989 * Gets the new line kind as a string.
9990 */
9991 getNewLineKindAsString(): "\n" | "\r\n";
9992 /**
9993 * Gets the indentation text;
9994 */
9995 getIndentationText(): IndentationText;
9996 /**
9997 * Sets one or all of the settings.
9998 * @param settings - Settings to set.
9999 */
10000 set(settings: Partial<ManipulationSettings>): void;
10001}
10002export declare abstract class SettingsContainer<T extends object> {
10003 protected constructor();
10004 /**
10005 * Resets the settings to the default.
10006 */
10007 reset(): void;
10008 /**
10009 * Gets a copy of the settings as an object.
10010 */
10011 get(): T;
10012 /**
10013 * Sets one or all of the settings.
10014 * @param settings - Settings to set.
10015 */
10016 set(settings: Partial<T>): void;
10017}
10018export interface AbstractableNodeStructure {
10019 isAbstract?: boolean;
10020}
10021export interface AmbientableNodeStructure {
10022 hasDeclareKeyword?: boolean;
10023}
10024export interface AsyncableNodeStructure {
10025 isAsync?: boolean;
10026}
10027export interface AwaitableNodeStructure {
10028 isAwaited?: boolean;
10029}
10030
10031export interface BodiedNodeStructure {
10032 bodyText?: string | WriterFunction;
10033}
10034
10035export interface BodyableNodeStructure {
10036 bodyText?: string | WriterFunction;
10037}
10038
10039export interface DecoratableNodeStructure {
10040 decorators?: DecoratorStructure[];
10041}
10042export interface ExclamationTokenableNodeStructure {
10043 hasExclamationToken?: boolean;
10044}
10045export interface ExportableNodeStructure {
10046 isExported?: boolean;
10047 isDefaultExport?: boolean;
10048}
10049
10050export interface ExtendsClauseableNodeStructure {
10051 extends?: (string | WriterFunction)[] | WriterFunction;
10052}
10053export interface GeneratorableNodeStructure {
10054 isGenerator?: boolean;
10055}
10056
10057export interface ImplementsClauseableNodeStructure {
10058 implements?: (string | WriterFunction)[] | WriterFunction;
10059}
10060
10061export interface InitializerExpressionableNodeStructure extends InitializerSetExpressionableNodeStructure {
10062}
10063
10064export interface InitializerSetExpressionableNodeStructure {
10065 initializer?: string | WriterFunction;
10066}
10067
10068export interface JSDocableNodeStructure {
10069 docs?: (JSDocStructure | string)[];
10070}
10071
10072export interface ModuledNodeStructure {
10073 imports?: ImportDeclarationStructure[];
10074 exports?: ExportDeclarationStructure[];
10075}
10076export interface BindingNamedNodeStructure {
10077 name: string;
10078}
10079export interface DeclarationNamedNodeStructure {
10080 name?: string;
10081}
10082export interface NameableNodeStructure {
10083 name?: string;
10084}
10085export interface NamedNodeStructure {
10086 name: string;
10087}
10088export interface PropertyNameableNodeStructure {
10089 name?: string;
10090}
10091export interface PropertyNamedNodeStructure {
10092 name: string;
10093}
10094
10095export interface ParameteredNodeStructure {
10096 parameters?: ParameterDeclarationStructure[];
10097}
10098export interface QuestionTokenableNodeStructure {
10099 hasQuestionToken?: boolean;
10100}
10101export interface ReadonlyableNodeStructure {
10102 isReadonly?: boolean;
10103}
10104
10105export interface ReturnTypedNodeStructure {
10106 returnType?: string | WriterFunction;
10107}
10108
10109export interface ScopeableNodeStructure {
10110 scope?: Scope;
10111}
10112
10113export interface ScopedNodeStructure {
10114 scope?: Scope;
10115}
10116
10117export interface SignaturedDeclarationStructure extends ParameteredNodeStructure, ReturnTypedNodeStructure {
10118}
10119export interface StaticableNodeStructure {
10120 isStatic?: boolean;
10121}
10122
10123export interface TypedNodeStructure {
10124 type?: string | WriterFunction;
10125}
10126
10127export interface TypeElementMemberedNodeStructure {
10128 callSignatures?: CallSignatureDeclarationStructure[];
10129 constructSignatures?: ConstructSignatureDeclarationStructure[];
10130 indexSignatures?: IndexSignatureDeclarationStructure[];
10131 methods?: MethodSignatureStructure[];
10132 properties?: PropertySignatureStructure[];
10133}
10134
10135export interface TypeParameteredNodeStructure {
10136 typeParameters?: (TypeParameterDeclarationStructure | string)[];
10137}
10138
10139export interface ClassLikeDeclarationBaseStructure extends NameableNodeStructure, ClassLikeDeclarationBaseSpecificStructure, ImplementsClauseableNodeStructure, DecoratableNodeStructure, TypeParameteredNodeStructure, JSDocableNodeStructure, AbstractableNodeStructure {
10140}
10141
10142interface ClassLikeDeclarationBaseSpecificStructure {
10143 extends?: string | WriterFunction;
10144 ctors?: ConstructorDeclarationStructure[];
10145 properties?: PropertyDeclarationStructure[];
10146 getAccessors?: GetAccessorDeclarationStructure[];
10147 setAccessors?: SetAccessorDeclarationStructure[];
10148 methods?: MethodDeclarationStructure[];
10149}
10150
10151export interface ClassDeclarationStructure extends ClassLikeDeclarationBaseStructure, ClassDeclarationSpecificStructure, AmbientableNodeStructure, ExportableNodeStructure {
10152 /**
10153 * The class name.
10154 * @remarks Can be undefined. For example: `export default class { ... }`
10155 */
10156 name?: string;
10157}
10158
10159interface ClassDeclarationSpecificStructure {
10160}
10161
10162export interface ConstructorDeclarationStructure extends ConstructorDeclarationSpecificStructure, ScopedNodeStructure, FunctionLikeDeclarationStructure, BodyableNodeStructure {
10163}
10164
10165interface ConstructorDeclarationSpecificStructure {
10166 overloads?: ConstructorDeclarationOverloadStructure[];
10167}
10168
10169export interface ConstructorDeclarationOverloadStructure extends ScopedNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure, JSDocableNodeStructure {
10170}
10171
10172export interface GetAccessorDeclarationStructure extends GetAccessorDeclarationSpecificStructure, PropertyNamedNodeStructure, StaticableNodeStructure, DecoratableNodeStructure, AbstractableNodeStructure, ScopedNodeStructure, FunctionLikeDeclarationStructure, BodyableNodeStructure {
10173}
10174
10175interface GetAccessorDeclarationSpecificStructure {
10176}
10177
10178export interface MethodDeclarationStructure extends MethodDeclarationSpecificStructure, PropertyNamedNodeStructure, StaticableNodeStructure, DecoratableNodeStructure, AbstractableNodeStructure, ScopedNodeStructure, AsyncableNodeStructure, GeneratorableNodeStructure, FunctionLikeDeclarationStructure, BodyableNodeStructure, QuestionTokenableNodeStructure {
10179}
10180
10181interface MethodDeclarationSpecificStructure {
10182 overloads?: MethodDeclarationOverloadStructure[];
10183}
10184
10185export interface MethodDeclarationOverloadStructure extends StaticableNodeStructure, AbstractableNodeStructure, ScopedNodeStructure, AsyncableNodeStructure, GeneratorableNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure, JSDocableNodeStructure, QuestionTokenableNodeStructure {
10186}
10187
10188export interface PropertyDeclarationStructure extends PropertyDeclarationSpecificStructure, PropertyNamedNodeStructure, TypedNodeStructure, QuestionTokenableNodeStructure, ExclamationTokenableNodeStructure, StaticableNodeStructure, ScopedNodeStructure, JSDocableNodeStructure, ReadonlyableNodeStructure, InitializerExpressionableNodeStructure, DecoratableNodeStructure, AbstractableNodeStructure {
10189}
10190
10191interface PropertyDeclarationSpecificStructure {
10192}
10193
10194export interface SetAccessorDeclarationStructure extends SetAccessorDeclarationSpecificStructure, PropertyNamedNodeStructure, StaticableNodeStructure, DecoratableNodeStructure, AbstractableNodeStructure, ScopedNodeStructure, FunctionLikeDeclarationStructure, BodyableNodeStructure {
10195}
10196
10197interface SetAccessorDeclarationSpecificStructure {
10198}
10199
10200export interface DecoratorStructure {
10201 name: string;
10202 /**
10203 * Arguments for a decorator factory.
10204 * @remarks Provide an empty array to make the structure a decorator factory.
10205 */
10206 arguments?: (string | WriterFunction)[] | WriterFunction;
10207 typeArguments?: string[];
10208}
10209
10210export interface JSDocStructure {
10211 description: string | WriterFunction;
10212}
10213
10214export interface ExpressionedNodeStructure {
10215 expression: string | WriterFunction;
10216}
10217
10218export interface PropertyAssignmentStructure extends PropertyAssignmentSpecificStructure, PropertyNamedNodeStructure {
10219}
10220
10221interface PropertyAssignmentSpecificStructure {
10222 initializer: string | WriterFunction;
10223}
10224
10225export interface ShorthandPropertyAssignmentStructure extends ShorthandPropertyAssignmentSpecificStructure, NamedNodeStructure {
10226}
10227
10228interface ShorthandPropertyAssignmentSpecificStructure {
10229}
10230
10231export interface SpreadAssignmentStructure extends ExpressionedNodeStructure {
10232}
10233
10234export interface EnumDeclarationStructure extends NamedNodeStructure, EnumDeclarationSpecificStructure, JSDocableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure {
10235}
10236
10237interface EnumDeclarationSpecificStructure {
10238 isConst?: boolean;
10239 members?: EnumMemberStructure[];
10240}
10241
10242export interface EnumMemberStructure extends EnumMemberSpecificStructure, PropertyNamedNodeStructure, JSDocableNodeStructure, InitializerExpressionableNodeStructure {
10243}
10244
10245interface EnumMemberSpecificStructure {
10246 value?: number | string;
10247}
10248
10249export interface FunctionDeclarationStructure extends FunctionDeclarationSpecificStructure, NameableNodeStructure, FunctionLikeDeclarationStructure, StatementedNodeStructure, AsyncableNodeStructure, GeneratorableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure, BodyableNodeStructure {
10250}
10251
10252interface FunctionDeclarationSpecificStructure {
10253 overloads?: FunctionDeclarationOverloadStructure[];
10254}
10255
10256export interface FunctionDeclarationOverloadStructure extends SignaturedDeclarationStructure, TypeParameteredNodeStructure, JSDocableNodeStructure, AsyncableNodeStructure, GeneratorableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure {
10257}
10258
10259export interface FunctionLikeDeclarationStructure extends SignaturedDeclarationStructure, TypeParameteredNodeStructure, JSDocableNodeStructure, StatementedNodeStructure {
10260}
10261
10262export interface ParameterDeclarationStructure extends DeclarationNamedNodeStructure, TypedNodeStructure, ReadonlyableNodeStructure, DecoratableNodeStructure, QuestionTokenableNodeStructure, ScopeableNodeStructure, InitializerExpressionableNodeStructure, ParameterDeclarationSpecificStructure {
10263}
10264
10265interface ParameterDeclarationSpecificStructure {
10266 isRestParameter?: boolean;
10267}
10268
10269export interface CallSignatureDeclarationStructure extends CallSignatureDeclarationSpecificStructure, JSDocableNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure {
10270}
10271
10272interface CallSignatureDeclarationSpecificStructure {
10273}
10274
10275export interface ConstructSignatureDeclarationStructure extends ConstructSignatureDeclarationSpecificStructure, JSDocableNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure {
10276}
10277
10278interface ConstructSignatureDeclarationSpecificStructure {
10279}
10280
10281export interface IndexSignatureDeclarationStructure extends IndexSignatureDeclarationSpecificStructure, JSDocableNodeStructure, ReadonlyableNodeStructure, ReturnTypedNodeStructure {
10282}
10283
10284interface IndexSignatureDeclarationSpecificStructure {
10285 keyName?: string;
10286 keyType?: string;
10287}
10288
10289export interface InterfaceDeclarationStructure extends NamedNodeStructure, InterfaceDeclarationSpecificStructure, ExtendsClauseableNodeStructure, TypeParameteredNodeStructure, JSDocableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure, TypeElementMemberedNodeStructure {
10290}
10291
10292interface InterfaceDeclarationSpecificStructure {
10293}
10294
10295export interface MethodSignatureStructure extends PropertyNamedNodeStructure, MethodSignatureSpecificStructure, QuestionTokenableNodeStructure, JSDocableNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure {
10296}
10297
10298interface MethodSignatureSpecificStructure {
10299}
10300
10301export interface PropertySignatureStructure extends PropertySignatureSpecificStructure, PropertyNamedNodeStructure, TypedNodeStructure, QuestionTokenableNodeStructure, JSDocableNodeStructure, ReadonlyableNodeStructure, InitializerExpressionableNodeStructure {
10302}
10303
10304interface PropertySignatureSpecificStructure {
10305}
10306
10307export interface JsxAttributeStructure extends JsxAttributeSpecificStructure, NamedNodeStructure {
10308}
10309
10310interface JsxAttributeSpecificStructure {
10311 isSpreadAttribute?: false;
10312 initializer?: string;
10313}
10314
10315export interface JsxElementStructure {
10316 name: string;
10317 attributes?: (JsxAttributeStructure | JsxSpreadAttributeStructure)[];
10318 isSelfClosing?: boolean;
10319 children?: JsxElementStructure[];
10320 bodyText?: string;
10321}
10322export interface JsxSpreadAttributeStructure {
10323 isSpreadAttribute: true;
10324 expression: string;
10325}
10326
10327export interface ExportAssignmentStructure {
10328 isExportEquals?: boolean;
10329 expression: string | WriterFunction;
10330}
10331
10332export interface ExportDeclarationStructure {
10333 namedExports?: (string | ExportSpecifierStructure | WriterFunction)[] | WriterFunction;
10334 moduleSpecifier?: string;
10335}
10336export interface ExportSpecifierStructure {
10337 name: string;
10338 alias?: string;
10339}
10340
10341export interface ImportDeclarationStructure {
10342 defaultImport?: string;
10343 namespaceImport?: string;
10344 namedImports?: (ImportSpecifierStructure | string | WriterFunction)[] | WriterFunction;
10345 moduleSpecifier: string;
10346}
10347export interface ImportSpecifierStructure {
10348 name: string;
10349 alias?: string;
10350}
10351
10352export interface NamespaceDeclarationStructure extends NamedNodeStructure, NamespaceDeclarationSpecificStructure, JSDocableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure, StatementedNodeStructure, BodiedNodeStructure, ModuledNodeStructure {
10353}
10354
10355interface NamespaceDeclarationSpecificStructure {
10356 /**
10357 * The namespace declaration kind.
10358 *
10359 * @remarks Defaults to "namespace".
10360 */
10361 declarationKind?: NamespaceDeclarationKind;
10362}
10363
10364export interface SourceFileStructure extends SourceFileSpecificStructure, StatementedNodeStructure, ModuledNodeStructure {
10365 bodyText?: string | WriterFunction;
10366}
10367
10368interface SourceFileSpecificStructure {
10369}
10370
10371export interface StatementedNodeStructure {
10372 classes?: ClassDeclarationStructure[];
10373 enums?: EnumDeclarationStructure[];
10374 functions?: FunctionDeclarationStructure[];
10375 interfaces?: InterfaceDeclarationStructure[];
10376 namespaces?: NamespaceDeclarationStructure[];
10377 typeAliases?: TypeAliasDeclarationStructure[];
10378}
10379
10380export interface VariableDeclarationListStructure extends VariableDeclarationListSpecificStructure {
10381}
10382
10383interface VariableDeclarationListSpecificStructure {
10384 declarationKind?: VariableDeclarationKind;
10385 declarations: VariableDeclarationStructure[];
10386}
10387
10388export interface VariableDeclarationStructure extends VariableDeclarationSpecificStructure, BindingNamedNodeStructure, InitializerExpressionableNodeStructure, TypedNodeStructure, ExclamationTokenableNodeStructure {
10389}
10390
10391interface VariableDeclarationSpecificStructure {
10392}
10393
10394export interface VariableStatementStructure extends VariableStatementSpecificStructure, JSDocableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure {
10395}
10396
10397interface VariableStatementSpecificStructure {
10398 declarationKind?: VariableDeclarationKind;
10399 declarations: VariableDeclarationStructure[];
10400}
10401
10402export interface TypeAliasDeclarationStructure extends TypeAliasDeclarationSpecificStructure, NamedNodeStructure, TypedNodeStructure, TypeParameteredNodeStructure, JSDocableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure {
10403 type: string | WriterFunction;
10404}
10405
10406interface TypeAliasDeclarationSpecificStructure {
10407 type: string | WriterFunction;
10408}
10409
10410export interface TypeParameterDeclarationStructure extends TypeParameterDeclarationSpecificStructure, NamedNodeStructure {
10411}
10412
10413interface TypeParameterDeclarationSpecificStructure {
10414 constraint?: string | WriterFunction;
10415 default?: string | WriterFunction;
10416}
10417
10418export { ts, SyntaxKind, CompilerOptions, EmitHint, ScriptKind, NewLineKind, LanguageVariant, ScriptTarget, TypeFlags, ObjectFlags, SymbolFlags, TypeFormatFlags, DiagnosticCategory, EditorSettings, ModuleResolutionKind };
10419export * from "./code-block-writer";
10420
10421/** @deprecated Use the named export "Project" */
10422export default Project;