Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

[Typescript] bug -- backticks sometimes results in the rest of the file being highlighted as a string #5774

Closed

Description

@williamstein

Here is a minimal .ts example to reproduce the problem:

class Foo {
  f(obj) {
    for (let key in obj) {
    }
  }

  g(a: string): void {
    if (!this.h(a)) {
      throw Error(`${a}`);
    }
  }

  // This should not be red!
  h(a: string): boolean {
    //...
  }
}

Paste that into the official demo and you'll see:

image

Activity

  1. haraldschilly commented on Feb 6, 2019

    @haraldschilly
    Contributor

    I refined the one above to be a bit shorter. It seems to trip over nested { { .. } }:

    if (true) {
      for (let i in [1, 2, 3]) {
        console.log(`${i}`);
      }
    }
    console.log("this is all orange");
    console.log("this is all orange");
    console.log("this is all orange");
    

    screenshot from 2019-02-06 18-40-09

  2. added a commit that references this issue on Jan 6, 2020
    644c2b1
  3. added a commit that references this issue on Jan 21, 2020
    2e3f6d4
  4. OmgImAlexis commented on May 11, 2021

    @OmgImAlexis
  5. marijnh commented on May 12, 2021

    @marijnh
    Member

    That's a different issue -- the mode didn't support the newly introduced template string types yet. Attached patch should address that.

  6. added a commit that references this issue on Sep 5, 2024
    e80024c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions