-
I'm working with the Combobox, doing something very similar to the example here. I'm seeing an error on
Could it be a weird behavior because of Typescript? Any help with getting unblocked would be appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Thanks for the question, @yannieyip ! We're a bit short on engineers today, so it may take a little longer than usual to help get an answer to this. Will check back in here soon 🤞 Let me know if this is very urgently blocking you, though. |
Beta Was this translation helpful? Give feedback.
-
Hi @yannieyip I suspect this is Typescript errors not being particular helpful, but it is doing what it should be doing in terms of type checking.
Let us know how you get on. |
Beta Was this translation helpful? Give feedback.
-
@SiTaggart Adding the check got rid of the error. Thank you! |
Beta Was this translation helpful? Give feedback.
Hi @yannieyip
I suspect this is Typescript errors not being particular helpful, but it is doing what it should be doing in terms of type checking.
Item
is typed to be either a string or an object. Currently your code only proves to Typescript thatitem
exists. At the point at which you try to getname
fromitem
, Typescript still thinks it could either be a string or an object, so it's complaining. The first part of the error is misleading. I suspect if you check that item is not a string before you pull name off of it, you'll clear the error.Let us know how you get on.