Skip to content

ES6 parameter destructuring and rest syntax bug #36

Closed
@motopods

Description

@motopods

https://github.com/unnoq/orpc/blob/b6b0cc3b76551e582a43bb612cba3bf90b268828/packages/client/src/error.ts#L107

@rsbuild/plugin-check-syntax plugin with ecmaVersion: 6. The plugin reports an error on valid ES6 syntax.

Specifically, the plugin flags the following constructor pattern as an error:

export class ORPCError<TCode extends ORPCErrorCode, TData> extends Error {
  readonly defined: boolean
  readonly code: TCode
  readonly status: number
  readonly data: TData

  constructor(code: TCode, ...[options]: MaybeOptionalOptions<ORPCErrorOptions<TData>>) {
   // ....
  }
}

Image

This syntax combines parameter destructuring with rest parameters, which are both standard ES6 (ES2015) features that should be compatible with the ecmaVersion: 6 setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions