diff --git a/integration/simple-long/google/protobuf/wrappers.ts b/integration/simple-long/google/protobuf/wrappers.ts index 791fdbc7b..b332a409d 100644 --- a/integration/simple-long/google/protobuf/wrappers.ts +++ b/integration/simple-long/google/protobuf/wrappers.ts @@ -224,7 +224,7 @@ export const Int64Value = { fromJSON(object: any): Int64Value { return { - value: isSet(object.value) ? Long.fromString(object.value) : Long.ZERO, + value: isSet(object.value) ? Long.fromValue(object.value) : Long.ZERO, }; }, @@ -273,7 +273,7 @@ export const UInt64Value = { fromJSON(object: any): UInt64Value { return { - value: isSet(object.value) ? Long.fromString(object.value) : Long.UZERO, + value: isSet(object.value) ? Long.fromValue(object.value) : Long.UZERO, }; }, diff --git a/integration/simple-long/simple.ts b/integration/simple-long/simple.ts index 7b27d8426..2c22195bb 100644 --- a/integration/simple-long/simple.ts +++ b/integration/simple-long/simple.ts @@ -443,7 +443,7 @@ export const SimpleWithMap_LongLookupEntry = { fromJSON(object: any): SimpleWithMap_LongLookupEntry { return { key: isSet(object.key) ? String(object.key) : '', - value: isSet(object.value) ? Long.fromString(object.value) : Long.ZERO, + value: isSet(object.value) ? Long.fromValue(object.value) : Long.ZERO, }; }, @@ -594,16 +594,16 @@ export const Numbers = { double: isSet(object.double) ? Number(object.double) : 0, float: isSet(object.float) ? Number(object.float) : 0, int32: isSet(object.int32) ? Number(object.int32) : 0, - int64: isSet(object.int64) ? Long.fromString(object.int64) : Long.ZERO, + int64: isSet(object.int64) ? Long.fromValue(object.int64) : Long.ZERO, uint32: isSet(object.uint32) ? Number(object.uint32) : 0, - uint64: isSet(object.uint64) ? Long.fromString(object.uint64) : Long.UZERO, + uint64: isSet(object.uint64) ? Long.fromValue(object.uint64) : Long.UZERO, sint32: isSet(object.sint32) ? Number(object.sint32) : 0, - sint64: isSet(object.sint64) ? Long.fromString(object.sint64) : Long.ZERO, + sint64: isSet(object.sint64) ? Long.fromValue(object.sint64) : Long.ZERO, fixed32: isSet(object.fixed32) ? Number(object.fixed32) : 0, - fixed64: isSet(object.fixed64) ? Long.fromString(object.fixed64) : Long.UZERO, + fixed64: isSet(object.fixed64) ? Long.fromValue(object.fixed64) : Long.UZERO, sfixed32: isSet(object.sfixed32) ? Number(object.sfixed32) : 0, - sfixed64: isSet(object.sfixed64) ? Long.fromString(object.sfixed64) : Long.ZERO, - manyUint64: Array.isArray(object?.manyUint64) ? object.manyUint64.map((e: any) => Long.fromString(e)) : [], + sfixed64: isSet(object.sfixed64) ? Long.fromValue(object.sfixed64) : Long.ZERO, + manyUint64: Array.isArray(object?.manyUint64) ? object.manyUint64.map((e: any) => Long.fromValue(e)) : [], }; }, diff --git a/src/main.ts b/src/main.ts index 26e4255ab..70e34b73d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1174,7 +1174,7 @@ function generateFromJson(ctx: Context, fullName: string, fullTypeName: string, } } else if (isLong(field) && options.forceLong === LongOption.LONG) { const cstr = capitalize(basicTypeName(ctx, field, { keepValueType: true }).toCodeString()); - return code`${cstr}.fromString(${from})`; + return code`${cstr}.fromValue(${from})`; } else { const cstr = capitalize(basicTypeName(ctx, field, { keepValueType: true }).toCodeString()); return code`${cstr}(${from})`;