utils.d.ts 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import { BooleanLiteral, ClassDeclaration, Decorator, Expression, ExpressionWithTypeArguments, Node, NodeArray, ObjectLiteralExpression, SourceFile } from 'typescript';
  2. export declare enum AngularClassDecorators {
  3. Component = "Component",
  4. Directive = "Directive",
  5. Injectable = "Injectable",
  6. NgModule = "NgModule",
  7. Pipe = "Pipe"
  8. }
  9. declare enum AngularConstructorParameterDecorators {
  10. Attribute = "Attribute",
  11. Host = "Host",
  12. Inject = "Inject",
  13. Optional = "Optional",
  14. Self = "Self",
  15. SkipSelf = "SkipSelf"
  16. }
  17. declare enum AngularMethodDecorators {
  18. HostListener = "HostListener"
  19. }
  20. declare enum AngularPropertyAccessorDecorators {
  21. ContentChild = "ContentChild",
  22. ContentChildren = "ContentChildren",
  23. HostBinding = "HostBinding",
  24. Input = "Input",
  25. Output = "Output",
  26. ViewChild = "ViewChild",
  27. ViewChildren = "ViewChildren"
  28. }
  29. export declare const AngularInnerClassDecorators: {
  30. ContentChild: AngularPropertyAccessorDecorators.ContentChild;
  31. ContentChildren: AngularPropertyAccessorDecorators.ContentChildren;
  32. HostBinding: AngularPropertyAccessorDecorators.HostBinding;
  33. Input: AngularPropertyAccessorDecorators.Input;
  34. Output: AngularPropertyAccessorDecorators.Output;
  35. ViewChild: AngularPropertyAccessorDecorators.ViewChild;
  36. ViewChildren: AngularPropertyAccessorDecorators.ViewChildren;
  37. HostListener: AngularMethodDecorators.HostListener;
  38. Attribute: AngularConstructorParameterDecorators.Attribute;
  39. Host: AngularConstructorParameterDecorators.Host;
  40. Inject: AngularConstructorParameterDecorators.Inject;
  41. Optional: AngularConstructorParameterDecorators.Optional;
  42. Self: AngularConstructorParameterDecorators.Self;
  43. SkipSelf: AngularConstructorParameterDecorators.SkipSelf;
  44. };
  45. export declare enum AngularLifecycleInterfaces {
  46. AfterContentChecked = "AfterContentChecked",
  47. AfterContentInit = "AfterContentInit",
  48. AfterViewChecked = "AfterViewChecked",
  49. AfterViewInit = "AfterViewInit",
  50. OnChanges = "OnChanges",
  51. OnDestroy = "OnDestroy",
  52. OnInit = "OnInit",
  53. DoCheck = "DoCheck"
  54. }
  55. export declare enum AngularLifecycleMethods {
  56. ngAfterContentChecked = "ngAfterContentChecked",
  57. ngAfterContentInit = "ngAfterContentInit",
  58. ngAfterViewChecked = "ngAfterViewChecked",
  59. ngAfterViewInit = "ngAfterViewInit",
  60. ngOnChanges = "ngOnChanges",
  61. ngOnDestroy = "ngOnDestroy",
  62. ngOnInit = "ngOnInit",
  63. ngDoCheck = "ngDoCheck"
  64. }
  65. export declare type AngularClassDecoratorKeys = keyof typeof AngularClassDecorators;
  66. export declare type AngularInnerClassDecoratorKeys = Exclude<keyof typeof AngularInnerClassDecorators, number>;
  67. export declare type AngularLifecycleInterfaceKeys = keyof typeof AngularLifecycleInterfaces;
  68. export declare type AngularLifecycleMethodKeys = keyof typeof AngularLifecycleMethods;
  69. export declare const angularClassDecoratorKeys: readonly ("Component" | "Directive" | "Injectable" | "NgModule" | "Pipe")[];
  70. export declare const angularInnerClassDecoratorKeys: readonly ("ContentChild" | "ContentChildren" | "HostBinding" | "Input" | "Output" | "ViewChild" | "ViewChildren" | "HostListener" | "Attribute" | "Host" | "Inject" | "Optional" | "Self" | "SkipSelf")[];
  71. export declare const angularLifecycleInterfaceKeys: readonly ("AfterContentChecked" | "AfterContentInit" | "AfterViewChecked" | "AfterViewInit" | "OnChanges" | "OnDestroy" | "OnInit" | "DoCheck")[];
  72. export declare const angularLifecycleMethodKeys: readonly ("ngAfterContentChecked" | "ngAfterContentInit" | "ngAfterViewChecked" | "ngAfterViewInit" | "ngOnChanges" | "ngOnDestroy" | "ngOnInit" | "ngDoCheck")[];
  73. export declare const ANGULAR_INNER_CLASS_DECORATORS: ReadonlySet<AngularInnerClassDecoratorKeys>;
  74. export declare const ANGULAR_CLASS_DECORATORS: ReadonlySet<AngularClassDecoratorKeys>;
  75. export declare const ANGULAR_CLASS_DECORATOR_MAPPER: ReadonlyMap<AngularClassDecoratorKeys, ReadonlySet<AngularInnerClassDecoratorKeys>>;
  76. export declare const ANGULAR_LIFECYCLE_INTERFACES: ReadonlySet<AngularLifecycleInterfaceKeys>;
  77. export declare const ANGULAR_LIFECYCLE_METHODS: ReadonlySet<AngularLifecycleMethodKeys>;
  78. export declare const ANGULAR_CLASS_DECORATOR_LIFECYCLE_METHOD_MAPPER: ReadonlyMap<AngularClassDecoratorKeys, ReadonlySet<AngularLifecycleMethodKeys>>;
  79. export declare const getClassName: (node: Node) => string;
  80. export declare const getDecorator: (node: ClassDeclaration, decoratorName: string) => Decorator;
  81. export declare const getDecoratorArgument: (decorator: Decorator) => ObjectLiteralExpression;
  82. export declare const getDecoratorName: (decorator: Decorator) => string;
  83. export declare const getDecoratorPropertyInitializer: (decorator: Decorator, name: string) => Expression;
  84. export declare const getNextToLastParentNode: (node: Node) => Node;
  85. export declare const getComponentDecorator: (node: ClassDeclaration) => Decorator;
  86. export declare const getDirectiveDecorator: (node: ClassDeclaration) => Decorator;
  87. export declare const getInjectableDecorator: (node: ClassDeclaration) => Decorator;
  88. export declare const getNgModuleDecorator: (node: ClassDeclaration) => Decorator;
  89. export declare const getPipeDecorator: (node: ClassDeclaration) => Decorator;
  90. export declare const getSymbolName: (expression: ExpressionWithTypeArguments) => string;
  91. export declare const isAngularClassDecorator: (value: string) => value is "Component" | "Directive" | "Injectable" | "NgModule" | "Pipe";
  92. export declare const isAngularInnerClassDecorator: (value: string) => value is "ContentChild" | "ContentChildren" | "HostBinding" | "Input" | "Output" | "ViewChild" | "ViewChildren" | "HostListener" | "Attribute" | "Host" | "Inject" | "Optional" | "Self" | "SkipSelf";
  93. export declare const isAngularLifecycleInterface: (value: string) => value is "AfterContentChecked" | "AfterContentInit" | "AfterViewChecked" | "AfterViewInit" | "OnChanges" | "OnDestroy" | "OnInit" | "DoCheck";
  94. export declare const isAngularLifecycleMethod: (value: string) => value is "ngAfterContentChecked" | "ngAfterContentInit" | "ngAfterViewChecked" | "ngAfterViewInit" | "ngOnChanges" | "ngOnDestroy" | "ngOnInit" | "ngDoCheck";
  95. export declare const getDeclaredInterfaces: (node: ClassDeclaration) => NodeArray<ExpressionWithTypeArguments>;
  96. export declare const getDeclaredInterfaceNames: (node: ClassDeclaration) => string[];
  97. export declare const getDeclaredInterfaceName: (node: ClassDeclaration, value: string) => string;
  98. export declare const getDeclaredAngularLifecycleInterfaces: (node: ClassDeclaration) => readonly ("AfterContentChecked" | "AfterContentInit" | "AfterViewChecked" | "AfterViewInit" | "OnChanges" | "OnDestroy" | "OnInit" | "DoCheck")[];
  99. export declare const getLifecycleInterfaceByMethodName: (methodName: "ngAfterContentChecked" | "ngAfterContentInit" | "ngAfterViewChecked" | "ngAfterViewInit" | "ngOnChanges" | "ngOnDestroy" | "ngOnInit" | "ngDoCheck") => "AfterContentChecked" | "AfterContentInit" | "AfterViewChecked" | "AfterViewInit" | "OnChanges" | "OnDestroy" | "OnInit" | "DoCheck";
  100. export declare const getDeclaredAngularLifecycleMethods: (node: ClassDeclaration) => readonly ("ngAfterContentChecked" | "ngAfterContentInit" | "ngAfterViewChecked" | "ngAfterViewInit" | "ngOnChanges" | "ngOnDestroy" | "ngOnInit" | "ngDoCheck")[];
  101. export declare const kebabToCamelCase: (value: string) => string;
  102. export declare const isSameLine: (sourceFile: SourceFile, pos1: number, pos2: number) => boolean;
  103. export declare const isBooleanLiteralLike: (node: Node) => node is BooleanLiteral;
  104. export declare const isStringLiteralLike: (node: Node) => node is import("typescript").StringLiteralLike;
  105. export declare const maybeNodeArray: <T extends Node>(nodes: NodeArray<T>) => readonly T[];
  106. export declare const toTitleCase: (value: string) => string;
  107. export {};