Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.


brooke_spreenbrooke_spreen Member, Developers Posts: 109 PRO
Is there an analog of Javascript's "typeof" in Featurescript?

In other words, is there a way to ask the open-ended question "what is the type of this variable"?
Note that this is a different question than "is this variable of the type 'myType'", which returns a boolean.

As an example, when debugging, it would be very useful to do:
println(typeof myVar);

example output:

Design Engineer | Anerdgy AG


  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    Sadly there are no capability like this in fs. Only if tests, not even case/match statements, though these keywords are reserved so it may come once.
  • brooke_spreenbrooke_spreen Member, Developers Posts: 109 PRO
    Bummer! Maybe one day the typeof will come as well...
    Design Engineer | Anerdgy AG
  • Jacob_CorderJacob_Corder Member Posts: 65 PRO
    you can use this

    If(myVar is Plane)

    else if(myVar is Query

    elseif(myVar is Array)

    else if(myVar is Map) 


    it works for any type and passes through the type check function of each type. 
Sign In or Register to comment.