Skip to content

Semi-colon requirements/spec for TypeScript-specific concepts #10730

@JamesHenry

Description

@JamesHenry

I apologise for deviating from the standard template, but I strongly feel this low-level question can only be answered by a member of the TypeScript team.

I began asking this in the gitter channel but I think this is more appropriate in this case.

Background

I am a member of the ESLint team working on the typescript-eslint-parser project. We are super excited to bring TypeScript support to ESLint and be able to bring together two awesome communities.

We are currently looking into how we could extend existing rules to "just work". Early findings and more background to that is available here: eslint/typescript-eslint-parser#77

Specifically this has led me to need to determine how semi-colon behaviour is defined for TypeScript-specific statements?

For example, if we want want to extend the semi or no-extra-semi rules in ESLint to take TypeScript specific nodes into account, we first need to define when a semi-colon could be used (whether required or not).

Some examples:

Type aliases seem to work just fine with or without semi-colons:

type Result<T> = Success<T> | Failure
type Result<T> = Success<T> | Failure;

Interfaces seem to allow pretty much anything as a delimiter:

interface Foo {
    bar: boolean
    baz: string;
    qux: any,
}

Is it spec'd somewhere, officially or unofficially, how these statements and delimiters should behave?

Many thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsThe issue relates to how you learn TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions