Skip to content

TypeScript syntax highlighting breaks for class methods returning a type ending in a digit #188

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

Closed
aeschli opened this issue Jun 15, 2016 · 2 comments

Comments

@aeschli
Copy link

aeschli commented Jun 15, 2016

From @lostfictions on June 3, 2016 7:45

This is a bit of a strange one. In the screenshot below, a class with two methods is declared. The first returns a number and has correct syntax highlighting. The second has an almost identical body but returns an endsWithDigit1 (a type alias for number), which breaks highlighting for the method body.

(On a more practical level, I discovered this while trying write a method that returned a Matrix4x4, so it's definitely something that might happen in day-to-day use!)

bug

  • VSCode Version: 1.1.1
  • OS Version: Ubuntu 14.04

Steps to Reproduce:

The repro code in the screenshot above is as follows:

type endsWithDigit1 = number

class Repro {
  normalMember() : number {

    const someDeclaration : (name : string) => string = (name) => 'hello there ' + name
    const myString = someDeclaration('human')
    let coolNumber = myString.length + 20
    var anotherCoolThing = {
      pigs: 6,
      rabbits: 29,
      horseName: 'Johnny'
    }

    console.log('this is how the syntax highlighting should look!')

    return 1
  }

  badHighlightingMember() : endsWithDigit1 {

    const someDeclaration : (name : string) => string = (name) => 'hello there ' + name
    const myString = someDeclaration('human')
    let coolNumber = myString.length + 20
    var anotherCoolThing = {
      pigs: 6,
      rabbits: 29,
      horseName: 'Johnny'
    }

    console.log('this has some highlighting but the colors are wrong')

    return 1
  }
}

Copied from original issue: microsoft/vscode#7170

@glen-84
Copy link

glen-84 commented Aug 7, 2016

Duplicate of #153.

@sheetalkamat
Copy link
Member

Fixed by #257

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

3 participants