declare module 'esrap' { type BaseNode = { type: string; loc?: null | { start: { line: number; column: number }; end: { line: number; column: number }; }; }; type NodeOf = X extends { type: T } ? X : never; type SpecialisedVisitors = { [K in T['type']]?: Visitor>; }; type Visitor = (node: T, context: Context) => void; export type Visitors = T['type'] extends '_' ? never : SpecialisedVisitors & { _?: (node: T, context: Context, visit: (node: T) => void) => void }; interface Location { type: 'Location'; line: number; column: number; } type Command = string | number | Location | Command[]; export interface PrintOptions { sourceMapSource?: string; sourceMapContent?: string; sourceMapEncodeMappings?: boolean; // default true indent?: string; // default tab } /** * @returns // TODO */ export function print(node: T, visitors: Visitors, opts?: PrintOptions): { code: string; map: any; }; export class Context { constructor(visitors: Visitors, commands?: Command[]); multiline: boolean; indent(): void; dedent(): void; margin(): void; newline(): void; space(): void; append(context: Context): void; write(content: string, node?: BaseNode): void; location(line: number, column: number): void; visit(node: { type: string; }): void; empty(): boolean; measure(): number; "new"(): Context; #private; } export {}; } declare module 'esrap/languages/ts' { import type { TSESTree } from '@typescript-eslint/types'; import type { Context } from 'esrap'; export const EXPRESSIONS_PRECEDENCE: Record; export default function _default(options?: TSOptions): Visitors; export type Node = TSESTree.Node; type TSOptions = { quotes?: 'double' | 'single'; comments?: Comment[]; getLeadingComments?: (node: TSESTree.Node) => BaseComment[] | undefined; getTrailingComments?: (node: TSESTree.Node) => BaseComment[] | undefined; }; interface Position { line: number; column: number; } // this exists in TSESTree but because of the inanity around enums // it's easier to do this ourselves export interface BaseComment { type: 'Line' | 'Block'; value: string; start?: number; end?: number; } export interface Comment extends BaseComment { loc: { start: Position; end: Position; }; } type BaseNode = { type: string; loc?: null | { start: { line: number; column: number }; end: { line: number; column: number }; }; }; type NodeOf = X extends { type: T } ? X : never; type SpecialisedVisitors = { [K in T['type']]?: Visitor>; }; type Visitor = (node: T, context: Context) => void; type Visitors = T['type'] extends '_' ? never : SpecialisedVisitors & { _?: (node: T, context: Context, visit: (node: T) => void) => void }; export {}; } declare module 'esrap/languages/tsx' { import type { TSESTree } from '@typescript-eslint/types'; import type { Context } from 'esrap'; export default function _default(options?: TSOptions): Visitors; export type Node = TSESTree.Node; type TSOptions = { quotes?: 'double' | 'single'; comments?: Comment[]; getLeadingComments?: (node: TSESTree.Node) => BaseComment[] | undefined; getTrailingComments?: (node: TSESTree.Node) => BaseComment[] | undefined; }; interface Position { line: number; column: number; } // this exists in TSESTree but because of the inanity around enums // it's easier to do this ourselves export interface BaseComment { type: 'Line' | 'Block'; value: string; start?: number; end?: number; } export interface Comment extends BaseComment { loc: { start: Position; end: Position; }; } type BaseNode = { type: string; loc?: null | { start: { line: number; column: number }; end: { line: number; column: number }; }; }; type NodeOf = X extends { type: T } ? X : never; type SpecialisedVisitors = { [K in T['type']]?: Visitor>; }; type Visitor = (node: T, context: Context) => void; type Visitors = T['type'] extends '_' ? never : SpecialisedVisitors & { _?: (node: T, context: Context, visit: (node: T) => void) => void }; export {}; } //# sourceMappingURL=index.d.ts.map