@@ -97,7 +97,7 @@ function unshift (item, arr) {
9797 * @param {ExpressionArray } path
9898 * @param {ParentValue } parent
9999 * @param {string|null } parentPropName
100- * @returns {boolean }
100+ * @returns {boolean|null }
101101 */
102102
103103/**
@@ -264,7 +264,6 @@ class JSONPathClass {
264264 * "other" type or not (or it may handle transformations and return
265265 * `false`).
266266 * @param {undefined } [otherTypeCallback]
267- * @returns {JSONPath|JSONPathClass }
268267 */
269268 /**
270269 * @overload
@@ -310,16 +309,6 @@ class JSONPathClass {
310309 /** @type {OtherTypeCallback|undefined } */
311310 this . currOtherTypeCallback = undefined ;
312311
313- /** @type {SafeScriptType } */
314- // eslint-disable-next-line @stylistic/max-len -- Long
315- // eslint-disable-next-line unicorn/no-undeclared-class-members, no-unused-expressions -- On prototype
316- this . safeVm ;
317-
318- /** @type {ScriptType } */
319- // eslint-disable-next-line @stylistic/max-len -- Long
320- // eslint-disable-next-line unicorn/no-undeclared-class-members, no-unused-expressions -- On prototype
321- this . vm ;
322-
323312 /** @type {SandboxType|undefined } */
324313 this . currSandbox = undefined ;
325314
@@ -1021,18 +1010,32 @@ class JSONPathClass {
10211010 ) ;
10221011 if ( [ 'safe' , true , undefined ] . includes ( evalType ) ) {
10231012 const { cache} = JSONPath ;
1013+ // eslint-disable-next-line @stylistic/max-len -- Long
1014+ /* eslint-disable unicorn/no-undeclared-class-members -- Prototype members */
10241015 cache [ scriptCacheKey ] = new (
1025- // eslint-disable-next-line @stylistic/max-len -- Long
1026- // eslint-disable-next-line unicorn/no-undeclared-class-members -- Prototype
1027- this . safeVm
1028- ) . Script ( script ) ;
1016+ /**
1017+ * @type {JSONPathClass & {
1018+ * safeVm: SafeScriptType,
1019+ * vm: ScriptType
1020+ * }}
1021+ */ ( /** @type {unknown } */ ( this ) )
1022+ ) . safeVm . Script ( script ) ;
1023+ // eslint-disable-next-line @stylistic/max-len -- Long
1024+ /* eslint-enable unicorn/no-undeclared-class-members -- End prototype member scope */
10291025 } else if ( this . currEval === 'native' ) {
10301026 const { cache} = JSONPath ;
1027+ // eslint-disable-next-line @stylistic/max-len -- Long
1028+ /* eslint-disable unicorn/no-undeclared-class-members -- Prototype members */
10311029 cache [ scriptCacheKey ] = new (
1032- // eslint-disable-next-line @stylistic/max-len -- Long
1033- // eslint-disable-next-line unicorn/no-undeclared-class-members -- Prototype
1034- this . vm
1035- ) . Script ( script ) ;
1030+ /**
1031+ * @type {JSONPathClass & {
1032+ * safeVm: SafeScriptType,
1033+ * vm: ScriptType
1034+ * }}
1035+ */ ( /** @type {unknown } */ ( this ) )
1036+ ) . vm . Script ( script ) ;
1037+ // eslint-disable-next-line @stylistic/max-len -- Long
1038+ /* eslint-enable unicorn/no-undeclared-class-members -- End prototype member scope */
10361039 } else if (
10371040 typeof this . currEval === 'function' &&
10381041 this . currEval . prototype &&
@@ -1088,7 +1091,8 @@ class JSONPathClass {
10881091 }
10891092}
10901093
1091- JSONPathClass . prototype . safeVm = {
1094+ /** @type {{safeVm: SafeScriptType} } */
1095+ ( /** @type {unknown } */ ( JSONPathClass . prototype ) ) . safeVm = {
10921096 Script : SafeScript
10931097} ;
10941098
0 commit comments