futurGH / ts-to-jsdoc

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

Using relative paths for imported types #43

Closed DEVTomatoCake closed 4 months ago

DEVTomatoCake commented 4 months ago

Nice project!

Is there any way of making it use relative paths instead of absolute ones for imported types when using the project option? Absolute paths makes a project mostly unable to collaborate to together with others with different setups.

There doesn't seem to be any disadvantage in using e.g.

@returns {import("./file").File}

over

@returns {import("C:/path/to/file").File}
futurGH commented 4 months ago

Hey! Can you share a reproduction where this happens?

DEVTomatoCake commented 4 months ago
static contextmenu=new Contextmenu("guild menu");

gets transformed to

/**
 * @static
 * @default import("C:/path/to/folder/contextmenu").Contextmenu
 */
static contextmenu = new Contextmenu("guild menu");

I'm trying this on MathMan05/JankClient, the above is an example from guild.js after running npx ts-to-jsdoc -p ./tsconfig.json. I'd guess it happens to other projects too though.

futurGH commented 4 months ago

Thanks, fixed in 2.1.2!