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

TSTypeOperatorBuilder interface call signature should accept a typeAnnotation parameter #947

Open
lachlanhunt opened this issue Nov 23, 2023 · 0 comments

Comments

@lachlanhunt
Copy link

The current TSTypeOperatorBuilder interface:

export interface TSTypeOperatorBuilder {
  (operator: string): namedTypes.TSTypeOperator;
  from(
    params: {
      comments?: K.CommentKind[] | null;
      loc?: K.SourceLocationKind | null;
      operator: string;
      typeAnnotation: K.TSTypeKind;
    }
  ): namedTypes.TSTypeOperator;
}

Since the typeAnnotation is required, attempting to create a TSTypeOperator by calling the function isn't possible. It can only be done by using the .from() method instead.

The call signature should have a second parameter for the typeAnnotation

export interface TSTypeOperatorBuilder {
  (operator: string, typeAnnotation: K.TSTypeKind): namedTypes.TSTypeOperator;
  ...
}

Some code to reproduce the error can be viewed here.

https://astexplorer.net/#/gist/2328ddf6e049e141a5db2293d6d67668/27d29233f044354b19d639701ceff667448b4b55

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