type MaybeNullNickname = {
id: string;
nickname: string | null;
}
pipe(
maybeNullNicknames, // MaybeNullNickname[],
Array.filter(Predicate.struct({
id: Predicate.isNotNullable, // or a noop or isString or whatever. Doesn't really matter for this example, I don't think
// Keep only non nullable nicknames
nickname: Predicate.isNotNullable,
}),
Array.forEach(({ id, nickname }) => {
// I'd like for nickname to be typed as NonNullable, but it's not because Predicate.struct returns just a Predicate, not a Refinement
})
)
type MaybeNullNickname = {
id: string;
nickname: string | null;
}
pipe(
maybeNullNicknames, // MaybeNullNickname[],
Array.filter(Predicate.struct({
id: Predicate.isNotNullable, // or a noop or isString or whatever. Doesn't really matter for this example, I don't think
// Keep only non nullable nicknames
nickname: Predicate.isNotNullable,
}),
Array.forEach(({ id, nickname }) => {
// I'd like for nickname to be typed as NonNullable, but it's not because Predicate.struct returns just a Predicate, not a Refinement
})
)