Skip to content

Commit 85012d0

Browse files
author
Evgeniy Timokhov
committed
Added parenthesizes to as expressions
1 parent 9f95513 commit 85012d0

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

tests/test-cases/any/input.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function func(obj1: PublicInterface, obj2: InternalInterface, obj3: PublicByJSDo
1616
}
1717

1818
function func2(): any {
19-
const b = { value: 321 } as any;
20-
const c = { field: 222 } as any as InternalInterface;
19+
const b = (({ value: 321 }) as any);
20+
const c = (({ field: 222 }) as any) as InternalInterface;
2121
return {
2222
foo: 1,
2323
bar: b,

tests/test-cases/any/output.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ function func(obj1, obj2, obj3) {
44
console.log(obj1.field.f1Any, obj2._internal_field.f2Any, obj3.field.f3Any);
55
}
66
function func2() {
7-
var b = { value: 321 };
8-
var c = { _internal_field: 222 };
7+
var b = ({ value: 321 });
8+
var c = ({ _internal_field: 222 });
99
return {
1010
foo: 1,
1111
bar: b,

tests/test-cases/unknown/input.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ interface InternalInterface {
33
}
44

55
function func(): unknown {
6-
const b = { value: 321 } as unknown;
7-
const c = { int: 222 } as unknown as InternalInterface;
6+
const b = (({ value: 321 }) as unknown);
7+
const c = (({ int: 222 }) as unknown) as InternalInterface;
88

99
return {
1010
foo: 1,

tests/test-cases/unknown/output.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function func() {
2-
var b = { value: 321 };
3-
var c = { _internal_int: 222 };
2+
var b = ({ value: 321 });
3+
var c = ({ _internal_int: 222 });
44
return {
55
foo: 1,
66
bar: b,

0 commit comments

Comments
 (0)