transform.d.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import * as ng from '@angular/compiler/src/expression_parser/ast';
  2. import * as b from '@babel/types';
  3. import { Context } from './context';
  4. import { NGNode, RawNGComment, RawNGSpan } from './types';
  5. declare module '@babel/types' {
  6. interface SourceLocation {
  7. identifierName?: string;
  8. }
  9. interface NumericLiteral {
  10. extra: {
  11. raw: string;
  12. rawValue: number;
  13. };
  14. }
  15. interface StringLiteral {
  16. extra: {
  17. raw: string;
  18. rawValue: string;
  19. };
  20. }
  21. interface ObjectProperty {
  22. method: boolean;
  23. }
  24. type CommentLine = Pick<b.LineComment, Exclude<keyof b.LineComment, 'type'>> & {
  25. type: 'CommentLine';
  26. };
  27. }
  28. export declare type InputNode = ng.AST | RawNGComment;
  29. export declare type OutputNode = NGNode | b.CommentLine;
  30. export declare const transform: (node: InputNode, context: Context, isInParentParens?: boolean) => OutputNode;
  31. export declare function transformSpan(span: RawNGSpan, context: Context, processSpan?: boolean, hasParentParens?: boolean): {
  32. start: NonNullable<b.BaseNode['start']>;
  33. end: NonNullable<b.BaseNode['end']>;
  34. loc: NonNullable<b.BaseNode['loc']>;
  35. };