You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In PXT 4.4, cast to class or interface is not supported.
In PXT 5.5, no error is displayed on the JavaScript editor but the code does not run.
The issue here is that member access to string, array and object are handled differently in PXT runtime and, when the type is an interface, it is handled as if it is an object and thus passing string and array into the function causes runtime error.
To make the function work at runtime, the showLength function can be written as follows:
Describe the bug



In PXT 4.4, cast to class or interface is not supported.
In PXT 5.5, no error is displayed on the JavaScript editor but the code does not run.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Either the cast is disallowed with error or it works successfully.
The text was updated successfully, but these errors were encountered: