File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 1- import { SyntaxError } from './errors' ;
1+ import { LiqeError , SyntaxError } from './errors' ;
22import grammar from './grammar' ;
33import { hydrateAst } from './hydrateAst' ;
44import { type LiqeQuery , type ParserAst } from './types' ;
@@ -52,7 +52,14 @@ export const parse = (query: string): LiqeQuery => {
5252 }
5353
5454 if ( results . length > 1 ) {
55- throw new Error ( 'Ambiguous results.' ) ;
55+ const firstResult = JSON . stringify ( results [ 0 ] ) ;
56+
57+ for ( const result of results ) {
58+ // Only throw if the results are different.
59+ if ( JSON . stringify ( result ) !== firstResult ) {
60+ throw new LiqeError ( 'Ambiguous results.' ) ;
61+ }
62+ }
5663 }
5764
5865 const hydratedAst = hydrateAst ( results [ 0 ] ) ;
Original file line number Diff line number Diff line change 44 "declaration" : true ,
55 "esModuleInterop" : true ,
66 "forceConsistentCasingInFileNames" : true ,
7+ "lib" : [
8+ " es2021"
9+ ],
710 "module" : " commonjs" ,
811 "moduleResolution" : " node" ,
912 "noImplicitAny" : false ,
1215 "noUnusedParameters" : false ,
1316 "outDir" : " dist" ,
1417 "skipLibCheck" : true ,
15- "lib" : [
16- " es2021"
17- ],
1818 "strict" : true ,
1919 "target" : " ES2018"
2020 },
You can’t perform that action at this time.
0 commit comments