I would like to change the code to Typescript if possible. Do I need to write an interface as well?