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

Missing computed flag on TSMethodSignature #290

Closed
vjeux opened this issue May 24, 2017 · 6 comments
Closed

Missing computed flag on TSMethodSignature #290

vjeux opened this issue May 24, 2017 · 6 comments
Labels

Comments

@vjeux
Copy link

vjeux commented May 24, 2017

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

What code were you trying to parse?

interface Iterable<T> {
  [Symbol.iterator](): Iterator<T>;
}

What did you expect to happen?

TSMethodSignature to have computed: true

What happened?

It doesn't.

{ type: 'TSMethodSignature',
  range: [ 26, 59 ],
  loc: { start: { line: 2, column: 2 }, end: { line: 2, column: 35 } },
  transformFlags: undefined,
  modifiers: undefined,
  name:
   { type: 'MemberExpression',
     range: [ 27, 42 ],
     loc: { start: [Object], end: [Object] },
     object:
      { type: 'Identifier',
        range: [Object],
        loc: [Object],
        name: 'Symbol' },
     property:
      { type: 'Identifier',
        range: [Object],
        loc: [Object],
        name: 'iterator' },
     computed: false },
  questionToken: undefined,
  typeParameters: null,
  parameters: [],
  typeAnnotation:
   { type: 'TypeAnnotation',
     loc: { start: [Object], end: [Object] },
     range: [ 47, 58 ],
     typeAnnotation:
      { type: 'TSTypeReference',
        range: [Object],
        loc: [Object],
        transformFlags: undefined,
        typeName: [Object],
        typeParameters: [Object] } } }

So prettier prints it as

interface Iterable<T> {
  Symbol.iterator(): Iterator<T>;
}
@soda0289 soda0289 changed the title Missing computer flag on TSMethodSignature Missing computed flag on TSMethodSignature May 24, 2017
@soda0289
Copy link
Member

Thanks for the report.

I think this is a duplicate of #262

I have another PR #264 that should handle all these cases. I will double check this one and add a test if needed.

@soda0289 soda0289 added bug and removed triage labels May 24, 2017
@vjeux
Copy link
Author

vjeux commented May 24, 2017

Awesome, looks like @azz already reported the same ones as I did :P

If you want to see what's missing to get all the popular typescript projects to transpile correctly: prettier/prettier#1643 (comment)

@vjeux
Copy link
Author

vjeux commented May 28, 2017

This is actually not a duplicate of #262.

var x: { [y]: any };

is now fixed, but

interface Iterable<T> {
  [Symbol.iterator](): Iterator<T>;
}

is still missing computed: true

@JamesHenry JamesHenry reopened this May 28, 2017
@vjeux
Copy link
Author

vjeux commented May 28, 2017

Actually, nevermind. Prettier isn't printing it -_- but it's there!

@vjeux vjeux closed this as completed May 28, 2017
@vjeux
Copy link
Author

vjeux commented May 28, 2017

Okay, there are no longer any known issues with typescript-eslint-parser from prettier. You are awesome!

@azz
Copy link
Contributor

azz commented May 29, 2017

Absolutely. Thanks heaps @soda0289 and @JamesHenry!

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

5 participants