//global.d.ts type ConfigMeta = StringConfig | NumberConfig declare interface Config { name: string value: T } interface StringConfig extends Config { type: "string" } interface NumberConfig extends Config { type: "number" } interface MetaData { name: string, config: ConfigMeta[] } declare function registerPlugin(meta: MetaData, callback: (config: Record) => void): void //script.ts registerPlugin({ name: "some plugin", config: [{ type: "string", name: "foo", value: "asdf" }, { type: "number", name: "bar", value: 123 }] }, (config) => { //the issue here, config is declared as Record //however is it possible to extract type information from above config input //and get the correct key and associated types directly assigned? console.log(config) //gives { foo: "asdf", bar: 123 } })