Typescript Change Type Based On Value