Skip to content

JS Doc type annotation moved inside of object after v0.13 #650

@michielpauw

Description

@michielpauw

Hi! I noticed a strange change of behaviour from v0.14 onwards when using jscodeshift on this code snippet:

export default /** @type {SomeType} */ ({
  someProp: 'someProp',
});

I'm "transforming" this file as such:

const root = j.(fs.readFileSync(filepath, 'utf-8'));
return root.toSource();

Expected output

The code should not have changed

export default /** @type {SomeType} */ ({
  someProp: 'someProp',
});

This seems to be the case in v0.13 and before.

Actual output (from v0.14 onward)

export default ({
  /** @type {SomeType} */ someProp: 'someProp'
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions