I have an interface that has a property matchMaker, it looks like this:
export interface ServerOptions {
matchMaker: MatchMakerType<MatchMaker>
}
I then have a class that sets up default values for to utilize that interface which looks like this:
export class Server {
public readonly settings: ServerOptions = {
matchMaker: undefined
}
public constructor(options: ServerOptions) {
this.settings = Object.assign(this.settings, options)
}
}
When a new instance of the class Server is created, I want to require a typeof MatchMaker to be set for matchMaker when passing the options to the constructor. I don't want to allow undefined | null or anything else to be passed to the constructor, however I need to have some value as the default, and when I use undefined which will get overridden, I get an error:
Type 'undefined' is not assignable to type 'MatchMakerType'.
What can I do to set up a default that will be overridden?