qmhc / vite-plugin-dts

A Vite plugin for generating `.d.ts` files.
MIT License
1.14k stars 76 forks source link

Keep comments of the variable in d.ts #334

Open s3xysteak opened 1 month ago

s3xysteak commented 1 month ago

Description

Could we keep comments of the variable in d.ts, like unjs/unbuild ? However I haven't looked at the unjs/untyped implementation, so I don't know if this is possible.

Suggested solution

No idea.

Alternative

No response

Additional context

No response

Validations

qmhc commented 1 month ago

Comments will be keeped in declaration files. You need to provide a reproduction to show how the comments disappeared.

Shinigami92 commented 1 week ago

I assume it is related to #132, but that is not a valuable workaround.

We export types e.g. like this:

<script lang="ts">
export interface MyCompProps {
  /** JSDoc comment */
  myprop1: string
}
</script>

<script setup lang="ts">
defineProps<MyCompProps>()
</script>

That way other devs can also import these TS types and reuse them for their needs