Is there a way to ensure type-checking for the handler class in the configuration object below?
import { S01Handler } from "./handlers/start/S01Handler"
const config: ConfigInterface = {
states: {
[StateEnum.S01]: {
objects: [
BackgroundObject.NAME,
LeavesObject.NAME,
],
handler: S01Handler,
},
},
}
The S01Handler
class inherits from the abstract base class BaseHandler
. For example, let's consider
export abstract class BaseClass {}
The current ConfigInterface
doesn't support type-checking for class types.
type StateEnum = import("./StateEnum").StateEnum
type BaseHandler = import("../handlers/BaseHandler").BaseHandler
type ObjectName = string & {readonly '': unique symbol}
interface ConfigInterface
{
states: {
[key in StateEnum]: {
objects: ObjectName[]
handler: BaseHandler
}
}
}
What modifications should be made to enable type-checking for the handler
class?