-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathtypes.d.ts
More file actions
37 lines (30 loc) · 965 Bytes
/
types.d.ts
File metadata and controls
37 lines (30 loc) · 965 Bytes
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
import type * as ast from '@nomicfoundation/slang/ast';
import type { AstPath, Doc } from 'prettier';
import type { Comment, PrintableNode } from './slang-nodes/types.d.ts';
// Adding our own options to prettier's `ParserOptions` interface.
declare module 'prettier' {
interface ParserOptions {
compiler: string;
}
}
interface CollectedMetadata {
offsets: Map<number, number>;
comments: Comment[];
}
interface Location {
start: number;
end: number;
}
interface AstLocation extends Location {
outerStart: number;
outerEnd: number;
}
type PrintFunction = (
selector?: string | number | (string | number)[] | AstPath<PrintableNode>
) => Doc;
// This the union of all the types in the namespace `ast`.
type TypeOfAst = typeof ast;
type KeyOfAst = keyof TypeOfAst;
type ValuesOf<E> = E[keyof E];
type SlangAstNode = { [k in KeyOfAst]: ValuesOf<TypeOfAst[k]> }[KeyOfAst];
type SlangAstNodeClass = { [k in KeyOfAst]: TypeOfAst[k] }[KeyOfAst];