Issue 1:
I originally reported this against a downstream project: hailocab/react-pure#2

I think it's terrific that Babel doesn't just dump the entire external helpers file everywhere, or requires the whole thing to be used by every project, because that's effectively what traceur ends up doing and for small projects it ends up being quite bloated.

However, I've noticed that a small set of helpers is being duplicated across every file in the aforementioned project. I've read about helpers here:

https://babeljs.io/docs/usage/external-helpers/

There doesn't seem to actually be a way to disable the helpers. The default behaviour seems to be:

babel --external-helpers

and the following doesn't change the behaviour:

babel --no-external-helpers

Is there a way to have Babel output a deduplicated centralised module (or modules) for the tailored set of helpers, and automatically have require() statements injected into the output where the duplicated content used to be?

Issue 2:
Bug Report

Current Behavior

When encountering a declare statement for an identifier that's already in scope, Babel throws up. The upstream TypeScript compiler understands this syntax.

{ SyntaxError: /Users/ec/Sync/Code/excmd/src/interface.ts: Identifier 'Something'
has already been declared (3:14)

1 | import Something from './somewhere.js'
2 |
> 3 | declare class Something {
| ^
4 | // ...
5 | }
at Object.raise (/Users/ec/Sync/Code/excmd/node_modules/@babel/parser/lib/index.js:6325:17)
at TypeScriptScopeHandler.checkRedeclarationInScope (/Users/ec/Sync/Code/excmd/node_modules/@babel/parser/lib/index.js:3759:12)
at TypeScriptScopeHandler.declareName (/Users/ec/Sync/Code/excmd/node_modules/@babel/parser/lib/index.js:3725:12)
at TypeScriptScopeHandler.declareName (/Users/ec/Sync/Code/excmd/node_modules/@babel/parser/lib/index.js:3835:11)
at Object.checkLVal (/Users/ec/Sync/Code/excmd/node_modules/@babel/parser/lib/index.js:8021:22)
at Object.checkLVal (/Users/ec/Sync/Code/excmd/node_modules/@babel/parser/lib/index.js:5727:15)
at Object.parseClassId (/Users/ec/Sync/Code/excmd/node_modules/@babel/parser/lib/index.js:10855:14)
at Object.parseClassId (/Users/ec/Sync/Code/excmd/node_modules/@babel/parser/lib/index.js:5508:11)
at Object.parseClass (/Users/ec/Sync/Code/excmd/node_modules/@babel/parser/lib/index.js:10572:10)
at Object.tsTryParseDeclare (/Users/ec/Sync/Code/excmd/node_modules/@babel/parser/lib/index.js:4984:21)
pos: 1216,
loc: Position { line: 3, column: 14 },
code: 'BABEL_PARSE_ERROR' }

Input Code

import Something from './somewhere.js'

declare class Something {
// ...
}

Expected behavior/code

As with tsc, this should have no effect on the produced code; these declarations are essentially "inline .d.ts" for non-TypeScript imports. To satisfy the current Babel, I guess I'll need to extract these declarations into additional .d.ts files, and check those into my source-control; but as I only have a single TypeScript file in my codebase, I'd really prefer to keep the typings for other modules centralized to that single TypeScript file!

Babel Configuration (.babelrc, package.json, cli command)

// .babelrc
{
"presets": ["@babel/env", "@babel/preset-typescript"]
}

// CLI invocation
babel --verbose src --extensions '.ts,.js' --ignore '**/*.bs.js' --ignore '**/*.d.ts' --copy-files --out-dir lib

Environment

Babel version(s): 7.5.5 (@babel/core 7.5.5)

Node/npm version: v10.12.0

OS: macOS 10.14.5

How you are using Babel: cli

Additional context/Screenshots

The above example is somewhat massaged / simplified from my actual codebase I can't even get the web-playground (with "TypeScript" enabled!) to parse a simple declare class Blah, but I would have included a working example if I could.