Skip to content

struct unwrap fails TypeScript's noImplicitReturns check #432

Closed
@absoludity

Description

Since 1.88.0 was released, the code to unwrap a struct has failed TypeScript's noImplicitReturns check, which is normally a sane check to have on.

In 1.88.0, the function unwrapAnyValue was added, without an explicit return (even though you may know one of the conditionals is guaranteed to be true), resulting in:

src/gen/google/protobuf/struct.ts:415:4 - error TS7030: Not all code paths return a value.

415 ): string | number | boolean | Object | null | Array<any> | undefined {
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is still the case, though in a slightly different form in the latest 1.91, still resulting in the lint error:

src/gen/google/protobuf/struct.ts:397:6 - error TS7030: Not all code paths return a value.

397   ): string | number | boolean | Object | null | Array<any> | undefined {
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions