Skip to content

Is there any way to configure TypeScript differently for specific files? #32284

@isitreallyalive

Description

@isitreallyalive

Is there any way I can set my class file, Client.ts, to compile to ES6 whilst the rest compiles to ES5?

I was getting the error Class constructor Client cannot be invoked without 'new', so I set out to find an answer. According to this answer, I need to set my target to es6, so I did. That meant that Node could not run my code due to the fact that it was in ES6. Apparently, Node supports ES6 classes though, so how would I go about making only that file compile to ES6?

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn 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