question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Data properties not found and/or incorrectly typed in TypeScript 3.6.2

See original GitHub issue

Version

2.6.10

Reproduction link

https://jsfiddle.net/keegan_openbay/nhvemx32/ (be aware that JSFiddle does not show TypeScript compiler errors)

Steps to reproduce

  • use TypeScript >= 3.6.1-beta (currently stable at 3.6.2)
  • have at least one prop
  • correctly type all your methods
  • use a non-string data property in your component options

What is expected?

Normal behavior; the data property is correctly typed and found on the instance.

What is actually happening?

Errors arise because:

  • in methods, the data properties are not found on the component type.
  • in watch, the data properties are typed string | WatchOptionsWithHandler<any> | WatchHandler<any>.
  • in computed, the data properties are typed (() => any) | ComputedOptions<any>.

Screen Shot 2019-08-29 at 6 50 52 PM Screen Shot 2019-08-29 at 7 00 23 PM Screen Shot 2019-08-29 at 7 10 17 PM

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
ktsncommented, Aug 30, 2019

I’ve filed it on TypeScript repo. https://github.com/microsoft/TypeScript/issues/33164

1reaction
dasDanielcommented, Jun 25, 2022

I’m still seeing this with TypeScript 4.5.5 on vue 2.6.14

my workaround is to use (this as Vue) instead of this

for example

watch:{
  myVar(){
    (this as Vue).myMethod()
  }
}

with a component definition (in the same file) like:

declare module "vue/types/vue" {
  interface Vue {
    myMethod: () => void
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript: Property does not exist on type '{}' - Stack Overflow
The error " Property 'fadeDiv' does not exist on type '{}'. " seems to be triggering on a line you haven't posted in...
Read more >
TypeScript errors and how to fix them
error TS2420: Class 'Dog' incorrectly implements interface 'Animal'. Property 'name' is private in type 'Dog' but not in type 'Animal'. Broken Code ❌ ......
Read more >
Announcing TypeScript 3.6 - Microsoft Developer Blogs
Today we're happy to announce the availability of TypeScript 3.6! For those unfamiliar, TypeScript is a language that builds on JavaScript ...
Read more >
41LO Manual of Documentation Practices - DTIC
Data preparation rules, handling chemical compounds and scientific symbols, etc., ... The use of computers to produce various types of indexes (KWIC,.
Read more >
Third-Party Notices and/or Licenses - Oracle Help Center
The sections below identify the open source components used by each Oracle Communications Cloud Native Core subproduct. The licensing information can be found...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found