[TS] Enum value default null (#8619)

* [TS] Enum value default null

* Re-gen
This commit is contained in:
Björn Harrtell
2025-06-22 07:25:56 +02:00
committed by GitHub
parent 5822c1c8dd
commit 595ac94a6a
7 changed files with 9 additions and 9 deletions

View File

@@ -257,7 +257,7 @@ class TsGenerator : public BaseGenerator {
for (const auto &it : ns_defs_) {
code = "// " + std::string(FlatBuffersGeneratedWarning()) + "\n\n" +
"/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */\n\n";
// export all definitions in ns entry point module
int export_counter = 0;
for (const auto &def : it.second.definitions) {
@@ -567,7 +567,7 @@ class TsGenerator : public BaseGenerator {
static Type GetUnionUnderlyingType(const Type &type)
{
if (type.enum_def != nullptr &&
if (type.enum_def != nullptr &&
type.enum_def->underlying_type.base_type != type.base_type) {
return type.enum_def->underlying_type;
} else {
@@ -1849,7 +1849,7 @@ class TsGenerator : public BaseGenerator {
code += "BigInt(0)";
} else if (IsScalar(field.value.type.element)) {
if (field.value.type.enum_def) {
code += field.value.constant;
code += "null";
} else {
code += "0";
}