-
Notifications
You must be signed in to change notification settings - Fork 114
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
Type 'V' does not satisfy the constraint '{}' #254
Comments
It doesn't actually happen with typescript |
You're totally right. It only happens with |
@tyilo I changed it in my initial comment so that it doesn't mislead others. |
Yes, |
Indeed. I tried a few things after cloning the repo and they all go down to the problem that, in the FYI: There is a quick and dirty fix but it's at the cost of removing this dependency on the -export interface Maybe<T extends NonNullable<{}>>
- extends Setoid<Maybe<T>>, ITraversable<T>, Catamorphism<undefined, T>, Iterable<T> {
+export interface Maybe<T>
+ extends Setoid<Maybe<T>>, ITraversable<T>, Catamorphism<NonNullable<T>, T>, Iterable<T> {
/* Inherited from Monad: */
- bind<V extends NonNullable<{}>>(fn: (val: T) => Maybe<V>): Maybe<V>;
- flatMap<V extends NonNullable<{}>>(fn: (val: T) => Maybe<V>): Maybe<V>;
- chain<V extends NonNullable<{}>>(fn: (val: T) => Maybe<V>): Maybe<V>;
- map<V extends NonNullable<{}>>(fn: (val: T) => V): Maybe<V>;
+ bind<V>(fn: (val: T) => Maybe<V>): Maybe<V>;
+ flatMap<V>(fn: (val: T) => Maybe<V>): Maybe<V>;
+ chain<V>(fn: (val: T) => Maybe<V>): Maybe<V>;
+ map<V>(fn: (val: T) => V): Maybe<V>;
join<V>(): T extends Maybe<V> ? V : never;
takeLeft(m: Maybe<T>): Maybe<T>;
takeRight(m: Maybe<T>): Maybe<T>;
/* Inherited from Applicative */
- ap<V extends NonNullable<{}>>(maybeFn: Maybe<(val: T) => V>): Maybe<V>;
- apTo<V extends NonNullable<{}>> (value: Maybe<V>): T extends (arg: V) => any ? Maybe<ReturnType<T>> : never;
+ ap<V>(maybeFn: Maybe<(val: T) => V>): Maybe<V>;
+ apTo<V>(value: Maybe<V>): T extends (arg: V) => any ? Maybe<ReturnType<T>> : never; |
This incompatibility is preventing us from upgrading TypeScript. Can a maintainer review the proposed Pull Request #255 to see if this is a viable fix? Alternatively, does anyone have any suggestions for alternatives to the monet package, specifically a replacement for Either? |
For this reason, I had to re-write it and put it in my own utility library: ts-utls $ npm i ts-utls import { Either } from 'ts-utls'
const eitherString = Either('string', true)
console.assert(eitherString.isRight())
console.assert(eitherString.right() === 'string')
const rightString = Right('right')
console.assert(rightString.equals(eitherString)) |
When upgrading TypeScript to version
4.8.x
, I have the following compilation errors:The text was updated successfully, but these errors were encountered: