Skip to content

typescript: TSIndexSignature without type parameters #7225

@armano2

Description

@armano2

This is similar issue as #7174 but for TSIndexSignature

Prettier 1.19.1
Playground link

--parser typescript

Input:

type foo = { [a: string] }

Output:

type foo = { [a: string]:  };

2nd run

SyntaxError: Type expected. (1:28)
> 1 | type foo = { [a: string]:  };
    |                            ^
  2 | 

Expected behavior:

type foo = { [a: string]; }

Additional info

https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/typescript-estree/src/ts-estree/ts-estree.ts#L1336-L1344

export interface TSIndexSignature extends BaseNode {
  type: AST_NODE_TYPES.TSIndexSignature;
  parameters: Parameter[];
  typeAnnotation?: TSTypeAnnotation;
  readonly?: boolean;
  accessibility?: Accessibility;
  export?: boolean;
  static?: boolean;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions