typings
typings copied to clipboard
A couple type problems
Hi, thanks for making the typings for XD, it's a big help. Here are a couple problems I've come across:
- If I type selection as
XDSelectionand I try to then access,selection.items[0].textI get an error, "Property 'text' does not exist on 'SceneNode'" - If I type foo (ex. a Group) as
SceneNodeand I try to accessfoo.sharedPluginData.getAll()I get an error, "Property 'sharedPluginData' does not exist on type 'SceneNode'."
I also tried (selection.items[0] as Text).text which gives me, "Property 'text' does not exist on type 'Text'."
Since I'm currently dealing with an ear infection, just a very quick, undetailed answer (in the hopes that it still helps):
- That's to be expected as at this point, it is not established that it is, in fact, a
Textnode. Please take a look at the sample.js file. You can useinstanceofto check the type and use its properties 🙂 - We're currently in the process of integrating the new APIs (including
sharedPluginData) into the types. Cf. #77. When it's merged,sharedPluginDatawill be available 🙂 .