-
Notifications
You must be signed in to change notification settings - Fork 141
TypeScript: ES5 target support #418
Comments
This should be possible. {
"compilerOptions": {
"target": "es6",
"module": "commonjs"
}
} @jhoffner |
Sounds good. Would love to get this up-to-date. We will need to make sure to make |
...I didn't think about the compatibility issues with TypeScript 1.8 and 2.0+ :( |
If we can support both 1.8 and 2.0 at the same time then we should be fine. I guess we could just manually copy the 1.8 files into the node_modules folder on the image (unless there is a better way to support two versions via npm). |
docker/node.docker#L23-L24 installs the latest stable release and Codewars currently has # Install TypeScript
RUN npm -g install typescript // Kumite
const cp = require('child_process');
console.log(cp.execSync('which tsc', {encoding:'utf8'}));
//=> /.npm-global/bin/tsc
console.log(cp.execSync('tsc -v', {encoding:'utf8'}));
//=> Version 2.2.1 |
Hmm, should have locked that to a version... |
@vguzev I was trying to cleanup the codebase while doing so. |
Multiple |
Have not idea what does that mean )
|
@vguzev I understand what this issue is about, and making |
I just re-read #380 and the issue is about |
Perhaps switching the default target from ES3 to ES6 could be the workaround for now...? |
We can make |
Cool! That would be great! ) |
@jhoffner what do you think of making targets configurable as described above? I won't be able to do it right now since my TODO list is getting long, but this one should be relatively easy. |
If we were to use targets as language versions, we would probably want to do 1.8/ES5, 2.2/ES5, 2.2/ES6, etc. I'm wondering if the accidental update from 1.8 to 2.2 caused any backwards compatibility issues with existing content. If it didn't, we could just leave it upgraded and not worry about 1.8 at all. As far as ES5 vs ES6, I'm thinking it's probably safe to switch to using ES6 as the target without ES3/5 support at all. ES5 is in the past, lets leave it there. |
Yeah, TypeScript's compatibility needs to be looked into. For targets, I think the issue will be allowing sloppy mode or not. JavaScript (ECMAScript) is very careful with backward compatibility because of "don't break the web". I'm assuming the default target "ES3" is sloppy and "ES5+" is strict. So just keeping "ES3" and the latest standard might be enough. I found a |
Hi! Any updates? |
@vguzev we won't be able to have this feature on Codewars anytime soon. There're some things we need to look into and decide. Also, @jhoffner will be on vacation starting tomorrow. If you can provide information about any breaking changes between TypeScript 1.8 and 2.2, that'll help. @jhoffner maybe #316 ( |
Oups... I meant not the "modern compiler", but configurable targets. The problem is that tsc v.2.2.1 also have ES3 target enabled by default. There is a PR out there microsoft/TypeScript#15466 for switching default target to ES5, but it is not available in current version of tsc. |
Meanwhile typescript 2.4.2 was published several days ago... any updates on this issue? |
I guess we can forget about 1.8? |
@kazk Great! Don't forget to set |
@kazk Looks OK for me :) |
Is it possible to add TypeScript configuration with ES5 target?
We can't use getters/setters with current version of TypeScript 1.8.10...
For example when I try to run this kata
https://www.codewars.com/kata/590b85b745eaa415e10000b1/train/typescript
I'm getting errors:
../home/codewarrior/solution.ts(28,7): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
In command line this can be done via command:
tsc task.ts -t ES5
The text was updated successfully, but these errors were encountered: