Skip to content

⬅️ Back to Table of Contents

📄 types.ts

📊 Analysis Summary

Metric Count
📐 Interfaces 7
📑 Type Aliases 2

📚 Table of Contents

🛠️ File Location:

📂 packages/rule-schema-to-typescript-types/src/types.ts

Interfaces

BaseASTNode

Interface Code
interface BaseASTNode {
  readonly commentLines: string[];
}

Properties

Name Type Optional Description
commentLines string[]

ArrayAST

Interface Code
export interface ArrayAST extends BaseASTNode {
  readonly elementType: AST;
  readonly type: 'array';
}

Properties

Name Type Optional Description
elementType AST
type 'array'

LiteralAST

Interface Code
export interface LiteralAST extends BaseASTNode {
  readonly code: string;
  readonly type: 'literal';
}

Properties

Name Type Optional Description
code string
type 'literal'

ObjectAST

Interface Code
export interface ObjectAST extends BaseASTNode {
  readonly indexSignature: AST | null;
  readonly properties: {
    readonly name: string;
    readonly optional: boolean;
    readonly type: AST;
  }[];
  readonly type: 'object';
}

Properties

Name Type Optional Description
indexSignature AST | null
properties `{
readonly name: string;
readonly optional: boolean;
readonly type: AST;
}[]`
type 'object'

TupleAST

Interface Code
export interface TupleAST extends BaseASTNode {
  readonly elements: AST[];
  readonly spreadType: AST | null;
  readonly type: 'tuple';
}

Properties

Name Type Optional Description
elements AST[]
spreadType AST | null
type 'tuple'

TypeReferenceAST

Interface Code
export interface TypeReferenceAST extends BaseASTNode {
  readonly type: 'type-reference';
  readonly typeName: string;
}

Properties

Name Type Optional Description
type 'type-reference'
typeName string

UnionAST

Interface Code
export interface UnionAST extends BaseASTNode {
  readonly elements: AST[];
  readonly type: 'union';
}

Properties

Name Type Optional Description
elements AST[]
type 'union'

Type Aliases

RefMap

type RefMap = ReadonlyMap<
  // ref path
  string,
  // type name
  string
>;

AST

type AST = | ArrayAST
  | LiteralAST
  | ObjectAST
  | TupleAST
  | TypeReferenceAST
  | UnionAST;