fix[protocol] typescript compatible

This commit is contained in:
harochen75
2023-11-18 16:18:58 +08:00
committed by GitHub
parent ffeeb63029
commit 47d70752a4
@@ -205,7 +205,7 @@ public abstract class GenerateTsUtils {
var field = fields[i];
var fieldRegistration = fieldRegistrations[i];
if (field.isAnnotationPresent(Compatible.class)) {
tsBuilder.append(TAB + TAB).append("if (buffer.compatibleRead(beforeReadIndex, length)) {").append(LS);
tsBuilder.append(TAB + TAB).append("if (!buffer.compatibleRead(beforeReadIndex, length)) {").append(LS);
var compatibleReadObject = tsSerializer(fieldRegistration.serializer()).readObject(tsBuilder, 3, field, fieldRegistration);
tsBuilder.append(TAB + TAB+ TAB).append(StringUtils.format("packet.{} = {};", field.getName(), compatibleReadObject)).append(LS);
tsBuilder.append(TAB + TAB).append("}").append(LS);