thiagobustamante / typescript-rest-swagger

Swagger tools for typescript-rest
156 stars 57 forks source link

Error generate parameter method: Cannot read properties of undefined (reading 'filter') #142

Open Khuzha opened 3 years ago

Khuzha commented 3 years ago

Hello! I have a trouble with your lib and hope for your help:

I get this error: Error generate parameter method: 'AuthService.signIn' argument: ctx TypeError: Cannot read properties of undefined (reading 'filter')

When add types to controller's arguments.

For example, this is ok:

import { Path, POST } from 'typescript-rest';

@Path('auth')
export default class AuthService {
  @POST
  public signIn(ctx: object) {

  }
}

But when I change ctx: object to ctx: Context:

import { Path, POST } from 'typescript-rest';
import { Context } from '../../utils';

@Path('auth')
export default class AuthService {
  @POST
  public signIn(ctx: Context) {

  }
}

I get that error.

How can I fix it?


And I have question: why multiple arguments are forbidden? How can I user this lib when I need e.g. next function, like this?

import { Path, POST } from 'typescript-rest';
import { Context, Next } from '../../utils';

@Path('auth')
export default class AuthService {
  @POST
  public signIn(ctx: Context, next: Next) {

  }
}