zer0
zer0
DDeno
Created by zer0 on 11/28/2024 in #help
Properly Integrating JSDoc and Type Definitions for Deno and JS
Hi everyone! I’m working on a JavaScript codebase designed for both Deno and browsers. We’re adding documentation and types to publish it on JSR, but I’ve hit some roadblocks. Issue 1: JSDoc Using JSDoc for @param and @returns doesn’t work with deno doc or JSR—they ignore the types, likely because they rely on .d.ts files for type information. This seems limiting for *.js files but might be a technical constraint. Issue 2: .d.ts Files I tried using .d.ts files following https://docs.deno.com/runtime/fundamentals/typescript/, however: - Comments in the source and .d.ts seems mutually exclusive in deno doc, forcing me to move all comments in .d.ts, leaving the source undocumented. - While the editor’s language server recognizes the .d.ts types for imports (a main.js, but still fails on add.js), deno check fails on both main.js and add.js with errors like: error: TS7006 [ERROR]: Parameter 'a' implicitly has an 'any' type.. Questions: 1. How can I make deno check work with @ts-self-types for both the source (add.js) and the importer (main.js)? 2. [And/or] Is there any way to make JSDoc types work directly with deno doc and JSR without .d.ts files? Thanks for any help!
1 replies