/frontend/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/host.d.ts

https://gitlab.com/girmayegebremedhin/student_managment · TypeScript Typings · 76 lines · 39 code · 0 blank · 37 comment · 31 complexity · 3a299dfca0be20548e01aab7a8e07c59 MD5 · raw file

  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. /// <amd-module name="@angular/compiler-cli/src/ngtsc/typecheck/src/host" />
  9. import * as ts from 'typescript';
  10. /**
  11. * Represents the `ts.CompilerHost` interface, with a transformation applied that turns all
  12. * methods (even optional ones) into required fields (which may be `undefined`, if the method was
  13. * optional).
  14. */
  15. export declare type RequiredCompilerHostDelegations = {
  16. [M in keyof Required<ts.CompilerHost>]: ts.CompilerHost[M];
  17. };
  18. /**
  19. * Delegates all methods of `ts.CompilerHost` to a delegate, with the exception of
  20. * `getSourceFile`, `fileExists` and `writeFile` which are implemented in `TypeCheckProgramHost`.
  21. *
  22. * If a new method is added to `ts.CompilerHost` which is not delegated, a type error will be
  23. * generated for this class.
  24. */
  25. export declare class DelegatingCompilerHost implements Omit<RequiredCompilerHostDelegations, 'getSourceFile' | 'fileExists' | 'writeFile'> {
  26. protected delegate: ts.CompilerHost;
  27. constructor(delegate: ts.CompilerHost);
  28. private delegateMethod;
  29. createHash: ((data: string) => string) | undefined;
  30. directoryExists: ((directoryName: string) => boolean) | undefined;
  31. getCancellationToken: (() => ts.CancellationToken) | undefined;
  32. getCanonicalFileName: (fileName: string) => string;
  33. getCurrentDirectory: () => string;
  34. getDefaultLibFileName: (options: ts.CompilerOptions) => string;
  35. getDefaultLibLocation: (() => string) | undefined;
  36. getDirectories: ((path: string) => string[]) | undefined;
  37. getEnvironmentVariable: ((name: string) => string | undefined) | undefined;
  38. getNewLine: () => string;
  39. getParsedCommandLine: ((fileName: string) => ts.ParsedCommandLine | undefined) | undefined;
  40. getSourceFileByPath: ((fileName: string, path: ts.Path, languageVersion: ts.ScriptTarget, onError?: ((message: string) => void) | undefined, shouldCreateNewSourceFile?: boolean | undefined) => ts.SourceFile | undefined) | undefined;
  41. readDirectory: ((rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number | undefined) => string[]) | undefined;
  42. readFile: (fileName: string) => string | undefined;
  43. realpath: ((path: string) => string) | undefined;
  44. resolveModuleNames: ((moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ts.ResolvedProjectReference | undefined, options: ts.CompilerOptions) => (ts.ResolvedModule | undefined)[]) | undefined;
  45. resolveTypeReferenceDirectives: ((typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ts.ResolvedProjectReference | undefined, options: ts.CompilerOptions) => (ts.ResolvedTypeReferenceDirective | undefined)[]) | undefined;
  46. trace: ((s: string) => void) | undefined;
  47. useCaseSensitiveFileNames: () => boolean;
  48. }
  49. /**
  50. * A `ts.CompilerHost` which augments source files with type checking code from a
  51. * `TypeCheckContext`.
  52. */
  53. export declare class TypeCheckProgramHost extends DelegatingCompilerHost {
  54. private originalProgram;
  55. private shimExtensionPrefixes;
  56. /**
  57. * Map of source file names to `ts.SourceFile` instances.
  58. */
  59. private sfMap;
  60. /**
  61. * The `ShimReferenceTagger` responsible for tagging `ts.SourceFile`s loaded via this host.
  62. *
  63. * The `TypeCheckProgramHost` is used in the creation of a new `ts.Program`. Even though this new
  64. * program is based on a prior one, TypeScript will still start from the root files and enumerate
  65. * all source files to include in the new program. This means that just like during the original
  66. * program's creation, these source files must be tagged with references to per-file shims in
  67. * order for those shims to be loaded, and then cleaned up afterwards. Thus the
  68. * `TypeCheckProgramHost` has its own `ShimReferenceTagger` to perform this function.
  69. */
  70. private shimTagger;
  71. constructor(sfMap: Map<string, ts.SourceFile>, originalProgram: ts.Program, delegate: ts.CompilerHost, shimExtensionPrefixes: string[]);
  72. getSourceFile(fileName: string, languageVersion: ts.ScriptTarget, onError?: ((message: string) => void) | undefined, shouldCreateNewSourceFile?: boolean | undefined): ts.SourceFile | undefined;
  73. postProgramCreationCleanup(): void;
  74. writeFile(): never;
  75. fileExists(fileName: string): boolean;
  76. }