Skip to content

formatter: yield expression with comment #14273

@nnnnoel

Description

@nnnnoel
declare var a: any;

function *t1() {
    yield (
        // comment
        a as any
    );
}
function *t2() {
    yield (
        // comment
        a as any
    ) + 1;
}
function *t3() {
    yield (
        // comment
        a as any
    ) ? 0 : 1;
}
function *t4() {
    yield (
        // comment
        a as any
    ).b;
}
function *t5() {
    yield (
        // comment
        a as any
    )[a];
}
function *t6() {
    yield (
        // comment
        a as any
    )();
}
function *t7() {
    yield (
        // comment
        a as any
    )``;
}
function *t8() {
    yield (
        // comment
        a as any
    ) as any;
}
function *t9() {
    yield (
        // comment
        a as any
    ) satisfies any;
}
function *t10() {
    yield (
        // comment
        a as any
    )!;
}

It works wrong to format.

Actual

declare var a: any;

function* t1() {
  yield // comment

  a as any;
}

function* t2() {
  yield // comment

  (a as any) + 1;
}

function* t3() {
  yield // comment

  (a as any)
    ? 0
    : 1;
}

function* t4() {
  yield // comment

  (a as any).b;
}

function* t5() {
  yield // comment

  (a as any)[a];
}

function* t6() {
  yield // comment

  (a as any)();
}

function* t7() {
  yield // comment

  (a as any)``;
}

function* t8() {
  yield // comment

  a as any as any;
}

function* t9() {
  yield // comment

  a as any satisfies any;
}

function* t10() {
  yield // comment

  (a as any)!;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions