-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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] how to use validateField in typescript #8756
Comments
Translation of this issue: Element UI version0.1.0 OS/Browsers versionTypescript: 2.6.2 Vue version2.5.9 Reproduction Linkhttps://jsfiddle.net/mmx38qxw/ Steps to reproduceUsing typescript with element-ui, the following method is used to verify a field in the form:
What is Expected?Callback should be optional and can be introduced into a simple arrow function What is actually happening?Callback is a necessary option, and the introduction of a simple arrowhead function will be wrong: ` TS2349: Cannot invoke an expression whose type lacks a call signature. Type |
I meet the same problem |
I´m facing the same problem. Writing |
Element UI version
0.1.0
OS/Browsers version
typescript: 2.6.2
Vue version
2.5.9
Reproduction Link
https://jsfiddle.net/mmx38qxw/
Steps to reproduce
使用typescript配合element-ui,在表单验证某个字段的时候使用了如下方法:
(this.$refs[formRef] as ElForm).validateField('packageNames', function(errMsg: string): void {})
但是会报错:
TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'void' has no compatible call signatures.
What is Expected?
callback应该为可选项,且可以传入简单的箭头函数
What is actually happening?
callback为必选项,且传入简单的箭头函数会报错:
TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'void' has no compatible call signatures.
The text was updated successfully, but these errors were encountered: