Skip to content

False positive "Extraneous children found" when using v-if on named slot #6053

@YuchenWell

Description

@YuchenWell

Vue - Official extension or vue-tsc version

3.2.9、3.3.0

VSCode version

1.120.0

Vue version

3.5

TypeScript version

6.0

Steps to reproduce

<template>
  <Parent>
    <template #default>default slot</template>
    <template v-if="showHeader" #header>header slot</template>
  </Parent>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import Parent from './parent.vue';
const showHeader = ref(true);
</script>

What is expected?

No diagnostic should be reported.

What is actually happening?

Extraneous children found when component already has explicitly named default slot. These children will be ignored.
Image

Link to minimal reproduction

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    good reproduction ✨This issue provides a good reproduction, we will be able to investigate it first🔩 p2-edge-case

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions