Currently, I am working on converting Javascript examples to typed Typescript as part of the "Flock of Functions" series. You can find the reference code at https://github.com/glebec/lambda-talk/blob/master/src/index.js#L152. The True function returns the first curried argument and ignores the second one.
Here is a snippet of Typescript code for your consideration:
interface ElsFn<T> {
(els: unknown): T;
}
interface True extends Function {
<T>(thn: T): ElsFn<T>;
}
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
const T: True = (thn) => (_els) => thn;
console.log(T('true')('false'));
If I want to maintain the "explicit-function-return-type" rule, how do I eliminate the need for the ESLint disable comment? In simpler terms, how can I properly type the True function?
My editor indicates an issue with the (_els) => thn
section of the code. It requires some form of typing.
https://i.sstatic.net/8l4jO.png ]
What steps can I take to define the return type or make sure this is correctly typed so that I don't have to deactivate the ESLint rule?