Data properties not found and/or incorrectly typed in TypeScript 3.6.2
See original GitHub issueVersion
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 typedstring | WatchOptionsWithHandler<any> | WatchHandler<any>
. - in
computed
, the data properties are typed(() => any) | ComputedOptions<any>
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:5 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve filed it on TypeScript repo. https://github.com/microsoft/TypeScript/issues/33164
I’m still seeing this with TypeScript
4.5.5
on vue 2.6.14my workaround is to use
(this as Vue)
instead ofthis
for example
with a component definition (in the same file) like: