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

Property 'title' does not exist on type 'unknown'. #240

Closed
anyclub opened this issue Jun 2, 2021 · 6 comments
Closed

Property 'title' does not exist on type 'unknown'. #240

anyclub opened this issue Jun 2, 2021 · 6 comments
Labels
question Further information is requested

Comments

@anyclub
Copy link

anyclub commented Jun 2, 2021

image

how to fixe it

@johnsoncodehk
Copy link
Member

This is expected, you need to define value type correctly.

value: {
  type: Array as PropType<{ title: string }[]>
}

@johnsoncodehk johnsoncodehk added the question Further information is requested label Jun 2, 2021
@anyclub
Copy link
Author

anyclub commented Jun 3, 2021

This is a JS file and not a TS
Is there any other plan?

@johnsoncodehk johnsoncodehk reopened this Jun 3, 2021
@ci010
Copy link

ci010 commented Jun 3, 2021

Do you mean we should disable part of typecheck function for js script by default?

@anyclub
Copy link
Author

anyclub commented Jun 3, 2021

typecheck is very helpful most of the time, but if my project cannot use TS, similar situations may happen from time to time.
It is recommended to have a disable check switch for the value passed in PROPS,
or similar to eslint use injection /* eslint-disable */ /* eslint-enable */ ......

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Jun 3, 2021

@ts-ignore is available in template:

{{
  // @ts-ignore
  item.title
}}

Please wait for vuejs/core#1359, we can use (item, index) in value as { title: string }[] to resolve after vue supported TS in template.

@mino01x
Copy link

mino01x commented Aug 23, 2021

use jsdoc?

@type {import('@vue/runtime-dom').PropType<any[]>}
type: Array

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

No branches or pull requests

4 participants