I've encountered this error while converting a codebase. I have worked around it by transforming points.length -= 2 into points.length = points.length - 2, so this is not blocking for me and I have low interest in it, but I'm opening an issue just so you're aware and can keep track of this.
One thing though, it would be nice if the cast(...) function could give more context as to where this happens so users of tstl can avoid having to go through the debugger to find where in the source code it happens.
Stack trace:
Error: Failed to cast value to expected type using isAssignmentLeftHandSideExpression.
at cast (/home/romgrk/src/kui.nvim/node_modules/.pnpm/typescript-to-lua@1.12.1_typescript@4.9.5/node_modules/typescript-to-lua/dist/utils.js:62:15)
at transformCompoundAssignmentStatement (/home/romgrk/src/kui.nvim/node_modules/.pnpm/typescript-to-lua@1.12.1_typescript@4.9.5/node_modules/typescript-to-lua/dist/transformation/visitors/binary-expression/compound.js:119:35)
at transformBinaryExpressionStatement (/home/romgrk/src/kui.nvim/node_modules/.pnpm/typescript-to-lua@1.12.1_typescript@4.9.5/node_modules/typescript-to-lua/dist/transformation/visitors/binary-expression/index.js:158:68)
at transformExpressionStatement (/home/romgrk/src/kui.nvim/node_modules/.pnpm/typescript-to-lua@1.12.1_typescript@4.9.5/node_modules/typescript-to-lua/dist/transformation/visitors/expression-statement.js:13:95)
at TransformationContext.transformNodeRaw (/home/romgrk/src/kui.nvim/node_modules/.pnpm/typescript-to-lua@1.12.1_typescript@4.9.5/node_modules/typescript-to-lua/dist/transformation/context/context.js:65:24)
at TransformationContext.transformNode (/home/romgrk/src/kui.nvim/node_modules/.pnpm/typescript-to-lua@1.12.1_typescript@4.9.5/node_modules/typescript-to-lua/dist/transformation/context/context.js:45:56)
at /home/romgrk/src/kui.nvim/node_modules/.pnpm/typescript-to-lua@1.12.1_typescript@4.9.5/node_modules/typescript-to-lua/dist/transformation/context/context.js:100:37
at Array.flatMap (<anonymous>)
at TransformationContext.transformStatements (/home/romgrk/src/kui.nvim/node_modules/.pnpm/typescript-to-lua@1.12.1_typescript@4.9.5/node_modules/typescript-to-lua/dist/transformation/context/context.js:98:45)
at transformFunctionBodyContent (/home/romgrk/src/kui.nvim/node_modules/.pnpm/typescript-to-lua@1.12.1_typescript@4.9.5/node_modules/typescript-to-lua/dist/transformation/visitors/function.js:75:74)


I've encountered this error while converting a codebase. I have worked around it by transforming
points.length -= 2intopoints.length = points.length - 2, so this is not blocking for me and I have low interest in it, but I'm opening an issue just so you're aware and can keep track of this.One thing though, it would be nice if the
cast(...)function could give more context as to where this happens so users of tstl can avoid having to go through the debugger to find where in the source code it happens.Stack trace: