-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) fallback param for built-in transition/animate (#790)
Up to Svelte version 3.32.0, the built-in animate/transition functions have optional parameters, but according to its typings they were mandatory. To not show unnecessary type errors to those users, `{}` should be added as a fallback parameter if the user did not provide one. It may be the case that someone has a custom animation with the same name that expects different parameters, but that possibility is far less likely. #785
- Loading branch information
1 parent
611e665
commit c9c6ea7
Showing
5 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
packages/svelte2tsx/test/htmlx2jsx/samples/transition-animate-fallbacks/expected.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<> | ||
<h1 {...__sveltets_ensureTransition(blur(__sveltets_ElementNode,{}))}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(fade(__sveltets_ElementNode,{}))}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(fly(__sveltets_ElementNode,{}))}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(slide(__sveltets_ElementNode,{}))}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(scale(__sveltets_ElementNode,{}))}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(draw(__sveltets_ElementNode,{}))}>Hello</h1> | ||
|
||
<h1 {...__sveltets_ensureTransition(blur(__sveltets_ElementNode,{}))}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(blur(__sveltets_ElementNode,{}))}>Hello</h1> | ||
|
||
<h1 {...__sveltets_ensureAnimation(flip(__sveltets_ElementNode,__sveltets_AnimationMove,{}))}>Hello</h1> | ||
|
||
<h1 {...__sveltets_ensureTransition(foo(__sveltets_ElementNode))}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(foo(__sveltets_ElementNode))}>Hello</h1> | ||
<h1 {...__sveltets_ensureTransition(foo(__sveltets_ElementNode))}>Hello</h1> | ||
<h1 {...__sveltets_ensureAnimation(foo(__sveltets_ElementNode,__sveltets_AnimationMove))}>Hello</h1></> |
17 changes: 17 additions & 0 deletions
17
packages/svelte2tsx/test/htmlx2jsx/samples/transition-animate-fallbacks/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- transitions --> | ||
<h1 transition:blur>Hello</h1> | ||
<h1 transition:fade>Hello</h1> | ||
<h1 transition:fly>Hello</h1> | ||
<h1 transition:slide>Hello</h1> | ||
<h1 transition:scale>Hello</h1> | ||
<h1 transition:draw>Hello</h1> | ||
<!-- also for in/out transitions --> | ||
<h1 in:blur>Hello</h1> | ||
<h1 out:blur>Hello</h1> | ||
<!-- animate --> | ||
<h1 animate:flip>Hello</h1> | ||
<!-- not others --> | ||
<h1 transition:foo>Hello</h1> | ||
<h1 in:foo>Hello</h1> | ||
<h1 out:foo>Hello</h1> | ||
<h1 animate:foo>Hello</h1> |
2 changes: 1 addition & 1 deletion
2
packages/svelte2tsx/test/htmlx2jsx/samples/transition-modifiers/expected.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<><div {...__sveltets_ensureTransition(slide(__sveltets_ElementNode))}> | ||
<><div {...__sveltets_ensureTransition(slide(__sveltets_ElementNode,{}))}> | ||
{item} | ||
</div></> |