Skip to content

Commit c493f85

Browse files
committed
Use Deparser class directly to work around type issue
1 parent d910e3a commit c493f85

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/lib/Parser.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import prettier from 'prettier/standalone.js'
22
import SqlFormatter from 'prettier-plugin-sql'
3-
import { parse, deparse } from 'pgsql-parser'
3+
import { parse, Deparser } from 'pgsql-parser'
44
import { FormatterOptions } from './types.js'
55

66
const DEFAULT_FORMATTER_OPTIONS = {
@@ -33,9 +33,7 @@ interface ParseReturnValues {
3333
*/
3434
export function Deparse(parsedSql: object): DeparseReturnValues {
3535
try {
36-
// @ts-ignore - Type definition defines non-optional any, though the argument is not required
37-
const data = deparse(parsedSql)
38-
36+
const data = new Deparser(parsedSql).deparseQuery()
3937
return { data, error: null }
4038
} catch (error) {
4139
return { data: null, error: error as Error }

0 commit comments

Comments
 (0)