Solved on the github issues, this is due to errors in the typescript api bindings or whatever is the correct term for them not matching the p2 javascript below. fixes have been done and pushed up by some nice chap so anyone reading this having issues with the p2 stuff go fetch the newest files from the repository.