Skip to content

Indentation formatting nested destructering is incorrect #105

Closed
@jvanoostveen

Description

@jvanoostveen

Provided the following code:

let a = {
  b: 1,
  c: 2,
  d: {
    e: 'a',
    f: 'b',
    h: 'c'
  }
};

export let test = (
  multi: typeof a,
  line: boolean,
  params: boolean
): boolean => {
  let {
    d: {
      e,
      f,
      h
    }
  } = a;

  return true;
};

After formatting, the function will be:

export let test = (
  multi: typeof a,
  line: boolean,
  params: boolean
): boolean => {
  let {
    d: {
      e,
    f,
    h
    }
  } = a;

  return true;
};

The f and h in the destruct are unidented one position.
When I add a destruct before the d (for example c), then the formatting is correct.

  let {
    c, // <- one before the nested destruct.
    d: {
      e,
      f,
      h
    }
  } = a;

Environment:
TypeScript 2.3.4
TypeScript Formatter 5.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions