mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
//// [tests/cases/compiler/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts] ////
|
|
|
|
//// [arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts]
|
|
// regression test for https://github.com/microsoft/TypeScript/issues/32914
|
|
declare var value: boolean;
|
|
declare var a: any;
|
|
|
|
const test = () => ({
|
|
// "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space.
|
|
prop: !value, // remove ! to see that errors will be gone
|
|
run: () => { //replace arrow function with regular function to see that errors will be gone
|
|
// comment next line or remove "()" to see that errors will be gone
|
|
if(!a.b()) { return 'special'; }
|
|
|
|
return 'default';
|
|
}
|
|
});
|
|
|
|
|
|
//// [arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.js]
|
|
"use strict";
|
|
const test = () => ({
|
|
// "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space.
|
|
prop: !value, // remove ! to see that errors will be gone
|
|
run: () => {
|
|
// comment next line or remove "()" to see that errors will be gone
|
|
if (!a.b()) {
|
|
return 'special';
|
|
}
|
|
return 'default';
|
|
}
|
|
});
|