deno_doc icon indicating copy to clipboard operation
deno_doc copied to clipboard

treat default export as reference node

Open crowlKats opened this issue 1 year ago • 2 comments

crowlKats avatar Dec 11 '24 17:12 crowlKats

I had the following example for this if it helps: (pasted from https://github.com/denoland/docs/issues/1313)

I was working on a promise util library here: https://jsr.io/@tyler/[email protected]

I have documented my first util with jsdoc, but re-exporting this symbol from a top level default export seems to break the jsr auto-doc detection.

It seems like exporting as a single default object results in the wrong type output too, which seems related. The type of default is {}.

The index.ts is just like this:

import { map } from './map.ts';

export default { map };

I have since changed the library to export the symbols as named to get around the issue (and I also stylistically prefer named), but this does seem like a problem worth solving nonetheless.

tylersayshi avatar Jan 07 '25 09:01 tylersayshi

@tylersayshi I had the same problem, but the following worked for me:

const defaultExport: { fetch: (req: Request) => Promise<Response>; } = { fetch };
export default defaultExport;

mb21 avatar Oct 15 '25 15:10 mb21