Skip to content

TypeScript: nested union types + useTabs #4198

@thorn0

Description

@thorn0

Prettier 1.11.1
Playground link

--parser typescript
--tab-width 4
--use-tabs

Input:

class Aaa {
  private normalizeServerError(rawError:
    string |
    {a:string|number|{a:string}|Rwersdfsdfvxcvsdfdewerwerw} |                            
    ng.IHttpPromiseCallbackArg<
      | string
      | { error: string | ErrorInformation }
      | { Message: string; ExceptionType: string }
    >
  ) {
    console.log(rawError);
  }
}

Output:

class Aaa {
	private normalizeServerError(
		rawError:
			| string
			| {
					a:
						| string
						| number
						| { a: string }
						| Rwersdfsdfvxcvsdfdewerwerw;
			  }
			| ng.IHttpPromiseCallbackArg<
					| string
					| { error: string | ErrorInformation }
					| { Message: string; ExceptionType: string }
			  >
	) {
		console.log(rawError);
	}
}

Expected behavior:

class Aaa {
	private normalizeServerError(
		rawError:
			| string
			| {
				a:
					| string
					| number
					| { a: string }
					| Rwersdfsdfvxcvsdfdewerwerw;
			  }
			| ng.IHttpPromiseCallbackArg<
				| string
				| { error: string | ErrorInformation }
				| { Message: string; ExceptionType: string }
			  >
	) {
		console.log(rawError);
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:union typeslang:flowIssues affecting Flow-specific constructs (not general JS issues)lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions