I have a block of TypeScript code as shown below:
/**
* @typedef Foo
* @type {Object}
* @property {string} id
*/
type Foo = {
id: string
}
/**
* bar
* @returns {Foo}
*/
function bar(): Foo {
const foo:Foo = {id: 'foo'}
return foo
}
When transpiling this code with Rollup, I want the resulting JavaScript to look like this:
/**
* @typedef Foo
* @type {Object}
* @property {string} id
*/
/**
* bar
* @returns {Foo}
*/
function bar() {
const foo = { id: 'foo' };
return foo;
}
This way, the @returns{Foo}
JSDoc will accurately reflect in my code editor.
During the transpilation process by Rollup and possibly using tools like the TypeScript Playground (tsc?), the Foo typedef JSDoc block gets removed. I'm looking for a way to preserve that @typedef JSDoc block. Any suggestions?