@khanacademy/perseus-score 8.2.8 → 8.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import type { MathFormat } from "@khanacademy/perseus-core";
1
2
  type Guess = any;
2
3
  type Predicate = (guess: number, maxError: number) => boolean;
3
4
  export type Score = {
@@ -8,6 +9,16 @@ export type Score = {
8
9
  guess: Guess;
9
10
  ungraded?: boolean;
10
11
  };
12
+ type PredicateValidatorOptions = {
13
+ simplify?: "required" | "optional" | "enforced" | true;
14
+ ratio?: boolean;
15
+ forms?: string | MathFormat[];
16
+ inexact?: boolean;
17
+ maxError?: string | number | null;
18
+ decimal_separator?: string;
19
+ fallback?: string;
20
+ message?: string;
21
+ };
11
22
  /**
12
23
  * Answer types
13
24
  *
@@ -51,11 +62,10 @@ export type Score = {
51
62
  declare const KhanAnswerTypes: {
52
63
  readonly predicate: {
53
64
  readonly defaultForms: "integer, proper, improper, mixed, decimal";
54
- readonly createValidatorFunctional: (predicate: Predicate, options: any) => (arg1: Guess) => Score;
65
+ readonly createValidatorFunctional: (predicate: Predicate, rawOptions: PredicateValidatorOptions) => (guess: Guess) => Score;
55
66
  };
56
67
  readonly number: {
57
- readonly convertToPredicate: (correctAnswer: string, options: any) => [predicate: Predicate, options: any];
58
- readonly createValidatorFunctional: (correctAnswer: string, options: any) => (arg1: Guess) => Score;
68
+ readonly createValidatorFunctional: (correctAnswer: string, options: PredicateValidatorOptions) => (arg1: Guess) => Score;
59
69
  };
60
70
  readonly expression: {
61
71
  readonly parseSolution: (solutionString: string, options: any) => any;
@@ -1,9 +1,7 @@
1
- import type { PerseusRenderer, PerseusWidgetsMap } from "@khanacademy/perseus-core";
1
+ import type { PerseusRenderer } from "@khanacademy/perseus-core";
2
2
  /**
3
- * Returns the upgraded widgets and the IDs of widgets that should be scored.
4
- * Filters out widgets not referenced in content and widgets that are static or ungraded.
3
+ * Returns the IDs of widgets that should be scored.
4
+ * Filters out widgets not referenced in content and widgets that are static
5
+ * or ungraded.
5
6
  */
6
- export default function getScoreableWidgets(perseusRenderData: PerseusRenderer): {
7
- upgradedWidgets: PerseusWidgetsMap;
8
- scoreableWidgetIds: ReadonlyArray<string>;
9
- };
7
+ export default function getScoreableWidgets(perseusRenderData: PerseusRenderer): ReadonlyArray<string>;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Perseus score",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "8.2.8",
6
+ "version": "8.2.9",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -23,8 +23,8 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@khanacademy/kas": "2.1.7",
26
- "@khanacademy/kmath": "2.2.31",
27
- "@khanacademy/perseus-core": "23.0.1",
26
+ "@khanacademy/kmath": "2.2.32",
27
+ "@khanacademy/perseus-core": "23.0.2",
28
28
  "@khanacademy/perseus-utils": "2.1.4"
29
29
  },
30
30
  "devDependencies": {