You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Props defined on a component's $$Props type that extend another component's props via Svelte's ComponentProps<> TypeScript utility function lose any JSDoc-style prop documentation.
Hover documentation works fine when referencing the Svelte components directly, it's only the built definition files generated through build commands that seem to lose the comments and break documentation.
Reproduction
ComponentA.svelte
<scriptlang="ts">
interface $$Props {/** a doc */a: string;}</script>
ComponentB.svelte
importtype{ComponentProps}from'svelte';importComponentAfrom'./ComponentA.svelte';<scriptlang="ts">
interface $$Props extends ComponentProps<ComponentA>{/** b doc */b: string;}</script>
Build the components, and inspect the .d.ts files, and you'll see that the /** a doc */ comment is missing from ComponentB.svelte.d.ts.
Describe the bug
Props defined on a component's
$$Props
type that extend another component's props via Svelte'sComponentProps<>
TypeScript utility function lose any JSDoc-style prop documentation.Hover documentation works fine when referencing the Svelte components directly, it's only the built definition files generated through build commands that seem to lose the comments and break documentation.
Reproduction
ComponentA.svelte
ComponentB.svelte
Build the components, and inspect the
.d.ts
files, and you'll see that the/** a doc */
comment is missing fromComponentB.svelte.d.ts
.I've forked the
language-tools
repo and added a failing test demonstrating the issue. See the test Test4$$PropsExtends.svelte and the expected output Test4$$PropsExtends.svelte.d.ts.I suspect this is coming from TS itself, but curious if there's a workaround. Thanks for any insights.
Expected behaviour
JSDoc Comments are preserved in
.d.ts
files.System Info
System:
OS: macOS 14.0
Binaries:
Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.17.1/bin/yarn
npm: 10.1.0 - ~/.nvm/versions/node/v18.17.1/bin/npm
pnpm: 8.6.1 - ~/.nvm/versions/node/v18.17.1/bin/pnpm
Browsers:
Chrome: 118.0.5993.70
Edge: 118.0.2088.46
Safari: 17.0
npmPackages:
svelte: ^4.2.1 => 4.2.1
Which package is the issue about?
svelte2tsx
Additional Information, eg. Screenshots
No response
The text was updated successfully, but these errors were encountered: