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

Types for handler function #15

Open
M46O opened this issue Jul 9, 2021 · 1 comment
Open

Types for handler function #15

M46O opened this issue Jul 9, 2021 · 1 comment

Comments

@M46O
Copy link

M46O commented Jul 9, 2021

A nice improvement would be to add type control for the parameter that the pipe returns like this:

export class PipeFunction implements PipeTransform {
  public transform<Type>(value: any, handler: (value: any) => Type, context?: any): Type {
    if (context) {
      return handler.call(context, value);
    }

    return handler(value);
  }
}

https://www.typescriptlang.org/docs/handbook/2/generics.html#working-with-generic-type-variables

@M46O M46O changed the title Types for handler functions Types for handler function Jul 9, 2021
@nrauschcom
Copy link

Since this project seems to be unmaintained and the author didn't reply to my mail for some months, I would suggest you to take a look at ngx-function-expression

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

2 participants