# svelte/experimental-require-slot-types

require slot type declaration using the $$Slots interface

# 📖 Rule Details

This rule enforces the presence of the $$Slots interface if any slots are present in the component. This interface declares all of the used slots and their props and enables typechecking both in the component itself as well as all components that include it. The $$Slots interface is experimental and is documented in svelte RFC #38.

<!-- ✓ GOOD -->
<script lang="ts">
  /* eslint svelte/experimental-require-slot-types: "error" */
</script>

<b>No slots here!</b>
<!-- ✓ GOOD -->
<script lang="ts">
  /* eslint svelte/experimental-require-slot-types: "error" */

  
Parsing error: The keyword 'interface' is reserved
i
nterface $$Slots {
default: Record<string, never>; } </script> <slot />
<!-- ✓ GOOD -->
<script lang="ts">
  /* eslint svelte/experimental-require-slot-types: "error" */

  
Parsing error: The keyword 'interface' is reserved
i
nterface $$Slots {
default: { prop: boolean }; } </script> <slot prop={true} />
<!-- ✓ GOOD -->
<script lang="ts">
  /* eslint svelte/experimental-require-slot-types: "error" */

  
Parsing error: The keyword 'interface' is reserved
i
nterface $$Slots {
named: Record<string, never>; } </script> <slot name="named" />
<
The component must define the $$Slots interface. (svelte/experimental-require-slot-types)
!
-- ✗ BAD -->
<script lang="ts"> /* eslint svelte/experimental-require-slot-types: "error" */ </script> <slot />

# 🔧 Options

Nothing.

# 🚀 Version

This rule was introduced in eslint-plugin-svelte v2.18.0

# 🔍 Implementation