Observable.replace() and cleanup.

- Add Observable.prototype.replace().
- Fix type annotations.
- Update extern.