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] Issues on syntax highlight and indentation on interfaces and types #5734

Closed

Description

@ficristo

The types aren't always highlighted as such. The last type Bar seems also wrong.
Trying the code on https://codemirror.net/mode/javascript/typescript.html I get inconsistent indentation: if I hit Enter after string or void in some cases I go the the 2 in other to the 4 or 6 column.

interface Foo {
    name: string;
    greet(): void;
}

type Bar = {
    name: string;
    greet(): void;
}

interface Foo {
    name: string,
    greet(): void,
}

type Bar = {
    name: string,
    greet(): void,
}

interface Foo {
    name: string
    greet(): void
}

type Bar = {
    name: string
    greet(): void
}

If I hit enter after the last curly brace it is indented when it shouldn't.

declare namespace CodeMirror {
}

Activity

  1. ficristo commented on Jan 3, 2019

    @ficristo
    ContributorAuthor

    In the code example above I still see some issues with the interface with comma delimiters and the last type when preceded with the interface without delimiters.

  2. marijnh commented on Jan 4, 2019

    @marijnh
    Member

    Ahh, right, that was caused by the parser treating class and interface declarations the same, and getting confused when there was neither a body nor a semicolon after a method. Attached patch should help.

  3. ficristo commented on Jan 4, 2019

    @ficristo
    ContributorAuthor

    The interface with comma delimiters has still some problems.

  4. added 3 commits that reference this issue on Jan 6, 2020
    0ca0af2
    8eacb3f
    fce2f7a
  5. added a commit that references this issue on Jan 21, 2020
    2e3f6d4
  6. added a commit that references this issue on Sep 5, 2024
    fe2bdb3
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