Learning typescript via fp-ts
leads me to trouble.
I'm getting the following error:
Type 'Record<string, number>' is not assignable to type 'Timestamps'. Index signatures are incompatible. Type 'number' is not assignable to type 'Timestamp'.(2322)
Code below:
import * as R from "fp-ts/dist/esm/Record";
interface Timestamp {
date: number
id: string
}
interface Timestamps {
[key: string]: Timestamp
}
const MyFunction = (dates: Timestamps): Timestamps => {
const predicate = (s: string, v: number) => s === "date" && v > 0 // 0 milliseconds
return R.filterWithIndex(predicate)(dates)
}
What should i change for my code to work?