ts error fixed for method init()