vue-json-pretty icon indicating copy to clipboard operation
vue-json-pretty copied to clipboard

Typscriptproblem: VueJsonPretty has type `App<any> & ...`

Open LuWa-at-work opened this issue 1 year ago • 2 comments

I get following errormessage in vscode when i use the <VueJsonPretty/>-component:

Das Argument vom Typ "{ data: JSONDataType; showLine: false; "show-line": boolean; showIcon: true; "show-icon": boolean; deep: number; }" kann dem Parameter vom Typ "App<any> & Partial<{ data: JSONDataType; showLength: boolean; showDoubleQuotes: boolean; showSelectController: boolean; showLine: boolean; showLineNumber: boolean; selectOnClickNode: boolean; ... 13 more ...; collapsedOnClickBrackets: boolean; }> & Omit<...> & Record<...>" nicht zugewiesen werden.
  Im Typ "{ data: JSONDataType; showLine: false; "show-line": boolean; showIcon: true; "show-icon": boolean; deep: number; }" fehlen die folgenden Eigenschaften von Typ "App<any>": "version, config, use, mixin" und 11 weitere.ts(2345)

It seems it thinks the component has also the App<any> Type and requires a few more parameters. image

code from my Component:

<script setup lang="ts">
import VueJsonPretty from 'vue-json-pretty';
import { JSONDataType } from 'vue-json-pretty/types/utils';

interface Props {
  name: string;
  result: { data: unknown; error: unknown };
}

defineProps<Props>();
</script>

<template>
  <h3>{{ name }}</h3>
  <div class="response">
    <VueJsonPretty
      :data="result.data as JSONDataType"
      :show-line="false"
      :show-icon="true"
      :deep="1"
    />
  </div>
  <div class="error">
    {{ result.error }}
  </div>
</template>

strangly on the ES-Lint run this doesn`t show up 🤔 Versions:


╰─⩥ npm list                                                                                                                                                     
├── @types/[email protected]
├── @typescript-eslint/[email protected]
├── @typescript-eslint/[email protected]
├── @vitejs/[email protected]
├── @vue/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

LuWa-at-work avatar Apr 21 '23 14:04 LuWa-at-work

Getting the same error

dili021 avatar Apr 25 '23 16:04 dili021

Sorry, I ran the demo code without reproducing the problem, can anyone provide more detailed information?

leezng avatar May 04 '23 01:05 leezng