Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface for WITH statement does not match actual implementation wrt the stmt property #1925

Open
pkthomsen opened this issue May 28, 2024 · 0 comments

Comments

@pkthomsen
Copy link

Hi,

I noticed that the interface (in the types.ts.d file) for a WITH statement, it is defined like this:

export interface With {
  name: { value: string };
  stmt: {
    _parentheses?: boolean;
    tableList: string[];
    columnList: string[];
    ast: Select;
  };
  columns?: any[];
}

Here the stmt object contains a property 'ast' that is defined as a AST (or specifically a Select)

However, when I look at the actual object generated from the astify() function, I see that the stmt object itself is the AST object, i.e. as if the interface should have been like this:

export interface With {
  name: { value: string };
  stmt: Select;
  columns?: any[];
}

I much prefer the original definition of the interface, as it is very practical to always have a property named "ast" whenever there is an AST object. This makes it very easy to quickly parse through the output from astify() and find all ast named properties and parse these AST objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant