I'm new to typescript and wondering if it's possible to create a function that returns the interface for variable declarations. If so, how can this be accomplished? An example use case (which may not work) could look like this:
let someVar: desiredFunction(name);
const desiredFunction = (name: string) => (name === 'name1') ? Interface1 : Interface2;