Skip to content

Non-optional fields causing TypeScript errors #749

@paralin

Description

@paralin

protobuf.js version: 6.7.1

I'm passing the output of pbjs json conversion to loadJson, this works fine, but there's a new typing error in the latest update:

Argument of type '{ "nested": { "google": { "nested": { "api": { "options": { "java_multiple_files": boolean; "java...' is not assignable to parameter of type 'NamespaceDescriptor'.
  Types of property 'nested' are incompatible.
    Type '{ "google": { "nested": { "api": { "options": { "java_multiple_files": boolean; "java_outer_class...' is not assignable to type '{ [k: string]: EnumDescriptor | ExtensionFieldDescriptor | ExtensionMapFieldDescriptor | TypeDesc...'.
      Property '"google"' is incompatible with index signature.
        Type '{ "nested": { "api": { "options": { "java_multiple_files": boolean; "java_outer_classname": strin...' is not assignable to type 'EnumDescriptor | ExtensionFieldDescriptor | ExtensionMapFieldDescriptor | TypeDescriptor | Servic...'.
          Type '{ "nested": { "api": { "options": { "java_multiple_files": boolean; "java_outer_classname": strin...' is not assignable to type 'ServiceDescriptor'.
            Property 'methods' is missing in type '{ "nested": { "api": { "options": { "java_multiple_files": boolean; "java_outer_classname": strin...'

The issue is that the "methods" field is not optional. Could you please set that field to optional in the typings?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions