-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Typings with Typescript 2.7.1 #7640
Comments
I believe this is a bug in TypeScript. For now you can cast it. import Vue, {PropOptions} from "vue"
Vue.extend({
props: {
myProp: {
type: Array,
} as PropOptions<any[]>,
},
computed: {
myComputed(): string {
return "hello"
},
otherComputed(): string {
return this.myComputed
},
},
}) |
@HerringtonDarkholme Do you know if there's a specific issue in https://github.com/Microsoft/TypeScript/issues that we can track related to this? |
I guess this is the problem of overloading, again. Commenting out the last of |
Boiled down reproduction: type Prop<T> = { (): T }
declare function test<T>(a: Prop<T>): T
declare function test(a: Prop<any>): {} // toggle this line
var a = test(Array)
a.push |
This issue is now tracked in microsoft/TypeScript#22471. There is nothing Vue can do for now. Let's close this and wait for TS team to fix it. For now you can manually annotate the prop definition as shown above. |
Version
2.5.13
Steps to reproduce
Create a simple component using Typescript:
We have the following error:
If we change the type of the prop to
String
,Number
or smtg else we don't have this problem anymoreWhat is expected?
No error
What is actually happening?
Errors
This problem was not happening with the previous Typescript versions (at least 2.5.2)
The text was updated successfully, but these errors were encountered: