futurGH / ts-to-jsdoc

Transpile TypeScript code to fully compatible JavaScript + JSDoc comments.
MIT License
179 stars 17 forks source link

jsdoc returns type is imported from absolute path #21

Closed milahu closed 1 year ago

milahu commented 1 year ago

typescript input

export interface SomeType {
  someKey: string;
}

export function someFunction(someString: string): SomeType {
    return { someKey: someString };
}

actual javascript output

/** @param {string} someString
 * @returns {import("/absolute/path/to/workdir/input-file-basename.ts-to-jsdoc").SomeType}
 */
export function someFunction(someString) {
    return { someKey: someString };
}

/** @typedef {Object} SomeType
 * @property {string} someKey
 */

expected jsdoc comment: no type import

/** @param {string} someString
 * @returns {SomeType}
 */