Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] [TypeScript] [input] [el-input] Property 'rows' does not exist on type #8068

Closed
yuniit opened this issue Jun 3, 2022 · 5 comments

Comments

@yuniit
Copy link

yuniit commented Jun 3, 2022

Bug Type: TypeScript

Environment

  • Vue Version: 3.2.31
  • Element Plus Version: 2.2.2
  • Browser / OS: Version 102.0.5005.61 (Official Build) (arm64)
  • Build Tool: Other

Reproduction

Related Component

  • el-input

Reproduction Link

Element Plus Playground

Steps to reproduce

  1. create component with <script lang "ts">
  2. use type="textarea" and set :rows="number"

Screen Shot 2022-06-03 at 9 02 39 AM

Ex:

<script setup lang="ts">
  defineProps({ /* ... */ })
</script>

<template>
   <el-input
    v-model="text"
    type="textarea"
    :rows="2"
   ></el-input>
</template>

What is Expected?

It shouldn't show the error

What is actually happening?

Property 'rows' does not exist on type 'IntrinsicAttributes & Partial<{ type: string; size: BuildPropType ...

Additional comments

(empty)

@LinZhanMing
Copy link
Contributor

可能是 packages/components/input/src/input.ts 里面的 inputProps 缺少了 rows ?

@yuniit
Copy link
Author

yuniit commented Jun 3, 2022

Maybe the inputProps in packages/components/input/src/input.ts is missing rows ?

I've checked prop rows is missing

@tolking
Copy link
Member

tolking commented Jun 3, 2022

This may be caused by vue-tsc link.

You can try to modify the vue-tsc version

or

// env.d.ts

declare module '@vue/runtime-core' {
    interface AllowedComponentProps {
        [key: string]: any
    }
}

export { }

@yuniit yuniit closed this as completed Jun 9, 2022
@Etienne-Leveque
Copy link

This issue still exists as of today, and it doesn't seem to be related to vue-tsc:

Argument of type '{ modelValue: string; rows: number; type: string; autocomplete: string; size: "default"; style: {}; "onUpdate:modelValue": any; }' is not assignable to parameter of type '{ readonly type?: string | undefined; readonly modelValue?: EpPropMergeType<(new (...args: any[]) => string | number) | (() => string | number | null | undefined) | ((new (...args: any[]) => string | number) | (() => string | number | null | undefined))[], unknown, unknown>; ... 44 more ...; readonly prefixIcon?: Ep...'.
Object literal may only specify known properties, and 'rows' does not exist in type '{ readonly type?: string | undefined; readonly modelValue?: EpPropMergeType<(new (...args: any[]) => string | number) | (() => string | number | null | undefined) | ((new (...args: any[]) => string | number) | (() => string | number | null | undefined))[], unknown, unknown>; ... 44 more ...; readonly prefixIcon?: Ep...'.ts(2345)

rows is missing in the type declaration

@tolking
Copy link
Member

tolking commented Nov 28, 2023

There are many native attributes that are not defined in props now, which can indeed cause some type errors (eq using in tsx).

You can also use the above method to temporarily handle the problem, and if there is a better solution, you can also discuss it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants