A couple type problems
Opened this issue · 2 comments
abcd-ca commented
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
XDSelection
and I try to then access,selection.items[0].text
I get an error, "Property 'text' does not exist on 'SceneNode'" - If I type foo (ex. a Group) as
SceneNode
and I try to accessfoo.sharedPluginData.getAll()
I get an error, "Property 'sharedPluginData' does not exist on type 'SceneNode'."
abcd-ca commented
I also tried (selection.items[0] as Text).text
which gives me, "Property 'text' does not exist on type 'Text'."
pklaschka commented
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
Text
node. Please take a look at the sample.js file. You can useinstanceof
to 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,sharedPluginData
will be available 🙂 .