diff --git a/integration/angular/simple-message.ts b/integration/angular/simple-message.ts index bb230e72b..6b578253f 100644 --- a/integration/angular/simple-message.ts +++ b/integration/angular/simple-message.ts @@ -55,9 +55,8 @@ export const SimpleMessage = { }, create, I>>(base?: I): SimpleMessage { - return SimpleMessage.fromPartial(base ?? {}); + return SimpleMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleMessage { const message = createBaseSimpleMessage(); message.numberField = object.numberField ?? 0; diff --git a/integration/async-iterable-services-abort-signal/simple.ts b/integration/async-iterable-services-abort-signal/simple.ts index bcfc7f913..2fef10081 100644 --- a/integration/async-iterable-services-abort-signal/simple.ts +++ b/integration/async-iterable-services-abort-signal/simple.ts @@ -88,9 +88,8 @@ export const EchoMsg = { }, create, I>>(base?: I): EchoMsg { - return EchoMsg.fromPartial(base ?? {}); + return EchoMsg.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): EchoMsg { const message = createBaseEchoMsg(); message.body = object.body ?? ""; diff --git a/integration/async-iterable-services/simple.ts b/integration/async-iterable-services/simple.ts index a06a74093..4b6c45a32 100644 --- a/integration/async-iterable-services/simple.ts +++ b/integration/async-iterable-services/simple.ts @@ -88,9 +88,8 @@ export const EchoMsg = { }, create, I>>(base?: I): EchoMsg { - return EchoMsg.fromPartial(base ?? {}); + return EchoMsg.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): EchoMsg { const message = createBaseEchoMsg(); message.body = object.body ?? ""; diff --git a/integration/avoid-import-conflicts/simple.ts b/integration/avoid-import-conflicts/simple.ts index 299bbe76c..53fa95643 100644 --- a/integration/avoid-import-conflicts/simple.ts +++ b/integration/avoid-import-conflicts/simple.ts @@ -133,9 +133,8 @@ export const Simple = { }, create, I>>(base?: I): Simple { - return Simple.fromPartial(base ?? {}); + return Simple.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple { const message = createBaseSimple(); message.name = object.name ?? ""; @@ -210,9 +209,8 @@ export const SimpleEnums = { }, create, I>>(base?: I): SimpleEnums { - return SimpleEnums.fromPartial(base ?? {}); + return SimpleEnums.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleEnums { const message = createBaseSimpleEnums(); message.localEnum = object.localEnum ?? 0; @@ -269,9 +267,8 @@ export const FooServiceCreateRequest = { }, create, I>>(base?: I): FooServiceCreateRequest { - return FooServiceCreateRequest.fromPartial(base ?? {}); + return FooServiceCreateRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FooServiceCreateRequest { const message = createBaseFooServiceCreateRequest(); message.kind = object.kind ?? 0; @@ -327,9 +324,8 @@ export const FooServiceCreateResponse = { }, create, I>>(base?: I): FooServiceCreateResponse { - return FooServiceCreateResponse.fromPartial(base ?? {}); + return FooServiceCreateResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FooServiceCreateResponse { const message = createBaseFooServiceCreateResponse(); message.kind = object.kind ?? 0; diff --git a/integration/avoid-import-conflicts/simple2.ts b/integration/avoid-import-conflicts/simple2.ts index 111f0665e..57968f6bb 100644 --- a/integration/avoid-import-conflicts/simple2.ts +++ b/integration/avoid-import-conflicts/simple2.ts @@ -147,9 +147,8 @@ export const Simple = { }, create, I>>(base?: I): Simple { - return Simple.fromPartial(base ?? {}); + return Simple.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple { const message = createBaseSimple(); message.name = object.name ?? ""; diff --git a/integration/barrel-imports/bar.ts b/integration/barrel-imports/bar.ts index 7ea77bd2a..70156a00a 100644 --- a/integration/barrel-imports/bar.ts +++ b/integration/barrel-imports/bar.ts @@ -67,9 +67,8 @@ export const Bar = { }, create, I>>(base?: I): Bar { - return Bar.fromPartial(base ?? {}); + return Bar.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Bar { const message = createBaseBar(); message.name = object.name ?? ""; diff --git a/integration/barrel-imports/foo.ts b/integration/barrel-imports/foo.ts index e5a81e984..c7f833d97 100644 --- a/integration/barrel-imports/foo.ts +++ b/integration/barrel-imports/foo.ts @@ -71,9 +71,8 @@ export const Foo = { }, create, I>>(base?: I): Foo { - return Foo.fromPartial(base ?? {}); + return Foo.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Foo { const message = createBaseFoo(); message.name = object.name ?? ""; diff --git a/integration/batching-with-context-esModuleInterop/batching.ts b/integration/batching-with-context-esModuleInterop/batching.ts index ff89bf541..ed1f9bc41 100644 --- a/integration/batching-with-context-esModuleInterop/batching.ts +++ b/integration/batching-with-context-esModuleInterop/batching.ts @@ -94,9 +94,8 @@ export const BatchQueryRequest = { }, create, I>>(base?: I): BatchQueryRequest { - return BatchQueryRequest.fromPartial(base ?? {}); + return BatchQueryRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BatchQueryRequest { const message = createBaseBatchQueryRequest(); message.ids = object.ids?.map((e) => e) || []; @@ -152,9 +151,8 @@ export const BatchQueryResponse = { }, create, I>>(base?: I): BatchQueryResponse { - return BatchQueryResponse.fromPartial(base ?? {}); + return BatchQueryResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BatchQueryResponse { const message = createBaseBatchQueryResponse(); message.entities = object.entities?.map((e) => Entity.fromPartial(e)) || []; @@ -210,9 +208,8 @@ export const BatchMapQueryRequest = { }, create, I>>(base?: I): BatchMapQueryRequest { - return BatchMapQueryRequest.fromPartial(base ?? {}); + return BatchMapQueryRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BatchMapQueryRequest { const message = createBaseBatchMapQueryRequest(); message.ids = object.ids?.map((e) => e) || []; @@ -284,9 +281,8 @@ export const BatchMapQueryResponse = { }, create, I>>(base?: I): BatchMapQueryResponse { - return BatchMapQueryResponse.fromPartial(base ?? {}); + return BatchMapQueryResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BatchMapQueryResponse { const message = createBaseBatchMapQueryResponse(); message.entities = Object.entries(object.entities ?? {}).reduce<{ [key: string]: Entity }>((acc, [key, value]) => { @@ -365,9 +361,8 @@ export const BatchMapQueryResponse_EntitiesEntry = { create, I>>( base?: I, ): BatchMapQueryResponse_EntitiesEntry { - return BatchMapQueryResponse_EntitiesEntry.fromPartial(base ?? {}); + return BatchMapQueryResponse_EntitiesEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): BatchMapQueryResponse_EntitiesEntry { @@ -428,9 +423,8 @@ export const GetOnlyMethodRequest = { }, create, I>>(base?: I): GetOnlyMethodRequest { - return GetOnlyMethodRequest.fromPartial(base ?? {}); + return GetOnlyMethodRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GetOnlyMethodRequest { const message = createBaseGetOnlyMethodRequest(); message.id = object.id ?? ""; @@ -486,9 +480,8 @@ export const GetOnlyMethodResponse = { }, create, I>>(base?: I): GetOnlyMethodResponse { - return GetOnlyMethodResponse.fromPartial(base ?? {}); + return GetOnlyMethodResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GetOnlyMethodResponse { const message = createBaseGetOnlyMethodResponse(); message.entity = (object.entity !== undefined && object.entity !== null) @@ -546,9 +539,8 @@ export const WriteMethodRequest = { }, create, I>>(base?: I): WriteMethodRequest { - return WriteMethodRequest.fromPartial(base ?? {}); + return WriteMethodRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): WriteMethodRequest { const message = createBaseWriteMethodRequest(); message.id = object.id ?? ""; @@ -591,9 +583,8 @@ export const WriteMethodResponse = { }, create, I>>(base?: I): WriteMethodResponse { - return WriteMethodResponse.fromPartial(base ?? {}); + return WriteMethodResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): WriteMethodResponse { const message = createBaseWriteMethodResponse(); return message; @@ -661,9 +652,8 @@ export const Entity = { }, create, I>>(base?: I): Entity { - return Entity.fromPartial(base ?? {}); + return Entity.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Entity { const message = createBaseEntity(); message.id = object.id ?? ""; diff --git a/integration/batching-with-context/batching.ts b/integration/batching-with-context/batching.ts index 77b71e738..3f5426019 100644 --- a/integration/batching-with-context/batching.ts +++ b/integration/batching-with-context/batching.ts @@ -94,9 +94,8 @@ export const BatchQueryRequest = { }, create, I>>(base?: I): BatchQueryRequest { - return BatchQueryRequest.fromPartial(base ?? {}); + return BatchQueryRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BatchQueryRequest { const message = createBaseBatchQueryRequest(); message.ids = object.ids?.map((e) => e) || []; @@ -152,9 +151,8 @@ export const BatchQueryResponse = { }, create, I>>(base?: I): BatchQueryResponse { - return BatchQueryResponse.fromPartial(base ?? {}); + return BatchQueryResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BatchQueryResponse { const message = createBaseBatchQueryResponse(); message.entities = object.entities?.map((e) => Entity.fromPartial(e)) || []; @@ -210,9 +208,8 @@ export const BatchMapQueryRequest = { }, create, I>>(base?: I): BatchMapQueryRequest { - return BatchMapQueryRequest.fromPartial(base ?? {}); + return BatchMapQueryRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BatchMapQueryRequest { const message = createBaseBatchMapQueryRequest(); message.ids = object.ids?.map((e) => e) || []; @@ -284,9 +281,8 @@ export const BatchMapQueryResponse = { }, create, I>>(base?: I): BatchMapQueryResponse { - return BatchMapQueryResponse.fromPartial(base ?? {}); + return BatchMapQueryResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BatchMapQueryResponse { const message = createBaseBatchMapQueryResponse(); message.entities = Object.entries(object.entities ?? {}).reduce<{ [key: string]: Entity }>((acc, [key, value]) => { @@ -365,9 +361,8 @@ export const BatchMapQueryResponse_EntitiesEntry = { create, I>>( base?: I, ): BatchMapQueryResponse_EntitiesEntry { - return BatchMapQueryResponse_EntitiesEntry.fromPartial(base ?? {}); + return BatchMapQueryResponse_EntitiesEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): BatchMapQueryResponse_EntitiesEntry { @@ -428,9 +423,8 @@ export const GetOnlyMethodRequest = { }, create, I>>(base?: I): GetOnlyMethodRequest { - return GetOnlyMethodRequest.fromPartial(base ?? {}); + return GetOnlyMethodRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GetOnlyMethodRequest { const message = createBaseGetOnlyMethodRequest(); message.id = object.id ?? ""; @@ -486,9 +480,8 @@ export const GetOnlyMethodResponse = { }, create, I>>(base?: I): GetOnlyMethodResponse { - return GetOnlyMethodResponse.fromPartial(base ?? {}); + return GetOnlyMethodResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GetOnlyMethodResponse { const message = createBaseGetOnlyMethodResponse(); message.entity = (object.entity !== undefined && object.entity !== null) @@ -546,9 +539,8 @@ export const WriteMethodRequest = { }, create, I>>(base?: I): WriteMethodRequest { - return WriteMethodRequest.fromPartial(base ?? {}); + return WriteMethodRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): WriteMethodRequest { const message = createBaseWriteMethodRequest(); message.id = object.id ?? ""; @@ -591,9 +583,8 @@ export const WriteMethodResponse = { }, create, I>>(base?: I): WriteMethodResponse { - return WriteMethodResponse.fromPartial(base ?? {}); + return WriteMethodResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): WriteMethodResponse { const message = createBaseWriteMethodResponse(); return message; @@ -661,9 +652,8 @@ export const Entity = { }, create, I>>(base?: I): Entity { - return Entity.fromPartial(base ?? {}); + return Entity.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Entity { const message = createBaseEntity(); message.id = object.id ?? ""; diff --git a/integration/batching/batching.ts b/integration/batching/batching.ts index ea5e6ddbb..836fc00d5 100644 --- a/integration/batching/batching.ts +++ b/integration/batching/batching.ts @@ -92,9 +92,8 @@ export const BatchQueryRequest = { }, create, I>>(base?: I): BatchQueryRequest { - return BatchQueryRequest.fromPartial(base ?? {}); + return BatchQueryRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BatchQueryRequest { const message = createBaseBatchQueryRequest(); message.ids = object.ids?.map((e) => e) || []; @@ -150,9 +149,8 @@ export const BatchQueryResponse = { }, create, I>>(base?: I): BatchQueryResponse { - return BatchQueryResponse.fromPartial(base ?? {}); + return BatchQueryResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BatchQueryResponse { const message = createBaseBatchQueryResponse(); message.entities = object.entities?.map((e) => Entity.fromPartial(e)) || []; @@ -208,9 +206,8 @@ export const BatchMapQueryRequest = { }, create, I>>(base?: I): BatchMapQueryRequest { - return BatchMapQueryRequest.fromPartial(base ?? {}); + return BatchMapQueryRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BatchMapQueryRequest { const message = createBaseBatchMapQueryRequest(); message.ids = object.ids?.map((e) => e) || []; @@ -282,9 +279,8 @@ export const BatchMapQueryResponse = { }, create, I>>(base?: I): BatchMapQueryResponse { - return BatchMapQueryResponse.fromPartial(base ?? {}); + return BatchMapQueryResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BatchMapQueryResponse { const message = createBaseBatchMapQueryResponse(); message.entities = Object.entries(object.entities ?? {}).reduce<{ [key: string]: Entity }>((acc, [key, value]) => { @@ -363,9 +359,8 @@ export const BatchMapQueryResponse_EntitiesEntry = { create, I>>( base?: I, ): BatchMapQueryResponse_EntitiesEntry { - return BatchMapQueryResponse_EntitiesEntry.fromPartial(base ?? {}); + return BatchMapQueryResponse_EntitiesEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): BatchMapQueryResponse_EntitiesEntry { @@ -426,9 +421,8 @@ export const GetOnlyMethodRequest = { }, create, I>>(base?: I): GetOnlyMethodRequest { - return GetOnlyMethodRequest.fromPartial(base ?? {}); + return GetOnlyMethodRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GetOnlyMethodRequest { const message = createBaseGetOnlyMethodRequest(); message.id = object.id ?? ""; @@ -484,9 +478,8 @@ export const GetOnlyMethodResponse = { }, create, I>>(base?: I): GetOnlyMethodResponse { - return GetOnlyMethodResponse.fromPartial(base ?? {}); + return GetOnlyMethodResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GetOnlyMethodResponse { const message = createBaseGetOnlyMethodResponse(); message.entity = (object.entity !== undefined && object.entity !== null) @@ -544,9 +537,8 @@ export const WriteMethodRequest = { }, create, I>>(base?: I): WriteMethodRequest { - return WriteMethodRequest.fromPartial(base ?? {}); + return WriteMethodRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): WriteMethodRequest { const message = createBaseWriteMethodRequest(); message.id = object.id ?? ""; @@ -589,9 +581,8 @@ export const WriteMethodResponse = { }, create, I>>(base?: I): WriteMethodResponse { - return WriteMethodResponse.fromPartial(base ?? {}); + return WriteMethodResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): WriteMethodResponse { const message = createBaseWriteMethodResponse(); return message; @@ -659,9 +650,8 @@ export const Entity = { }, create, I>>(base?: I): Entity { - return Entity.fromPartial(base ?? {}); + return Entity.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Entity { const message = createBaseEntity(); message.id = object.id ?? ""; diff --git a/integration/bytes-as-base64/message.ts b/integration/bytes-as-base64/message.ts index 9678e3084..0c78fea60 100644 --- a/integration/bytes-as-base64/message.ts +++ b/integration/bytes-as-base64/message.ts @@ -24,9 +24,8 @@ export const Message = { }, create, I>>(base?: I): Message { - return Message.fromPartial(base ?? {}); + return Message.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Message { const message = createBaseMessage(); message.data = object.data ?? new Uint8Array(0); diff --git a/integration/bytes-node/google/protobuf/wrappers.ts b/integration/bytes-node/google/protobuf/wrappers.ts index 1bbfbcb1d..360a266bf 100644 --- a/integration/bytes-node/google/protobuf/wrappers.ts +++ b/integration/bytes-node/google/protobuf/wrappers.ts @@ -142,9 +142,8 @@ export const DoubleValue = { }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -200,9 +199,8 @@ export const FloatValue = { }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -258,9 +256,8 @@ export const Int64Value = { }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = createBaseInt64Value(); message.value = object.value ?? 0; @@ -316,9 +313,8 @@ export const UInt64Value = { }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = createBaseUInt64Value(); message.value = object.value ?? 0; @@ -374,9 +370,8 @@ export const Int32Value = { }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -432,9 +427,8 @@ export const UInt32Value = { }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -490,9 +484,8 @@ export const BoolValue = { }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -548,9 +541,8 @@ export const StringValue = { }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -606,9 +598,8 @@ export const BytesValue = { }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? Buffer.alloc(0); diff --git a/integration/bytes-node/point.ts b/integration/bytes-node/point.ts index c9f0a51e0..78fd909b0 100644 --- a/integration/bytes-node/point.ts +++ b/integration/bytes-node/point.ts @@ -73,9 +73,8 @@ export const Point = { }, create, I>>(base?: I): Point { - return Point.fromPartial(base ?? {}); + return Point.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Point { const message = createBasePoint(); message.data = object.data ?? Buffer.alloc(0); diff --git a/integration/const-enum/const-enum.ts b/integration/const-enum/const-enum.ts index c6140f96d..675148027 100644 --- a/integration/const-enum/const-enum.ts +++ b/integration/const-enum/const-enum.ts @@ -152,9 +152,8 @@ export const DividerData = { }, create, I>>(base?: I): DividerData { - return DividerData.fromPartial(base ?? {}); + return DividerData.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DividerData { const message = createBaseDividerData(); message.type = object.type ?? DividerData_DividerType.DOUBLE; @@ -235,9 +234,8 @@ export const DividerData_TypeMapEntry = { }, create, I>>(base?: I): DividerData_TypeMapEntry { - return DividerData_TypeMapEntry.fromPartial(base ?? {}); + return DividerData_TypeMapEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DividerData_TypeMapEntry { const message = createBaseDividerData_TypeMapEntry(); message.key = object.key ?? ""; diff --git a/integration/enums-as-literals-with-string-enums/enums-as-literals-with-string-enums.ts b/integration/enums-as-literals-with-string-enums/enums-as-literals-with-string-enums.ts index 554f21662..4b80bfae2 100644 --- a/integration/enums-as-literals-with-string-enums/enums-as-literals-with-string-enums.ts +++ b/integration/enums-as-literals-with-string-enums/enums-as-literals-with-string-enums.ts @@ -118,9 +118,8 @@ export const DividerData = { }, create, I>>(base?: I): DividerData { - return DividerData.fromPartial(base ?? {}); + return DividerData.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DividerData { const message = createBaseDividerData(); message.type = object.type ?? DividerData_DividerType.DOUBLE; diff --git a/integration/enums-as-literals/enums-as-literals.ts b/integration/enums-as-literals/enums-as-literals.ts index 93d1914a0..62b27838f 100644 --- a/integration/enums-as-literals/enums-as-literals.ts +++ b/integration/enums-as-literals/enums-as-literals.ts @@ -96,9 +96,8 @@ export const DividerData = { }, create, I>>(base?: I): DividerData { - return DividerData.fromPartial(base ?? {}); + return DividerData.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DividerData { const message = createBaseDividerData(); message.type = object.type ?? 0; diff --git a/integration/extensions/test.ts b/integration/extensions/test.ts index e843bccac..dd7ea9e87 100644 --- a/integration/extensions/test.ts +++ b/integration/extensions/test.ts @@ -186,9 +186,8 @@ export const Extendable = { }, create, I>>(base?: I): Extendable { - return Extendable.fromPartial(base ?? {}); + return Extendable.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Extendable { const message = createBaseExtendable(); message.field = object.field ?? undefined; @@ -296,9 +295,8 @@ export const Nested = { }, create, I>>(base?: I): Nested { - return Nested.fromPartial(base ?? {}); + return Nested.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Nested { const message = createBaseNested(); message.field = object.field ?? undefined; @@ -397,9 +395,8 @@ export const Group = { }, create, I>>(base?: I): Group { - return Group.fromPartial(base ?? {}); + return Group.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Group { const message = createBaseGroup(); message.name = object.name ?? undefined; diff --git a/integration/fieldmask/fieldmask.ts b/integration/fieldmask/fieldmask.ts index 8b908180b..9ec4344e1 100644 --- a/integration/fieldmask/fieldmask.ts +++ b/integration/fieldmask/fieldmask.ts @@ -56,9 +56,8 @@ export const FieldMaskMessage = { }, create, I>>(base?: I): FieldMaskMessage { - return FieldMaskMessage.fromPartial(base ?? {}); + return FieldMaskMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FieldMaskMessage { const message = createBaseFieldMaskMessage(); message.fieldMask = object.fieldMask ?? undefined; diff --git a/integration/fieldmask/google/protobuf/field_mask.ts b/integration/fieldmask/google/protobuf/field_mask.ts index 327bf5421..98ce1bb8b 100644 --- a/integration/fieldmask/google/protobuf/field_mask.ts +++ b/integration/fieldmask/google/protobuf/field_mask.ts @@ -258,9 +258,8 @@ export const FieldMask = { }, create, I>>(base?: I): FieldMask { - return FieldMask.fromPartial(base ?? {}); + return FieldMask.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FieldMask { const message = createBaseFieldMask(); message.paths = object.paths?.map((e) => e) || []; diff --git a/integration/file-suffix/child.pb.ts b/integration/file-suffix/child.pb.ts index 8c91027c8..d4fd6dcd8 100644 --- a/integration/file-suffix/child.pb.ts +++ b/integration/file-suffix/child.pb.ts @@ -88,9 +88,8 @@ export const Child = { }, create, I>>(base?: I): Child { - return Child.fromPartial(base ?? {}); + return Child.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Child { const message = createBaseChild(); message.name = object.name ?? ""; diff --git a/integration/file-suffix/google/protobuf/timestamp.pb.ts b/integration/file-suffix/google/protobuf/timestamp.pb.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/file-suffix/google/protobuf/timestamp.pb.ts +++ b/integration/file-suffix/google/protobuf/timestamp.pb.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/file-suffix/parent.pb.ts b/integration/file-suffix/parent.pb.ts index 8cd18e863..f26b84bcf 100644 --- a/integration/file-suffix/parent.pb.ts +++ b/integration/file-suffix/parent.pb.ts @@ -89,9 +89,8 @@ export const Parent = { }, create, I>>(base?: I): Parent { - return Parent.fromPartial(base ?? {}); + return Parent.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Parent { const message = createBaseParent(); message.child = (object.child !== undefined && object.child !== null) ? Child.fromPartial(object.child) : undefined; diff --git a/integration/from-partial-no-initialize/test.ts b/integration/from-partial-no-initialize/test.ts index 4dc48cfcb..38648a4dc 100644 --- a/integration/from-partial-no-initialize/test.ts +++ b/integration/from-partial-no-initialize/test.ts @@ -70,9 +70,8 @@ export const TPartialMessage = { }, create, I>>(base?: I): TPartialMessage { - return TPartialMessage.fromPartial(base ?? {}); + return TPartialMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TPartialMessage { const message = createBaseTPartialMessage(); message.field = object.field ?? undefined; @@ -267,9 +266,8 @@ export const TPartial = { }, create, I>>(base?: I): TPartial { - return TPartial.fromPartial(base ?? {}); + return TPartial.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TPartial { const message = createBaseTPartial(); message.number = object.number ?? undefined; @@ -353,9 +351,8 @@ export const TPartial_MapEntry = { }, create, I>>(base?: I): TPartial_MapEntry { - return TPartial_MapEntry.fromPartial(base ?? {}); + return TPartial_MapEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TPartial_MapEntry { const message = createBaseTPartial_MapEntry(); message.key = object.key ?? ""; diff --git a/integration/generic-metadata/hero.ts b/integration/generic-metadata/hero.ts index de969f6f1..28f4e1b41 100644 --- a/integration/generic-metadata/hero.ts +++ b/integration/generic-metadata/hero.ts @@ -72,9 +72,8 @@ export const HeroById = { }, create, I>>(base?: I): HeroById { - return HeroById.fromPartial(base ?? {}); + return HeroById.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): HeroById { const message = createBaseHeroById(); message.id = object.id ?? 0; @@ -130,9 +129,8 @@ export const VillainById = { }, create, I>>(base?: I): VillainById { - return VillainById.fromPartial(base ?? {}); + return VillainById.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): VillainById { const message = createBaseVillainById(); message.id = object.id ?? 0; @@ -201,9 +199,8 @@ export const Hero = { }, create, I>>(base?: I): Hero { - return Hero.fromPartial(base ?? {}); + return Hero.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Hero { const message = createBaseHero(); message.id = object.id ?? 0; @@ -273,9 +270,8 @@ export const Villain = { }, create, I>>(base?: I): Villain { - return Villain.fromPartial(base ?? {}); + return Villain.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Villain { const message = createBaseVillain(); message.id = object.id ?? 0; diff --git a/integration/generic-service-definitions-and-services/simple.ts b/integration/generic-service-definitions-and-services/simple.ts index 09d413f92..28066f995 100644 --- a/integration/generic-service-definitions-and-services/simple.ts +++ b/integration/generic-service-definitions-and-services/simple.ts @@ -55,9 +55,8 @@ export const TestMessage = { }, create, I>>(base?: I): TestMessage { - return TestMessage.fromPartial(base ?? {}); + return TestMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TestMessage { const message = createBaseTestMessage(); message.value = object.value ?? ""; diff --git a/integration/generic-service-definitions/simple.ts b/integration/generic-service-definitions/simple.ts index 09d413f92..28066f995 100644 --- a/integration/generic-service-definitions/simple.ts +++ b/integration/generic-service-definitions/simple.ts @@ -55,9 +55,8 @@ export const TestMessage = { }, create, I>>(base?: I): TestMessage { - return TestMessage.fromPartial(base ?? {}); + return TestMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TestMessage { const message = createBaseTestMessage(); message.value = object.value ?? ""; diff --git a/integration/global-this/global-this.ts b/integration/global-this/global-this.ts index 216089c26..39b07ba67 100644 --- a/integration/global-this/global-this.ts +++ b/integration/global-this/global-this.ts @@ -59,9 +59,8 @@ export const Object = { }, create, I>>(base?: I): Object { - return Object.fromPartial(base ?? {}); + return Object.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Object { const message = createBaseObject(); message.name = object.name ?? ""; @@ -117,9 +116,8 @@ export const Error = { }, create, I>>(base?: I): Error { - return Error.fromPartial(base ?? {}); + return Error.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Error { const message = createBaseError(); message.name = object.name ?? ""; diff --git a/integration/groups/test.ts b/integration/groups/test.ts index 038e37513..8b8cf45bc 100644 --- a/integration/groups/test.ts +++ b/integration/groups/test.ts @@ -156,9 +156,8 @@ export const GroupsOptionalTest = { }, create, I>>(base?: I): GroupsOptionalTest { - return GroupsOptionalTest.fromPartial(base ?? {}); + return GroupsOptionalTest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GroupsOptionalTest { const message = createBaseGroupsOptionalTest(); message.int1 = object.int1 ?? undefined; @@ -261,9 +260,8 @@ export const GroupsOptionalTest_Group = { }, create, I>>(base?: I): GroupsOptionalTest_Group { - return GroupsOptionalTest_Group.fromPartial(base ?? {}); + return GroupsOptionalTest_Group.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GroupsOptionalTest_Group { const message = createBaseGroupsOptionalTest_Group(); message.key = object.key ?? undefined; @@ -424,9 +422,8 @@ export const GroupsRepeatedTest = { }, create, I>>(base?: I): GroupsRepeatedTest { - return GroupsRepeatedTest.fromPartial(base ?? {}); + return GroupsRepeatedTest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GroupsRepeatedTest { const message = createBaseGroupsRepeatedTest(); message.int1 = object.int1?.map((e) => e) || undefined; @@ -537,9 +534,8 @@ export const GroupsRepeatedTest_Group = { }, create, I>>(base?: I): GroupsRepeatedTest_Group { - return GroupsRepeatedTest_Group.fromPartial(base ?? {}); + return GroupsRepeatedTest_Group.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GroupsRepeatedTest_Group { const message = createBaseGroupsRepeatedTest_Group(); message.key = object.key?.map((e) => e) || undefined; @@ -700,9 +696,8 @@ export const GroupsNestedTest = { }, create, I>>(base?: I): GroupsNestedTest { - return GroupsNestedTest.fromPartial(base ?? {}); + return GroupsNestedTest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GroupsNestedTest { const message = createBaseGroupsNestedTest(); message.int1 = object.int1?.map((e) => e) || undefined; @@ -796,9 +791,8 @@ export const GroupsNestedTest_Group = { }, create, I>>(base?: I): GroupsNestedTest_Group { - return GroupsNestedTest_Group.fromPartial(base ?? {}); + return GroupsNestedTest_Group.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): GroupsNestedTest_Group { const message = createBaseGroupsNestedTest_Group(); message.nested = object.nested?.map((e) => GroupsNestedTest_Group_Nested.fromPartial(e)) || undefined; @@ -890,9 +884,8 @@ export const GroupsNestedTest_Group_Nested = { }, create, I>>(base?: I): GroupsNestedTest_Group_Nested { - return GroupsNestedTest_Group_Nested.fromPartial(base ?? {}); + return GroupsNestedTest_Group_Nested.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): GroupsNestedTest_Group_Nested { @@ -979,9 +972,8 @@ export const GroupsNestedTest_Group_Nested_Nested2 = { create, I>>( base?: I, ): GroupsNestedTest_Group_Nested_Nested2 { - return GroupsNestedTest_Group_Nested_Nested2.fromPartial(base ?? {}); + return GroupsNestedTest_Group_Nested_Nested2.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): GroupsNestedTest_Group_Nested_Nested2 { diff --git a/integration/grpc-js-use-date-false/google/protobuf/timestamp.ts b/integration/grpc-js-use-date-false/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/grpc-js-use-date-false/google/protobuf/timestamp.ts +++ b/integration/grpc-js-use-date-false/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/grpc-js-use-date-false/grpc-js-use-date-false.ts b/integration/grpc-js-use-date-false/grpc-js-use-date-false.ts index 511846364..9ac75b0c4 100644 --- a/integration/grpc-js-use-date-false/grpc-js-use-date-false.ts +++ b/integration/grpc-js-use-date-false/grpc-js-use-date-false.ts @@ -68,9 +68,8 @@ export const TimestampMessage = { }, create, I>>(base?: I): TimestampMessage { - return TimestampMessage.fromPartial(base ?? {}); + return TimestampMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TimestampMessage { const message = createBaseTimestampMessage(); message.timestamp = (object.timestamp !== undefined && object.timestamp !== null) diff --git a/integration/grpc-js-use-date-string/google/protobuf/timestamp.ts b/integration/grpc-js-use-date-string/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/grpc-js-use-date-string/google/protobuf/timestamp.ts +++ b/integration/grpc-js-use-date-string/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/grpc-js-use-date-string/grpc-js-use-date-string.ts b/integration/grpc-js-use-date-string/grpc-js-use-date-string.ts index 021ca8402..c3b862211 100644 --- a/integration/grpc-js-use-date-string/grpc-js-use-date-string.ts +++ b/integration/grpc-js-use-date-string/grpc-js-use-date-string.ts @@ -68,9 +68,8 @@ export const TimestampMessage = { }, create, I>>(base?: I): TimestampMessage { - return TimestampMessage.fromPartial(base ?? {}); + return TimestampMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TimestampMessage { const message = createBaseTimestampMessage(); message.timestamp = object.timestamp ?? undefined; diff --git a/integration/grpc-js-use-date-true/google/protobuf/timestamp.ts b/integration/grpc-js-use-date-true/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/grpc-js-use-date-true/google/protobuf/timestamp.ts +++ b/integration/grpc-js-use-date-true/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/grpc-js-use-date-true/grpc-js-use-date-true.ts b/integration/grpc-js-use-date-true/grpc-js-use-date-true.ts index 606cf4504..9e03abb9f 100644 --- a/integration/grpc-js-use-date-true/grpc-js-use-date-true.ts +++ b/integration/grpc-js-use-date-true/grpc-js-use-date-true.ts @@ -68,9 +68,8 @@ export const TimestampMessage = { }, create, I>>(base?: I): TimestampMessage { - return TimestampMessage.fromPartial(base ?? {}); + return TimestampMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TimestampMessage { const message = createBaseTimestampMessage(); message.timestamp = object.timestamp ?? undefined; diff --git a/integration/grpc-js/google/protobuf/empty.ts b/integration/grpc-js/google/protobuf/empty.ts index 1387d7ce4..5f012de45 100644 --- a/integration/grpc-js/google/protobuf/empty.ts +++ b/integration/grpc-js/google/protobuf/empty.ts @@ -52,9 +52,8 @@ export const Empty = { }, create, I>>(base?: I): Empty { - return Empty.fromPartial(base ?? {}); + return Empty.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Empty { const message = createBaseEmpty(); return message; diff --git a/integration/grpc-js/google/protobuf/struct.ts b/integration/grpc-js/google/protobuf/struct.ts index b2486a866..4d9869bbe 100644 --- a/integration/grpc-js/google/protobuf/struct.ts +++ b/integration/grpc-js/google/protobuf/struct.ts @@ -166,9 +166,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -265,9 +264,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -403,9 +401,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; @@ -503,9 +500,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/grpc-js/google/protobuf/timestamp.ts b/integration/grpc-js/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/grpc-js/google/protobuf/timestamp.ts +++ b/integration/grpc-js/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/grpc-js/google/protobuf/wrappers.ts b/integration/grpc-js/google/protobuf/wrappers.ts index 6637762f8..47d1af1f6 100644 --- a/integration/grpc-js/google/protobuf/wrappers.ts +++ b/integration/grpc-js/google/protobuf/wrappers.ts @@ -142,9 +142,8 @@ export const DoubleValue = { }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -200,9 +199,8 @@ export const FloatValue = { }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -258,9 +256,8 @@ export const Int64Value = { }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = createBaseInt64Value(); message.value = object.value ?? 0; @@ -316,9 +313,8 @@ export const UInt64Value = { }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = createBaseUInt64Value(); message.value = object.value ?? 0; @@ -374,9 +370,8 @@ export const Int32Value = { }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -432,9 +427,8 @@ export const UInt32Value = { }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -490,9 +484,8 @@ export const BoolValue = { }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -548,9 +541,8 @@ export const StringValue = { }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -606,9 +598,8 @@ export const BytesValue = { }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? new Uint8Array(0); diff --git a/integration/grpc-js/simple.ts b/integration/grpc-js/simple.ts index a552d77d9..44816dbfc 100644 --- a/integration/grpc-js/simple.ts +++ b/integration/grpc-js/simple.ts @@ -87,9 +87,8 @@ export const TestMessage = { }, create, I>>(base?: I): TestMessage { - return TestMessage.fromPartial(base ?? {}); + return TestMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TestMessage { const message = createBaseTestMessage(); message.timestamp = object.timestamp ?? undefined; diff --git a/integration/grpc-web-abort-signal/example.ts b/integration/grpc-web-abort-signal/example.ts index a0f08c644..78503684e 100644 --- a/integration/grpc-web-abort-signal/example.ts +++ b/integration/grpc-web-abort-signal/example.ts @@ -159,9 +159,8 @@ export const DashFlash = { }, create, I>>(base?: I): DashFlash { - return DashFlash.fromPartial(base ?? {}); + return DashFlash.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashFlash { const message = createBaseDashFlash(); message.msg = object.msg ?? ""; @@ -248,9 +247,8 @@ export const DashUserSettingsState = { }, create, I>>(base?: I): DashUserSettingsState { - return DashUserSettingsState.fromPartial(base ?? {}); + return DashUserSettingsState.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashUserSettingsState { const message = createBaseDashUserSettingsState(); message.email = object.email ?? ""; @@ -326,9 +324,8 @@ export const DashUserSettingsState_URLs = { }, create, I>>(base?: I): DashUserSettingsState_URLs { - return DashUserSettingsState_URLs.fromPartial(base ?? {}); + return DashUserSettingsState_URLs.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashUserSettingsState_URLs { const message = createBaseDashUserSettingsState_URLs(); message.connectGoogle = object.connectGoogle ?? ""; @@ -429,9 +426,8 @@ export const DashCred = { }, create, I>>(base?: I): DashCred { - return DashCred.fromPartial(base ?? {}); + return DashCred.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashCred { const message = createBaseDashCred(); message.description = object.description ?? ""; @@ -506,9 +502,8 @@ export const DashAPICredsCreateReq = { }, create, I>>(base?: I): DashAPICredsCreateReq { - return DashAPICredsCreateReq.fromPartial(base ?? {}); + return DashAPICredsCreateReq.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashAPICredsCreateReq { const message = createBaseDashAPICredsCreateReq(); message.description = object.description ?? ""; @@ -609,9 +604,8 @@ export const DashAPICredsUpdateReq = { }, create, I>>(base?: I): DashAPICredsUpdateReq { - return DashAPICredsUpdateReq.fromPartial(base ?? {}); + return DashAPICredsUpdateReq.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashAPICredsUpdateReq { const message = createBaseDashAPICredsUpdateReq(); message.credSid = object.credSid ?? ""; @@ -686,9 +680,8 @@ export const DashAPICredsDeleteReq = { }, create, I>>(base?: I): DashAPICredsDeleteReq { - return DashAPICredsDeleteReq.fromPartial(base ?? {}); + return DashAPICredsDeleteReq.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashAPICredsDeleteReq { const message = createBaseDashAPICredsDeleteReq(); message.credSid = object.credSid ?? ""; @@ -732,9 +725,8 @@ export const Empty = { }, create, I>>(base?: I): Empty { - return Empty.fromPartial(base ?? {}); + return Empty.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Empty { const message = createBaseEmpty(); return message; diff --git a/integration/grpc-web-go-server/example.ts b/integration/grpc-web-go-server/example.ts index d1f2e05e3..ce5dfebd7 100644 --- a/integration/grpc-web-go-server/example.ts +++ b/integration/grpc-web-go-server/example.ts @@ -157,9 +157,8 @@ export const DashFlash = { }, create, I>>(base?: I): DashFlash { - return DashFlash.fromPartial(base ?? {}); + return DashFlash.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashFlash { const message = createBaseDashFlash(); message.msg = object.msg ?? ""; @@ -246,9 +245,8 @@ export const DashUserSettingsState = { }, create, I>>(base?: I): DashUserSettingsState { - return DashUserSettingsState.fromPartial(base ?? {}); + return DashUserSettingsState.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashUserSettingsState { const message = createBaseDashUserSettingsState(); message.email = object.email ?? ""; @@ -324,9 +322,8 @@ export const DashUserSettingsState_URLs = { }, create, I>>(base?: I): DashUserSettingsState_URLs { - return DashUserSettingsState_URLs.fromPartial(base ?? {}); + return DashUserSettingsState_URLs.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashUserSettingsState_URLs { const message = createBaseDashUserSettingsState_URLs(); message.connectGoogle = object.connectGoogle ?? ""; @@ -427,9 +424,8 @@ export const DashCred = { }, create, I>>(base?: I): DashCred { - return DashCred.fromPartial(base ?? {}); + return DashCred.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashCred { const message = createBaseDashCred(); message.description = object.description ?? ""; @@ -504,9 +500,8 @@ export const DashAPICredsCreateReq = { }, create, I>>(base?: I): DashAPICredsCreateReq { - return DashAPICredsCreateReq.fromPartial(base ?? {}); + return DashAPICredsCreateReq.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashAPICredsCreateReq { const message = createBaseDashAPICredsCreateReq(); message.description = object.description ?? ""; @@ -607,9 +602,8 @@ export const DashAPICredsUpdateReq = { }, create, I>>(base?: I): DashAPICredsUpdateReq { - return DashAPICredsUpdateReq.fromPartial(base ?? {}); + return DashAPICredsUpdateReq.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashAPICredsUpdateReq { const message = createBaseDashAPICredsUpdateReq(); message.credSid = object.credSid ?? ""; @@ -684,9 +678,8 @@ export const DashAPICredsDeleteReq = { }, create, I>>(base?: I): DashAPICredsDeleteReq { - return DashAPICredsDeleteReq.fromPartial(base ?? {}); + return DashAPICredsDeleteReq.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashAPICredsDeleteReq { const message = createBaseDashAPICredsDeleteReq(); message.credSid = object.credSid ?? ""; @@ -730,9 +723,8 @@ export const Empty = { }, create, I>>(base?: I): Empty { - return Empty.fromPartial(base ?? {}); + return Empty.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Empty { const message = createBaseEmpty(); return message; diff --git a/integration/grpc-web-no-streaming-observable/example.ts b/integration/grpc-web-no-streaming-observable/example.ts index 82366a50c..a59e9953c 100644 --- a/integration/grpc-web-no-streaming-observable/example.ts +++ b/integration/grpc-web-no-streaming-observable/example.ts @@ -135,9 +135,8 @@ export const DashFlash = { }, create, I>>(base?: I): DashFlash { - return DashFlash.fromPartial(base ?? {}); + return DashFlash.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashFlash { const message = createBaseDashFlash(); message.msg = object.msg ?? ""; @@ -224,9 +223,8 @@ export const DashUserSettingsState = { }, create, I>>(base?: I): DashUserSettingsState { - return DashUserSettingsState.fromPartial(base ?? {}); + return DashUserSettingsState.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashUserSettingsState { const message = createBaseDashUserSettingsState(); message.email = object.email ?? ""; @@ -302,9 +300,8 @@ export const DashUserSettingsState_URLs = { }, create, I>>(base?: I): DashUserSettingsState_URLs { - return DashUserSettingsState_URLs.fromPartial(base ?? {}); + return DashUserSettingsState_URLs.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashUserSettingsState_URLs { const message = createBaseDashUserSettingsState_URLs(); message.connectGoogle = object.connectGoogle ?? ""; @@ -348,9 +345,8 @@ export const Empty = { }, create, I>>(base?: I): Empty { - return Empty.fromPartial(base ?? {}); + return Empty.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Empty { const message = createBaseEmpty(); return message; diff --git a/integration/grpc-web-no-streaming/example.ts b/integration/grpc-web-no-streaming/example.ts index d055a5e0c..61c5a4722 100644 --- a/integration/grpc-web-no-streaming/example.ts +++ b/integration/grpc-web-no-streaming/example.ts @@ -133,9 +133,8 @@ export const DashFlash = { }, create, I>>(base?: I): DashFlash { - return DashFlash.fromPartial(base ?? {}); + return DashFlash.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashFlash { const message = createBaseDashFlash(); message.msg = object.msg ?? ""; @@ -222,9 +221,8 @@ export const DashUserSettingsState = { }, create, I>>(base?: I): DashUserSettingsState { - return DashUserSettingsState.fromPartial(base ?? {}); + return DashUserSettingsState.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashUserSettingsState { const message = createBaseDashUserSettingsState(); message.email = object.email ?? ""; @@ -300,9 +298,8 @@ export const DashUserSettingsState_URLs = { }, create, I>>(base?: I): DashUserSettingsState_URLs { - return DashUserSettingsState_URLs.fromPartial(base ?? {}); + return DashUserSettingsState_URLs.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashUserSettingsState_URLs { const message = createBaseDashUserSettingsState_URLs(); message.connectGoogle = object.connectGoogle ?? ""; @@ -346,9 +343,8 @@ export const Empty = { }, create, I>>(base?: I): Empty { - return Empty.fromPartial(base ?? {}); + return Empty.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Empty { const message = createBaseEmpty(); return message; diff --git a/integration/grpc-web/example.ts b/integration/grpc-web/example.ts index 49e312479..c12a43c3d 100644 --- a/integration/grpc-web/example.ts +++ b/integration/grpc-web/example.ts @@ -159,9 +159,8 @@ export const DashFlash = { }, create, I>>(base?: I): DashFlash { - return DashFlash.fromPartial(base ?? {}); + return DashFlash.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashFlash { const message = createBaseDashFlash(); message.msg = object.msg ?? ""; @@ -248,9 +247,8 @@ export const DashUserSettingsState = { }, create, I>>(base?: I): DashUserSettingsState { - return DashUserSettingsState.fromPartial(base ?? {}); + return DashUserSettingsState.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashUserSettingsState { const message = createBaseDashUserSettingsState(); message.email = object.email ?? ""; @@ -326,9 +324,8 @@ export const DashUserSettingsState_URLs = { }, create, I>>(base?: I): DashUserSettingsState_URLs { - return DashUserSettingsState_URLs.fromPartial(base ?? {}); + return DashUserSettingsState_URLs.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashUserSettingsState_URLs { const message = createBaseDashUserSettingsState_URLs(); message.connectGoogle = object.connectGoogle ?? ""; @@ -429,9 +426,8 @@ export const DashCred = { }, create, I>>(base?: I): DashCred { - return DashCred.fromPartial(base ?? {}); + return DashCred.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashCred { const message = createBaseDashCred(); message.description = object.description ?? ""; @@ -506,9 +502,8 @@ export const DashAPICredsCreateReq = { }, create, I>>(base?: I): DashAPICredsCreateReq { - return DashAPICredsCreateReq.fromPartial(base ?? {}); + return DashAPICredsCreateReq.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashAPICredsCreateReq { const message = createBaseDashAPICredsCreateReq(); message.description = object.description ?? ""; @@ -609,9 +604,8 @@ export const DashAPICredsUpdateReq = { }, create, I>>(base?: I): DashAPICredsUpdateReq { - return DashAPICredsUpdateReq.fromPartial(base ?? {}); + return DashAPICredsUpdateReq.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashAPICredsUpdateReq { const message = createBaseDashAPICredsUpdateReq(); message.credSid = object.credSid ?? ""; @@ -686,9 +680,8 @@ export const DashAPICredsDeleteReq = { }, create, I>>(base?: I): DashAPICredsDeleteReq { - return DashAPICredsDeleteReq.fromPartial(base ?? {}); + return DashAPICredsDeleteReq.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DashAPICredsDeleteReq { const message = createBaseDashAPICredsDeleteReq(); message.credSid = object.credSid ?? ""; @@ -732,9 +725,8 @@ export const Empty = { }, create, I>>(base?: I): Empty { - return Empty.fromPartial(base ?? {}); + return Empty.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Empty { const message = createBaseEmpty(); return message; diff --git a/integration/import-mapping/google/protobuf/timestamp.ts b/integration/import-mapping/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/import-mapping/google/protobuf/timestamp.ts +++ b/integration/import-mapping/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/import-mapping/mapping.ts b/integration/import-mapping/mapping.ts index 06fd3c94e..84775f10b 100644 --- a/integration/import-mapping/mapping.ts +++ b/integration/import-mapping/mapping.ts @@ -76,9 +76,8 @@ export const WithEmtpy = { }, create, I>>(base?: I): WithEmtpy { - return WithEmtpy.fromPartial(base ?? {}); + return WithEmtpy.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): WithEmtpy { const message = createBaseWithEmtpy(); message.empty = (object.empty !== undefined && object.empty !== null) ? Empty.fromPartial(object.empty) : undefined; @@ -134,9 +133,8 @@ export const WithStruct = { }, create, I>>(base?: I): WithStruct { - return WithStruct.fromPartial(base ?? {}); + return WithStruct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): WithStruct { const message = createBaseWithStruct(); message.strut = object.strut ?? undefined; @@ -192,9 +190,8 @@ export const WithTimestamp = { }, create, I>>(base?: I): WithTimestamp { - return WithTimestamp.fromPartial(base ?? {}); + return WithTimestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): WithTimestamp { const message = createBaseWithTimestamp(); message.timestamp = object.timestamp ?? undefined; @@ -308,9 +305,8 @@ export const WithAll = { }, create, I>>(base?: I): WithAll { - return WithAll.fromPartial(base ?? {}); + return WithAll.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): WithAll { const message = createBaseWithAll(); message.empty = (object.empty !== undefined && object.empty !== null) ? Empty.fromPartial(object.empty) : undefined; diff --git a/integration/import-suffix/child.pb.ts b/integration/import-suffix/child.pb.ts index 95c76a35c..8e07ba1b1 100644 --- a/integration/import-suffix/child.pb.ts +++ b/integration/import-suffix/child.pb.ts @@ -88,9 +88,8 @@ export const Child = { }, create, I>>(base?: I): Child { - return Child.fromPartial(base ?? {}); + return Child.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Child { const message = createBaseChild(); message.name = object.name ?? ""; diff --git a/integration/import-suffix/google/protobuf/timestamp.pb.ts b/integration/import-suffix/google/protobuf/timestamp.pb.ts index de977dc2b..7d2f9170d 100644 --- a/integration/import-suffix/google/protobuf/timestamp.pb.ts +++ b/integration/import-suffix/google/protobuf/timestamp.pb.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/import-suffix/parent.pb.ts b/integration/import-suffix/parent.pb.ts index 0cd242d71..9fef51576 100644 --- a/integration/import-suffix/parent.pb.ts +++ b/integration/import-suffix/parent.pb.ts @@ -89,9 +89,8 @@ export const Parent = { }, create, I>>(base?: I): Parent { - return Parent.fromPartial(base ?? {}); + return Parent.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Parent { const message = createBaseParent(); message.child = (object.child !== undefined && object.child !== null) ? Child.fromPartial(object.child) : undefined; diff --git a/integration/lower-case-svc-methods/math.ts b/integration/lower-case-svc-methods/math.ts index 8bb700a08..6d7ea8a01 100644 --- a/integration/lower-case-svc-methods/math.ts +++ b/integration/lower-case-svc-methods/math.ts @@ -79,9 +79,8 @@ export const NumPair = { }, create, I>>(base?: I): NumPair { - return NumPair.fromPartial(base ?? {}); + return NumPair.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): NumPair { const message = createBaseNumPair(); message.num1 = object.num1 ?? 0; @@ -138,9 +137,8 @@ export const NumSingle = { }, create, I>>(base?: I): NumSingle { - return NumSingle.fromPartial(base ?? {}); + return NumSingle.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): NumSingle { const message = createBaseNumSingle(); message.num = object.num ?? 0; @@ -208,9 +206,8 @@ export const Numbers = { }, create, I>>(base?: I): Numbers { - return Numbers.fromPartial(base ?? {}); + return Numbers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Numbers { const message = createBaseNumbers(); message.num = object.num?.map((e) => e) || []; diff --git a/integration/map-bigint-optional/test.ts b/integration/map-bigint-optional/test.ts index e2edeac10..19f092464 100644 --- a/integration/map-bigint-optional/test.ts +++ b/integration/map-bigint-optional/test.ts @@ -106,9 +106,8 @@ export const MapBigInt = { }, create, I>>(base?: I): MapBigInt { - return MapBigInt.fromPartial(base ?? {}); + return MapBigInt.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): MapBigInt { const message = createBaseMapBigInt(); message.map = (object.map === undefined || object.map === null) ? undefined : (() => { @@ -215,9 +214,8 @@ export const MapBigInt_MapEntry = { }, create, I>>(base?: I): MapBigInt_MapEntry { - return MapBigInt_MapEntry.fromPartial(base ?? {}); + return MapBigInt_MapEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): MapBigInt_MapEntry { const message = createBaseMapBigInt_MapEntry(); message.key = object.key ?? BigInt("0"); diff --git a/integration/map-long-optional/test.ts b/integration/map-long-optional/test.ts index ac947f4af..5f8f46124 100644 --- a/integration/map-long-optional/test.ts +++ b/integration/map-long-optional/test.ts @@ -106,9 +106,8 @@ export const MapBigInt = { }, create, I>>(base?: I): MapBigInt { - return MapBigInt.fromPartial(base ?? {}); + return MapBigInt.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): MapBigInt { const message = createBaseMapBigInt(); message.map = (object.map === undefined || object.map === null) ? undefined : (() => { @@ -215,9 +214,8 @@ export const MapBigInt_MapEntry = { }, create, I>>(base?: I): MapBigInt_MapEntry { - return MapBigInt_MapEntry.fromPartial(base ?? {}); + return MapBigInt_MapEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): MapBigInt_MapEntry { const message = createBaseMapBigInt_MapEntry(); message.key = (object.key !== undefined && object.key !== null) ? Long.fromValue(object.key) : Long.UZERO; diff --git a/integration/map-longstring-optional/test.ts b/integration/map-longstring-optional/test.ts index e5fccb66c..0710cf04d 100644 --- a/integration/map-longstring-optional/test.ts +++ b/integration/map-longstring-optional/test.ts @@ -106,9 +106,8 @@ export const MapBigInt = { }, create, I>>(base?: I): MapBigInt { - return MapBigInt.fromPartial(base ?? {}); + return MapBigInt.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): MapBigInt { const message = createBaseMapBigInt(); message.map = (object.map === undefined || object.map === null) ? undefined : (() => { @@ -215,9 +214,8 @@ export const MapBigInt_MapEntry = { }, create, I>>(base?: I): MapBigInt_MapEntry { - return MapBigInt_MapEntry.fromPartial(base ?? {}); + return MapBigInt_MapEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): MapBigInt_MapEntry { const message = createBaseMapBigInt_MapEntry(); message.key = object.key ?? "0"; diff --git a/integration/nice-grpc/google/protobuf/empty.ts b/integration/nice-grpc/google/protobuf/empty.ts index 89e044465..15f57b3c9 100644 --- a/integration/nice-grpc/google/protobuf/empty.ts +++ b/integration/nice-grpc/google/protobuf/empty.ts @@ -54,7 +54,6 @@ export const Empty = { create(base?: DeepPartial): Empty { return Empty.fromPartial(base ?? {}); }, - fromPartial(_: DeepPartial): Empty { const message = createBaseEmpty(); return message; diff --git a/integration/nice-grpc/google/protobuf/struct.ts b/integration/nice-grpc/google/protobuf/struct.ts index 1aa09a906..ec6e0fc6c 100644 --- a/integration/nice-grpc/google/protobuf/struct.ts +++ b/integration/nice-grpc/google/protobuf/struct.ts @@ -168,7 +168,6 @@ export const Struct = { create(base?: DeepPartial): Struct { return Struct.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -267,7 +266,6 @@ export const Struct_FieldsEntry = { create(base?: DeepPartial): Struct_FieldsEntry { return Struct_FieldsEntry.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -405,7 +403,6 @@ export const Value = { create(base?: DeepPartial): Value { return Value.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): Value { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; @@ -505,7 +502,6 @@ export const ListValue = { create(base?: DeepPartial): ListValue { return ListValue.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/nice-grpc/google/protobuf/timestamp.ts b/integration/nice-grpc/google/protobuf/timestamp.ts index a4b4415ac..bb9e014d2 100644 --- a/integration/nice-grpc/google/protobuf/timestamp.ts +++ b/integration/nice-grpc/google/protobuf/timestamp.ts @@ -177,7 +177,6 @@ export const Timestamp = { create(base?: DeepPartial): Timestamp { return Timestamp.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/nice-grpc/google/protobuf/wrappers.ts b/integration/nice-grpc/google/protobuf/wrappers.ts index aabe92a94..4cffaaa4e 100644 --- a/integration/nice-grpc/google/protobuf/wrappers.ts +++ b/integration/nice-grpc/google/protobuf/wrappers.ts @@ -144,7 +144,6 @@ export const DoubleValue = { create(base?: DeepPartial): DoubleValue { return DoubleValue.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -202,7 +201,6 @@ export const FloatValue = { create(base?: DeepPartial): FloatValue { return FloatValue.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -260,7 +258,6 @@ export const Int64Value = { create(base?: DeepPartial): Int64Value { return Int64Value.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): Int64Value { const message = createBaseInt64Value(); message.value = object.value ?? 0; @@ -318,7 +315,6 @@ export const UInt64Value = { create(base?: DeepPartial): UInt64Value { return UInt64Value.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): UInt64Value { const message = createBaseUInt64Value(); message.value = object.value ?? 0; @@ -376,7 +372,6 @@ export const Int32Value = { create(base?: DeepPartial): Int32Value { return Int32Value.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -434,7 +429,6 @@ export const UInt32Value = { create(base?: DeepPartial): UInt32Value { return UInt32Value.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -492,7 +486,6 @@ export const BoolValue = { create(base?: DeepPartial): BoolValue { return BoolValue.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -550,7 +543,6 @@ export const StringValue = { create(base?: DeepPartial): StringValue { return StringValue.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -608,7 +600,6 @@ export const BytesValue = { create(base?: DeepPartial): BytesValue { return BytesValue.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? new Uint8Array(0); diff --git a/integration/nice-grpc/simple.ts b/integration/nice-grpc/simple.ts index 109f33346..ae1ec03c1 100644 --- a/integration/nice-grpc/simple.ts +++ b/integration/nice-grpc/simple.ts @@ -72,7 +72,6 @@ export const TestMessage = { create(base?: DeepPartial): TestMessage { return TestMessage.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): TestMessage { const message = createBaseTestMessage(); message.timestamp = object.timestamp ?? undefined; diff --git a/integration/no-proto-package/no-proto-package.ts b/integration/no-proto-package/no-proto-package.ts index 6eeed4715..06c3a3251 100644 --- a/integration/no-proto-package/no-proto-package.ts +++ b/integration/no-proto-package/no-proto-package.ts @@ -60,9 +60,8 @@ export const User = { }, create, I>>(base?: I): User { - return User.fromPartial(base ?? {}); + return User.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): User { const message = createBaseUser(); message.name = object.name ?? ""; @@ -105,9 +104,8 @@ export const Empty = { }, create, I>>(base?: I): Empty { - return Empty.fromPartial(base ?? {}); + return Empty.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Empty { const message = createBaseEmpty(); return message; diff --git a/integration/omit-optionals/simple.ts b/integration/omit-optionals/simple.ts index 738aa496f..038972b4c 100644 --- a/integration/omit-optionals/simple.ts +++ b/integration/omit-optionals/simple.ts @@ -72,9 +72,8 @@ export const TestMessage = { }, create, I>>(base?: I): TestMessage { - return TestMessage.fromPartial(base ?? {}); + return TestMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): TestMessage { const message = createBaseTestMessage(); message.field1 = object.field1 ?? false; diff --git a/integration/oneof-properties/oneof.ts b/integration/oneof-properties/oneof.ts index 4e844786c..4764d3fa4 100644 --- a/integration/oneof-properties/oneof.ts +++ b/integration/oneof-properties/oneof.ts @@ -278,9 +278,8 @@ export const PleaseChoose = { }, create, I>>(base?: I): PleaseChoose { - return PleaseChoose.fromPartial(base ?? {}); + return PleaseChoose.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PleaseChoose { const message = createBasePleaseChoose(); message.name = object.name ?? ""; @@ -348,9 +347,8 @@ export const PleaseChoose_Submessage = { }, create, I>>(base?: I): PleaseChoose_Submessage { - return PleaseChoose_Submessage.fromPartial(base ?? {}); + return PleaseChoose_Submessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PleaseChoose_Submessage { const message = createBasePleaseChoose_Submessage(); message.name = object.name ?? ""; diff --git a/integration/oneof-unions-snake/google/protobuf/struct.ts b/integration/oneof-unions-snake/google/protobuf/struct.ts index f21e1fa8b..a7b40be14 100644 --- a/integration/oneof-unions-snake/google/protobuf/struct.ts +++ b/integration/oneof-unions-snake/google/protobuf/struct.ts @@ -152,9 +152,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -251,9 +250,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -394,9 +392,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); if ( @@ -525,9 +522,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/oneof-unions-snake/simple.ts b/integration/oneof-unions-snake/simple.ts index 68d930e95..ee106ecbe 100644 --- a/integration/oneof-unions-snake/simple.ts +++ b/integration/oneof-unions-snake/simple.ts @@ -61,9 +61,8 @@ export const SimpleStruct = { }, create, I>>(base?: I): SimpleStruct { - return SimpleStruct.fromPartial(base ?? {}); + return SimpleStruct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleStruct { const message = createBaseSimpleStruct(); message.simple_struct = object.simple_struct ?? undefined; diff --git a/integration/oneof-unions/google/protobuf/struct.ts b/integration/oneof-unions/google/protobuf/struct.ts index 5c0628529..b1f613072 100644 --- a/integration/oneof-unions/google/protobuf/struct.ts +++ b/integration/oneof-unions/google/protobuf/struct.ts @@ -152,9 +152,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -251,9 +250,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -391,9 +389,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); if (object.kind?.$case === "nullValue" && object.kind?.nullValue !== undefined && object.kind?.nullValue !== null) { @@ -516,9 +513,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/oneof-unions/oneof.ts b/integration/oneof-unions/oneof.ts index e377b010a..dc6f0da10 100644 --- a/integration/oneof-unions/oneof.ts +++ b/integration/oneof-unions/oneof.ts @@ -305,9 +305,8 @@ export const PleaseChoose = { }, create, I>>(base?: I): PleaseChoose { - return PleaseChoose.fromPartial(base ?? {}); + return PleaseChoose.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PleaseChoose { const message = createBasePleaseChoose(); message.name = object.name ?? ""; @@ -405,9 +404,8 @@ export const PleaseChoose_Submessage = { }, create, I>>(base?: I): PleaseChoose_Submessage { - return PleaseChoose_Submessage.fromPartial(base ?? {}); + return PleaseChoose_Submessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PleaseChoose_Submessage { const message = createBasePleaseChoose_Submessage(); message.name = object.name ?? ""; @@ -479,9 +477,8 @@ export const SimpleButOptional = { }, create, I>>(base?: I): SimpleButOptional { - return SimpleButOptional.fromPartial(base ?? {}); + return SimpleButOptional.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleButOptional { const message = createBaseSimpleButOptional(); message.name = object.name ?? undefined; diff --git a/integration/output-index/a.ts b/integration/output-index/a.ts index 05b9a11b9..a6cabe256 100644 --- a/integration/output-index/a.ts +++ b/integration/output-index/a.ts @@ -53,9 +53,8 @@ export const A = { }, create, I>>(base?: I): A { - return A.fromPartial(base ?? {}); + return A.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): A { const message = createBaseA(); message.a = object.a ?? ""; diff --git a/integration/point/point.ts b/integration/point/point.ts index b98c2845d..718fffd7b 100644 --- a/integration/point/point.ts +++ b/integration/point/point.ts @@ -74,9 +74,8 @@ export const Point = { }, create, I>>(base?: I): Point { - return Point.fromPartial(base ?? {}); + return Point.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Point { const message = createBasePoint(); message.lat = object.lat ?? 0; @@ -149,9 +148,8 @@ export const Area = { }, create, I>>(base?: I): Area { - return Area.fromPartial(base ?? {}); + return Area.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Area { const message = createBaseArea(); message.nw = (object.nw !== undefined && object.nw !== null) ? Point.fromPartial(object.nw) : undefined; diff --git a/integration/reserved-words/reserved-words.ts b/integration/reserved-words/reserved-words.ts index c8e70e8fe..169fcc963 100644 --- a/integration/reserved-words/reserved-words.ts +++ b/integration/reserved-words/reserved-words.ts @@ -41,9 +41,8 @@ export const Record = { }, create, I>>(base?: I): Record { - return Record.fromPartial(base ?? {}); + return Record.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Record { const message = createBaseRecord(); return message; diff --git a/integration/return-observable/observable.ts b/integration/return-observable/observable.ts index 1d9048445..df4e45875 100644 --- a/integration/return-observable/observable.ts +++ b/integration/return-observable/observable.ts @@ -60,9 +60,8 @@ export const ProduceRequest = { }, create, I>>(base?: I): ProduceRequest { - return ProduceRequest.fromPartial(base ?? {}); + return ProduceRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ProduceRequest { const message = createBaseProduceRequest(); message.ingredients = object.ingredients ?? ""; @@ -118,9 +117,8 @@ export const ProduceReply = { }, create, I>>(base?: I): ProduceReply { - return ProduceReply.fromPartial(base ?? {}); + return ProduceReply.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ProduceReply { const message = createBaseProduceReply(); message.result = object.result ?? ""; diff --git a/integration/simple-deprecated-fields/simple.ts b/integration/simple-deprecated-fields/simple.ts index f9a7fb45b..30248068f 100644 --- a/integration/simple-deprecated-fields/simple.ts +++ b/integration/simple-deprecated-fields/simple.ts @@ -139,9 +139,8 @@ export const Simple = { }, create, I>>(base?: I): Simple { - return Simple.fromPartial(base ?? {}); + return Simple.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple { const message = createBaseSimple(); message.name = object.name ?? ""; @@ -201,9 +200,8 @@ export const Child = { }, create, I>>(base?: I): Child { - return Child.fromPartial(base ?? {}); + return Child.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Child { const message = createBaseChild(); message.name = object.name ?? ""; diff --git a/integration/simple-esmodule-interop/simple.ts b/integration/simple-esmodule-interop/simple.ts index 797fea600..e555cb95e 100644 --- a/integration/simple-esmodule-interop/simple.ts +++ b/integration/simple-esmodule-interop/simple.ts @@ -85,9 +85,8 @@ export const Simple = { }, create, I>>(base?: I): Simple { - return Simple.fromPartial(base ?? {}); + return Simple.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple { const message = createBaseSimple(); message.name = object.name ?? ""; @@ -313,9 +312,8 @@ export const Numbers = { }, create, I>>(base?: I): Numbers { - return Numbers.fromPartial(base ?? {}); + return Numbers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Numbers { const message = createBaseNumbers(); message.double = object.double ?? 0; diff --git a/integration/simple-json-name/google/protobuf/timestamp.ts b/integration/simple-json-name/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/simple-json-name/google/protobuf/timestamp.ts +++ b/integration/simple-json-name/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/simple-json-name/simple.ts b/integration/simple-json-name/simple.ts index 37f2a3705..7eb951423 100644 --- a/integration/simple-json-name/simple.ts +++ b/integration/simple-json-name/simple.ts @@ -172,9 +172,8 @@ export const Simple = { }, create, I>>(base?: I): Simple { - return Simple.fromPartial(base ?? {}); + return Simple.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple { const message = createBaseSimple(); message.name = object.name ?? ""; diff --git a/integration/simple-long-bigint/google/protobuf/timestamp.ts b/integration/simple-long-bigint/google/protobuf/timestamp.ts index dbc000c51..6fbfc8858 100644 --- a/integration/simple-long-bigint/google/protobuf/timestamp.ts +++ b/integration/simple-long-bigint/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? BigInt("0"); diff --git a/integration/simple-long-bigint/google/protobuf/wrappers.ts b/integration/simple-long-bigint/google/protobuf/wrappers.ts index 6f5ad2a6a..b0dbbcf8c 100644 --- a/integration/simple-long-bigint/google/protobuf/wrappers.ts +++ b/integration/simple-long-bigint/google/protobuf/wrappers.ts @@ -142,9 +142,8 @@ export const DoubleValue = { }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -200,9 +199,8 @@ export const FloatValue = { }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -258,9 +256,8 @@ export const Int64Value = { }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = createBaseInt64Value(); message.value = object.value ?? BigInt("0"); @@ -316,9 +313,8 @@ export const UInt64Value = { }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = createBaseUInt64Value(); message.value = object.value ?? BigInt("0"); @@ -374,9 +370,8 @@ export const Int32Value = { }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -432,9 +427,8 @@ export const UInt32Value = { }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -490,9 +484,8 @@ export const BoolValue = { }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -548,9 +541,8 @@ export const StringValue = { }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -606,9 +598,8 @@ export const BytesValue = { }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? new Uint8Array(0); diff --git a/integration/simple-long-bigint/simple.ts b/integration/simple-long-bigint/simple.ts index d773deb76..2a75ff903 100644 --- a/integration/simple-long-bigint/simple.ts +++ b/integration/simple-long-bigint/simple.ts @@ -298,9 +298,8 @@ export const Numbers = { }, create, I>>(base?: I): Numbers { - return Numbers.fromPartial(base ?? {}); + return Numbers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Numbers { const message = createBaseNumbers(); message.double = object.double ?? 0; diff --git a/integration/simple-long-string/google/protobuf/timestamp.ts b/integration/simple-long-string/google/protobuf/timestamp.ts index 7785db1cd..261126610 100644 --- a/integration/simple-long-string/google/protobuf/timestamp.ts +++ b/integration/simple-long-string/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? "0"; diff --git a/integration/simple-long-string/google/protobuf/wrappers.ts b/integration/simple-long-string/google/protobuf/wrappers.ts index aa0588050..eb21b8a94 100644 --- a/integration/simple-long-string/google/protobuf/wrappers.ts +++ b/integration/simple-long-string/google/protobuf/wrappers.ts @@ -142,9 +142,8 @@ export const DoubleValue = { }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -200,9 +199,8 @@ export const FloatValue = { }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -258,9 +256,8 @@ export const Int64Value = { }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = createBaseInt64Value(); message.value = object.value ?? "0"; @@ -316,9 +313,8 @@ export const UInt64Value = { }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = createBaseUInt64Value(); message.value = object.value ?? "0"; @@ -374,9 +370,8 @@ export const Int32Value = { }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -432,9 +427,8 @@ export const UInt32Value = { }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -490,9 +484,8 @@ export const BoolValue = { }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -548,9 +541,8 @@ export const StringValue = { }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -606,9 +598,8 @@ export const BytesValue = { }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? new Uint8Array(0); diff --git a/integration/simple-long-string/simple.ts b/integration/simple-long-string/simple.ts index 1c9f48f3f..40b15d0f1 100644 --- a/integration/simple-long-string/simple.ts +++ b/integration/simple-long-string/simple.ts @@ -270,9 +270,8 @@ export const Numbers = { }, create, I>>(base?: I): Numbers { - return Numbers.fromPartial(base ?? {}); + return Numbers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Numbers { const message = createBaseNumbers(); message.double = object.double ?? 0; diff --git a/integration/simple-long/google/protobuf/wrappers.ts b/integration/simple-long/google/protobuf/wrappers.ts index f0fe7c61c..875de68bd 100644 --- a/integration/simple-long/google/protobuf/wrappers.ts +++ b/integration/simple-long/google/protobuf/wrappers.ts @@ -142,9 +142,8 @@ export const DoubleValue = { }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -200,9 +199,8 @@ export const FloatValue = { }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -258,9 +256,8 @@ export const Int64Value = { }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = createBaseInt64Value(); message.value = (object.value !== undefined && object.value !== null) ? Long.fromValue(object.value) : Long.ZERO; @@ -316,9 +313,8 @@ export const UInt64Value = { }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = createBaseUInt64Value(); message.value = (object.value !== undefined && object.value !== null) ? Long.fromValue(object.value) : Long.UZERO; @@ -374,9 +370,8 @@ export const Int32Value = { }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -432,9 +427,8 @@ export const UInt32Value = { }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -490,9 +484,8 @@ export const BoolValue = { }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -548,9 +541,8 @@ export const StringValue = { }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -606,9 +598,8 @@ export const BytesValue = { }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? new Uint8Array(0); diff --git a/integration/simple-long/simple.ts b/integration/simple-long/simple.ts index 73815f744..e48f71c54 100644 --- a/integration/simple-long/simple.ts +++ b/integration/simple-long/simple.ts @@ -173,9 +173,8 @@ export const SimpleWithWrappers = { }, create, I>>(base?: I): SimpleWithWrappers { - return SimpleWithWrappers.fromPartial(base ?? {}); + return SimpleWithWrappers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithWrappers { const message = createBaseSimpleWithWrappers(); message.name = object.name ?? undefined; @@ -310,9 +309,8 @@ export const SimpleWithMap = { }, create, I>>(base?: I): SimpleWithMap { - return SimpleWithMap.fromPartial(base ?? {}); + return SimpleWithMap.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMap { const message = createBaseSimpleWithMap(); message.nameLookup = Object.entries(object.nameLookup ?? {}).reduce<{ [key: string]: string }>( @@ -407,9 +405,8 @@ export const SimpleWithMap_NameLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_NameLookupEntry { - return SimpleWithMap_NameLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_NameLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_NameLookupEntry { @@ -481,9 +478,8 @@ export const SimpleWithMap_IntLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_IntLookupEntry { - return SimpleWithMap_IntLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_IntLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMap_IntLookupEntry { const message = createBaseSimpleWithMap_IntLookupEntry(); message.key = object.key ?? 0; @@ -556,9 +552,8 @@ export const SimpleWithMap_LongLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_LongLookupEntry { - return SimpleWithMap_LongLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_LongLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_LongLookupEntry { @@ -813,9 +808,8 @@ export const Numbers = { }, create, I>>(base?: I): Numbers { - return Numbers.fromPartial(base ?? {}); + return Numbers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Numbers { const message = createBaseNumbers(); message.double = object.double ?? 0; diff --git a/integration/simple-optionals/google/protobuf/timestamp.ts b/integration/simple-optionals/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/simple-optionals/google/protobuf/timestamp.ts +++ b/integration/simple-optionals/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/simple-optionals/google/protobuf/wrappers.ts b/integration/simple-optionals/google/protobuf/wrappers.ts index 6637762f8..47d1af1f6 100644 --- a/integration/simple-optionals/google/protobuf/wrappers.ts +++ b/integration/simple-optionals/google/protobuf/wrappers.ts @@ -142,9 +142,8 @@ export const DoubleValue = { }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -200,9 +199,8 @@ export const FloatValue = { }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -258,9 +256,8 @@ export const Int64Value = { }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = createBaseInt64Value(); message.value = object.value ?? 0; @@ -316,9 +313,8 @@ export const UInt64Value = { }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = createBaseUInt64Value(); message.value = object.value ?? 0; @@ -374,9 +370,8 @@ export const Int32Value = { }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -432,9 +427,8 @@ export const UInt32Value = { }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -490,9 +484,8 @@ export const BoolValue = { }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -548,9 +541,8 @@ export const StringValue = { }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -606,9 +598,8 @@ export const BytesValue = { }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? new Uint8Array(0); diff --git a/integration/simple-optionals/import_dir/thing.ts b/integration/simple-optionals/import_dir/thing.ts index dacd1b268..645df09b8 100644 --- a/integration/simple-optionals/import_dir/thing.ts +++ b/integration/simple-optionals/import_dir/thing.ts @@ -56,9 +56,8 @@ export const ImportedThing = { }, create, I>>(base?: I): ImportedThing { - return ImportedThing.fromPartial(base ?? {}); + return ImportedThing.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ImportedThing { const message = createBaseImportedThing(); message.createdAt = object.createdAt ?? undefined; diff --git a/integration/simple-optionals/simple.ts b/integration/simple-optionals/simple.ts index dbc6a1ee4..b30261b05 100644 --- a/integration/simple-optionals/simple.ts +++ b/integration/simple-optionals/simple.ts @@ -451,9 +451,8 @@ export const Simple = { }, create, I>>(base?: I): Simple { - return Simple.fromPartial(base ?? {}); + return Simple.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple { const message = createBaseSimple(); message.name = object.name ?? ""; @@ -536,9 +535,8 @@ export const Child = { }, create, I>>(base?: I): Child { - return Child.fromPartial(base ?? {}); + return Child.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Child { const message = createBaseChild(); message.name = object.name ?? ""; @@ -625,9 +623,8 @@ export const Nested = { }, create, I>>(base?: I): Nested { - return Nested.fromPartial(base ?? {}); + return Nested.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Nested { const message = createBaseNested(); message.name = object.name ?? ""; @@ -703,9 +700,8 @@ export const Nested_InnerMessage = { }, create, I>>(base?: I): Nested_InnerMessage { - return Nested_InnerMessage.fromPartial(base ?? {}); + return Nested_InnerMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Nested_InnerMessage { const message = createBaseNested_InnerMessage(); message.name = object.name ?? ""; @@ -764,9 +760,8 @@ export const Nested_InnerMessage_DeepMessage = { }, create, I>>(base?: I): Nested_InnerMessage_DeepMessage { - return Nested_InnerMessage_DeepMessage.fromPartial(base ?? {}); + return Nested_InnerMessage_DeepMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): Nested_InnerMessage_DeepMessage { @@ -840,9 +835,8 @@ export const OneOfMessage = { }, create, I>>(base?: I): OneOfMessage { - return OneOfMessage.fromPartial(base ?? {}); + return OneOfMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneOfMessage { const message = createBaseOneOfMessage(); message.first = object.first ?? undefined; @@ -957,9 +951,8 @@ export const SimpleWithWrappers = { }, create, I>>(base?: I): SimpleWithWrappers { - return SimpleWithWrappers.fromPartial(base ?? {}); + return SimpleWithWrappers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithWrappers { const message = createBaseSimpleWithWrappers(); message.name = object.name ?? undefined; @@ -1019,9 +1012,8 @@ export const Entity = { }, create, I>>(base?: I): Entity { - return Entity.fromPartial(base ?? {}); + return Entity.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Entity { const message = createBaseEntity(); message.id = object.id ?? 0; @@ -1149,9 +1141,8 @@ export const SimpleWithMap = { }, create, I>>(base?: I): SimpleWithMap { - return SimpleWithMap.fromPartial(base ?? {}); + return SimpleWithMap.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMap { const message = createBaseSimpleWithMap(); message.entitiesById = Object.entries(object.entitiesById ?? {}).reduce<{ [key: number]: Entity }>( @@ -1249,9 +1240,8 @@ export const SimpleWithMap_EntitiesByIdEntry = { }, create, I>>(base?: I): SimpleWithMap_EntitiesByIdEntry { - return SimpleWithMap_EntitiesByIdEntry.fromPartial(base ?? {}); + return SimpleWithMap_EntitiesByIdEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_EntitiesByIdEntry { @@ -1325,9 +1315,8 @@ export const SimpleWithMap_NameLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_NameLookupEntry { - return SimpleWithMap_NameLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_NameLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_NameLookupEntry { @@ -1399,9 +1388,8 @@ export const SimpleWithMap_IntLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_IntLookupEntry { - return SimpleWithMap_IntLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_IntLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMap_IntLookupEntry { const message = createBaseSimpleWithMap_IntLookupEntry(); message.key = object.key ?? 0; @@ -1474,9 +1462,8 @@ export const SimpleWithSnakeCaseMap = { }, create, I>>(base?: I): SimpleWithSnakeCaseMap { - return SimpleWithSnakeCaseMap.fromPartial(base ?? {}); + return SimpleWithSnakeCaseMap.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithSnakeCaseMap { const message = createBaseSimpleWithSnakeCaseMap(); message.entitiesById = Object.entries(object.entitiesById ?? {}).reduce<{ [key: number]: Entity }>( @@ -1558,9 +1545,8 @@ export const SimpleWithSnakeCaseMap_EntitiesByIdEntry = { create, I>>( base?: I, ): SimpleWithSnakeCaseMap_EntitiesByIdEntry { - return SimpleWithSnakeCaseMap_EntitiesByIdEntry.fromPartial(base ?? {}); + return SimpleWithSnakeCaseMap_EntitiesByIdEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithSnakeCaseMap_EntitiesByIdEntry { @@ -1621,9 +1607,8 @@ export const PingRequest = { }, create, I>>(base?: I): PingRequest { - return PingRequest.fromPartial(base ?? {}); + return PingRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PingRequest { const message = createBasePingRequest(); message.input = object.input ?? ""; @@ -1679,9 +1664,8 @@ export const PingResponse = { }, create, I>>(base?: I): PingResponse { - return PingResponse.fromPartial(base ?? {}); + return PingResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PingResponse { const message = createBasePingResponse(); message.output = object.output ?? ""; @@ -1906,9 +1890,8 @@ export const Numbers = { }, create, I>>(base?: I): Numbers { - return Numbers.fromPartial(base ?? {}); + return Numbers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Numbers { const message = createBaseNumbers(); message.double = object.double ?? 0; diff --git a/integration/simple-optionals/thing.ts b/integration/simple-optionals/thing.ts index f890da70b..25dd77fdd 100644 --- a/integration/simple-optionals/thing.ts +++ b/integration/simple-optionals/thing.ts @@ -56,9 +56,8 @@ export const ImportedThing = { }, create, I>>(base?: I): ImportedThing { - return ImportedThing.fromPartial(base ?? {}); + return ImportedThing.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ImportedThing { const message = createBaseImportedThing(); message.createdAt = object.createdAt ?? undefined; diff --git a/integration/simple-proto2/simple.ts b/integration/simple-proto2/simple.ts index 1b086230d..7068e093e 100644 --- a/integration/simple-proto2/simple.ts +++ b/integration/simple-proto2/simple.ts @@ -88,9 +88,8 @@ export const Issue56 = { }, create, I>>(base?: I): Issue56 { - return Issue56.fromPartial(base ?? {}); + return Issue56.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Issue56 { const message = createBaseIssue56(); message.test = object.test ?? 1; diff --git a/integration/simple-prototype-defaults/google/protobuf/timestamp.ts b/integration/simple-prototype-defaults/google/protobuf/timestamp.ts index c1279f5f9..5aaf79e75 100644 --- a/integration/simple-prototype-defaults/google/protobuf/timestamp.ts +++ b/integration/simple-prototype-defaults/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = Object.create(createBaseTimestamp()) as Timestamp; message.seconds = object.seconds ?? 0; diff --git a/integration/simple-prototype-defaults/google/protobuf/wrappers.ts b/integration/simple-prototype-defaults/google/protobuf/wrappers.ts index b8a1a2f92..03f92a4fe 100644 --- a/integration/simple-prototype-defaults/google/protobuf/wrappers.ts +++ b/integration/simple-prototype-defaults/google/protobuf/wrappers.ts @@ -142,9 +142,8 @@ export const DoubleValue = { }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = Object.create(createBaseDoubleValue()) as DoubleValue; message.value = object.value ?? 0; @@ -200,9 +199,8 @@ export const FloatValue = { }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = Object.create(createBaseFloatValue()) as FloatValue; message.value = object.value ?? 0; @@ -258,9 +256,8 @@ export const Int64Value = { }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = Object.create(createBaseInt64Value()) as Int64Value; message.value = object.value ?? 0; @@ -316,9 +313,8 @@ export const UInt64Value = { }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = Object.create(createBaseUInt64Value()) as UInt64Value; message.value = object.value ?? 0; @@ -374,9 +370,8 @@ export const Int32Value = { }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = Object.create(createBaseInt32Value()) as Int32Value; message.value = object.value ?? 0; @@ -432,9 +427,8 @@ export const UInt32Value = { }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = Object.create(createBaseUInt32Value()) as UInt32Value; message.value = object.value ?? 0; @@ -490,9 +484,8 @@ export const BoolValue = { }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = Object.create(createBaseBoolValue()) as BoolValue; message.value = object.value ?? false; @@ -548,9 +541,8 @@ export const StringValue = { }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = Object.create(createBaseStringValue()) as StringValue; message.value = object.value ?? ""; @@ -606,9 +598,8 @@ export const BytesValue = { }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = Object.create(createBaseBytesValue()) as BytesValue; message.value = object.value ?? new Uint8Array(0); diff --git a/integration/simple-prototype-defaults/google/type/date.ts b/integration/simple-prototype-defaults/google/type/date.ts index 2e042add8..b7b14eccc 100644 --- a/integration/simple-prototype-defaults/google/type/date.ts +++ b/integration/simple-prototype-defaults/google/type/date.ts @@ -112,9 +112,8 @@ export const DateMessage = { }, create, I>>(base?: I): DateMessage { - return DateMessage.fromPartial(base ?? {}); + return DateMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DateMessage { const message = Object.create(createBaseDateMessage()) as DateMessage; message.year = object.year ?? 0; diff --git a/integration/simple-prototype-defaults/import_dir/thing.ts b/integration/simple-prototype-defaults/import_dir/thing.ts index 9ae339e4a..7b91073dc 100644 --- a/integration/simple-prototype-defaults/import_dir/thing.ts +++ b/integration/simple-prototype-defaults/import_dir/thing.ts @@ -56,9 +56,8 @@ export const ImportedThing = { }, create, I>>(base?: I): ImportedThing { - return ImportedThing.fromPartial(base ?? {}); + return ImportedThing.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ImportedThing { const message = Object.create(createBaseImportedThing()) as ImportedThing; message.createdAt = object.createdAt ?? undefined; diff --git a/integration/simple-prototype-defaults/simple.ts b/integration/simple-prototype-defaults/simple.ts index fe9580023..c834bc216 100644 --- a/integration/simple-prototype-defaults/simple.ts +++ b/integration/simple-prototype-defaults/simple.ts @@ -558,9 +558,8 @@ export const Simple = { }, create, I>>(base?: I): Simple { - return Simple.fromPartial(base ?? {}); + return Simple.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple { const message = Object.create(createBaseSimple()) as Simple; message.name = object.name ?? ""; @@ -648,9 +647,8 @@ export const Child = { }, create, I>>(base?: I): Child { - return Child.fromPartial(base ?? {}); + return Child.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Child { const message = Object.create(createBaseChild()) as Child; message.name = object.name ?? ""; @@ -737,9 +735,8 @@ export const Nested = { }, create, I>>(base?: I): Nested { - return Nested.fromPartial(base ?? {}); + return Nested.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Nested { const message = Object.create(createBaseNested()) as Nested; message.name = object.name ?? ""; @@ -815,9 +812,8 @@ export const Nested_InnerMessage = { }, create, I>>(base?: I): Nested_InnerMessage { - return Nested_InnerMessage.fromPartial(base ?? {}); + return Nested_InnerMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Nested_InnerMessage { const message = Object.create(createBaseNested_InnerMessage()) as Nested_InnerMessage; message.name = object.name ?? ""; @@ -876,9 +872,8 @@ export const Nested_InnerMessage_DeepMessage = { }, create, I>>(base?: I): Nested_InnerMessage_DeepMessage { - return Nested_InnerMessage_DeepMessage.fromPartial(base ?? {}); + return Nested_InnerMessage_DeepMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): Nested_InnerMessage_DeepMessage { @@ -952,9 +947,8 @@ export const OneOfMessage = { }, create, I>>(base?: I): OneOfMessage { - return OneOfMessage.fromPartial(base ?? {}); + return OneOfMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneOfMessage { const message = Object.create(createBaseOneOfMessage()) as OneOfMessage; message.first = object.first ?? undefined; @@ -1083,9 +1077,8 @@ export const SimpleWithWrappers = { }, create, I>>(base?: I): SimpleWithWrappers { - return SimpleWithWrappers.fromPartial(base ?? {}); + return SimpleWithWrappers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithWrappers { const message = Object.create(createBaseSimpleWithWrappers()) as SimpleWithWrappers; message.name = object.name ?? undefined; @@ -1146,9 +1139,8 @@ export const Entity = { }, create, I>>(base?: I): Entity { - return Entity.fromPartial(base ?? {}); + return Entity.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Entity { const message = Object.create(createBaseEntity()) as Entity; message.id = object.id ?? 0; @@ -1401,9 +1393,8 @@ export const SimpleWithMap = { }, create, I>>(base?: I): SimpleWithMap { - return SimpleWithMap.fromPartial(base ?? {}); + return SimpleWithMap.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMap { const message = Object.create(createBaseSimpleWithMap()) as SimpleWithMap; message.entitiesById = Object.entries(object.entitiesById ?? {}).reduce<{ [key: number]: Entity }>( @@ -1536,9 +1527,8 @@ export const SimpleWithMap_EntitiesByIdEntry = { }, create, I>>(base?: I): SimpleWithMap_EntitiesByIdEntry { - return SimpleWithMap_EntitiesByIdEntry.fromPartial(base ?? {}); + return SimpleWithMap_EntitiesByIdEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_EntitiesByIdEntry { @@ -1612,9 +1602,8 @@ export const SimpleWithMap_NameLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_NameLookupEntry { - return SimpleWithMap_NameLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_NameLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_NameLookupEntry { @@ -1686,9 +1675,8 @@ export const SimpleWithMap_IntLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_IntLookupEntry { - return SimpleWithMap_IntLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_IntLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMap_IntLookupEntry { const message = Object.create(createBaseSimpleWithMap_IntLookupEntry()) as SimpleWithMap_IntLookupEntry; message.key = object.key ?? 0; @@ -1763,9 +1751,8 @@ export const SimpleWithMap_MapOfTimestampsEntry = { create, I>>( base?: I, ): SimpleWithMap_MapOfTimestampsEntry { - return SimpleWithMap_MapOfTimestampsEntry.fromPartial(base ?? {}); + return SimpleWithMap_MapOfTimestampsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_MapOfTimestampsEntry { @@ -1840,9 +1827,8 @@ export const SimpleWithMap_MapOfBytesEntry = { }, create, I>>(base?: I): SimpleWithMap_MapOfBytesEntry { - return SimpleWithMap_MapOfBytesEntry.fromPartial(base ?? {}); + return SimpleWithMap_MapOfBytesEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_MapOfBytesEntry { @@ -1921,9 +1907,8 @@ export const SimpleWithMap_MapOfStringValuesEntry = { create, I>>( base?: I, ): SimpleWithMap_MapOfStringValuesEntry { - return SimpleWithMap_MapOfStringValuesEntry.fromPartial(base ?? {}); + return SimpleWithMap_MapOfStringValuesEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_MapOfStringValuesEntry { @@ -1997,9 +1982,8 @@ export const SimpleWithMap_LongLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_LongLookupEntry { - return SimpleWithMap_LongLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_LongLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_LongLookupEntry { @@ -2074,9 +2058,8 @@ export const SimpleWithSnakeCaseMap = { }, create, I>>(base?: I): SimpleWithSnakeCaseMap { - return SimpleWithSnakeCaseMap.fromPartial(base ?? {}); + return SimpleWithSnakeCaseMap.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithSnakeCaseMap { const message = Object.create(createBaseSimpleWithSnakeCaseMap()) as SimpleWithSnakeCaseMap; message.entitiesById = Object.entries(object.entitiesById ?? {}).reduce<{ [key: number]: Entity }>( @@ -2160,9 +2143,8 @@ export const SimpleWithSnakeCaseMap_EntitiesByIdEntry = { create, I>>( base?: I, ): SimpleWithSnakeCaseMap_EntitiesByIdEntry { - return SimpleWithSnakeCaseMap_EntitiesByIdEntry.fromPartial(base ?? {}); + return SimpleWithSnakeCaseMap_EntitiesByIdEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithSnakeCaseMap_EntitiesByIdEntry { @@ -2241,9 +2223,8 @@ export const SimpleWithMapOfEnums = { }, create, I>>(base?: I): SimpleWithMapOfEnums { - return SimpleWithMapOfEnums.fromPartial(base ?? {}); + return SimpleWithMapOfEnums.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMapOfEnums { const message = Object.create(createBaseSimpleWithMapOfEnums()) as SimpleWithMapOfEnums; message.enumsById = Object.entries(object.enumsById ?? {}).reduce<{ [key: number]: StateEnum }>( @@ -2327,9 +2308,8 @@ export const SimpleWithMapOfEnums_EnumsByIdEntry = { create, I>>( base?: I, ): SimpleWithMapOfEnums_EnumsByIdEntry { - return SimpleWithMapOfEnums_EnumsByIdEntry.fromPartial(base ?? {}); + return SimpleWithMapOfEnums_EnumsByIdEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMapOfEnums_EnumsByIdEntry { @@ -2390,9 +2370,8 @@ export const PingRequest = { }, create, I>>(base?: I): PingRequest { - return PingRequest.fromPartial(base ?? {}); + return PingRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PingRequest { const message = Object.create(createBasePingRequest()) as PingRequest; message.input = object.input ?? ""; @@ -2448,9 +2427,8 @@ export const PingResponse = { }, create, I>>(base?: I): PingResponse { - return PingResponse.fromPartial(base ?? {}); + return PingResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PingResponse { const message = Object.create(createBasePingResponse()) as PingResponse; message.output = object.output ?? ""; @@ -2675,9 +2653,8 @@ export const Numbers = { }, create, I>>(base?: I): Numbers { - return Numbers.fromPartial(base ?? {}); + return Numbers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Numbers { const message = Object.create(createBaseNumbers()) as Numbers; message.double = object.double ?? 0; @@ -2838,9 +2815,8 @@ export const SimpleButOptional = { }, create, I>>(base?: I): SimpleButOptional { - return SimpleButOptional.fromPartial(base ?? {}); + return SimpleButOptional.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleButOptional { const message = Object.create(createBaseSimpleButOptional()) as SimpleButOptional; message.name = object.name ?? undefined; @@ -2893,9 +2869,8 @@ export const Empty = { }, create, I>>(base?: I): Empty { - return Empty.fromPartial(base ?? {}); + return Empty.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Empty { const message = Object.create(createBaseEmpty()) as Empty; return message; diff --git a/integration/simple-snake/google/protobuf/struct.ts b/integration/simple-snake/google/protobuf/struct.ts index cf5700cc5..aac735d0d 100644 --- a/integration/simple-snake/google/protobuf/struct.ts +++ b/integration/simple-snake/google/protobuf/struct.ts @@ -166,9 +166,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -265,9 +264,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -403,9 +401,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); message.null_value = object.null_value ?? undefined; @@ -503,9 +500,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/simple-snake/google/protobuf/timestamp.ts b/integration/simple-snake/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/simple-snake/google/protobuf/timestamp.ts +++ b/integration/simple-snake/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/simple-snake/google/protobuf/wrappers.ts b/integration/simple-snake/google/protobuf/wrappers.ts index 6637762f8..47d1af1f6 100644 --- a/integration/simple-snake/google/protobuf/wrappers.ts +++ b/integration/simple-snake/google/protobuf/wrappers.ts @@ -142,9 +142,8 @@ export const DoubleValue = { }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -200,9 +199,8 @@ export const FloatValue = { }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -258,9 +256,8 @@ export const Int64Value = { }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = createBaseInt64Value(); message.value = object.value ?? 0; @@ -316,9 +313,8 @@ export const UInt64Value = { }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = createBaseUInt64Value(); message.value = object.value ?? 0; @@ -374,9 +370,8 @@ export const Int32Value = { }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -432,9 +427,8 @@ export const UInt32Value = { }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -490,9 +484,8 @@ export const BoolValue = { }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -548,9 +541,8 @@ export const StringValue = { }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -606,9 +598,8 @@ export const BytesValue = { }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? new Uint8Array(0); diff --git a/integration/simple-snake/import_dir/thing.ts b/integration/simple-snake/import_dir/thing.ts index ea62d88a7..bc7abd064 100644 --- a/integration/simple-snake/import_dir/thing.ts +++ b/integration/simple-snake/import_dir/thing.ts @@ -56,9 +56,8 @@ export const ImportedThing = { }, create, I>>(base?: I): ImportedThing { - return ImportedThing.fromPartial(base ?? {}); + return ImportedThing.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ImportedThing { const message = createBaseImportedThing(); message.created_at = object.created_at ?? undefined; diff --git a/integration/simple-snake/simple.ts b/integration/simple-snake/simple.ts index 6c2d143ee..d0b2088b0 100644 --- a/integration/simple-snake/simple.ts +++ b/integration/simple-snake/simple.ts @@ -456,9 +456,8 @@ export const Simple = { }, create, I>>(base?: I): Simple { - return Simple.fromPartial(base ?? {}); + return Simple.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple { const message = createBaseSimple(); message.name = object.name ?? ""; @@ -541,9 +540,8 @@ export const Child = { }, create, I>>(base?: I): Child { - return Child.fromPartial(base ?? {}); + return Child.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Child { const message = createBaseChild(); message.name = object.name ?? ""; @@ -630,9 +628,8 @@ export const Nested = { }, create, I>>(base?: I): Nested { - return Nested.fromPartial(base ?? {}); + return Nested.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Nested { const message = createBaseNested(); message.name = object.name ?? ""; @@ -708,9 +705,8 @@ export const Nested_InnerMessage = { }, create, I>>(base?: I): Nested_InnerMessage { - return Nested_InnerMessage.fromPartial(base ?? {}); + return Nested_InnerMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Nested_InnerMessage { const message = createBaseNested_InnerMessage(); message.name = object.name ?? ""; @@ -769,9 +765,8 @@ export const Nested_InnerMessage_DeepMessage = { }, create, I>>(base?: I): Nested_InnerMessage_DeepMessage { - return Nested_InnerMessage_DeepMessage.fromPartial(base ?? {}); + return Nested_InnerMessage_DeepMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): Nested_InnerMessage_DeepMessage { @@ -845,9 +840,8 @@ export const OneOfMessage = { }, create, I>>(base?: I): OneOfMessage { - return OneOfMessage.fromPartial(base ?? {}); + return OneOfMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneOfMessage { const message = createBaseOneOfMessage(); message.first = object.first ?? undefined; @@ -962,9 +956,8 @@ export const SimpleWithWrappers = { }, create, I>>(base?: I): SimpleWithWrappers { - return SimpleWithWrappers.fromPartial(base ?? {}); + return SimpleWithWrappers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithWrappers { const message = createBaseSimpleWithWrappers(); message.name = object.name ?? undefined; @@ -1024,9 +1017,8 @@ export const Entity = { }, create, I>>(base?: I): Entity { - return Entity.fromPartial(base ?? {}); + return Entity.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Entity { const message = createBaseEntity(); message.id = object.id ?? 0; @@ -1154,9 +1146,8 @@ export const SimpleWithMap = { }, create, I>>(base?: I): SimpleWithMap { - return SimpleWithMap.fromPartial(base ?? {}); + return SimpleWithMap.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMap { const message = createBaseSimpleWithMap(); message.entitiesById = Object.entries(object.entitiesById ?? {}).reduce<{ [key: number]: Entity }>( @@ -1254,9 +1245,8 @@ export const SimpleWithMap_EntitiesByIdEntry = { }, create, I>>(base?: I): SimpleWithMap_EntitiesByIdEntry { - return SimpleWithMap_EntitiesByIdEntry.fromPartial(base ?? {}); + return SimpleWithMap_EntitiesByIdEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_EntitiesByIdEntry { @@ -1330,9 +1320,8 @@ export const SimpleWithMap_NameLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_NameLookupEntry { - return SimpleWithMap_NameLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_NameLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_NameLookupEntry { @@ -1404,9 +1393,8 @@ export const SimpleWithMap_IntLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_IntLookupEntry { - return SimpleWithMap_IntLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_IntLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMap_IntLookupEntry { const message = createBaseSimpleWithMap_IntLookupEntry(); message.key = object.key ?? 0; @@ -1479,9 +1467,8 @@ export const SimpleWithSnakeCaseMap = { }, create, I>>(base?: I): SimpleWithSnakeCaseMap { - return SimpleWithSnakeCaseMap.fromPartial(base ?? {}); + return SimpleWithSnakeCaseMap.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithSnakeCaseMap { const message = createBaseSimpleWithSnakeCaseMap(); message.entities_by_id = Object.entries(object.entities_by_id ?? {}).reduce<{ [key: number]: Entity }>( @@ -1563,9 +1550,8 @@ export const SimpleWithSnakeCaseMap_EntitiesByIdEntry = { create, I>>( base?: I, ): SimpleWithSnakeCaseMap_EntitiesByIdEntry { - return SimpleWithSnakeCaseMap_EntitiesByIdEntry.fromPartial(base ?? {}); + return SimpleWithSnakeCaseMap_EntitiesByIdEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithSnakeCaseMap_EntitiesByIdEntry { @@ -1626,9 +1612,8 @@ export const PingRequest = { }, create, I>>(base?: I): PingRequest { - return PingRequest.fromPartial(base ?? {}); + return PingRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PingRequest { const message = createBasePingRequest(); message.input = object.input ?? ""; @@ -1684,9 +1669,8 @@ export const PingResponse = { }, create, I>>(base?: I): PingResponse { - return PingResponse.fromPartial(base ?? {}); + return PingResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PingResponse { const message = createBasePingResponse(); message.output = object.output ?? ""; @@ -1911,9 +1895,8 @@ export const Numbers = { }, create, I>>(base?: I): Numbers { - return Numbers.fromPartial(base ?? {}); + return Numbers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Numbers { const message = createBaseNumbers(); message.double = object.double ?? 0; @@ -1980,9 +1963,8 @@ export const SimpleStruct = { }, create, I>>(base?: I): SimpleStruct { - return SimpleStruct.fromPartial(base ?? {}); + return SimpleStruct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleStruct { const message = createBaseSimpleStruct(); message.simple_struct = object.simple_struct ?? undefined; diff --git a/integration/simple-string-enums/google/protobuf/struct.ts b/integration/simple-string-enums/google/protobuf/struct.ts index c0bd44e2d..ff6efe0ff 100644 --- a/integration/simple-string-enums/google/protobuf/struct.ts +++ b/integration/simple-string-enums/google/protobuf/struct.ts @@ -176,9 +176,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -275,9 +274,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -413,9 +411,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; @@ -513,9 +510,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/simple-string-enums/simple.ts b/integration/simple-string-enums/simple.ts index 05a4259c8..3221a6281 100644 --- a/integration/simple-string-enums/simple.ts +++ b/integration/simple-string-enums/simple.ts @@ -202,9 +202,8 @@ export const Simple = { }, create, I>>(base?: I): Simple { - return Simple.fromPartial(base ?? {}); + return Simple.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple { const message = createBaseSimple(); message.name = object.name ?? ""; @@ -288,9 +287,8 @@ export const Simple_StateMapEntry = { }, create, I>>(base?: I): Simple_StateMapEntry { - return Simple_StateMapEntry.fromPartial(base ?? {}); + return Simple_StateMapEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple_StateMapEntry { const message = createBaseSimple_StateMapEntry(); message.key = object.key ?? ""; diff --git a/integration/simple-unrecognized-enum/google/protobuf/timestamp.ts b/integration/simple-unrecognized-enum/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/simple-unrecognized-enum/google/protobuf/timestamp.ts +++ b/integration/simple-unrecognized-enum/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/simple-unrecognized-enum/google/protobuf/wrappers.ts b/integration/simple-unrecognized-enum/google/protobuf/wrappers.ts index 6637762f8..47d1af1f6 100644 --- a/integration/simple-unrecognized-enum/google/protobuf/wrappers.ts +++ b/integration/simple-unrecognized-enum/google/protobuf/wrappers.ts @@ -142,9 +142,8 @@ export const DoubleValue = { }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -200,9 +199,8 @@ export const FloatValue = { }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -258,9 +256,8 @@ export const Int64Value = { }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = createBaseInt64Value(); message.value = object.value ?? 0; @@ -316,9 +313,8 @@ export const UInt64Value = { }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = createBaseUInt64Value(); message.value = object.value ?? 0; @@ -374,9 +370,8 @@ export const Int32Value = { }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -432,9 +427,8 @@ export const UInt32Value = { }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -490,9 +484,8 @@ export const BoolValue = { }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -548,9 +541,8 @@ export const StringValue = { }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -606,9 +598,8 @@ export const BytesValue = { }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? new Uint8Array(0); diff --git a/integration/simple-unrecognized-enum/import_dir/thing.ts b/integration/simple-unrecognized-enum/import_dir/thing.ts index 4fe4bb1a2..e57f3e817 100644 --- a/integration/simple-unrecognized-enum/import_dir/thing.ts +++ b/integration/simple-unrecognized-enum/import_dir/thing.ts @@ -56,9 +56,8 @@ export const ImportedThing = { }, create, I>>(base?: I): ImportedThing { - return ImportedThing.fromPartial(base ?? {}); + return ImportedThing.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ImportedThing { const message = createBaseImportedThing(); message.createdAt = object.createdAt ?? undefined; diff --git a/integration/simple-unrecognized-enum/simple.ts b/integration/simple-unrecognized-enum/simple.ts index e4b7063ff..0019a47af 100644 --- a/integration/simple-unrecognized-enum/simple.ts +++ b/integration/simple-unrecognized-enum/simple.ts @@ -439,9 +439,8 @@ export const Simple = { }, create, I>>(base?: I): Simple { - return Simple.fromPartial(base ?? {}); + return Simple.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple { const message = createBaseSimple(); message.name = object.name ?? ""; @@ -524,9 +523,8 @@ export const Child = { }, create, I>>(base?: I): Child { - return Child.fromPartial(base ?? {}); + return Child.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Child { const message = createBaseChild(); message.name = object.name ?? ""; @@ -613,9 +611,8 @@ export const Nested = { }, create, I>>(base?: I): Nested { - return Nested.fromPartial(base ?? {}); + return Nested.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Nested { const message = createBaseNested(); message.name = object.name ?? ""; @@ -691,9 +688,8 @@ export const Nested_InnerMessage = { }, create, I>>(base?: I): Nested_InnerMessage { - return Nested_InnerMessage.fromPartial(base ?? {}); + return Nested_InnerMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Nested_InnerMessage { const message = createBaseNested_InnerMessage(); message.name = object.name ?? ""; @@ -752,9 +748,8 @@ export const Nested_InnerMessage_DeepMessage = { }, create, I>>(base?: I): Nested_InnerMessage_DeepMessage { - return Nested_InnerMessage_DeepMessage.fromPartial(base ?? {}); + return Nested_InnerMessage_DeepMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): Nested_InnerMessage_DeepMessage { @@ -828,9 +823,8 @@ export const OneOfMessage = { }, create, I>>(base?: I): OneOfMessage { - return OneOfMessage.fromPartial(base ?? {}); + return OneOfMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneOfMessage { const message = createBaseOneOfMessage(); message.first = object.first ?? undefined; @@ -945,9 +939,8 @@ export const SimpleWithWrappers = { }, create, I>>(base?: I): SimpleWithWrappers { - return SimpleWithWrappers.fromPartial(base ?? {}); + return SimpleWithWrappers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithWrappers { const message = createBaseSimpleWithWrappers(); message.name = object.name ?? undefined; @@ -1007,9 +1000,8 @@ export const Entity = { }, create, I>>(base?: I): Entity { - return Entity.fromPartial(base ?? {}); + return Entity.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Entity { const message = createBaseEntity(); message.id = object.id ?? 0; @@ -1137,9 +1129,8 @@ export const SimpleWithMap = { }, create, I>>(base?: I): SimpleWithMap { - return SimpleWithMap.fromPartial(base ?? {}); + return SimpleWithMap.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMap { const message = createBaseSimpleWithMap(); message.entitiesById = Object.entries(object.entitiesById ?? {}).reduce<{ [key: number]: Entity }>( @@ -1237,9 +1228,8 @@ export const SimpleWithMap_EntitiesByIdEntry = { }, create, I>>(base?: I): SimpleWithMap_EntitiesByIdEntry { - return SimpleWithMap_EntitiesByIdEntry.fromPartial(base ?? {}); + return SimpleWithMap_EntitiesByIdEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_EntitiesByIdEntry { @@ -1313,9 +1303,8 @@ export const SimpleWithMap_NameLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_NameLookupEntry { - return SimpleWithMap_NameLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_NameLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_NameLookupEntry { @@ -1387,9 +1376,8 @@ export const SimpleWithMap_IntLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_IntLookupEntry { - return SimpleWithMap_IntLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_IntLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMap_IntLookupEntry { const message = createBaseSimpleWithMap_IntLookupEntry(); message.key = object.key ?? 0; @@ -1462,9 +1450,8 @@ export const SimpleWithSnakeCaseMap = { }, create, I>>(base?: I): SimpleWithSnakeCaseMap { - return SimpleWithSnakeCaseMap.fromPartial(base ?? {}); + return SimpleWithSnakeCaseMap.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithSnakeCaseMap { const message = createBaseSimpleWithSnakeCaseMap(); message.entitiesById = Object.entries(object.entitiesById ?? {}).reduce<{ [key: number]: Entity }>( @@ -1546,9 +1533,8 @@ export const SimpleWithSnakeCaseMap_EntitiesByIdEntry = { create, I>>( base?: I, ): SimpleWithSnakeCaseMap_EntitiesByIdEntry { - return SimpleWithSnakeCaseMap_EntitiesByIdEntry.fromPartial(base ?? {}); + return SimpleWithSnakeCaseMap_EntitiesByIdEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithSnakeCaseMap_EntitiesByIdEntry { @@ -1609,9 +1595,8 @@ export const PingRequest = { }, create, I>>(base?: I): PingRequest { - return PingRequest.fromPartial(base ?? {}); + return PingRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PingRequest { const message = createBasePingRequest(); message.input = object.input ?? ""; @@ -1667,9 +1652,8 @@ export const PingResponse = { }, create, I>>(base?: I): PingResponse { - return PingResponse.fromPartial(base ?? {}); + return PingResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PingResponse { const message = createBasePingResponse(); message.output = object.output ?? ""; @@ -1894,9 +1878,8 @@ export const Numbers = { }, create, I>>(base?: I): Numbers { - return Numbers.fromPartial(base ?? {}); + return Numbers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Numbers { const message = createBaseNumbers(); message.double = object.double ?? 0; diff --git a/integration/simple/google/protobuf/timestamp.ts b/integration/simple/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/simple/google/protobuf/timestamp.ts +++ b/integration/simple/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/simple/google/protobuf/wrappers.ts b/integration/simple/google/protobuf/wrappers.ts index 6637762f8..47d1af1f6 100644 --- a/integration/simple/google/protobuf/wrappers.ts +++ b/integration/simple/google/protobuf/wrappers.ts @@ -142,9 +142,8 @@ export const DoubleValue = { }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -200,9 +199,8 @@ export const FloatValue = { }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -258,9 +256,8 @@ export const Int64Value = { }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = createBaseInt64Value(); message.value = object.value ?? 0; @@ -316,9 +313,8 @@ export const UInt64Value = { }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = createBaseUInt64Value(); message.value = object.value ?? 0; @@ -374,9 +370,8 @@ export const Int32Value = { }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -432,9 +427,8 @@ export const UInt32Value = { }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -490,9 +484,8 @@ export const BoolValue = { }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -548,9 +541,8 @@ export const StringValue = { }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -606,9 +598,8 @@ export const BytesValue = { }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? new Uint8Array(0); diff --git a/integration/simple/google/type/date.ts b/integration/simple/google/type/date.ts index 055208cca..fa3432109 100644 --- a/integration/simple/google/type/date.ts +++ b/integration/simple/google/type/date.ts @@ -112,9 +112,8 @@ export const DateMessage = { }, create, I>>(base?: I): DateMessage { - return DateMessage.fromPartial(base ?? {}); + return DateMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DateMessage { const message = createBaseDateMessage(); message.year = object.year ?? 0; diff --git a/integration/simple/import_dir/thing.ts b/integration/simple/import_dir/thing.ts index 4fe4bb1a2..e57f3e817 100644 --- a/integration/simple/import_dir/thing.ts +++ b/integration/simple/import_dir/thing.ts @@ -56,9 +56,8 @@ export const ImportedThing = { }, create, I>>(base?: I): ImportedThing { - return ImportedThing.fromPartial(base ?? {}); + return ImportedThing.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ImportedThing { const message = createBaseImportedThing(); message.createdAt = object.createdAt ?? undefined; diff --git a/integration/simple/simple.ts b/integration/simple/simple.ts index 4e07b22b8..c8a55c59f 100644 --- a/integration/simple/simple.ts +++ b/integration/simple/simple.ts @@ -574,9 +574,8 @@ export const Simple = { }, create, I>>(base?: I): Simple { - return Simple.fromPartial(base ?? {}); + return Simple.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple { const message = createBaseSimple(); message.name = object.name ?? ""; @@ -665,9 +664,8 @@ export const Child = { }, create, I>>(base?: I): Child { - return Child.fromPartial(base ?? {}); + return Child.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Child { const message = createBaseChild(); message.name = object.name ?? ""; @@ -754,9 +752,8 @@ export const Nested = { }, create, I>>(base?: I): Nested { - return Nested.fromPartial(base ?? {}); + return Nested.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Nested { const message = createBaseNested(); message.name = object.name ?? ""; @@ -832,9 +829,8 @@ export const Nested_InnerMessage = { }, create, I>>(base?: I): Nested_InnerMessage { - return Nested_InnerMessage.fromPartial(base ?? {}); + return Nested_InnerMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Nested_InnerMessage { const message = createBaseNested_InnerMessage(); message.name = object.name ?? ""; @@ -893,9 +889,8 @@ export const Nested_InnerMessage_DeepMessage = { }, create, I>>(base?: I): Nested_InnerMessage_DeepMessage { - return Nested_InnerMessage_DeepMessage.fromPartial(base ?? {}); + return Nested_InnerMessage_DeepMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): Nested_InnerMessage_DeepMessage { @@ -969,9 +964,8 @@ export const OneOfMessage = { }, create, I>>(base?: I): OneOfMessage { - return OneOfMessage.fromPartial(base ?? {}); + return OneOfMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OneOfMessage { const message = createBaseOneOfMessage(); message.first = object.first ?? undefined; @@ -1100,9 +1094,8 @@ export const SimpleWithWrappers = { }, create, I>>(base?: I): SimpleWithWrappers { - return SimpleWithWrappers.fromPartial(base ?? {}); + return SimpleWithWrappers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithWrappers { const message = createBaseSimpleWithWrappers(); message.name = object.name ?? undefined; @@ -1163,9 +1156,8 @@ export const Entity = { }, create, I>>(base?: I): Entity { - return Entity.fromPartial(base ?? {}); + return Entity.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Entity { const message = createBaseEntity(); message.id = object.id ?? 0; @@ -1418,9 +1410,8 @@ export const SimpleWithMap = { }, create, I>>(base?: I): SimpleWithMap { - return SimpleWithMap.fromPartial(base ?? {}); + return SimpleWithMap.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMap { const message = createBaseSimpleWithMap(); message.entitiesById = Object.entries(object.entitiesById ?? {}).reduce<{ [key: number]: Entity }>( @@ -1553,9 +1544,8 @@ export const SimpleWithMap_EntitiesByIdEntry = { }, create, I>>(base?: I): SimpleWithMap_EntitiesByIdEntry { - return SimpleWithMap_EntitiesByIdEntry.fromPartial(base ?? {}); + return SimpleWithMap_EntitiesByIdEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_EntitiesByIdEntry { @@ -1629,9 +1619,8 @@ export const SimpleWithMap_NameLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_NameLookupEntry { - return SimpleWithMap_NameLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_NameLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_NameLookupEntry { @@ -1703,9 +1692,8 @@ export const SimpleWithMap_IntLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_IntLookupEntry { - return SimpleWithMap_IntLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_IntLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMap_IntLookupEntry { const message = createBaseSimpleWithMap_IntLookupEntry(); message.key = object.key ?? 0; @@ -1780,9 +1768,8 @@ export const SimpleWithMap_MapOfTimestampsEntry = { create, I>>( base?: I, ): SimpleWithMap_MapOfTimestampsEntry { - return SimpleWithMap_MapOfTimestampsEntry.fromPartial(base ?? {}); + return SimpleWithMap_MapOfTimestampsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_MapOfTimestampsEntry { @@ -1857,9 +1844,8 @@ export const SimpleWithMap_MapOfBytesEntry = { }, create, I>>(base?: I): SimpleWithMap_MapOfBytesEntry { - return SimpleWithMap_MapOfBytesEntry.fromPartial(base ?? {}); + return SimpleWithMap_MapOfBytesEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_MapOfBytesEntry { @@ -1936,9 +1922,8 @@ export const SimpleWithMap_MapOfStringValuesEntry = { create, I>>( base?: I, ): SimpleWithMap_MapOfStringValuesEntry { - return SimpleWithMap_MapOfStringValuesEntry.fromPartial(base ?? {}); + return SimpleWithMap_MapOfStringValuesEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_MapOfStringValuesEntry { @@ -2010,9 +1995,8 @@ export const SimpleWithMap_LongLookupEntry = { }, create, I>>(base?: I): SimpleWithMap_LongLookupEntry { - return SimpleWithMap_LongLookupEntry.fromPartial(base ?? {}); + return SimpleWithMap_LongLookupEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMap_LongLookupEntry { @@ -2087,9 +2071,8 @@ export const SimpleWithSnakeCaseMap = { }, create, I>>(base?: I): SimpleWithSnakeCaseMap { - return SimpleWithSnakeCaseMap.fromPartial(base ?? {}); + return SimpleWithSnakeCaseMap.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithSnakeCaseMap { const message = createBaseSimpleWithSnakeCaseMap(); message.entitiesById = Object.entries(object.entitiesById ?? {}).reduce<{ [key: number]: Entity }>( @@ -2171,9 +2154,8 @@ export const SimpleWithSnakeCaseMap_EntitiesByIdEntry = { create, I>>( base?: I, ): SimpleWithSnakeCaseMap_EntitiesByIdEntry { - return SimpleWithSnakeCaseMap_EntitiesByIdEntry.fromPartial(base ?? {}); + return SimpleWithSnakeCaseMap_EntitiesByIdEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithSnakeCaseMap_EntitiesByIdEntry { @@ -2250,9 +2232,8 @@ export const SimpleWithMapOfEnums = { }, create, I>>(base?: I): SimpleWithMapOfEnums { - return SimpleWithMapOfEnums.fromPartial(base ?? {}); + return SimpleWithMapOfEnums.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleWithMapOfEnums { const message = createBaseSimpleWithMapOfEnums(); message.enumsById = Object.entries(object.enumsById ?? {}).reduce<{ [key: number]: StateEnum }>( @@ -2334,9 +2315,8 @@ export const SimpleWithMapOfEnums_EnumsByIdEntry = { create, I>>( base?: I, ): SimpleWithMapOfEnums_EnumsByIdEntry { - return SimpleWithMapOfEnums_EnumsByIdEntry.fromPartial(base ?? {}); + return SimpleWithMapOfEnums_EnumsByIdEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): SimpleWithMapOfEnums_EnumsByIdEntry { @@ -2395,9 +2375,8 @@ export const PingRequest = { }, create, I>>(base?: I): PingRequest { - return PingRequest.fromPartial(base ?? {}); + return PingRequest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PingRequest { const message = createBasePingRequest(); message.input = object.input ?? ""; @@ -2453,9 +2432,8 @@ export const PingResponse = { }, create, I>>(base?: I): PingResponse { - return PingResponse.fromPartial(base ?? {}); + return PingResponse.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): PingResponse { const message = createBasePingResponse(); message.output = object.output ?? ""; @@ -2680,9 +2658,8 @@ export const Numbers = { }, create, I>>(base?: I): Numbers { - return Numbers.fromPartial(base ?? {}); + return Numbers.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Numbers { const message = createBaseNumbers(); message.double = object.double ?? 0; @@ -2843,9 +2820,8 @@ export const SimpleButOptional = { }, create, I>>(base?: I): SimpleButOptional { - return SimpleButOptional.fromPartial(base ?? {}); + return SimpleButOptional.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SimpleButOptional { const message = createBaseSimpleButOptional(); message.name = object.name ?? undefined; @@ -2898,9 +2874,8 @@ export const Empty = { }, create, I>>(base?: I): Empty { - return Empty.fromPartial(base ?? {}); + return Empty.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Empty { const message = createBaseEmpty(); return message; diff --git a/integration/static-only-type-registry/bar/bar.ts b/integration/static-only-type-registry/bar/bar.ts index 7b1a4ac87..894ddc806 100644 --- a/integration/static-only-type-registry/bar/bar.ts +++ b/integration/static-only-type-registry/bar/bar.ts @@ -59,9 +59,8 @@ export const Bar = { }, create, I>>(base?: I): Bar { - return Bar.fromPartial(base ?? {}); + return Bar.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Bar { const message = createBaseBar(); message.foo = (object.foo !== undefined && object.foo !== null) ? Foo.fromPartial(object.foo) : undefined; diff --git a/integration/static-only-type-registry/foo.ts b/integration/static-only-type-registry/foo.ts index bf714ce78..60f5856c0 100644 --- a/integration/static-only-type-registry/foo.ts +++ b/integration/static-only-type-registry/foo.ts @@ -68,9 +68,8 @@ export const Foo = { }, create, I>>(base?: I): Foo { - return Foo.fromPartial(base ?? {}); + return Foo.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Foo { const message = createBaseFoo(); message.timestamp = object.timestamp ?? undefined; @@ -130,9 +129,8 @@ export const Foo2 = { }, create, I>>(base?: I): Foo2 { - return Foo2.fromPartial(base ?? {}); + return Foo2.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Foo2 { const message = createBaseFoo2(); message.timestamp = object.timestamp ?? undefined; @@ -192,9 +190,8 @@ export const WithStruct = { }, create, I>>(base?: I): WithStruct { - return WithStruct.fromPartial(base ?? {}); + return WithStruct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): WithStruct { const message = createBaseWithStruct(); message.struct = object.struct ?? undefined; diff --git a/integration/static-only-type-registry/google/protobuf/struct.ts b/integration/static-only-type-registry/google/protobuf/struct.ts index 239a36208..ae9f4bbc9 100644 --- a/integration/static-only-type-registry/google/protobuf/struct.ts +++ b/integration/static-only-type-registry/google/protobuf/struct.ts @@ -169,9 +169,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -272,9 +271,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -414,9 +412,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; @@ -518,9 +515,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/static-only-type-registry/google/protobuf/timestamp.ts b/integration/static-only-type-registry/google/protobuf/timestamp.ts index 6412e7c48..b6699d2e6 100644 --- a/integration/static-only-type-registry/google/protobuf/timestamp.ts +++ b/integration/static-only-type-registry/google/protobuf/timestamp.ts @@ -178,9 +178,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/static-only/bar/bar.ts b/integration/static-only/bar/bar.ts index 43cb9de82..3d6b35cec 100644 --- a/integration/static-only/bar/bar.ts +++ b/integration/static-only/bar/bar.ts @@ -58,9 +58,8 @@ export const Bar = { }, create, I>>(base?: I): Bar { - return Bar.fromPartial(base ?? {}); + return Bar.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Bar { const message = createBaseBar(); message.foo = (object.foo !== undefined && object.foo !== null) ? Foo.fromPartial(object.foo) : undefined; diff --git a/integration/static-only/foo.ts b/integration/static-only/foo.ts index 8055715b9..79faf9709 100644 --- a/integration/static-only/foo.ts +++ b/integration/static-only/foo.ts @@ -67,9 +67,8 @@ export const Foo = { }, create, I>>(base?: I): Foo { - return Foo.fromPartial(base ?? {}); + return Foo.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Foo { const message = createBaseFoo(); message.timestamp = object.timestamp ?? undefined; @@ -127,9 +126,8 @@ export const Foo2 = { }, create, I>>(base?: I): Foo2 { - return Foo2.fromPartial(base ?? {}); + return Foo2.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Foo2 { const message = createBaseFoo2(); message.timestamp = object.timestamp ?? undefined; @@ -187,9 +185,8 @@ export const WithStruct = { }, create, I>>(base?: I): WithStruct { - return WithStruct.fromPartial(base ?? {}); + return WithStruct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): WithStruct { const message = createBaseWithStruct(); message.struct = object.struct ?? undefined; diff --git a/integration/static-only/google/protobuf/struct.ts b/integration/static-only/google/protobuf/struct.ts index 64cca73ce..8fd19c518 100644 --- a/integration/static-only/google/protobuf/struct.ts +++ b/integration/static-only/google/protobuf/struct.ts @@ -168,9 +168,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -269,9 +268,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -409,9 +407,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; @@ -511,9 +508,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/static-only/google/protobuf/timestamp.ts b/integration/static-only/google/protobuf/timestamp.ts index 0fb7abe8f..6ccab68ee 100644 --- a/integration/static-only/google/protobuf/timestamp.ts +++ b/integration/static-only/google/protobuf/timestamp.ts @@ -177,9 +177,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/struct/google/protobuf/struct.ts b/integration/struct/google/protobuf/struct.ts index b2486a866..4d9869bbe 100644 --- a/integration/struct/google/protobuf/struct.ts +++ b/integration/struct/google/protobuf/struct.ts @@ -166,9 +166,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -265,9 +264,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -403,9 +401,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; @@ -503,9 +500,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/struct/struct.ts b/integration/struct/struct.ts index 83bf70017..ee5561019 100644 --- a/integration/struct/struct.ts +++ b/integration/struct/struct.ts @@ -56,9 +56,8 @@ export const StructMessage = { }, create, I>>(base?: I): StructMessage { - return StructMessage.fromPartial(base ?? {}); + return StructMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StructMessage { const message = createBaseStructMessage(); message.value = object.value ?? undefined; diff --git a/integration/type-annotations/bar/bar.ts b/integration/type-annotations/bar/bar.ts index aef3a1bfb..02d25f42d 100644 --- a/integration/type-annotations/bar/bar.ts +++ b/integration/type-annotations/bar/bar.ts @@ -59,9 +59,8 @@ export const Bar = { }, create, I>>(base?: I): Bar { - return Bar.fromPartial(base ?? {}); + return Bar.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Bar { const message = createBaseBar(); message.foo = (object.foo !== undefined && object.foo !== null) ? Foo.fromPartial(object.foo) : undefined; diff --git a/integration/type-annotations/foo.ts b/integration/type-annotations/foo.ts index 2ae6b7752..a70df82dd 100644 --- a/integration/type-annotations/foo.ts +++ b/integration/type-annotations/foo.ts @@ -70,9 +70,8 @@ export const Foo = { }, create, I>>(base?: I): Foo { - return Foo.fromPartial(base ?? {}); + return Foo.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Foo { const message = createBaseFoo(); message.timestamp = object.timestamp ?? undefined; @@ -130,9 +129,8 @@ export const Foo2 = { }, create, I>>(base?: I): Foo2 { - return Foo2.fromPartial(base ?? {}); + return Foo2.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Foo2 { const message = createBaseFoo2(); message.timestamp = object.timestamp ?? undefined; @@ -190,9 +188,8 @@ export const WithStruct = { }, create, I>>(base?: I): WithStruct { - return WithStruct.fromPartial(base ?? {}); + return WithStruct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): WithStruct { const message = createBaseWithStruct(); message.struct = object.struct ?? undefined; diff --git a/integration/type-annotations/google/protobuf/struct.ts b/integration/type-annotations/google/protobuf/struct.ts index 6e0125ecc..44688c3bf 100644 --- a/integration/type-annotations/google/protobuf/struct.ts +++ b/integration/type-annotations/google/protobuf/struct.ts @@ -176,9 +176,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -281,9 +280,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -423,9 +421,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; @@ -525,9 +522,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/type-annotations/google/protobuf/timestamp.ts b/integration/type-annotations/google/protobuf/timestamp.ts index d3a2b6743..2e4805245 100644 --- a/integration/type-annotations/google/protobuf/timestamp.ts +++ b/integration/type-annotations/google/protobuf/timestamp.ts @@ -179,9 +179,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/type-registry/bar/bar.ts b/integration/type-registry/bar/bar.ts index 2b5060a88..cf48b0f00 100644 --- a/integration/type-registry/bar/bar.ts +++ b/integration/type-registry/bar/bar.ts @@ -60,9 +60,8 @@ export const Bar = { }, create, I>>(base?: I): Bar { - return Bar.fromPartial(base ?? {}); + return Bar.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Bar { const message = createBaseBar(); message.foo = (object.foo !== undefined && object.foo !== null) ? Foo.fromPartial(object.foo) : undefined; diff --git a/integration/type-registry/foo.ts b/integration/type-registry/foo.ts index d8e4e26cc..66e28dce9 100644 --- a/integration/type-registry/foo.ts +++ b/integration/type-registry/foo.ts @@ -71,9 +71,8 @@ export const Foo = { }, create, I>>(base?: I): Foo { - return Foo.fromPartial(base ?? {}); + return Foo.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Foo { const message = createBaseFoo(); message.timestamp = object.timestamp ?? undefined; @@ -133,9 +132,8 @@ export const Foo2 = { }, create, I>>(base?: I): Foo2 { - return Foo2.fromPartial(base ?? {}); + return Foo2.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Foo2 { const message = createBaseFoo2(); message.timestamp = object.timestamp ?? undefined; @@ -195,9 +193,8 @@ export const WithStruct = { }, create, I>>(base?: I): WithStruct { - return WithStruct.fromPartial(base ?? {}); + return WithStruct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): WithStruct { const message = createBaseWithStruct(); message.struct = object.struct ?? undefined; diff --git a/integration/type-registry/google/protobuf/struct.ts b/integration/type-registry/google/protobuf/struct.ts index 451bad188..aa4e48cb5 100644 --- a/integration/type-registry/google/protobuf/struct.ts +++ b/integration/type-registry/google/protobuf/struct.ts @@ -177,9 +177,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -284,9 +283,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -428,9 +426,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; @@ -532,9 +529,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/type-registry/google/protobuf/timestamp.ts b/integration/type-registry/google/protobuf/timestamp.ts index cd8375327..02b9e8321 100644 --- a/integration/type-registry/google/protobuf/timestamp.ts +++ b/integration/type-registry/google/protobuf/timestamp.ts @@ -180,9 +180,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/types-with-underscores/file.ts b/integration/types-with-underscores/file.ts index 6b174be1f..8354311e6 100644 --- a/integration/types-with-underscores/file.ts +++ b/integration/types-with-underscores/file.ts @@ -58,9 +58,8 @@ export const Baz = { }, create, I>>(base?: I): Baz { - return Baz.fromPartial(base ?? {}); + return Baz.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Baz { const message = createBaseBaz(); message.foo = (object.foo !== undefined && object.foo !== null) ? FooBar.fromPartial(object.foo) : undefined; @@ -103,9 +102,8 @@ export const FooBar = { }, create, I>>(base?: I): FooBar { - return FooBar.fromPartial(base ?? {}); + return FooBar.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): FooBar { const message = createBaseFooBar(); return message; diff --git a/integration/use-date-false/google/protobuf/timestamp.ts b/integration/use-date-false/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/use-date-false/google/protobuf/timestamp.ts +++ b/integration/use-date-false/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/use-date-false/metadata.ts b/integration/use-date-false/metadata.ts index 097fa6736..5ea696d73 100644 --- a/integration/use-date-false/metadata.ts +++ b/integration/use-date-false/metadata.ts @@ -56,9 +56,8 @@ export const Metadata = { }, create, I>>(base?: I): Metadata { - return Metadata.fromPartial(base ?? {}); + return Metadata.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Metadata { const message = createBaseMetadata(); message.lastEdited = (object.lastEdited !== undefined && object.lastEdited !== null) diff --git a/integration/use-date-string/google/protobuf/timestamp.ts b/integration/use-date-string/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/use-date-string/google/protobuf/timestamp.ts +++ b/integration/use-date-string/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/use-date-string/use-date-string.ts b/integration/use-date-string/use-date-string.ts index e8d32a532..b71bfb533 100644 --- a/integration/use-date-string/use-date-string.ts +++ b/integration/use-date-string/use-date-string.ts @@ -139,9 +139,8 @@ export const Todo = { }, create, I>>(base?: I): Todo { - return Todo.fromPartial(base ?? {}); + return Todo.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Todo { const message = createBaseTodo(); message.id = object.id ?? ""; @@ -225,9 +224,8 @@ export const Todo_MapOfTimestampsEntry = { }, create, I>>(base?: I): Todo_MapOfTimestampsEntry { - return Todo_MapOfTimestampsEntry.fromPartial(base ?? {}); + return Todo_MapOfTimestampsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Todo_MapOfTimestampsEntry { const message = createBaseTodo_MapOfTimestampsEntry(); message.key = object.key ?? ""; diff --git a/integration/use-date-true/google/protobuf/empty.ts b/integration/use-date-true/google/protobuf/empty.ts index 1387d7ce4..5f012de45 100644 --- a/integration/use-date-true/google/protobuf/empty.ts +++ b/integration/use-date-true/google/protobuf/empty.ts @@ -52,9 +52,8 @@ export const Empty = { }, create, I>>(base?: I): Empty { - return Empty.fromPartial(base ?? {}); + return Empty.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Empty { const message = createBaseEmpty(); return message; diff --git a/integration/use-date-true/google/protobuf/timestamp.ts b/integration/use-date-true/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/use-date-true/google/protobuf/timestamp.ts +++ b/integration/use-date-true/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/use-date-true/use-date-true.ts b/integration/use-date-true/use-date-true.ts index 0fae63006..e5dae4c12 100644 --- a/integration/use-date-true/use-date-true.ts +++ b/integration/use-date-true/use-date-true.ts @@ -140,9 +140,8 @@ export const Todo = { }, create, I>>(base?: I): Todo { - return Todo.fromPartial(base ?? {}); + return Todo.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Todo { const message = createBaseTodo(); message.id = object.id ?? ""; @@ -226,9 +225,8 @@ export const Todo_MapOfTimestampsEntry = { }, create, I>>(base?: I): Todo_MapOfTimestampsEntry { - return Todo_MapOfTimestampsEntry.fromPartial(base ?? {}); + return Todo_MapOfTimestampsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Todo_MapOfTimestampsEntry { const message = createBaseTodo_MapOfTimestampsEntry(); message.key = object.key ?? ""; diff --git a/integration/use-exact-types-false/foo.ts b/integration/use-exact-types-false/foo.ts index fe86b5836..80cee2f5a 100644 --- a/integration/use-exact-types-false/foo.ts +++ b/integration/use-exact-types-false/foo.ts @@ -71,7 +71,6 @@ export const Foo = { create(base?: DeepPartial): Foo { return Foo.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): Foo { const message = createBaseFoo(); message.bar = object.bar ?? ""; diff --git a/integration/use-map-type/google/protobuf/struct.ts b/integration/use-map-type/google/protobuf/struct.ts index cb6b8e13d..da5112d66 100644 --- a/integration/use-map-type/google/protobuf/struct.ts +++ b/integration/use-map-type/google/protobuf/struct.ts @@ -163,9 +163,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = (() => { @@ -260,9 +259,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -398,9 +396,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; @@ -498,9 +495,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/use-map-type/google/protobuf/timestamp.ts b/integration/use-map-type/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/use-map-type/google/protobuf/timestamp.ts +++ b/integration/use-map-type/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/use-map-type/use-map-type.ts b/integration/use-map-type/use-map-type.ts index ddb7d7b3a..70a6183ce 100644 --- a/integration/use-map-type/use-map-type.ts +++ b/integration/use-map-type/use-map-type.ts @@ -92,9 +92,8 @@ export const Entity = { }, create, I>>(base?: I): Entity { - return Entity.fromPartial(base ?? {}); + return Entity.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Entity { const message = createBaseEntity(); message.id = object.id ?? 0; @@ -284,9 +283,8 @@ export const Maps = { }, create, I>>(base?: I): Maps { - return Maps.fromPartial(base ?? {}); + return Maps.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Maps { const message = createBaseMaps(); message.strToEntity = (() => { @@ -403,9 +401,8 @@ export const Maps_StrToEntityEntry = { }, create, I>>(base?: I): Maps_StrToEntityEntry { - return Maps_StrToEntityEntry.fromPartial(base ?? {}); + return Maps_StrToEntityEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Maps_StrToEntityEntry { const message = createBaseMaps_StrToEntityEntry(); message.key = object.key ?? ""; @@ -477,9 +474,8 @@ export const Maps_Int32ToInt32Entry = { }, create, I>>(base?: I): Maps_Int32ToInt32Entry { - return Maps_Int32ToInt32Entry.fromPartial(base ?? {}); + return Maps_Int32ToInt32Entry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Maps_Int32ToInt32Entry { const message = createBaseMaps_Int32ToInt32Entry(); message.key = object.key ?? 0; @@ -552,9 +548,8 @@ export const Maps_StringToBytesEntry = { }, create, I>>(base?: I): Maps_StringToBytesEntry { - return Maps_StringToBytesEntry.fromPartial(base ?? {}); + return Maps_StringToBytesEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Maps_StringToBytesEntry { const message = createBaseMaps_StringToBytesEntry(); message.key = object.key ?? ""; @@ -624,9 +619,8 @@ export const Maps_Int64ToInt64Entry = { }, create, I>>(base?: I): Maps_Int64ToInt64Entry { - return Maps_Int64ToInt64Entry.fromPartial(base ?? {}); + return Maps_Int64ToInt64Entry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Maps_Int64ToInt64Entry { const message = createBaseMaps_Int64ToInt64Entry(); message.key = object.key ?? 0; @@ -699,9 +693,8 @@ export const Maps_MapOfTimestampsEntry = { }, create, I>>(base?: I): Maps_MapOfTimestampsEntry { - return Maps_MapOfTimestampsEntry.fromPartial(base ?? {}); + return Maps_MapOfTimestampsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Maps_MapOfTimestampsEntry { const message = createBaseMaps_MapOfTimestampsEntry(); message.key = object.key ?? ""; diff --git a/integration/use-numeric-enum-json/google/protobuf/struct.ts b/integration/use-numeric-enum-json/google/protobuf/struct.ts index 41928548c..4fac6f104 100644 --- a/integration/use-numeric-enum-json/google/protobuf/struct.ts +++ b/integration/use-numeric-enum-json/google/protobuf/struct.ts @@ -166,9 +166,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -265,9 +264,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -403,9 +401,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; @@ -503,9 +500,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/use-numeric-enum-json/simple.ts b/integration/use-numeric-enum-json/simple.ts index bec6c5696..5be507613 100644 --- a/integration/use-numeric-enum-json/simple.ts +++ b/integration/use-numeric-enum-json/simple.ts @@ -188,9 +188,8 @@ export const Simple = { }, create, I>>(base?: I): Simple { - return Simple.fromPartial(base ?? {}); + return Simple.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple { const message = createBaseSimple(); message.name = object.name ?? ""; @@ -274,9 +273,8 @@ export const Simple_StateMapEntry = { }, create, I>>(base?: I): Simple_StateMapEntry { - return Simple_StateMapEntry.fromPartial(base ?? {}); + return Simple_StateMapEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Simple_StateMapEntry { const message = createBaseSimple_StateMapEntry(); message.key = object.key ?? ""; diff --git a/integration/use-objectid-true-external-import/objectid/objectid.ts b/integration/use-objectid-true-external-import/objectid/objectid.ts index e61fbb74b..944ab5791 100644 --- a/integration/use-objectid-true-external-import/objectid/objectid.ts +++ b/integration/use-objectid-true-external-import/objectid/objectid.ts @@ -55,9 +55,8 @@ export const ObjectId = { }, create, I>>(base?: I): ObjectId { - return ObjectId.fromPartial(base ?? {}); + return ObjectId.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ObjectId { const message = createBaseObjectId(); message.value = object.value ?? ""; diff --git a/integration/use-objectid-true-external-import/use-objectid-true.ts b/integration/use-objectid-true-external-import/use-objectid-true.ts index 4d51b266a..796561952 100644 --- a/integration/use-objectid-true-external-import/use-objectid-true.ts +++ b/integration/use-objectid-true-external-import/use-objectid-true.ts @@ -138,9 +138,8 @@ export const Todo = { }, create, I>>(base?: I): Todo { - return Todo.fromPartial(base ?? {}); + return Todo.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Todo { const message = createBaseTodo(); message.id = object.id ?? ""; @@ -226,9 +225,8 @@ export const Todo_MapOfOidsEntry = { }, create, I>>(base?: I): Todo_MapOfOidsEntry { - return Todo_MapOfOidsEntry.fromPartial(base ?? {}); + return Todo_MapOfOidsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Todo_MapOfOidsEntry { const message = createBaseTodo_MapOfOidsEntry(); message.key = object.key ?? ""; diff --git a/integration/use-optionals-all/google/protobuf/timestamp.ts b/integration/use-optionals-all/google/protobuf/timestamp.ts index 6b1f71f5e..81148d009 100644 --- a/integration/use-optionals-all/google/protobuf/timestamp.ts +++ b/integration/use-optionals-all/google/protobuf/timestamp.ts @@ -177,9 +177,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/use-optionals-all/test.ts b/integration/use-optionals-all/test.ts index 25ca5aa67..848e2fabd 100644 --- a/integration/use-optionals-all/test.ts +++ b/integration/use-optionals-all/test.ts @@ -536,9 +536,8 @@ export const OptionalsTest = { }, create, I>>(base?: I): OptionalsTest { - return OptionalsTest.fromPartial(base ?? {}); + return OptionalsTest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OptionalsTest { const message = createBaseOptionalsTest(); message.id = object.id ?? 0; @@ -639,9 +638,8 @@ export const OptionalsTest_TranslationsEntry = { }, create, I>>(base?: I): OptionalsTest_TranslationsEntry { - return OptionalsTest_TranslationsEntry.fromPartial(base ?? {}); + return OptionalsTest_TranslationsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): OptionalsTest_TranslationsEntry { @@ -687,9 +685,8 @@ export const Child = { }, create, I>>(base?: I): Child { - return Child.fromPartial(base ?? {}); + return Child.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Child { const message = createBaseChild(); return message; diff --git a/integration/use-optionals-no-undefined/test.ts b/integration/use-optionals-no-undefined/test.ts index a0ae92741..2cd3a6e07 100644 --- a/integration/use-optionals-no-undefined/test.ts +++ b/integration/use-optionals-no-undefined/test.ts @@ -534,9 +534,8 @@ export const OptionalsTest = { }, create, I>>(base?: I): OptionalsTest { - return OptionalsTest.fromPartial(base ?? {}); + return OptionalsTest.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): OptionalsTest { const message = createBaseOptionalsTest(); message.id = object.id ?? undefined; @@ -635,9 +634,8 @@ export const OptionalsTest_TranslationsEntry = { }, create, I>>(base?: I): OptionalsTest_TranslationsEntry { - return OptionalsTest_TranslationsEntry.fromPartial(base ?? {}); + return OptionalsTest_TranslationsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I, ): OptionalsTest_TranslationsEntry { @@ -683,9 +681,8 @@ export const Child = { }, create, I>>(base?: I): Child { - return Child.fromPartial(base ?? {}); + return Child.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Child { const message = createBaseChild(); return message; diff --git a/integration/use-readonly-types/google/protobuf/field_mask.ts b/integration/use-readonly-types/google/protobuf/field_mask.ts index bb2f0e74f..c2c42efc6 100644 --- a/integration/use-readonly-types/google/protobuf/field_mask.ts +++ b/integration/use-readonly-types/google/protobuf/field_mask.ts @@ -258,9 +258,8 @@ export const FieldMask = { }, create, I>>(base?: I): FieldMask { - return FieldMask.fromPartial(base ?? {}); + return FieldMask.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FieldMask { const message = createBaseFieldMask() as any; message.paths = object.paths?.map((e) => e) || []; diff --git a/integration/use-readonly-types/google/protobuf/struct.ts b/integration/use-readonly-types/google/protobuf/struct.ts index 9cf68f024..fa8a370e1 100644 --- a/integration/use-readonly-types/google/protobuf/struct.ts +++ b/integration/use-readonly-types/google/protobuf/struct.ts @@ -152,9 +152,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct() as any; message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -251,9 +250,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry() as any; message.key = object.key ?? ""; @@ -391,9 +389,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue() as any; if (object.kind?.$case === "nullValue" && object.kind?.nullValue !== undefined && object.kind?.nullValue !== null) { @@ -516,9 +513,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue() as any; message.values = object.values?.map((e) => e) || []; diff --git a/integration/use-readonly-types/use-readonly-types.ts b/integration/use-readonly-types/use-readonly-types.ts index c706088eb..33e6ad30c 100644 --- a/integration/use-readonly-types/use-readonly-types.ts +++ b/integration/use-readonly-types/use-readonly-types.ts @@ -261,9 +261,8 @@ export const Entity = { }, create, I>>(base?: I): Entity { - return Entity.fromPartial(base ?? {}); + return Entity.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Entity { const message = createBaseEntity() as any; message.intVal = object.intVal ?? 0; @@ -344,9 +343,8 @@ export const SubEntity = { }, create, I>>(base?: I): SubEntity { - return SubEntity.fromPartial(base ?? {}); + return SubEntity.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): SubEntity { const message = createBaseSubEntity() as any; message.subVal = object.subVal ?? 0; diff --git a/integration/value/google/protobuf/struct.ts b/integration/value/google/protobuf/struct.ts index b2486a866..4d9869bbe 100644 --- a/integration/value/google/protobuf/struct.ts +++ b/integration/value/google/protobuf/struct.ts @@ -166,9 +166,8 @@ export const Struct = { }, create, I>>(base?: I): Struct { - return Struct.fromPartial(base ?? {}); + return Struct.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct { const message = createBaseStruct(); message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( @@ -265,9 +264,8 @@ export const Struct_FieldsEntry = { }, create, I>>(base?: I): Struct_FieldsEntry { - return Struct_FieldsEntry.fromPartial(base ?? {}); + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Struct_FieldsEntry { const message = createBaseStruct_FieldsEntry(); message.key = object.key ?? ""; @@ -403,9 +401,8 @@ export const Value = { }, create, I>>(base?: I): Value { - return Value.fromPartial(base ?? {}); + return Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Value { const message = createBaseValue(); message.nullValue = object.nullValue ?? undefined; @@ -503,9 +500,8 @@ export const ListValue = { }, create, I>>(base?: I): ListValue { - return ListValue.fromPartial(base ?? {}); + return ListValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ListValue { const message = createBaseListValue(); message.values = object.values?.map((e) => e) || []; diff --git a/integration/value/google/protobuf/wrappers.ts b/integration/value/google/protobuf/wrappers.ts index 6637762f8..47d1af1f6 100644 --- a/integration/value/google/protobuf/wrappers.ts +++ b/integration/value/google/protobuf/wrappers.ts @@ -142,9 +142,8 @@ export const DoubleValue = { }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -200,9 +199,8 @@ export const FloatValue = { }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -258,9 +256,8 @@ export const Int64Value = { }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = createBaseInt64Value(); message.value = object.value ?? 0; @@ -316,9 +313,8 @@ export const UInt64Value = { }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = createBaseUInt64Value(); message.value = object.value ?? 0; @@ -374,9 +370,8 @@ export const Int32Value = { }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -432,9 +427,8 @@ export const UInt32Value = { }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -490,9 +484,8 @@ export const BoolValue = { }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -548,9 +541,8 @@ export const StringValue = { }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -606,9 +598,8 @@ export const BytesValue = { }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? new Uint8Array(0); diff --git a/integration/value/value.ts b/integration/value/value.ts index a8e9092b0..de18a9501 100644 --- a/integration/value/value.ts +++ b/integration/value/value.ts @@ -119,9 +119,8 @@ export const ValueMessage = { }, create, I>>(base?: I): ValueMessage { - return ValueMessage.fromPartial(base ?? {}); + return ValueMessage.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): ValueMessage { const message = createBaseValueMessage(); message.value = object.value ?? undefined; diff --git a/integration/vector-tile/vector_tile.ts b/integration/vector-tile/vector_tile.ts index 7dfda0699..0b8b98571 100644 --- a/integration/vector-tile/vector_tile.ts +++ b/integration/vector-tile/vector_tile.ts @@ -127,9 +127,8 @@ export const Tile = { }, create, I>>(base?: I): Tile { - return Tile.fromPartial(base ?? {}); + return Tile.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Tile { const message = createBaseTile(); message.layers = object.layers?.map((e) => Tile_Layer.fromPartial(e)) || []; @@ -271,9 +270,8 @@ export const Tile_Value = { }, create, I>>(base?: I): Tile_Value { - return Tile_Value.fromPartial(base ?? {}); + return Tile_Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Tile_Value { const message = createBaseTile_Value(); message.stringValue = object.stringValue ?? ""; @@ -403,9 +401,8 @@ export const Tile_Feature = { }, create, I>>(base?: I): Tile_Feature { - return Tile_Feature.fromPartial(base ?? {}); + return Tile_Feature.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Tile_Feature { const message = createBaseTile_Feature(); message.id = object.id ?? 0; @@ -536,9 +533,8 @@ export const Tile_Layer = { }, create, I>>(base?: I): Tile_Layer { - return Tile_Layer.fromPartial(base ?? {}); + return Tile_Layer.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Tile_Layer { const message = createBaseTile_Layer(); message.version = object.version ?? 0; diff --git a/integration/wrappers-regression/google/protobuf/empty.ts b/integration/wrappers-regression/google/protobuf/empty.ts index 1387d7ce4..5f012de45 100644 --- a/integration/wrappers-regression/google/protobuf/empty.ts +++ b/integration/wrappers-regression/google/protobuf/empty.ts @@ -52,9 +52,8 @@ export const Empty = { }, create, I>>(base?: I): Empty { - return Empty.fromPartial(base ?? {}); + return Empty.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(_: I): Empty { const message = createBaseEmpty(); return message; diff --git a/integration/wrappers-regression/google/protobuf/timestamp.ts b/integration/wrappers-regression/google/protobuf/timestamp.ts index 032f4ab29..585a2e7e9 100644 --- a/integration/wrappers-regression/google/protobuf/timestamp.ts +++ b/integration/wrappers-regression/google/protobuf/timestamp.ts @@ -175,9 +175,8 @@ export const Timestamp = { }, create, I>>(base?: I): Timestamp { - return Timestamp.fromPartial(base ?? {}); + return Timestamp.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Timestamp { const message = createBaseTimestamp(); message.seconds = object.seconds ?? 0; diff --git a/integration/wrappers-regression/google/protobuf/wrappers.ts b/integration/wrappers-regression/google/protobuf/wrappers.ts index 6637762f8..47d1af1f6 100644 --- a/integration/wrappers-regression/google/protobuf/wrappers.ts +++ b/integration/wrappers-regression/google/protobuf/wrappers.ts @@ -142,9 +142,8 @@ export const DoubleValue = { }, create, I>>(base?: I): DoubleValue { - return DoubleValue.fromPartial(base ?? {}); + return DoubleValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): DoubleValue { const message = createBaseDoubleValue(); message.value = object.value ?? 0; @@ -200,9 +199,8 @@ export const FloatValue = { }, create, I>>(base?: I): FloatValue { - return FloatValue.fromPartial(base ?? {}); + return FloatValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): FloatValue { const message = createBaseFloatValue(); message.value = object.value ?? 0; @@ -258,9 +256,8 @@ export const Int64Value = { }, create, I>>(base?: I): Int64Value { - return Int64Value.fromPartial(base ?? {}); + return Int64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int64Value { const message = createBaseInt64Value(); message.value = object.value ?? 0; @@ -316,9 +313,8 @@ export const UInt64Value = { }, create, I>>(base?: I): UInt64Value { - return UInt64Value.fromPartial(base ?? {}); + return UInt64Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt64Value { const message = createBaseUInt64Value(); message.value = object.value ?? 0; @@ -374,9 +370,8 @@ export const Int32Value = { }, create, I>>(base?: I): Int32Value { - return Int32Value.fromPartial(base ?? {}); + return Int32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Int32Value { const message = createBaseInt32Value(); message.value = object.value ?? 0; @@ -432,9 +427,8 @@ export const UInt32Value = { }, create, I>>(base?: I): UInt32Value { - return UInt32Value.fromPartial(base ?? {}); + return UInt32Value.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): UInt32Value { const message = createBaseUInt32Value(); message.value = object.value ?? 0; @@ -490,9 +484,8 @@ export const BoolValue = { }, create, I>>(base?: I): BoolValue { - return BoolValue.fromPartial(base ?? {}); + return BoolValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BoolValue { const message = createBaseBoolValue(); message.value = object.value ?? false; @@ -548,9 +541,8 @@ export const StringValue = { }, create, I>>(base?: I): StringValue { - return StringValue.fromPartial(base ?? {}); + return StringValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): StringValue { const message = createBaseStringValue(); message.value = object.value ?? ""; @@ -606,9 +598,8 @@ export const BytesValue = { }, create, I>>(base?: I): BytesValue { - return BytesValue.fromPartial(base ?? {}); + return BytesValue.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): BytesValue { const message = createBaseBytesValue(); message.value = object.value ?? new Uint8Array(0); diff --git a/src/main.ts b/src/main.ts index bbfaedbad..8efce8ac2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2091,19 +2091,17 @@ function generateFromPartial(ctx: Context, fullName: string, messageDesc: Descri if (ctx.options.useExactTypes) { chunks.push(code` create, I>>(base?: I): ${fullName} { + return ${fullName}.fromPartial(base ?? ({} as any)); + }, `); } else { chunks.push(code` create(base?: ${utils.DeepPartial}<${fullName}>): ${fullName} { + return ${fullName}.fromPartial(base ?? {}); + }, `); } - chunks.push(code` - return ${fullName}.fromPartial(base ?? {}) - `); - - chunks.push(code`},`, code``); - // create the fromPartial function declaration const paramName = messageDesc.field.length > 0 ? "object" : "_";