Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

TSPropertySignature has no computed flag #262

Closed
azz opened this issue May 7, 2017 · 2 comments
Closed

TSPropertySignature has no computed flag #262

azz opened this issue May 7, 2017 · 2 comments
Assignees
Labels

Comments

@azz
Copy link
Contributor

azz commented May 7, 2017

What version of TypeScript are you using?

2.3.2

What version of typescript-eslint-parser are you using?

a294afa

What code were you trying to parse?

var x: { [y]: any };

What did you expect to happen?

TSPropertySignature to have a computed: true property.

What happened?

No computed property.

In prettier, we currently print this as var x: { y: any }, which is incorrect.

prettier/prettier#1480

@soda0289 soda0289 added bug and removed triage labels May 7, 2017
@soda0289
Copy link
Member

soda0289 commented May 7, 2017

Typescript currently uses ComputedPropertyName node type for name in this case. We should convert it into a more ESTree like node. This will effect Interfaces as well. I will look into a fix.

@soda0289 soda0289 self-assigned this May 7, 2017
@soda0289
Copy link
Member

soda0289 commented May 7, 2017

@azz @JamesHenry
I have changed all of the node types to more estree like. Can you think of anything I might have missed?

interface TSPropertySignature {
  type: 'TSPropertySignature';
  optional: boolean;
  computed: boolean;
  key: Identifier;
  typeAnnotation: TypeAnnotation 
}

interface TSMethodSignature {
  type: 'TSMethodSignature';
  optional: boolean;
  computed: boolean;
  key: Identifier;
  params: [ Expression ]
  typeAnnotation: TypeAnnotation
  typeParameter: [ TypeParameter ]
}

interface TSIndexSignature {
  type: 'TSIndexSignature';
  index: Identifier;
  typeAnnotation: TypeAnnotation
}

interface TSConstructSignature {
  type: 'TSConstructSignature';
  params: [ Expression ]
  typeAnnotation: TypeAnnotation
  typeParameter: [ TypeParameter ]
}

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

No branches or pull requests

3 participants