prettier/tests/typescript_cast
Kevin Donnelly c6e7c1966e Improve formatting of TS casts with generics and unions (#4219)
* Add tests showing existing behavior of various TS casts.

* Improve formatting of TS casts with generics and unions.

By adding a soft break between the cast and the expression. Also
includes wrapping parentheses for clarity as suggested in #4171.

Avoids changing behavior at all though if casting an array or object
literal because those already have good behavior where the array or
object literal breaks before the cast does so including them would just
result in a pointless extra layer of parentheses that would add no
clarity.

* Update tests in prepation for updating long cast format.

* Update so nested breaks inside type cast are indented.

* Add tests where expression being cast is too long itself.

* Update cast formatting to only sometimes break after cast.

Specifically it will break after the cast if that makes the cast itself
fit on a single line. If the cast itself won't fit on a single line then
the expression being cast will be placed directly after the `>` at the
end of the cast.
2018-05-07 22:26:01 -06:00
..
__snapshots__ Improve formatting of TS casts with generics and unions (#4219) 2018-05-07 22:26:01 -06:00
generic-cast.ts Improve formatting of TS casts with generics and unions (#4219) 2018-05-07 22:26:01 -06:00
hug-args.ts TypeScript: allow type assertions to hug (#2439) 2017-07-10 22:37:43 +10:00
jsfmt.spec.js Change run_spec to have explicit parser list (#3356) 2017-11-30 03:31:52 -03:00
parenthesis.ts Print parens around type assertion as LHS in assignment, fixes #2521 (#2525) 2017-07-20 23:16:15 +10:00