Skip to content

ES6 should be valid TypeScript #2606

@ChristianKohler

Description

@ChristianKohler

Since TypeScript is a superset of JavaScript it should be possible to compile ES6 code without errors.

This valid ES6 snippets throws the following error:

Error:(3, 14) TS2339: Property 'weight' does not exist on type 'Car'.
class Car {
    constructor(weight) {
        this.weight = weight;
    }
}

Is this a bug or a 'feature'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already createdQuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions