Skip to content

No TypeScript errors for using incorrect prop types #323

Closed
@indianakernick

Description

@indianakernick

Version

vue-final-modal: v4.0.1
vue: v3.2.45

OS

Mac

Steps to reproduce

<script setup lang="ts">
import { VueFinalModal } from 'vue-final-modal';

defineProps<{
  title: string;
}>();
</script>

<template>
  <VueFinalModal>
    <h1>{{ title }}</h1>
  </VueFinalModal>
</template>
useModal({
  component: TestModal,
  attrs: {
    title: 1
  }
});

What is Expected?

A TypeScript error at title: 1.

What is actually happening?

VSCode is providing auto-complete for the prop and emit names. The types are there and VSCode even says title: string when I hover over it. Doing a command-click on it takes me to the component definition. But there is not a TypeScript error. Vue's runtime type checking will help in this particular case so I guess it's not the end of the world.

There are three instances of Record<string, any> in Modal.d.ts. If I remove them, it works as expected and I get a type error. I also get an error if I do attrs: {} but unfortunately not if attrs is omitted. I suspect they are there for a reason and cannot simply be removed!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions