deno_doc icon indicating copy to clipboard operation
deno_doc copied to clipboard

Render properties of interface-like type aliases to be like the interface

Open scarf005 opened this issue 2 years ago • 1 comments

Summary

deno doc does not take JSDoc into account when it encounters interface-like type alias. using type alias for documenting can be beneficial when the library owner does not intend to 'patch' interface globally.

Steps to reproduce

  1. create interface and type.
// example.ts

export interface Foo {
	/**
	 * @param x - The number to do something with
	 * @returns The number after doing something
	 */
	foo: (x: number) => number
}

export type Bar = {
	/**
	 * @param x - The number to do something with
	 * @returns The number after doing something
	 */
	bar: (x: number) => number
}
  1. run deno doc.
$ deno doc example.ts
Defined in file:///home/scarf/repo/etc/typed_regex/example.ts:1:1

interface Foo

  foo: (x: number) => number

    @param x
        - The number to do something with

    @return
        The number after doing something


Defined in file:///home/scarf/repo/etc/typed_regex/example.ts:9:1

type Bar = { bar: (x: number) => number; }

Expected Outcome

type Bar

  bar: (x: number) => number

    @param x
        - The number to do something with

    @return
        The number after doing something

Others

i thought #302 was already opened, but was confirmed at discord that they weren't the same

scarf005 avatar Dec 03 '23 09:12 scarf005

The topic on discord was slightly different: the topic was about rendering of individual properties of interface-like type aliases to be like the interface view

crowlKats avatar Dec 03 '23 09:12 crowlKats