Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Khuzha opened this issue Sep 21, 2021 · 0 comments

Comments

@Khuzha
Copy link

Khuzha commented Sep 21, 2021

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) {
    
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant