Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/svelte2tsx/src/svelte2tsx/nodes/ExportedNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,17 @@ export class ExportedNames {

private getDoc(target: ts.BindingName) {
let doc = undefined;
// Traverse `a` one up. If the declaration is part of a declaration list,
// the comment is at this point already
const variableDeclaration = target?.parent;
// Traverse `a` up to `export let a`
const exportExpr = target?.parent?.parent?.parent;

if (exportExpr) {
if (variableDeclaration) {
doc = getLastLeadingDoc(variableDeclaration);
}

if (exportExpr && !doc) {
doc = getLastLeadingDoc(exportExpr);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
*/
let b;
let c;
/**
* d
*/
let d;let
/**
* e
*/
e;
;
() => (<></>);
return { props: {
Expand All @@ -21,7 +29,13 @@ return { props: {
*/a: a ,
/**
* MORE DOCS!
*/b: b , c: c}, slots: {}, getters: {}, events: {} }}
*/b: b , c: c ,
/**
* d
*/d: d ,
/**
* e
*/e: e}, slots: {}, getters: {}, events: {} }}

export default class Input__SvelteComponent_ extends __sveltets_1_createSvelte2TsxComponent(__sveltets_1_partial(__sveltets_1_with_any_event(render()))) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@
*/
export let b;
export let c;
/**
* d
*/
export let d,
/**
* e
*/
e;
</script>