-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtypes.ts
65 lines (58 loc) · 1.57 KB
/
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
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
import {CompilerOptions} from 'typescript';
export interface IdMetadata {
descriptor: string;
id: string;
}
export interface CodeSample {
/** file.ext:line for this code sample */
descriptor: string;
language: 'js' | 'ts' | 'node' | 'json' | null;
/** either user-supplied sample ID or file-line */
id: string;
sectionHeader: string | null;
content: string;
isTSX: boolean;
checkJS: boolean;
tsOptions: CompilerOptions;
sourceFile: string;
lineNumber: number;
/** Is this code sample in a commented-out block? (Disables cosmetic checks.) */
inCommentBlock: boolean;
nodeModules: readonly string[];
/** If set, write this sample to a file with the given name instead of prepending. */
targetFilename: string | null;
auxiliaryFiles: AuxiliaryFile[];
/** Combined length of prefixes, for offsetting error messages */
prefixesLength: number;
skip: boolean;
output?: SampleOutput;
/** The raw content of the code sample (if different than content) */
originalContent?: string;
}
export interface Prefix {
id: string;
lines?: number[];
}
export interface PrefixedCodeSample extends CodeSample {
prefixes: readonly Prefix[];
replacementId?: string;
}
export interface SampleOutput {
code: number;
stdout: string;
stderr: string;
path: string;
}
export interface AuxiliaryFile {
filename: string;
content: string;
}
export interface PlaygroundEntry {
displayedCode: string;
playgroundUrl: string;
id: string;
sourceFile: string;
sourceLineNumber: number;
language: CodeSample['language'];
tsOptions: CompilerOptions;
}