-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuedocumentationDocumentation ("docs") that needs adding/updatingDocumentation ("docs") that needs adding/updating
Description
Before You File a Documentation Request Please Confirm You Have Done The Following...
- I have looked for existing open or closed documentation requests that match my proposal.
- I have read the FAQ and my problem is not listed.
Suggested Changes
The current documentation reads as if explicit any is almost always an error that needs fixing, but due to a lack of TypeScript features (e.g. higher-kinded types or Haskell-style custom infix operators) explicit any is often the only correct fix for typing higher-order functions.
e.g.:
// eslint-disable-next-line no-explicit-any
type a2a = (x: any) => any;
type compose = (...fns: a2a[]) => a2a;
const pipe: compose = (...fns) => x => fns.reduce((y, f) => f(y), x);
const compose: compose = (...fns) => x => fns.reduceRight((y, f) => f(y), x);
type n2n = (n: number) => number;
const g: n2n = n => n + 1;
const f: n2n = n => n * 2;
const h: n2n = pipe(g, f);
const j: n2n = compose(f, g);
Affected URL(s)
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuedocumentationDocumentation ("docs") that needs adding/updatingDocumentation ("docs") that needs adding/updating