Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript: type assertions (as) aren't wrapped #6443

Open
thorn0 opened this issue Sep 1, 2019 · 1 comment · Fixed by #7869 · May be fixed by #8612
Open

TypeScript: type assertions (as) aren't wrapped #6443

thorn0 opened this issue Sep 1, 2019 · 1 comment · Fixed by #7869 · May be fixed by #8612
Labels
lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) type:bug Issues identifying ugly output, or a defect in the program

Comments

@thorn0
Copy link
Member

thorn0 commented Sep 1, 2019

Prettier 1.18.2
Playground link

--parser typescript

Input:

const bifornCringerMoshedPerplexSawder = 
  askTrovenaBeenaDependsRowans as glimseGlyphsHazardNoopsTieTie;
  
averredBathersBoxroomBuggyNurl.anodyneCondosMalateOverateRetinol = 
  annularCooeedSplicesWalksWayWay as kochabCooieGameOnOboleUnweave;

averredBathersBoxroomBuggyNurl = {
  anodyneCondosMalateOverateRetinol:
    annularCooeedSplicesWalksWayWay as kochabCooieGameOnOboleUnweave
};

averredBathersBoxroomBuggyNurl(
  anodyneCondosMalateOverateRetinol.annularCooeedSplicesWalksWayWay as 
    kochabCooieGameOnOboleUnweave
);

Output:

const bifornCringerMoshedPerplexSawder = askTrovenaBeenaDependsRowans as glimseGlyphsHazardNoopsTieTie;

averredBathersBoxroomBuggyNurl.anodyneCondosMalateOverateRetinol = annularCooeedSplicesWalksWayWay as kochabCooieGameOnOboleUnweave;

averredBathersBoxroomBuggyNurl = {
  anodyneCondosMalateOverateRetinol: annularCooeedSplicesWalksWayWay as kochabCooieGameOnOboleUnweave
};

averredBathersBoxroomBuggyNurl(
  anodyneCondosMalateOverateRetinol.annularCooeedSplicesWalksWayWay as kochabCooieGameOnOboleUnweave
);

Expected behavior:
See input.

Note that as, if wrapped, should stay at the end of the line. This is not valid TS:

const bifornCringerMoshedPerplexSawder = askTrovenaBeenaDependsRowans
  as glimseGlyphsHazardNoopsTieTie;
@alexander-akait alexander-akait added lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) type:bug Issues identifying ugly output, or a defect in the program labels Sep 2, 2019
@alexander-akait
Copy link
Member

Mark as bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
2 participants