ts-morph-common.d.ts 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081
  1. import { ts } from "./typescript";
  2. export interface CompilerOptionsFromTsConfigOptions {
  3. encoding?: string;
  4. fileSystem?: FileSystemHost;
  5. }
  6. export interface CompilerOptionsFromTsConfigResult {
  7. options: ts.CompilerOptions;
  8. errors: ts.Diagnostic[];
  9. }
  10. /**
  11. * Gets the compiler options from a specified tsconfig.json
  12. * @param filePath - File path to the tsconfig.json.
  13. * @param options - Options.
  14. */
  15. export declare function getCompilerOptionsFromTsConfig(filePath: string, options?: CompilerOptionsFromTsConfigOptions): CompilerOptionsFromTsConfigResult;
  16. export declare class TsConfigResolver {
  17. #private;
  18. constructor(fileSystem: TransactionalFileSystem, tsConfigFilePath: StandardizedFilePath, encoding: string);
  19. getCompilerOptions(): ts.CompilerOptions;
  20. getErrors(): ts.Diagnostic[];
  21. getPaths(compilerOptions?: ts.CompilerOptions): {
  22. filePaths: StandardizedFilePath[];
  23. directoryPaths: StandardizedFilePath[];
  24. };
  25. private _parseJsonConfigFileContent;
  26. }
  27. /**
  28. * Helper around a Map.
  29. * @remarks The use of this class is historical as it served as an abstraction around an ES5 based map and ES6, if available. Eventually
  30. * this class should be removed in favour of helper functions around a Map.
  31. */
  32. export declare class KeyValueCache<T, U> {
  33. #private;
  34. getSize(): number;
  35. getValues(): IterableIterator<U>;
  36. getValuesAsArray(): U[];
  37. getKeys(): IterableIterator<T>;
  38. getEntries(): IterableIterator<[T, U]>;
  39. getOrCreate<TCreate extends U = U>(key: T, createFunc: () => TCreate): TCreate;
  40. has(key: T): boolean;
  41. get(key: T): U | undefined;
  42. set(key: T, value: U): void;
  43. replaceKey(key: T, newKey: T): void;
  44. removeByKey(key: T): void;
  45. clear(): void;
  46. }
  47. /**
  48. * An array where the values are sorted by a key of one of the values.
  49. */
  50. export declare class SortedKeyValueArray<TKey, TValue> {
  51. #private;
  52. constructor(getKey: (value: TValue) => TKey, comparer: Comparer<TKey>);
  53. set(value: TValue): void;
  54. removeByValue(value: TValue): void;
  55. removeByKey(key: TKey): void;
  56. getArrayCopy(): TValue[];
  57. hasItems(): boolean;
  58. entries(): Generator<TValue, void, undefined>;
  59. }
  60. /**
  61. * A wrapper around WeakMap.
  62. * @remarks The use of this class is historical as it served as an abstraction around an ES5 based weak map and ES6, if available. Eventually
  63. * this class should be removed in favour of helper functions around a WeakMap.
  64. */
  65. export declare class WeakCache<T extends object, U> {
  66. #private;
  67. getOrCreate<TCreate extends U = U>(key: T, createFunc: () => TCreate): TCreate;
  68. has(key: T): boolean;
  69. get(key: T): U | undefined;
  70. set(key: T, value: U): void;
  71. removeByKey(key: T): void;
  72. }
  73. /**
  74. * Compares two values specifying the sort order.
  75. */
  76. export interface Comparer<T> {
  77. /**
  78. * Checks the two items returning -1 if `a` preceeds, 0 if equal, and 1 if `a` follows.
  79. * @param a - Item to use.
  80. * @param b - Item to compare with.
  81. */
  82. compareTo(a: T, b: T): number;
  83. }
  84. /**
  85. * Converts a comparer to a stored comparer.
  86. */
  87. export declare class ComparerToStoredComparer<T> implements StoredComparer<T> {
  88. #private;
  89. /**
  90. * Constructor.
  91. * @param comparer - Comparer to use.
  92. * @param storedValue - Stored value to use as the value to always compare the input of `compareTo` to.
  93. */
  94. constructor(comparer: Comparer<T>, storedValue: T);
  95. /** @inheritdoc */
  96. compareTo(value: T): number;
  97. }
  98. /**
  99. * Compares two strings by en-us-u-kf-upper locale.
  100. */
  101. export declare class LocaleStringComparer implements Comparer<string> {
  102. /** Static instance for reuse. */
  103. static readonly instance: LocaleStringComparer;
  104. /** @inheritdoc */
  105. compareTo(a: string, b: string): 0 | 1 | -1;
  106. }
  107. /**
  108. * Compares two values based on one of their properties.
  109. */
  110. export declare class PropertyComparer<TValue, TProperty> implements Comparer<TValue> {
  111. #private;
  112. /**
  113. * Constructor.
  114. * @param getProperty - Gets the property from the value to use for comparisons.
  115. * @param comparer - Comparer to compare the properties with.
  116. */
  117. constructor(getProperty: (value: TValue) => TProperty, comparer: Comparer<TProperty>);
  118. /** @inheritdoc */
  119. compareTo(a: TValue, b: TValue): number;
  120. }
  121. /**
  122. * A stored comparer that compares a property to a stored value.
  123. */
  124. export declare class PropertyStoredComparer<TValue, TProperty> implements StoredComparer<TValue> {
  125. #private;
  126. /**
  127. * Constructor.
  128. * @param getProperty - Gets the property from the value.
  129. * @param comparer - Comparer to compare the property with.
  130. */
  131. constructor(getProperty: (value: TValue) => TProperty, comparer: StoredComparer<TProperty>);
  132. /** @inheritdoc */
  133. compareTo(value: TValue): number;
  134. }
  135. /**
  136. * Compares a value against a stored value.
  137. */
  138. export interface StoredComparer<T> {
  139. /**
  140. * Checks the value against a stored value returning -1 if the stored value preceeds, 0 if the value is equal, and 1 if follows.
  141. * @param value - Value to compare.
  142. */
  143. compareTo(value: T): number;
  144. }
  145. /**
  146. * Creates a language service host and compiler host.
  147. * @param options - Options for creating the hosts.
  148. */
  149. export declare function createHosts(options: CreateHostsOptions): {
  150. languageServiceHost: ts.LanguageServiceHost;
  151. compilerHost: ts.CompilerHost;
  152. };
  153. /**
  154. * Options for creating the hosts.
  155. */
  156. export interface CreateHostsOptions {
  157. /** The transactional file system to use. */
  158. transactionalFileSystem: TransactionalFileSystem;
  159. /** Container of source files to use. */
  160. sourceFileContainer: TsSourceFileContainer;
  161. /** Compiler options container to use. */
  162. compilerOptions: CompilerOptionsContainer;
  163. /** Newline kind to use. */
  164. getNewLine: () => "\r\n" | "\n";
  165. /** The resolution host used for resolving modules and type reference directives. */
  166. resolutionHost: ResolutionHost;
  167. /** Provides the current project version to be used to tell if source files have
  168. * changed. Provide this for a performance improvement. */
  169. getProjectVersion?: () => string;
  170. isKnownTypesPackageName?: ts.LanguageServiceHost["isKnownTypesPackageName"];
  171. /**
  172. * Set this to true to not load the typescript lib files.
  173. * @default false
  174. */
  175. skipLoadingLibFiles?: boolean;
  176. /**
  177. * Specify this to use a custom folder to load the lib files from.
  178. * @remarks skipLoadingLibFiles cannot be explicitly false if this is set.
  179. */
  180. libFolderPath?: string;
  181. }
  182. /**
  183. * Creates a module resolution host based on the provided options.
  184. * @param options - Options for creating the module resolution host.
  185. */
  186. export declare function createModuleResolutionHost(options: CreateModuleResolutionHostOptions): ts.ModuleResolutionHost;
  187. /**
  188. * Options for creating a module resolution host.
  189. */
  190. export interface CreateModuleResolutionHostOptions {
  191. /** The transactional file system to use. */
  192. transactionalFileSystem: TransactionalFileSystem;
  193. /** The source file container to use. */
  194. sourceFileContainer: TsSourceFileContainer;
  195. /** Gets the encoding to use. */
  196. getEncoding(): string;
  197. }
  198. /**
  199. * An implementation of a ts.DocumentRegistry that uses a transactional file system.
  200. */
  201. export declare class DocumentRegistry implements ts.DocumentRegistry {
  202. #private;
  203. /**
  204. * Constructor.
  205. * @param transactionalFileSystem - The transaction file system to use.
  206. */
  207. constructor(transactionalFileSystem: TransactionalFileSystem);
  208. /**
  209. * Creates or updates a source file in the document registry.
  210. * @param fileName - File name to create or update.
  211. * @param compilationSettings - Compiler options to use.
  212. * @param scriptSnapshot - Script snapshot (text) of the file.
  213. * @param scriptKind - Script kind of the file.
  214. */
  215. createOrUpdateSourceFile(fileName: StandardizedFilePath, compilationSettings: ts.CompilerOptions, scriptSnapshot: ts.IScriptSnapshot, scriptKind: ts.ScriptKind | undefined): ts.SourceFile;
  216. /**
  217. * Removes the source file from the document registry.
  218. * @param fileName - File name to remove.
  219. */
  220. removeSourceFile(fileName: StandardizedFilePath): void;
  221. /** @inheritdoc */
  222. acquireDocument(fileName: string, compilationSettings: ts.CompilerOptions, scriptSnapshot: ts.IScriptSnapshot, version: string, scriptKind: ts.ScriptKind | undefined): ts.SourceFile;
  223. /** @inheritdoc */
  224. acquireDocumentWithKey(fileName: string, path: ts.Path, compilationSettings: ts.CompilerOptions, key: ts.DocumentRegistryBucketKey, scriptSnapshot: ts.IScriptSnapshot, version: string, scriptKind: ts.ScriptKind | undefined): ts.SourceFile;
  225. /** @inheritdoc */
  226. updateDocument(fileName: string, compilationSettings: ts.CompilerOptions, scriptSnapshot: ts.IScriptSnapshot, version: string, scriptKind: ts.ScriptKind | undefined): ts.SourceFile;
  227. /** @inheritdoc */
  228. updateDocumentWithKey(fileName: string, path: ts.Path, compilationSettings: ts.CompilerOptions, key: ts.DocumentRegistryBucketKey, scriptSnapshot: ts.IScriptSnapshot, version: string, scriptKind: ts.ScriptKind | undefined): ts.SourceFile;
  229. /** @inheritdoc */
  230. getKeyForCompilationSettings(settings: ts.CompilerOptions): ts.DocumentRegistryBucketKey;
  231. /** @inheritdoc */
  232. releaseDocument(fileName: string, compilationSettings: ts.CompilerOptions): void;
  233. /** @inheritdoc */
  234. releaseDocumentWithKey(path: ts.Path, key: ts.DocumentRegistryBucketKey): void;
  235. /** @inheritdoc */
  236. reportStats(): string;
  237. /** @inheritdoc */
  238. getSourceFileVersion(sourceFile: ts.SourceFile): string;
  239. }
  240. /** Host for implementing custom module and/or type reference directive resolution. */
  241. export interface ResolutionHost {
  242. resolveModuleNames?: ts.LanguageServiceHost["resolveModuleNames"];
  243. getResolvedModuleWithFailedLookupLocationsFromCache?: ts.LanguageServiceHost["getResolvedModuleWithFailedLookupLocationsFromCache"];
  244. resolveTypeReferenceDirectives?: ts.LanguageServiceHost["resolveTypeReferenceDirectives"];
  245. }
  246. /**
  247. * Factory used to create a resolution host.
  248. * @remarks The compiler options are retrieved via a function in order to get the project's current compiler options.
  249. */
  250. export type ResolutionHostFactory = (moduleResolutionHost: ts.ModuleResolutionHost, getCompilerOptions: () => ts.CompilerOptions) => ResolutionHost;
  251. /** Collection of reusable resolution hosts. */
  252. export declare const ResolutionHosts: {
  253. deno: ResolutionHostFactory;
  254. };
  255. /**
  256. * A container of source files.
  257. */
  258. export interface TsSourceFileContainer {
  259. /**
  260. * Gets if a source file exists at the specified file path.
  261. * @param filePath - File path to check.
  262. */
  263. containsSourceFileAtPath(filePath: StandardizedFilePath): boolean;
  264. /**
  265. * Gets the source file paths of all the source files in the container.
  266. */
  267. getSourceFilePaths(): Iterable<StandardizedFilePath>;
  268. /**
  269. * Gets a source file from a file path, but only if it exists in the container's cache.
  270. * @param filePath - File path to get the source file from.
  271. */
  272. getSourceFileFromCacheFromFilePath(filePath: StandardizedFilePath): ts.SourceFile | undefined;
  273. /**
  274. * Asynchronously adds or gets a source file from a file path.
  275. * @param filePath - File path to get.
  276. * @param opts - Options for adding or getting the file.
  277. */
  278. addOrGetSourceFileFromFilePath(filePath: StandardizedFilePath, opts: {
  279. markInProject: boolean;
  280. scriptKind: ts.ScriptKind | undefined;
  281. }): Promise<ts.SourceFile | undefined>;
  282. /**
  283. * Synchronously adds or gets a source file from a file path.
  284. * @param filePath - File path to get.
  285. * @param opts - Options for adding or getting the file.
  286. */
  287. addOrGetSourceFileFromFilePathSync(filePath: StandardizedFilePath, opts: {
  288. markInProject: boolean;
  289. scriptKind: ts.ScriptKind | undefined;
  290. }): ts.SourceFile | undefined;
  291. /**
  292. * Gets the source file version of the specified source file.
  293. * @param sourceFile - Source file to inspect.
  294. */
  295. getSourceFileVersion(sourceFile: ts.SourceFile): string;
  296. /**
  297. * Gets if the container contains the specified directory.
  298. * @param dirPath - Path of the directory to check.
  299. */
  300. containsDirectoryAtPath(dirPath: StandardizedFilePath): boolean;
  301. /**
  302. * Gets the child directories of the specified directory.
  303. * @param dirPath - Path of the directory to check.
  304. */
  305. getChildDirectoriesOfDirectory(dirPath: StandardizedFilePath): StandardizedFilePath[];
  306. }
  307. /** Decorator for memoizing the result of a method or get accessor. */
  308. export declare function Memoize(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<any>): void;
  309. /** Collection of helper functions that can be used to throw errors. */
  310. export declare namespace errors {
  311. /**
  312. * Minimal attributes to show a error message with the node source.
  313. */
  314. interface Node {
  315. getSourceFile(): {
  316. getFilePath(): StandardizedFilePath;
  317. getFullText(): string;
  318. };
  319. getStart(): number;
  320. }
  321. /** Base error class. */
  322. abstract class BaseError extends Error {
  323. protected constructor();
  324. }
  325. /** Thrown when there is a problem with a provided argument. */
  326. class ArgumentError extends BaseError {
  327. constructor(argName: string, message: string, node?: Node);
  328. }
  329. /** Thrown when an argument is null or whitespace. */
  330. class ArgumentNullOrWhitespaceError extends ArgumentError {
  331. constructor(argName: string, node?: Node);
  332. }
  333. /** Thrown when an argument is out of range. */
  334. class ArgumentOutOfRangeError extends ArgumentError {
  335. constructor(argName: string, value: number, range: [number, number], node?: Node);
  336. }
  337. /** Thrown when an argument does not match an expected type. */
  338. class ArgumentTypeError extends ArgumentError {
  339. constructor(argName: string, expectedType: string, actualType: string, node?: Node);
  340. }
  341. /** Thrown when a file or directory path was not found. */
  342. class PathNotFoundError extends BaseError {
  343. readonly path: StandardizedFilePath;
  344. constructor(path: StandardizedFilePath, prefix?: string);
  345. readonly code: "ENOENT";
  346. }
  347. /** Thrown when a directory was not found. */
  348. class DirectoryNotFoundError extends PathNotFoundError {
  349. constructor(dirPath: StandardizedFilePath);
  350. }
  351. /** Thrown when a file was not found. */
  352. class FileNotFoundError extends PathNotFoundError {
  353. constructor(filePath: StandardizedFilePath);
  354. }
  355. /** Thrown when an action was taken that is not allowed. */
  356. class InvalidOperationError extends BaseError {
  357. constructor(message: string, node?: Node);
  358. }
  359. /** Thrown when a certain behaviour or feature has not been implemented. */
  360. class NotImplementedError extends BaseError {
  361. constructor(message?: string, node?: Node);
  362. }
  363. /** Thrown when an operation is not supported. */
  364. class NotSupportedError extends BaseError {
  365. constructor(message: string);
  366. }
  367. /**
  368. * Thows if not a type.
  369. * @param value - Value to check the type of.
  370. * @param expectedType - Expected type.
  371. * @param argName - Argument name.
  372. */
  373. function throwIfNotType(value: any, expectedType: string, argName: string): void;
  374. /**
  375. * Throws if the value is not a string.
  376. * @param value - Value to check.
  377. * @param argName - Arg name.
  378. */
  379. function throwIfNotString(value: string, argName: string): void;
  380. /**
  381. * Throws if the value is not a string or is whitespace.
  382. * @param value - Value to check.
  383. * @param argName - Arg name.
  384. */
  385. function throwIfWhitespaceOrNotString(value: string, argName: string): void;
  386. /**
  387. * Throws an ArgumentOutOfRangeError if an argument's value is out of an inclusive range.
  388. * @param value - Value.
  389. * @param range - Range.
  390. * @param argName - Argument name.
  391. */
  392. function throwIfOutOfRange(value: number, range: [number, number], argName: string): void;
  393. /**
  394. * Throws an ArgumentOutOfRangeError if an argument's range value is out of an inclusive range.
  395. *
  396. * Also throws when the start of the range is greater than the end.
  397. * @param actualRange - Range to check.
  398. * @param range - Range to check against.
  399. * @param argName - Argument name.
  400. */
  401. function throwIfRangeOutOfRange(actualRange: [number, number], range: [number, number], argName: string): void;
  402. /**
  403. * Gets an error saying that a feature is not implemented for a certain syntax kind.
  404. * @param kind - Syntax kind that isn't implemented.
  405. */
  406. function throwNotImplementedForSyntaxKindError(kind: ts.SyntaxKind, node?: Node): never;
  407. /**
  408. * Throws an Argument
  409. * @param value
  410. * @param argName
  411. */
  412. function throwIfNegative(value: number, argName: string): void;
  413. /**
  414. * Throws when the value is null or undefined.
  415. * @param value - Value to check.
  416. * @param errorMessage - Error message to throw when not defined.
  417. */
  418. function throwIfNullOrUndefined<T>(value: T | undefined, errorMessage: string | (() => string), node?: Node): T;
  419. /**
  420. * Throw if the value should have been the never type.
  421. * @param value - Value to check.
  422. */
  423. function throwNotImplementedForNeverValueError(value: never, sourceNode?: Node): never;
  424. /**
  425. * Throws an error if the actual value does not equal the expected value.
  426. * @param actual - Actual value.
  427. * @param expected - Expected value.
  428. * @param description - Message to show in the error. Should be a full sentence that doesn't include the actual and expected values.
  429. */
  430. function throwIfNotEqual<T>(actual: T, expected: T, description: string): void;
  431. /**
  432. * Throws if true.
  433. * @param value - Value to check.
  434. * @param errorMessage - Error message to throw when true.
  435. */
  436. function throwIfTrue(value: boolean | undefined, errorMessage: string): void;
  437. }
  438. /**
  439. * Represents a file system that can be interacted with.
  440. */
  441. export interface FileSystemHost {
  442. /** Gets if this file system is case sensitive. */
  443. isCaseSensitive(): boolean;
  444. /** Asynchronously deletes the specified file or directory. */
  445. delete(path: string): Promise<void>;
  446. /** Synchronously deletes the specified file or directory */
  447. deleteSync(path: string): void;
  448. /**
  449. * Reads all the child directories and files.
  450. * @remarks Implementers should have this return the full file path.
  451. */
  452. readDirSync(dirPath: string): RuntimeDirEntry[];
  453. /** Asynchronously reads a file at the specified path. */
  454. readFile(filePath: string, encoding?: string): Promise<string>;
  455. /** Synchronously reads a file at the specified path. */
  456. readFileSync(filePath: string, encoding?: string): string;
  457. /** Asynchronously writes a file to the file system. */
  458. writeFile(filePath: string, fileText: string): Promise<void>;
  459. /** Synchronously writes a file to the file system. */
  460. writeFileSync(filePath: string, fileText: string): void;
  461. /** Asynchronously creates a directory at the specified path. */
  462. mkdir(dirPath: string): Promise<void>;
  463. /** Synchronously creates a directory at the specified path. */
  464. mkdirSync(dirPath: string): void;
  465. /** Asynchronously moves a file or directory. */
  466. move(srcPath: string, destPath: string): Promise<void>;
  467. /** Synchronously moves a file or directory. */
  468. moveSync(srcPath: string, destPath: string): void;
  469. /** Asynchronously copies a file or directory. */
  470. copy(srcPath: string, destPath: string): Promise<void>;
  471. /** Synchronously copies a file or directory. */
  472. copySync(srcPath: string, destPath: string): void;
  473. /** Asynchronously checks if a file exists.
  474. * @remarks Implementers should throw an `errors.FileNotFoundError` when it does not exist.
  475. */
  476. fileExists(filePath: string): Promise<boolean>;
  477. /** Synchronously checks if a file exists.
  478. * @remarks Implementers should throw an `errors.FileNotFoundError` when it does not exist.
  479. */
  480. fileExistsSync(filePath: string): boolean;
  481. /** Asynchronously checks if a directory exists. */
  482. directoryExists(dirPath: string): Promise<boolean>;
  483. /** Synchronously checks if a directory exists. */
  484. directoryExistsSync(dirPath: string): boolean;
  485. /** See https://nodejs.org/api/fs.html#fs_fs_realpathsync_path_options */
  486. realpathSync(path: string): string;
  487. /** Gets the current directory of the environment. */
  488. getCurrentDirectory(): string;
  489. /** Uses pattern matching to find files or directories. */
  490. glob(patterns: ReadonlyArray<string>): Promise<string[]>;
  491. /** Synchronously uses pattern matching to find files or directories. */
  492. globSync(patterns: ReadonlyArray<string>): string[];
  493. }
  494. /** Utilities for working with files. */
  495. export declare class FileUtils {
  496. #private;
  497. static readonly ENOENT = "ENOENT";
  498. private constructor();
  499. /**
  500. * Gets if the error is a file not found or directory not found error.
  501. * @param err - Error to check.
  502. */
  503. static isNotExistsError(err: any): boolean;
  504. /**
  505. * Joins the paths.
  506. * @param paths - Paths to join.
  507. */
  508. static pathJoin<T extends string>(basePath: T, ...paths: string[]): T;
  509. /**
  510. * Gets if the path is absolute.
  511. * @param fileOrDirPath - File or directory path.
  512. */
  513. static pathIsAbsolute(fileOrDirPath: string): boolean;
  514. /**
  515. * Gets the standardized absolute path.
  516. * @param fileSystem - File system.
  517. * @param fileOrDirPath - Path to standardize.
  518. * @param relativeBase - Base path to be relative from.
  519. */
  520. static getStandardizedAbsolutePath(fileSystem: FileSystemHost, fileOrDirPath: string, relativeBase?: string): StandardizedFilePath;
  521. /**
  522. * Gets the directory path.
  523. * @param fileOrDirPath - Path to get the directory name from.
  524. */
  525. static getDirPath<T extends string>(fileOrDirPath: T): T;
  526. /**
  527. * Gets the last portion of the path.
  528. * @param fileOrDirPath - Path to get the base name from.
  529. */
  530. static getBaseName(fileOrDirPath: StandardizedFilePath): string;
  531. /**
  532. * Gets the extension of the file name.
  533. * @param fileOrDirPath - Path to get the extension from.
  534. */
  535. static getExtension(fileOrDirPath: StandardizedFilePath): string;
  536. /**
  537. * Changes all back slashes to forward slashes.
  538. * @param fileOrDirPath - Path.
  539. */
  540. static standardizeSlashes<T extends string>(fileOrDirPath: T): T;
  541. /**
  542. * Checks if a path ends with a specified search path.
  543. * @param fileOrDirPath - Path.
  544. * @param endsWithPath - Ends with path.
  545. */
  546. static pathEndsWith(fileOrDirPath: string | undefined, endsWithPath: string | undefined): boolean;
  547. /**
  548. * Checks if a path starts with a specified search path.
  549. * @param fileOrDirPath - Path.
  550. * @param startsWithPath - Starts with path.
  551. */
  552. static pathStartsWith(fileOrDirPath: string | undefined, startsWithPath: string | undefined): boolean;
  553. /**
  554. * Gets the parent most paths out of the list of paths.
  555. * @param paths - File or directory paths.
  556. */
  557. static getParentMostPaths(paths: StandardizedFilePath[]): StandardizedFilePath[];
  558. /**
  559. * Reads a file or returns false if the file doesn't exist.
  560. * @param fileSystem - File System.
  561. * @param filePath - Path to file.
  562. * @param encoding - File encoding.
  563. */
  564. static readFileOrNotExists(fileSystem: FileSystemHost, filePath: StandardizedFilePath, encoding: string): Promise<string | false>;
  565. /**
  566. * Reads a file synchronously or returns false if the file doesn't exist.
  567. * @param fileSystem - File System.
  568. * @param filePath - Path to file.
  569. * @param encoding - File encoding.
  570. */
  571. static readFileOrNotExistsSync(fileSystem: FileSystemHost, filePath: StandardizedFilePath, encoding: string): string | false;
  572. /**
  573. * Gets the text with a byte order mark.
  574. * @param text - Text.
  575. */
  576. static getTextWithByteOrderMark(text: string): string;
  577. /**
  578. * Gets the relative path from one absolute path to another.
  579. * @param absoluteDirPathFrom - Absolute directory path from.
  580. * @param absolutePathTo - Absolute path to.
  581. */
  582. static getRelativePathTo(absoluteDirPathFrom: StandardizedFilePath, absolutePathTo: StandardizedFilePath): StandardizedFilePath;
  583. /**
  584. * Gets if the path is for the root directory.
  585. * @param path - Path.
  586. */
  587. static isRootDirPath(dirOrFilePath: string): boolean;
  588. /**
  589. * Gets the descendant directories of the specified directory.
  590. * @param dirPath - Directory path.
  591. */
  592. static getDescendantDirectories(fileSystemWrapper: TransactionalFileSystem, dirPath: StandardizedFilePath): IterableIterator<StandardizedFilePath>;
  593. /**
  594. * Gets the glob as absolute.
  595. * @param glob - Glob.
  596. * @param cwd - Current working directory.
  597. */
  598. static toAbsoluteGlob(glob: string, cwd: string): string;
  599. /**
  600. * Gets if the glob is a negated glob.
  601. * @param glob - Glob.
  602. */
  603. static isNegatedGlob(glob: string): boolean;
  604. }
  605. /** An implementation of a file system that exists in memory only. */
  606. export declare class InMemoryFileSystemHost implements FileSystemHost {
  607. #private;
  608. /**
  609. * Constructor.
  610. */
  611. constructor();
  612. /** @inheritdoc */
  613. isCaseSensitive(): boolean;
  614. /** @inheritdoc */
  615. delete(path: string): Promise<void>;
  616. /** @inheritdoc */
  617. deleteSync(path: string): void;
  618. /** @inheritdoc */
  619. readDirSync(dirPath: string): RuntimeDirEntry[];
  620. /** @inheritdoc */
  621. readFile(filePath: string, encoding?: string): Promise<string>;
  622. /** @inheritdoc */
  623. readFileSync(filePath: string, encoding?: string): string;
  624. /** @inheritdoc */
  625. writeFile(filePath: string, fileText: string): Promise<void>;
  626. /** @inheritdoc */
  627. writeFileSync(filePath: string, fileText: string): void;
  628. /** @inheritdoc */
  629. mkdir(dirPath: string): Promise<void>;
  630. /** @inheritdoc */
  631. mkdirSync(dirPath: string): void;
  632. /** @inheritdoc */
  633. move(srcPath: string, destPath: string): Promise<void>;
  634. /** @inheritdoc */
  635. moveSync(srcPath: string, destPath: string): void;
  636. /** @inheritdoc */
  637. copy(srcPath: string, destPath: string): Promise<void>;
  638. /** @inheritdoc */
  639. copySync(srcPath: string, destPath: string): void;
  640. /** @inheritdoc */
  641. fileExists(filePath: string): Promise<boolean>;
  642. /** @inheritdoc */
  643. fileExistsSync(filePath: string): boolean;
  644. /** @inheritdoc */
  645. directoryExists(dirPath: string): Promise<boolean>;
  646. /** @inheritdoc */
  647. directoryExistsSync(dirPath: string): boolean;
  648. /** @inheritdoc */
  649. realpathSync(path: string): string;
  650. /** @inheritdoc */
  651. getCurrentDirectory(): string;
  652. /** @inheritdoc */
  653. glob(patterns: ReadonlyArray<string>): Promise<string[]>;
  654. /** @inheritdoc */
  655. globSync(patterns: ReadonlyArray<string>): string[];
  656. }
  657. /** Checks the specified file paths to see if the match any of the specified patterns. */
  658. export declare function matchGlobs(paths: ReadonlyArray<string>, patterns: string | ReadonlyArray<string>, cwd: string): string[];
  659. /** An implementation of a file host that interacts with the actual file system. */
  660. export declare class RealFileSystemHost implements FileSystemHost {
  661. #private;
  662. /** @inheritdoc */
  663. delete(path: string): Promise<void>;
  664. /** @inheritdoc */
  665. deleteSync(path: string): void;
  666. /** @inheritdoc */
  667. readDirSync(dirPath: string): RuntimeDirEntry[];
  668. /** @inheritdoc */
  669. readFile(filePath: string, encoding?: string): Promise<string>;
  670. /** @inheritdoc */
  671. readFileSync(filePath: string, encoding?: string): string;
  672. /** @inheritdoc */
  673. writeFile(filePath: string, fileText: string): Promise<void>;
  674. /** @inheritdoc */
  675. writeFileSync(filePath: string, fileText: string): void;
  676. /** @inheritdoc */
  677. mkdir(dirPath: string): Promise<void>;
  678. /** @inheritdoc */
  679. mkdirSync(dirPath: string): void;
  680. /** @inheritdoc */
  681. move(srcPath: string, destPath: string): Promise<void>;
  682. /** @inheritdoc */
  683. moveSync(srcPath: string, destPath: string): void;
  684. /** @inheritdoc */
  685. copy(srcPath: string, destPath: string): Promise<void>;
  686. /** @inheritdoc */
  687. copySync(srcPath: string, destPath: string): void;
  688. /** @inheritdoc */
  689. fileExists(filePath: string): Promise<boolean>;
  690. /** @inheritdoc */
  691. fileExistsSync(filePath: string): boolean;
  692. /** @inheritdoc */
  693. directoryExists(dirPath: string): Promise<boolean>;
  694. /** @inheritdoc */
  695. directoryExistsSync(dirPath: string): boolean;
  696. /** @inheritdoc */
  697. realpathSync(path: string): string;
  698. /** @inheritdoc */
  699. getCurrentDirectory(): string;
  700. /** @inheritdoc */
  701. glob(patterns: ReadonlyArray<string>): Promise<string[]>;
  702. /** @inheritdoc */
  703. globSync(patterns: ReadonlyArray<string>): string[];
  704. /** @inheritdoc */
  705. isCaseSensitive(): boolean;
  706. }
  707. /** Nominal type to denote a file path that has been standardized. */
  708. export type StandardizedFilePath = string & {
  709. _standardizedFilePathBrand: undefined;
  710. };
  711. export interface DirEntry {
  712. path: StandardizedFilePath;
  713. isFile: boolean;
  714. isDirectory: boolean;
  715. isSymlink: boolean;
  716. }
  717. export interface TransactionalFileSystemOptions {
  718. fileSystem: FileSystemHost;
  719. skipLoadingLibFiles: boolean | undefined;
  720. libFolderPath: string | undefined;
  721. }
  722. /**
  723. * FileSystemHost wrapper that allows transactionally queuing operations to the file system.
  724. */
  725. export declare class TransactionalFileSystem {
  726. #private;
  727. /**
  728. * Constructor.
  729. * @param fileSystem - File system host to commit the operations to.
  730. */
  731. constructor(options: TransactionalFileSystemOptions);
  732. queueFileDelete(filePath: StandardizedFilePath): void;
  733. removeFileDelete(filePath: StandardizedFilePath): void;
  734. queueMkdir(dirPath: StandardizedFilePath): void;
  735. queueDirectoryDelete(dirPath: StandardizedFilePath): void;
  736. queueMoveDirectory(srcPath: StandardizedFilePath, destPath: StandardizedFilePath): void;
  737. queueCopyDirectory(srcPath: StandardizedFilePath, destPath: StandardizedFilePath): void;
  738. flush(): Promise<void>;
  739. flushSync(): void;
  740. saveForDirectory(dirPath: StandardizedFilePath): Promise<void>;
  741. saveForDirectorySync(dirPath: StandardizedFilePath): void;
  742. moveFileImmediately(oldFilePath: StandardizedFilePath, newFilePath: StandardizedFilePath, fileText: string): Promise<void>;
  743. moveFileImmediatelySync(oldFilePath: StandardizedFilePath, newFilePath: StandardizedFilePath, fileText: string): void;
  744. deleteFileImmediately(filePath: StandardizedFilePath): Promise<void>;
  745. deleteFileImmediatelySync(filePath: StandardizedFilePath): void;
  746. copyDirectoryImmediately(srcDirPath: StandardizedFilePath, destDirPath: StandardizedFilePath): Promise<void>;
  747. copyDirectoryImmediatelySync(srcDirPath: StandardizedFilePath, destDirPath: StandardizedFilePath): void;
  748. moveDirectoryImmediately(srcDirPath: StandardizedFilePath, destDirPath: StandardizedFilePath): Promise<void>;
  749. moveDirectoryImmediatelySync(srcDirPath: StandardizedFilePath, destDirPath: StandardizedFilePath): void;
  750. deleteDirectoryImmediately(dirPath: StandardizedFilePath): Promise<void>;
  751. /** Recreates a directory on the underlying file system asynchronously. */
  752. clearDirectoryImmediately(dirPath: StandardizedFilePath): Promise<void>;
  753. /** Recreates a directory on the underlying file system synchronously. */
  754. clearDirectoryImmediatelySync(dirPath: StandardizedFilePath): void;
  755. deleteDirectoryImmediatelySync(dirPath: StandardizedFilePath): void;
  756. fileExists(filePath: StandardizedFilePath): boolean | Promise<boolean>;
  757. fileExistsSync(filePath: StandardizedFilePath): boolean;
  758. directoryExistsSync(dirPath: StandardizedFilePath): boolean;
  759. readFileIfExistsSync(filePath: StandardizedFilePath, encoding: string | undefined): string | undefined;
  760. readFileSync(filePath: StandardizedFilePath, encoding: string | undefined): string;
  761. readFileIfExists(filePath: StandardizedFilePath, encoding: string | undefined): Promise<string | undefined>;
  762. readFile(filePath: StandardizedFilePath, encoding: string | undefined): Promise<string>;
  763. readDirSync(dirPath: StandardizedFilePath): DirEntry[];
  764. glob(patterns: ReadonlyArray<string>): Promise<StandardizedFilePath[]>;
  765. globSync(patterns: ReadonlyArray<string>): Generator<StandardizedFilePath, void, unknown>;
  766. getFileSystem(): FileSystemHost;
  767. getCurrentDirectory(): StandardizedFilePath;
  768. getDirectories(dirPath: StandardizedFilePath): StandardizedFilePath[];
  769. realpathSync(path: StandardizedFilePath): StandardizedFilePath;
  770. getStandardizedAbsolutePath(fileOrDirPath: string, relativeBase?: string): StandardizedFilePath;
  771. readFileOrNotExists(filePath: StandardizedFilePath, encoding: string): false | Promise<string | false>;
  772. readFileOrNotExistsSync(filePath: StandardizedFilePath, encoding: string): string | false;
  773. writeFile(filePath: StandardizedFilePath, fileText: string): Promise<void>;
  774. writeFileSync(filePath: StandardizedFilePath, fileText: string): void;
  775. }
  776. /** Gets the TypeScript lib files (.d.ts files). */
  777. export declare function getLibFiles(): {
  778. fileName: string;
  779. text: string;
  780. }[];
  781. export declare function getLibFolderPath(options: {
  782. libFolderPath?: string;
  783. skipLoadingLibFiles?: boolean;
  784. }): string;
  785. /** The folder to use to "store" the in memory lib files. */
  786. export declare const libFolderInMemoryPath: StandardizedFilePath;
  787. /**
  788. * Gets the enum name for the specified syntax kind.
  789. * @param kind - Syntax kind.
  790. */
  791. export declare function getSyntaxKindName(kind: ts.SyntaxKind): string;
  792. /**
  793. * Holds the compiler options.
  794. */
  795. export declare class CompilerOptionsContainer extends SettingsContainer<ts.CompilerOptions> {
  796. constructor(defaultSettings?: ts.CompilerOptions);
  797. /**
  798. * Sets one or all of the compiler options.
  799. *
  800. * WARNING: Setting the compiler options will cause a complete reparse of all the source files.
  801. * @param settings - Compiler options to set.
  802. */
  803. set(settings: Partial<ts.CompilerOptions>): void;
  804. /**
  805. * Gets the encoding from the compiler options or returns utf-8.
  806. */
  807. getEncoding(): string;
  808. }
  809. export declare abstract class SettingsContainer<T extends object> {
  810. #private;
  811. protected _settings: T;
  812. /**
  813. * Constructor.
  814. * @param defaultSettings - The settings to use by default.
  815. */
  816. constructor(defaultSettings: T);
  817. /**
  818. * Resets the settings to the default.
  819. */
  820. reset(): void;
  821. /**
  822. * Gets a copy of the settings as an object.
  823. */
  824. get(): T;
  825. /**
  826. * Sets one or all of the settings.
  827. * @param settings - Settings to set.
  828. */
  829. set(settings: Partial<T>): void;
  830. /**
  831. * Subscribe to modifications in the settings container.
  832. * @param action - Action to execute when the settings change.
  833. */
  834. onModified(action: () => void): void;
  835. }
  836. export declare const runtime: Runtime;
  837. export interface Runtime {
  838. fs: RuntimeFileSystem;
  839. path: RuntimePath;
  840. getEnvVar(name: string): string | undefined;
  841. getEndOfLine(): string;
  842. getPathMatchesPattern(path: string, pattern: string): boolean;
  843. }
  844. export interface RuntimeDirEntry {
  845. name: string;
  846. isFile: boolean;
  847. isDirectory: boolean;
  848. isSymlink: boolean;
  849. }
  850. export interface RuntimeFileInfo {
  851. isFile(): boolean;
  852. isDirectory(): boolean;
  853. }
  854. export interface RuntimeFileSystem {
  855. /** Gets if this file system is case sensitive. */
  856. isCaseSensitive(): boolean;
  857. /** Asynchronously deletes the specified file or directory. */
  858. delete(path: string): Promise<void>;
  859. /** Synchronously deletes the specified file or directory */
  860. deleteSync(path: string): void;
  861. /** Reads all the child directories and files. */
  862. readDirSync(dirPath: string): RuntimeDirEntry[];
  863. /** Asynchronously reads a file at the specified path. */
  864. readFile(filePath: string, encoding?: string): Promise<string>;
  865. /** Synchronously reads a file at the specified path. */
  866. readFileSync(filePath: string, encoding?: string): string;
  867. /** Asynchronously writes a file to the file system. */
  868. writeFile(filePath: string, fileText: string): Promise<void>;
  869. /** Synchronously writes a file to the file system. */
  870. writeFileSync(filePath: string, fileText: string): void;
  871. /** Asynchronously creates a directory at the specified path. */
  872. mkdir(dirPath: string): Promise<void>;
  873. /** Synchronously creates a directory at the specified path. */
  874. mkdirSync(dirPath: string): void;
  875. /** Asynchronously moves a file or directory. */
  876. move(srcPath: string, destPath: string): Promise<void>;
  877. /** Synchronously moves a file or directory. */
  878. moveSync(srcPath: string, destPath: string): void;
  879. /** Asynchronously copies a file or directory. */
  880. copy(srcPath: string, destPath: string): Promise<void>;
  881. /** Synchronously copies a file or directory. */
  882. copySync(srcPath: string, destPath: string): void;
  883. /** Asynchronously gets the path's stat information. */
  884. stat(path: string): Promise<RuntimeFileInfo | undefined>;
  885. /** Synchronously gets the path's stat information. */
  886. statSync(path: string): RuntimeFileInfo | undefined;
  887. /** See https://nodejs.org/api/fs.html#fs_fs_realpathsync_path_options */
  888. realpathSync(path: string): string;
  889. /** Gets the current directory of the environment. */
  890. getCurrentDirectory(): string;
  891. /** Uses pattern matching to find files or directories. */
  892. glob(patterns: ReadonlyArray<string>): Promise<string[]>;
  893. /** Synchronously uses pattern matching to find files or directories. */
  894. globSync(patterns: ReadonlyArray<string>): string[];
  895. }
  896. export interface RuntimePath {
  897. /** Joins the paths. */
  898. join(...paths: string[]): string;
  899. /** Normalizes the provided path. */
  900. normalize(path: string): string;
  901. /** Returns the relative path from `from` to `to`. */
  902. relative(from: string, to: string): string;
  903. }
  904. export declare function matchFiles(this: any, path: string, extensions: ReadonlyArray<string>, excludes: ReadonlyArray<string>, includes: ReadonlyArray<string>, useCaseSensitiveFileNames: boolean, currentDirectory: string, depth: number | undefined, getEntries: (path: string) => FileSystemEntries, realpath: (path: string) => string, directoryExists: (path: string) => boolean): string[];
  905. export declare function getFileMatcherPatterns(this: any, path: string, excludes: ReadonlyArray<string>, includes: ReadonlyArray<string>, useCaseSensitiveFileNames: boolean, currentDirectory: string): FileMatcherPatterns;
  906. export declare function getEmitModuleResolutionKind(this: any, compilerOptions: ts.CompilerOptions): any;
  907. export interface FileMatcherPatterns {
  908. /** One pattern for each "include" spec. */
  909. includeFilePatterns: ReadonlyArray<string>;
  910. /** One pattern matching one of any of the "include" specs. */
  911. includeFilePattern: string;
  912. includeDirectoryPattern: string;
  913. excludePattern: string;
  914. basePaths: ReadonlyArray<string>;
  915. }
  916. export interface FileSystemEntries {
  917. readonly files: ReadonlyArray<string>;
  918. readonly directories: ReadonlyArray<string>;
  919. }
  920. export declare class ArrayUtils {
  921. private constructor();
  922. static isReadonlyArray<T>(a: unknown): a is ReadonlyArray<T>;
  923. static isNullOrEmpty<T>(a: ReadonlyArray<T> | undefined): a is undefined;
  924. static getUniqueItems<T>(a: ReadonlyArray<T>): T[];
  925. static removeFirst<T>(a: T[], item: T): boolean;
  926. static removeAll<T>(a: T[], isMatch: (item: T) => boolean): T[];
  927. static toIterator<T>(items: ReadonlyArray<T>): Generator<T, void, unknown>;
  928. static sortByProperty<T>(items: T[], getProp: (item: T) => string | number): T[];
  929. static groupBy<T>(items: ReadonlyArray<T>, getGroup: (item: T) => string | number): T[][];
  930. static binaryInsertWithOverwrite<T>(items: T[], newItem: T, comparer: Comparer<T>): void;
  931. static binarySearch<T>(items: ReadonlyArray<T>, storedComparer: StoredComparer<T>): number;
  932. static containsSubArray<T>(items: ReadonlyArray<T>, subArray: ReadonlyArray<T>): boolean;
  933. }
  934. /**
  935. * Deep clones an object not maintaining references.
  936. * @remarks If this has a circular reference it will go forever so be careful.
  937. */
  938. export declare function deepClone<T extends object>(objToClone: T): T;
  939. /**
  940. * Event container subscription type
  941. */
  942. export type EventContainerSubscription<EventArgType> = (arg: EventArgType) => void;
  943. /**
  944. * Event container for event subscriptions.
  945. */
  946. export declare class EventContainer<EventArgType = undefined> {
  947. #private;
  948. /**
  949. * Subscribe to an event being fired.
  950. * @param subscription - Subscription.
  951. */
  952. subscribe(subscription: EventContainerSubscription<EventArgType>): void;
  953. /**
  954. * Unsubscribe to an event being fired.
  955. * @param subscription - Subscription.
  956. */
  957. unsubscribe(subscription: EventContainerSubscription<EventArgType>): void;
  958. /**
  959. * Fire an event.
  960. */
  961. fire(arg: EventArgType): void;
  962. }
  963. export declare class IterableUtils {
  964. static find<T>(items: IterableIterator<T>, condition: (item: T) => boolean): T | undefined;
  965. }
  966. export declare function nameof<TObject>(obj: TObject, key: keyof TObject): string;
  967. export declare function nameof<TObject>(key: keyof TObject): string;
  968. export declare class ObjectUtils {
  969. private constructor();
  970. static clone<T>(obj: T): T;
  971. }
  972. export declare class StringUtils {
  973. private constructor();
  974. static isWhitespaceCharCode(charCode: number | undefined): boolean;
  975. static isSpaces(text: string): boolean;
  976. static hasBom(text: string): boolean;
  977. static stripBom(text: string): string;
  978. static stripQuotes(text: string): string;
  979. static isQuoted(text: string): boolean;
  980. static isNullOrWhitespace(str: string | undefined): str is undefined;
  981. static isNullOrEmpty(str: string | undefined): str is undefined;
  982. static isWhitespace(text: string | undefined): boolean;
  983. static startsWithNewLine(str: string | undefined): boolean;
  984. static endsWithNewLine(str: string | undefined): boolean;
  985. static insertAtLastNonWhitespace(str: string, insertText: string): string;
  986. static getLineNumberAtPos(str: string, pos: number): number;
  987. static getLengthFromLineStartAtPos(str: string, pos: number): number;
  988. static getLineStartFromPos(str: string, pos: number): number;
  989. static getLineEndFromPos(str: string, pos: number): number;
  990. static escapeForWithinString(str: string, quoteKind: "\"" | "'"): string;
  991. /**
  992. * Escapes all the occurrences of the char in the string.
  993. */
  994. static escapeChar(str: string, char: string): string;
  995. static removeIndentation(str: string, opts: {
  996. isInStringAtPos: (pos: number) => boolean;
  997. indentSizeInSpaces: number;
  998. }): string;
  999. static indent(str: string, times: number, options: {
  1000. indentText: string;
  1001. indentSizeInSpaces: number;
  1002. isInStringAtPos: (pos: number) => boolean;
  1003. }): string;
  1004. }
  1005. export import CompilerOptions = ts.CompilerOptions;
  1006. export import DiagnosticCategory = ts.DiagnosticCategory;
  1007. export import EditorSettings = ts.EditorSettings;
  1008. export import EmitHint = ts.EmitHint;
  1009. export import LanguageVariant = ts.LanguageVariant;
  1010. export import ModuleKind = ts.ModuleKind;
  1011. export import ModuleResolutionKind = ts.ModuleResolutionKind;
  1012. export import NewLineKind = ts.NewLineKind;
  1013. export import NodeFlags = ts.NodeFlags;
  1014. export import ObjectFlags = ts.ObjectFlags;
  1015. export import ScriptKind = ts.ScriptKind;
  1016. export import ScriptTarget = ts.ScriptTarget;
  1017. export import SymbolFlags = ts.SymbolFlags;
  1018. export import SyntaxKind = ts.SyntaxKind;
  1019. export import TypeFlags = ts.TypeFlags;
  1020. export import TypeFormatFlags = ts.TypeFormatFlags;
  1021. export { ts };