JS Doc type annotation moved inside of object after v0.13
Author: michielpauwCreated Feb 26, 2025Updated Jul 29, 2025
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'
});Source: facebook/jscodeshift