typescript bug fix, add typescript example