So I have an object with some standard property names and some random. I would like an interface that forces types for the known properties (lets say name,age) and also forces that all other properties are of type boolean. Is this possible somehow?
interface IUser {
name: string;
age: number;
}
type IWishThisWouldWork = IUser & { [key: Exclude<string, keyof IUser>]: boolean }
const x: IWishThisWouldWork = {
name: 'john', //required and allow only string
age: 5, //required and allow only number
randomProp1: true, //allow only boolean
randomProp2: false //allow only boolean
}