For example puppeteer uses TypeScript to validate code based on jsdoc annotations https://github.com/GoogleChrome/puppeteer/pull/986 Also flow can do some validation, but not sure if there is puppeteer type definitions.