Code cleanup with typescript