Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
scarf005 opened this issue Dec 3, 2023 · 1 comment
Labels

Comments

@scarf005
Copy link

scarf005 commented Dec 3, 2023

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 scarf005 changed the title Support documenting properties in type alias Support JSDoc for interface-like type alias Dec 3, 2023
@crowlKats
Copy link
Member

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

@scarf005 scarf005 changed the title Support JSDoc for interface-like type alias Render properties of interface-like type aliases to be like the interface Dec 3, 2023
@crowlKats crowlKats added the html label Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants