Typescript: Is there any way to configure TypeScript differently for specific files?

Created on 7 Jul 2019  路  3Comments  路  Source: microsoft/TypeScript

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?

Question

Most helpful comment

Short answer is "no". Long answer is also "no" 馃槈

All 3 comments

Kind of a duplicate of #8405 (or at least related).

This also seems to be a question. Please respect the issue template:
https://github.com/microsoft/TypeScript/blob/master/.github/ISSUE_TEMPLATE/Question.md

Short answer is "no". Long answer is also "no" 馃槈

@RyanCavanaugh Is there an answer between the short and the long one?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

remojansen picture remojansen  路  3Comments

blendsdk picture blendsdk  路  3Comments

kyasbal-1994 picture kyasbal-1994  路  3Comments

weswigham picture weswigham  路  3Comments

DanielRosenwasser picture DanielRosenwasser  路  3Comments