This is needed to prevent leaking internal APIs to users via our published .d.ts typings. Fixes #4645 Closes #4989