Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A couple type problems #78

Open
abcd-ca opened this issue Jun 5, 2020 · 2 comments
Open

A couple type problems #78

abcd-ca opened this issue Jun 5, 2020 · 2 comments

Comments

@abcd-ca
Copy link

abcd-ca commented Jun 5, 2020

Hi, thanks for making the typings for XD, it's a big help. Here are a couple problems I've come across:

  1. 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'"
  2. If I type foo (ex. a Group) as SceneNode and I try to access foo.sharedPluginData.getAll() I get an error, "Property 'sharedPluginData' does not exist on type 'SceneNode'."
@abcd-ca
Copy link
Author

abcd-ca commented Jun 5, 2020

I also tried (selection.items[0] as Text).text which gives me, "Property 'text' does not exist on type 'Text'."

@pklaschka
Copy link
Contributor

Since I'm currently dealing with an ear infection, just a very quick, undetailed answer (in the hopes that it still helps):

  1. 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 use instanceof to check the type and use its properties 🙂
  2. We're currently in the process of integrating the new APIs (including sharedPluginData) into the types. Cf. Xd 29 updates #77. When it's merged, sharedPluginData will be available 🙂 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants