Skip to content

Commit

Permalink
fix: preserve bind:... mapping on elements for better source maps
Browse files Browse the repository at this point in the history
else an error like "X is not assignable to bind:Y" is shown on the previous attribute, if there is one
  • Loading branch information
dummdidumm committed Nov 22, 2024
1 parent be44125 commit cda5c86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 1 addition & 6 deletions packages/svelte2tsx/src/htmlxtojsx_v2/nodes/Binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,7 @@ export function handleBinding(
? // HTML typings - preserve the bind: prefix
isShorthand
? [`"${str.original.substring(attr.start, attr.end)}"`]
: [
`"${str.original.substring(
attr.start,
str.original.lastIndexOf('=', attr.expression.start)
)}"`
]
: ['"', [attr.start, str.original.lastIndexOf('=', attr.expression.start)], '"']
: // Other typings - remove the bind: prefix
isShorthand
? [[attr.expression.start, attr.expression.end]]
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cda5c86

Please sign in to comment.