2.6.10
https://jsfiddle.net/keegan_openbay/nhvemx32/ (be aware that JSFiddle does not show TypeScript compiler errors)
data
property in your component optionsNormal behavior; the data
property is correctly typed and found on the instance.
Errors arise because:
methods
, the data properties are not found on the component type.watch
, the data properties are typed string | WatchOptionsWithHandler<any> | WatchHandler<any>
.computed
, the data properties are typed (() => any) | ComputedOptions<any>
.
It's indeed not working anymore while it was on 3.5.3. Not sure if it's an upstream problem or not but something broke in our types
I'm just looking into it. Still not sure whether it's upstream bug or not. But annotating data
's this
type can be a workaround:
data(this: any): { loading: boolean; fade: boolean } {
// ...
}
I've filed it on TypeScript repo.
https://github.com/microsoft/TypeScript/issues/33164
TypeScript v3.6.3 has been released and it solves this issue.
Most helpful comment
I've filed it on TypeScript repo.
https://github.com/microsoft/TypeScript/issues/33164