-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transition directive doesn't accept undefined values with exactOptionalPropertyTypes
enabled
#6926
Comments
I guess you mean |
People with "noUncheckedIndexedAccess" set to true in their tsconfig would get false errors when accessing the return type because without this spefici tuple typing, TS infers this as being an array of functions, not a tuple of functions. Fixes #6926
People with "noUncheckedIndexedAccess" set to true in their tsconfig would get false errors when accessing the return type because without this specific tuple typing, TS infers the return type as being an array of functions, not a tuple of functions. Fixes #6926
I think I got confused a bit about the actual problem and I thought the crossfade was related but it's nice that it's fixed anyway 😄 The actual feature request that I meant to describe was the following: Imagine I have a component that can apply a transition conditionally like this: <script lang="ts">
type Transition = (node: Element, params: SvelteTransitionConfig) => SvelteTransitionReturnType;
export let myTransition: Transition | undefined = undefined;
</script>
<div in:myTransition>
<div>content</div>
</div> <MyComponent
myTransition={(node, params) => ({
...params,
css: (t, u) => `transform: scale(${t}) translateY(${u * 4}px);`,
})}
/> Because sometimes I want the component to have a transition and sometimes not. My idea was to make the transition directive accept an If you want I can create another GitHub Issue if that makes things easier for you. Anyhow thank you for looking into it @dummdidumm 🙏 |
I created #6942 for this. |
awesome, thank you! |
Describe the problem
In TypeScript 4.4 the flag
exactOptionalPropertyTypes
was introduced which fixed some weak typing mechanics for thePartial<>
utility type. When enabling this flag in a Svelte project it is throwing errors when passingundefined
to transition directives.Describe the proposed solution
Make
undefined
a valid prop type for svelte transition directives.Alternatives considered
Make the
crossfade
function not return possiblyundefined
values but maybe an empty function. (I think this would be a bad alternative though)Importance
would make my life easier
The text was updated successfully, but these errors were encountered: