All files bases.ts

100% Statements 14/14
100% Branches 0/0
100% Functions 12/12
100% Lines 14/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120      2x     8x       3x                       14x             6x               5x             2x             8x                                     46x             9x             2x                 13x                       6x                         2x  
import * as ts from 'typescript';
import { Bases } from './types';
 
const bases: Bases = {
  ClassElement: {
    base: ['NamedDeclaration'],
    getChildren: (node: ts.ClassElement) => [node.name],
  },
  ClassLikeDeclarationBase: {
    base: ['NamedDeclaration', 'JSDocContainer'],
    getChildren: (node: ts.ClassLikeDeclarationBase) => [
      node.name,
      node.typeParameters,
      node.heritageClauses,
      node.members,
    ],
  },
  Declaration: {
    base: ['Node'],
  },
  DeclarationStatement: {
    base: ['NamedDeclaration', 'Statement'],
    getChildren: (node: ts.DeclarationStatement) => [node.name],
  },
  Expression: {
    base: ['Node'],
  },
  FunctionLikeDeclarationBase: {
    base: ['SignatureDeclarationBase'],
    getChildren: (node: ts.FunctionLikeDeclarationBase) => [
      node.asteriskToken,
      node.questionToken,
      node.body,
    ],
  },
  IterationStatement: {
    base: ['Statement'],
    getChildren: (node: ts.IterationStatement) => [node.statement],
  },
  JSDocContainer: {
    base: ['Node'],
  },
  JSDocPropertyLikeTag: {
    base: ['JSDocTag', 'Declaration'],
    getChildren: (node: ts.JSDocPropertyLikeTag) => [
      node.name,
      node.typeExpression,
    ],
  },
  JSDocTag: {
    base: ['Node'],
    getChildren: (node: ts.JSDocTag) => [node.atToken, node.tagName],
  },
  JSDocType: {
    base: ['TypeNode'],
  },
  LeftHandSideExpression: {
    base: ['UpdateExpression'],
  },
  LiteralExpression: {
    base: ['LiteralLikeNode', 'PrimaryExpression'],
  },
  LiteralLikeNode: {
    base: ['Node'],
  },
  MemberExpression: {
    base: ['LeftHandSideExpression'],
  },
  NamedDeclaration: {
    base: ['Declaration'],
    getChildren: (node: ts.NamedDeclaration) => [node.name],
  },
  Node: {
    base: [],
  },
  ObjectLiteralElement: {
    base: ['NamedDeclaration'],
    getChildren: (node: ts.NamedDeclaration) => [node.name],
  },
  ObjectLiteralExpression: {
    base: ['ObjectLiteralExpressionBase'],
  },
  ObjectLiteralExpressionBase: {
    base: ['PrimaryExpression', 'Declaration'],
    getChildren: (node: ts.ObjectLiteralExpressionBase<any>) => [
      node.properties,
    ],
  },
  PrimaryExpression: {
    base: ['MemberExpression'],
  },
  SignatureDeclarationBase: {
    base: ['NamedDeclaration', 'JSDocContainer'],
    getChildren: (node: ts.SignatureDeclarationBase) => [
      node.name,
      node.typeParameters,
      node.parameters,
      node.type,
    ],
  },
  Statement: {
    base: ['Node'],
  },
  TypeElement: {
    base: ['NamedDeclaration'],
    getChildren: (node: ts.TypeElement) => [node.name, node.questionToken],
  },
  TypeNode: {
    base: ['Node'],
  },
  UnaryExpression: {
    base: ['Expression'],
  },
  UpdateExpression: {
    base: ['UnaryExpression'],
  },
};
 
export default bases;