LSP formats .ts and .js files without any problem. However it fails to format .tsx files correctly. You can reproduce this behavior with a valid .tsx file.
The LSP server is responsible for formatting the file. So if the formatting is wrong, you need to report this to the author of the relevant LSP server, or check your configuration of LSP servers.
You can also use the Formatting plugin instead. It will use prettier for tsx files and should be able to do a much better job.
The formatter plugin also does not format correctly. Here is the error message: [00:07:10  Format Error] SyntaxError: Unexpected non-whitespace character after JSON at position 919 at JSON.parse () at Socket. (/tmp/kate.ZgzKcb:22:68) at Socket.emit (node:events:518:28) at addChunk (node:internal/streams/readable:559:12) at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) at Readable.push (node:internal/streams/readable:390:5) at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)