Looking to dynamically generate textures based on a config object? I have a function that does just that by returning an object with the same property names but different values:
function generateTextures(config: {
default?: boolean,
multiply?: boolean,
dark?: boolean
} = {default: true, multiply: true, dark: true}) {
const textures : {[key: string]: []} = {}; // Seeking a way to define object properties dynamically
const textures : { // Is there a way to achieve this without manually specifying keys and changing types?
default?: [],
multiply?: [],
dark?: []
} = {};
do something...
return textures;
}
Any suggestions or solutions would be greatly appreciated. Thank you!