File tree Expand file tree Collapse file tree 3 files changed +5
-7
lines changed Expand file tree Collapse file tree 3 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ export const functions: FunctionBuildersMap = {
130130 }
131131 } ,
132132
133- filter : < T > ( predicate : JSONQuery [ ] ) => {
133+ filter : < T > ( predicate : JSONQuery ) => {
134134 const _predicate = compile ( predicate )
135135
136136 return ( data : T [ ] ) => data . filter ( ( item ) => truthy ( _predicate ( item ) ) )
@@ -171,7 +171,7 @@ export const functions: FunctionBuildersMap = {
171171
172172 pick : ( ...properties : JSONQueryProperty [ ] ) => {
173173 const getters = properties . map (
174- ( [ _get , ...path ] ) => [ path [ path . length - 1 ] , functions . get ( ...path ) ] as Getter
174+ ( [ _get , ...path ] ) => [ path [ path . length - 1 ] , functions . get ( ...( path as JSONPath ) ) ] as Getter
175175 )
176176
177177 const _pick = ( object : Record < string , unknown > , getters : Getter [ ] ) : unknown => {
@@ -294,7 +294,7 @@ export const functions: FunctionBuildersMap = {
294294 not : buildFunction ( ( a : unknown ) => ! a ) ,
295295
296296 exists : ( queryGet : JSONQueryFunction ) => {
297- const parentPath = queryGet . slice ( 1 )
297+ const parentPath = queryGet . slice ( 1 ) as JSONPath
298298 const key = parentPath . pop ( )
299299 const getter = functions . get ( ...parentPath )
300300
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ export type {
2929 JSONQueryObject ,
3030 JSONQueryOptions ,
3131 JSONQueryParseOptions ,
32- JSONQueryPipe ,
3332 JSONQueryPrimitive ,
3433 JSONQueryProperty ,
3534 JSONQueryStringifyOptions
Original file line number Diff line number Diff line change 1- export type JSONQueryPipe = JSONQuery [ ]
2- export type JSONQueryFunction = [ name : string , ...args : JSONQuery [ ] ]
1+ export type JSONQueryFunction = [ name : string , ...args : unknown [ ] ]
32export type JSONQueryObject = { [ key : string ] : JSONQuery }
43export type JSONQueryPrimitive = string | number | boolean | null
5- export type JSONQuery = JSONQueryFunction | JSONQueryPipe | JSONQueryObject | JSONQueryPrimitive
4+ export type JSONQuery = JSONQueryFunction | JSONQueryObject | JSONQueryPrimitive
65
76export type JSONProperty = string
87export type JSONPath = JSONProperty [ ]
You can’t perform that action at this time.
0 commit comments