Skip to content

v-slot with { } accept slot data has type any error in typescript project when update to 0.27.2 #2258

@Eurkidu

Description

@Eurkidu

Info

  • Platform: macOS
  • Vetur version: 0.27.2
  • VS Code version: 1.48.2

Problem

when update to 0.27.2
use v-slot with { } to accept data has this error tip,but I don‘t know how to definition this type
and when use 0.27.1 version has no this error tip

图片

Reproducible Case

// mc-ossfile-view.vue
<template>
  <div class="mc-ossfile-view">
    <div class="mc-ossfile-view__file-item"
      v-for="(item, idx) in fileList" :key="idx">
      <slot :item="item" :idx="idx"></slot>
      <div class="info-button"></div>
      <slot name="after" :item="item" :idx="idx"></slot>
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator'

@Component
export default class McOssfileView extends Vue {
  @Prop({ type: Array, default: () => [] }) readonly fileList!: mcLib.TDataObject[]
}
</script>
// use vue file
<mcOssfileView
  :fileList="fileList">
  <template v-slot="{item}">{{item.name}}</template>
  <template v-slot:after="{item}">
    <div class="info-bar">
      <div class="text">{{item.name}}</div>
    </div>
  </template>
</mcOssfileView>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions