According to the invoke documentation, all arguments following the name must be “transferrable”. However, in practice I’ve passed TextEditor objects directly into the invoke function, as several commands expect to receive one. I suspect this is just confusion in the docs that could be clarified.
Is it expected to be able to pass the non-transferrable TextEditor object when calling invoke?
This is only the case when you are invoking a command that is not present within your own extension, as extensions are run within their own individual JavaScript sandboxes and TextEditor objects won’t be transferrable between them. But within your own extension, it ends up not being much different from invoking the command function directly.
We generally don’t recommend trying to do so and breaking API contract, so I can consider making this check more strict in the future.