Skip to content

Instantly share code, notes, and snippets.

@AtsushiSuzuki
Created October 8, 2016 12:19
Show Gist options
  • Save AtsushiSuzuki/8503c422bdc67c66e30c1b798de7f0c0 to your computer and use it in GitHub Desktop.
Save AtsushiSuzuki/8503c422bdc67c66e30c1b798de7f0c0 to your computer and use it in GitHub Desktop.
TypeScript 2.0.3 possible bug?
test1.ts(8,12): error TS1005: '=' expected.
test1.ts(9,27): error TS1005: ')' expected.
test1.ts(9,39): error TS1005: ';' expected.
test1.ts(9,41): error TS1005: '=>' expected.
test1.ts(11,6): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
test1.ts(13,1): error TS1128: Declaration or statement expected.
class Test1 {
async hello() {
return ["hello", "world"];
}
test() {
// should be OK but fail with TypeScript 2.0.3
(async () => {
for (let i in await this.hello()) {
}
});
}
}
class Test2 {
async hello() {
return ["hello", "world"];
}
async test() {
for (let i in await this.hello()) {
}
}
}
class Test3 {
async hello() {
return ["hello", "world"];
}
test() {
const fn = async () => {
for (let i in await this.hello()) {
}
};
fn();
}
}
class Test4 {
async hello() {
return ["hello", "world"];
}
test() {
(async () => {
await this.hello();
});
}
}
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment