-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtypes.ts
27 lines (23 loc) · 859 Bytes
/
types.ts
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
import { SyntaxNode } from 'web-tree-sitter';
import { TreeOption } from 'naive-ui';
import { Position } from 'codemirror';
export type CorrectStatus = 'correct' | 'misplaced' | 'wrong';
export interface TreeOptionEx extends TreeOption {
node: SyntaxNode,
correctChildCount: number,
correct: CorrectStatus,
correctText?: string,
modification: string | null,
correctStartRow?: number,
correctStartCol?: number,
allCorrect: boolean,
children: TreeOptionEx[],
depth: number,
minWrongDepth: number,
correctCount: number,
}
// it's actually useless and provides only minimum (inadequate) check as a type guard
export function isTreeOptionEx(option: TreeOption): option is TreeOptionEx {
return option.node !== null && typeof option.node === 'object';
}
export type MarkRange = (from: Position, to: Position, scroll: boolean) => void;