New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Babel's TypeScript support doesn't match the compiler w.r.t. inline declarations of in-scope identifiers #10353
Comments
|
Hey @ELLIOTTCABLE! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite. |
Probably fixed by #10352 |
I had high hopes, @nicolo-ribaudo, but unfortunately, it doesn't look like #10352 resolved this particular problem! )= With import * as $_AST from 'bs-excmd/src/aST.bs'
declare class $_AST {
static copy_expression($expr: $Expressiont): $Expressiont
static get_literal_exn($sub: $or_subexpr): $string
static get_sub_exn($sub: $or_subexpr): $Expressiont
// ... I'm still getting:
|
It fixed it for the parser but not in |
Ahhhh, I see. Just to be sure: the non-registration fix should affect this combination of an ES6 module-star-import and a class-type-declaration? Should I open a separate Issue somewhere else? 😣 I took a look at your changes, and dug around |
Well, when we introduce a big new feature like TS it will inevitably sneak across all the core modules 🤷♂️ 😛 |
Can't reproduce in latest version, seems to have been fixed. |
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.Input Code
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)
Environment
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.The text was updated successfully, but these errors were encountered: