We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
pipe
I'm new to this library, and I don't actually know if this is a by-design decision.
Current Behavior
When we use pipe with no arguments, an identity function is returned, as we can see here:
rxjs/src/internal/util/pipe.ts
Line 25 in fd66c29
The problem is that the current type does not reflect this behavior, see (in the 5th line of that same file):
Line 5 in fd66c29
I think that, if we change that first overload to:
export function pipe(): typeof identity; // Or: export function pipe(): <T>(x: T) => T;
- export function pipe<T>(): UnaryFunction<T, T>; + export function pipe(): typeof identity;
Or:
- export function pipe<T>(): UnaryFunction<T, T>; + export function pipe(): <T>(x: T) => T;
The type inference would be more accurate, see:
Current type inference
// %inferred-type: UnaryFunction<unknown, unknown> const fn = pipe(); // %inferred-type: unknown const returnValue = fn('Foo');
Expectedtype inference
// %inferred-type: <T>(x: T) => T /* (identity function type) */ const fn = pipe(); // %inferred-type: "Foo" const returnValue = fn('Foo');
Environment
6.6.0
Should I open a pull request to fix this? Or is this behavior intentional?
The text was updated successfully, but these errors were encountered:
fix ReactiveX#5557: add identity overload to pipe
1856088
fix: remove misused type param from static pipe
862762b
Closes ReactiveX#5557
8dc7d17
Successfully merging a pull request may close this issue.
Type inference "bug" report
I'm new to this library, and I don't actually know if this is a by-design decision.
Current Behavior
When we use
pipe
with no arguments, an identity function is returned, as we can see here:rxjs/src/internal/util/pipe.ts
Line 25 in fd66c29
The problem is that the current type does not reflect this behavior, see (in the 5th line of that same file):
rxjs/src/internal/util/pipe.ts
Line 5 in fd66c29
I think that, if we change that first overload to:
Diff
Or:
The type inference would be more accurate, see:
Current type inference
Expectedtype inference
Environment
6.6.0
at the moment)Should I open a pull request to fix this? Or is this behavior intentional?
The text was updated successfully, but these errors were encountered: