I'm attempting to create an implementation that meets the requirements of a type, but in a more specific way than that type.
type A = 'number' | 'string'
type B = {
[prop: string]: (
input: { [key: string]: A },
) => number
}
const test: B = {
prop: (input: { a: string, b: string }) => 0
}
This results in the error:
Type '{ [key: string]: A; }' is missing properties 'a' and 'b' from type '{ a: string; b: string; }'
Although I believe it should work because { a: string, b: string }
fits the requirements of { [key: string]: A; }
.
Is there a way for me to accomplish this?