fix: exclude type-only props from instance exports when migrating (#13485)

pull/13448/head
Rich Harris 1 day ago committed by GitHub
parent 6c1e462927
commit d77905d788
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: exclude type-only props from instance exports when migrating

@ -273,7 +273,7 @@ export function migrate(source) {
if (state.props.length > 0 && state.analysis.accessors) { if (state.props.length > 0 && state.analysis.accessors) {
str.appendRight( str.appendRight(
insertion_point, insertion_point,
`\n${indent}export {${state.props.reduce((acc, prop) => (prop.slot_name ? acc : `${acc}\n${indent}\t${prop.local},`), '')}\n${indent}}\n` `\n${indent}export {${state.props.reduce((acc, prop) => (prop.slot_name || prop.type_only ? acc : `${acc}\n${indent}\t${prop.local},`), '')}\n${indent}}\n`
); );
} }

@ -9,14 +9,12 @@
} }
let { let {
test,
count = 0, count = 0,
stuff, stuff,
cool cool
}: Props = $props(); }: Props = $props();
export { export {
test,
count, count,
stuff, stuff,
} }

Loading…
Cancel
Save