Skip to content

Method parameter decorators cause typescript build to fail. #2137

@IhsanMujdeci

Description

@IhsanMujdeci

Describe the bug
Not sure if this is a bug or intended.
The body function and other parameter functions aren't actually functions that typescript can build.
Other decorators seem to be fine and actually build and resolve to a value e.g. class decorators and method decorators.

To Reproduce
Steps to reproduce the behavior:

  1. npx @airtasker/spot init
  2. npx tsx ./api.ts
  3. Console error TypeError: decorator is not a function (it seems to error on the first instance of use of the @body decorator).

This error also appears while using SWC, I haven't tired TSC.

Expected behavior
I would expect that typescript would be able to build the solution but it seems it cant.
The @body and other method parameter decorators don't resolve to a real value, they are "undefined"
Actual building of API docs works fine via npx @airtasker/spot generate --contract api.ts

Screenshots
image

Desktop (please complete the following information):

  • OS: Macbbok M1 Pro 14.1 (23B74)
  • Yarn version v1.22.19
  • v18.18.2
  • Spot version: 1.12.0

Additional context
Please respond with if this is expected behaviour or a bug with how I'm using the library.

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