It's probably caused by the type intersection with { readonly 0: T } in here:
/**
* @category model
* @since 2.5.0
*/
export declare type ReadonlyNonEmptyArray<A> = ReadonlyArray<A> & {
readonly 0: A
}
The example of a problematic code:
import { ReadonlyNonEmptyArray } from 'fp-ts/lib/ReadonlyNonEmptyArray';
type MyType<T extends string> = null;
type MappedType<T extends ReadonlyNonEmptyArray<string>> = {
[K in keyof T]: MyType<T[K]>;
};
the problem is at line 5 with a generic argument T[K]. The error message is:
Type 'T[K]' does not satisfy the constraint 'string'.
Type 'T[keyof T]' is not assignable to type 'string'.
Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'string'.
Type 'T[string]' is not assignable to type 'string'.
I assume that TypeScript finds a possibility of T[string] because of the object-like fragment in the intersection, but that's just a blind guess of me because I'm not quite a TS ninja. To be honest I'm not entirely sure that I'm not doing something wrong and I have no idea if any solution to this problem exists.
It's probably caused by the type intersection with
{ readonly 0: T }
in here:The example of a problematic code:
the problem is at line 5 with a generic argument
T[K]
. The error message is:I assume that TypeScript finds a possibility of
T[string]
because of the object-like fragment in the intersection, but that's just a blind guess of me because I'm not quite a TS ninja. To be honest I'm not entirely sure that I'm not doing something wrong and I have no idea if any solution to this problem exists.