Open
Description
Currently "typedef to type conversion" doesn't care about the place where type is generated, resulting broken code if the type if generated inside the class / interface etc.
It's better to generate class in closest SourceFile root, namespace root or even function body in case the comment containing @typedef is placed at any other place of the code.
🔎 Search Terms
Searched for typedef issues reported after March 1st
🕗 Version & Regression Information
- This changed between versions 5.1.x and latest
⏯ Playground Link
💻 Code
class Example {
/**
* List of items to be rendered in the bar chart
* @typedef {{ count: number }} Counter
* @returns {Counter}
*/
get something() {
return { count: 0 };
}
}
🙁 Actual behavior
class Example {
type Counter={ count: number; }; // <- bug is here
get something() {
return { count: 0 };
}
}
🙂 Expected behavior
type Counter={ count: number; };
class Example {
/**
* List of items to be rendered in the bar chart
* @returns {Counter}
*/
get something() {
return { count: 0 };
}
}