Start implementing TypeScript declarations. Work in progress.