-
Notifications
You must be signed in to change notification settings - Fork 118
Strange error in script editor interface for variables after getObject() #838
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
Comments
@AlCalzone Error in Typings? |
More like code that Typescript cannot prove to be correct. @PeterVoronov can you try const obj = getObject('web.0.connected'); Instead of var test ='web.0.connected';
var obj = getObject(test); |
Actually, shouldn't it be |
web.0.info.connected is only example. |
Moreover - usually, in "big" scripts the variables is used, instead exact strings... I put the example of code, similar to what I have in real scripts... |
Okay, first off: I just realized the improvements to detecting the object types from the ID are only in Second: This is never going to be perfect for all use cases due to the way the script editor's syntax help (TypeScript) works. To be able to offer the correct options, the IDs that are used to infer the possible object types must have a certain format. I've pushed with the TypeScript team to bring this functionality as close as possible to what we need. But depending on how you construct these IDs, especially by using const test = 'web.0.info.connected';
const obj = getObject(test); but this won't var test = 'web.0.info.connected';
var obj = getObject(test); However, there's a workaround you can already use now. You just need to tell the editor that |
Thanks, will try and check... |
2.And, as I said - using const and placing the exact sting as parameter in getObject - is not useful for scripts, where the object id can be calculated, or , provided as parameter to function, which have the getObject call inside ... |
You missed the most important part of the workaround by the way... Look at line 9 in my screenshot.
Yeah, but there's not much we can do about it. If the script editor cannot know for sure that you're trying to access a state object, it cannot know that what you're doing is correct and/or that this object actually has a |
Excuse me, missed this. Looks like it working. Thanks. |
FYI this should work when #878 is merged and released. |
Describe the bug
It's simple - in the script, I use
getObject
function, and when I tried to use properties of thecommon
field of received object - it's marked mostly by error, for all properties, exceptname
,role
,icon
.To Reproduce
Steps to reproduce the behavior:
write
will be marked as wrong.Property 'write' does not exist on type 'ObjectCommon'.(2339)'
6

. Despite this messages, the object common property has whit write property and much more, not only
name
,role
,icon
- see the log:Expected behavior
Proposal for properties of property
common
has to display all possible field, and no error marks, forwrite
and other properties.Screenshots & Logfiles
See above.
Versions:
Additional context
I tried to find similar previous issues, but may be I'm not good in it. If it double - excuse me, but it is annoying.
The text was updated successfully, but these errors were encountered: