Working out issues with ts compiler