As a side note, there are some other mismatched/broken types in here. Examples include:
options is any-typed. Can we strongly type it?
columns is carrying an any[] option - can we eliminate that in favor of strong typing?
groupby is declared as being a mandatory object, but we see null at runtime.
having is any-typed. Can we strongly type it?
qualify is declared as any[] | null | undefined. Why does that field support both null and undefined when the others don't? Can we strongly type the any[] away?
limit is returned with a useless object at runtime, but should probably be null?
window is declared as window?: WindowExpr, but we see null at runtime. Maybe fix the type to be window: WindowExpr | null to match the other fields?
Why have both _limit and limit? Same with orderby and _orderby?
Describe the bug Typescript type for Select.distinct does not match runtime value when parsing Snowflake SQL.
Database Engine Snowflake
To Reproduce node-sql-parser version: 5.3.4 node version: 22.11.0
parser.astify('SELECT * from foo;', {database: 'Snowflake'});
Expected behavior Declared type as follows. Note that
distinct
should be the stringDISTINCT
ornull
, but is{type: null}
at runtime.As a side note, there are some other mismatched/broken types in here. Examples include:
options
is any-typed. Can we strongly type it?columns
is carrying anany[]
option - can we eliminate that in favor of strong typing?groupby
is declared as being a mandatory object, but we seenull
at runtime.having
is any-typed. Can we strongly type it?qualify
is declared asany[] | null | undefined
. Why does that field support bothnull
andundefined
when the others don't? Can we strongly type theany[]
away?limit
is returned with a useless object at runtime, but should probably benull
?window
is declared aswindow?: WindowExpr
, but we seenull
at runtime. Maybe fix the type to bewindow: WindowExpr | null
to match the other fields?_limit
andlimit
? Same withorderby
and_orderby
?