Skip to content

TSTypeOperatorBuilder interface call signature should accept a typeAnnotation parameter #947

Description

@lachlanhunt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions