Updated TypeScript definitions

Made the "index" parameter optional to reflect the JS version.