I want a type like:
interface Err {
error: Error,
[key: string]: string,
}
const e: Err = {
error: new Error(),
a: 'a',
b: 'b',
}
to define an Object with the key named error and has another key with a string type. But has some Type lint errors:
(property) Err.error: Error Property 'error' of type 'Error' is not assignable to 'string' index type 'string'.
So how to define a type that must have a key named error with Error type and has some other keys with string type?
This problem is error
and other keys are all string type, and I only want custom key is string type not Union Type like string | Error
, so it's not like with this.
Thanks for your time.