Skip to content

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

@Khuzha

Description

@Khuzha

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) {
    
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions