Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypeScript] format TSAsExpression with same logic as BinaryExpression (
#7869) * Treat TSAsExpression as like BinaryishNode * Change test file extension, as.js => as.ts * Add tests * Remove old case for TSAsExpression * Remove unnecesary condition * Fix by lint * Update snapshots * Add changelog * Remove convetToBinaryishNode * Fix comment * Use getBinaryishNodeNames * Modify to wrap TSAsExpression with parens * Fix by lint * Do not pass operator when node is TSAsExpression * Refactor shouldNotIndent * Update util.js Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
- Loading branch information
1 parent
18bf01e
commit 8a48ca2
Showing
8 changed files
with
172 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#### Wrap TSAsExpression ([#7869](https://github.com/prettier/prettier/pull/7869) by [@sosukesuzuki](https://github.com/sosukesuzuki)) | ||
|
||
<!-- prettier-ignore --> | ||
```ts | ||
// Input | ||
const varibale = foooooooooooooooooooooooooooooooooooooooooooooooooooo as SomeType; | ||
|
||
// Prettier stable | ||
const varibale = foooooooooooooooooooooooooooooooooooooooooooooooooooo as SomeType; | ||
|
||
// Prettier master | ||
const varibale = | ||
foooooooooooooooooooooooooooooooooooooooooooooooooooo as SomeType; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const name = (description as DescriptionObject).name || (description as string); | ||
this.isTabActionBar((e.target || e.srcElement) as HTMLElement); | ||
(originalError ? wrappedError(errMsg, originalError) : Error(errMsg)) as InjectionError; | ||
'current' in (props.pagination as Object); | ||
('current' in props.pagination) as Object; | ||
start + (yearSelectTotal as number); | ||
(start + yearSelectTotal) as number; | ||
scrollTop > (visibilityHeight as number); | ||
(scrollTop > visibilityHeight) as number; | ||
export default class Column<T> extends (RcTable.Column as React.ComponentClass<ColumnProps<T>,ColumnProps<T>,ColumnProps<T>,ColumnProps<T>>) {} | ||
export const MobxTypedForm = class extends (Form as { new (): any }) {} | ||
export abstract class MobxTypedForm1 extends (Form as { new (): any }) {} | ||
({}) as {}; | ||
function*g() { | ||
const test = (yield 'foo') as number; | ||
} | ||
async function g1() { | ||
const test = (await 'foo') as number; | ||
} | ||
({}) as X; | ||
() => ({}) as X; | ||
const state = JSON.stringify({ | ||
next: window.location.href, | ||
nonce, | ||
} as State); | ||
|
||
(foo.bar as Baz) = [bar]; | ||
(foo.bar as any)++; | ||
|
||
(bValue as boolean) ? 0 : -1; | ||
<boolean>bValue ? 0 : -1; | ||
|
||
const value1 = thisIsAReallyReallyReallyReallyReallyLongIdentifier as SomeInterface; | ||
const value2 = thisIsAnIdentifier as thisIsAReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongInterface; | ||
const value3 = thisIsAReallyLongIdentifier as (SomeInterface | SomeOtherInterface); | ||
const value4 = thisIsAReallyLongIdentifier as { prop1: string, prop2: number, prop3: number }[]; | ||
const value5 = thisIsAReallyReallyReallyReallyReallyReallyReallyReallyReallyLongIdentifier as [string, number]; | ||
|
||
const iter1 = createIterator(this.controller, child, this.tag as SyncFunctionComponent); | ||
const iter2 = createIterator(self.controller, child, self.tag as SyncFunctionComponent); |
Oops, something went wrong.