graphql icon indicating copy to clipboard operation
graphql copied to clipboard

How to use this library without typescript

Open dodo360 opened this issue 8 years ago • 2 comments

I'm submitting a...


[ ] Regression
[ ] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

I tried to use this library without typescript. Build with babel (env and transform-decorators) and all good, but in resolvers i tried to use Args parameter decorator and received build exception. After i used transform-function-parameter-decorators babel plugin, but have another exception (Cannot read property 'constructor' of undefined), maybe, because decorator did't have metadata.

Expected behavior

Make an alternative class method decorators for Args, Parent and other function parameter decorators

Minimal reproduction of the problem with instructions

.babelrc

{
  "presets": ["env"],
  "plugins": [
    "transform-decorators-legacy",
    "transform-function-parameter-decorators"
  ]
}

What is the motivation / use case for changing the behavior?

Maybe some people use nestjs without typescript and nestjs have (https://github.com/nestjs/javascript-starter).

Environment


Nest version:5.4.0
 
For Tooling issues:
- Node version: 10
- Platform:  Mac

dodo360 avatar Nov 21 '18 09:11 dodo360

You should use @Bind() decorator, for example:

@Bind(Args('id'))
create(id) {}

kamilmysliwiec avatar Nov 25 '18 14:11 kamilmysliwiec

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Apr 25 '20 14:04 lock[bot]