- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 4.7k
 
Closed
Labels
Description
Describe the problem
<script context="module" lang="ts">
  export type Props = {
    name: string;
  } & (
    | { iconType?: 'default'; icon?: typeof SvelteComponent }
    | {
        iconType?: 'featured';
        icon?: typeof SvelteComponent;
        featuredIconProps?: FeaturedIconProps;
      }
  );
</script>
<script lang="ts">
  type $$Props = Props;
  export let name: $$Props['name'];
  export let iconType: $$Props['iconType'] = undefined;
  export let icon: $$Props['icon'] = undefined;
</script>
{#if iconType === 'default'}
  <svelte:component this={icon} />
{:else if iconType === 'featured'}
  <FeaturedIcon {icon} {...featuredIconProps}  />
{/if}It doesn't seem possible to access unique props from discriminated unions
Describe the proposed solution
Attempted to access a unique prop.
<script lang="ts">
  let props: $$Props;
  if (iconType === 'featured') {
    props. // featuredIconProps doesn't show up.
  }
</script>Alternatives considered
None
Importance
i cannot use svelte without it
lin72h, kitschpatrol, bluemoon and max-got