-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathindex.d.ts
176 lines (148 loc) · 3.34 KB
/
index.d.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/* PEG API Types */
export declare function parse(input: string, options?: Options): GIFTQuestion[];
export declare class SyntaxError extends Error {
location: LocationRange;
expected: Expectation[];
found: string | null;
name: string;
message: string;
}
interface Options {
filename?: string;
startRule?: string;
tracer?: any;
[key: string]: any;
}
export interface Location {
line: number;
column: number;
offset: number;
}
export interface LocationRange {
start: Location;
end: Location;
}
export interface LiteralExpectation {
type: "literal";
text: string;
ignoreCase: boolean;
}
export interface ClassParts extends Array<string | ClassParts> {}
export interface ClassExpectation {
type: "class";
parts: ClassParts;
inverted: boolean;
ignoreCase: boolean;
}
export interface AnyExpectation {
type: "any";
}
export interface EndExpectation {
type: "end";
}
export interface OtherExpectation {
type: "other";
description: string;
}
export type Expectation =
| LiteralExpectation
| ClassExpectation
| AnyExpectation
| EndExpectation
| OtherExpectation;
/* GIFT Question Types */
export type QuestionType =
| "Description"
| "Category"
| "MC"
| "Numerical"
| "Short"
| "Essay"
| "TF"
| "Matching";
export type FormatType = "moodle" | "html" | "markdown" | "plain";
export type NumericalType = "simple" | "range" | "high-low";
export interface TextFormat {
format: FormatType;
text: string;
}
export interface NumericalFormat {
type: NumericalType;
number?: number;
range?: number;
numberHigh?: number;
numberLow?: number;
}
export interface TextChoice {
isCorrect: boolean;
weight: number | null;
text: TextFormat;
feedback: TextFormat | null;
}
export interface NumericalChoice {
isCorrect: boolean;
weight: number | null;
text: NumericalFormat;
feedback: TextFormat | null;
}
interface Question {
id?: string | null;
tags?: string[] | null;
type: QuestionType;
title: string | null;
stem: TextFormat;
hasEmbeddedAnswers: boolean;
globalFeedback: TextFormat | null;
}
export interface Description {
id?: string | null;
tags?: string[] | null;
type: Extract<QuestionType, "Description">;
title: string | null;
stem: TextFormat;
hasEmbeddedAnswers: boolean;
}
export interface Category {
id?: string | null;
tags?: string[] | null;
type: Extract<QuestionType, "Category">;
title: string;
}
export interface MultipleChoice extends Question {
type: Extract<QuestionType, "MC">;
choices: TextChoice[];
}
export interface ShortAnswer extends Question {
type: Extract<QuestionType, "Short">;
choices: TextChoice[];
}
export interface Numerical extends Question {
type: Extract<QuestionType, "Numerical">;
choices: NumericalChoice[] | NumericalFormat;
}
export interface Essay extends Question {
type: Extract<QuestionType, "Essay">;
}
export interface TrueFalse extends Question {
type: Extract<QuestionType, "TF">;
isTrue: boolean;
trueFeedback: TextFormat | null;
falseFeedback: TextFormat | null;
}
export interface Matching extends Question {
type: Extract<QuestionType, "Matching">;
matchPairs: Match[];
}
export interface Match {
subquestion: TextFormat;
subanswer: string;
}
export type GIFTQuestion =
| Description
| Category
| MultipleChoice
| ShortAnswer
| Numerical
| Essay
| TrueFalse
| Matching;