@@ -1203,8 +1203,7 @@ const plugin = {
12031203 */
12041204
12051205/**
1206- * @typedef {import('@jsep-plugin/assignment').
1207- * AssignmentExpression} AssignmentExpression
1206+ * @typedef {any } AssignmentExpression
12081207 */
12091208
12101209/**
@@ -1447,7 +1446,7 @@ class SafeScript {
14471446 */
14481447 constructor ( expr ) {
14491448 this . code = expr ;
1450- this . ast = jsep ( this . code ) ;
1449+ this . ast = /** @type { unknown } */ jsep ( this . code ) ;
14511450 }
14521451
14531452 /**
@@ -1458,7 +1457,7 @@ class SafeScript {
14581457 runInNewContext ( context ) {
14591458 // `Object.create(null)` creates a prototypeless object
14601459 const keyMap = Object . assign ( Object . create ( null ) , context ) ;
1461- return SafeEval . evalAst ( this . ast , keyMap ) ;
1460+ return SafeEval . evalAst ( /** @type { jsep.Expression } */ this . ast , keyMap ) ;
14621461 }
14631462}
14641463
@@ -1506,7 +1505,8 @@ class SafeScript {
15061505 */
15071506
15081507/**
1509- * @typedef {unknown|ParentValue|string|ReturnObject } PreferredOutput
1508+ * @typedef {ReturnObject|string|number|boolean|null|unknown[]|
1509+ * Record<string, unknown>} PreferredOutput
15101510 */
15111511
15121512/**
@@ -1595,11 +1595,17 @@ function unshift(item, arr) {
15951595 */
15961596
15971597/**
1598- * @typedef {{Script: typeof SafeScript} } SafeScriptType
1598+ * @typedef {new (expr: string) => {
1599+ * runInNewContext: (context: object) => EvaluatedResult
1600+ * }} ScriptConstructor
15991601 */
16001602
16011603/**
1602- * @typedef {{Script: typeof Script} } ScriptType
1604+ * @typedef {{Script: ScriptConstructor} } SafeScriptType
1605+ */
1606+
1607+ /**
1608+ * @typedef {{Script: ScriptConstructor} } ScriptType
16031609 */
16041610
16051611/**
@@ -1624,7 +1630,7 @@ function unshift(item, arr) {
16241630 * @property {SandboxType } [sandbox={}]
16251631 * @property {EvalValue } [eval='safe']
16261632 * @property {any|null } [parent=null]
1627- * @property {string|null } [parentProperty=null]
1633+ * @property {ParentProperty } [parentProperty=null]
16281634 * @property {JSONPathCallback } [callback]
16291635 * @property {OtherTypeCallback } [otherTypeCallback] Defaults to
16301636 * function which throws on encountering `@other`
@@ -1932,7 +1938,7 @@ class JSONPathClass {
19321938 case 'value' :
19331939 case 'parent' :
19341940 case 'parentProperty' :
1935- return ea [ resultType ] ;
1941+ return /** @type { PreferredOutput } */ ea [ resultType ] ;
19361942 case 'path' :
19371943 if ( typeof ea . path === 'string' ) {
19381944 return ea . path ;
0 commit comments