You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{defineStore}from"pinia";// This is a class called "Thing" with a private attribute nameclassThing{privatereadonlyname: string;constructor(name: string){this.name=name;}getName(): string{returnthis.name;}}// This function expects a Thing as argumentfunctiondisplayName(thing: Thing){console.log(thing.getName());}// This little example works as intendedconsta: Thing=newThing("test");displayName(a);exportconstuseTestStore=defineStore({id: `test`,actions: {getThingName(){// Error TS2345displayName(this.thing);}},state: ()=>({thing: newThing("test")})});
Steps to reproduce the behavior
Just paste this code in WebStorm (last version)
Expected behavior
It should pass typescript compilation
Actual behavior
Typescript fire a TS2345 error because property "name" is missing
Additional information
It can be "fixed" this by forcing the type:
Also, it's rather a small bug, I just wanted to mention it if anyone encountered this. I ❤️ 🍍 !
The text was updated successfully, but these errors were encountered:
Reproduction
Here is a little example
Steps to reproduce the behavior
Just paste this code in WebStorm (last version)
Expected behavior
It should pass typescript compilation
Actual behavior
Typescript fire a TS2345 error because property "name" is missing
Additional information
It can be "fixed" this by forcing the type:
![image](https://user-images.githubusercontent.com/4563971/144637180-ce6f5d19-d237-4443-92cf-8b66ed780f26.png)
Also, it's rather a small bug, I just wanted to mention it if anyone encountered this. I ❤️ 🍍 !
The text was updated successfully, but these errors were encountered: