GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Elide imports only referenced in ambient declarations by nicolo-ribaudo · Pull Request #18694 · babel/babel Conversation
Member
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…ions Assisted-by: Claude Opus 5.5 Assisted-by: Claude Opus 5.5
|
There was an error while loading. Please reload this page.
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/63671 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
4005307 to
6c2d383
Compare
|
commit: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Claude spot one regression, could you add a new test case and fix that?
// optimizeConstEnums: true import { D } from "a"; declare const enum E { X = D.x } console.log(E.X);
Before the PR: the output is import { D } from "a"; console.log(D.x);, which works.
With the current PR, the import is removed: console.log(D.x);, which throws a ReferenceError.
Also, can you add tests for import A = require("a") / import A = ns.B through isImportTypeOnly?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| p.isClassDeclaration({ declare: true }) || | ||
| p.isVariableDeclaration({ declare: true }) || | ||
| p.isTSEnumDeclaration({ declare: true }) || | ||
| p.isTSModuleDeclaration({ declare: true }), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
These checks are roughly the same as those in
babel/packages/babel-plugin-transform-typescript/src/index.ts
Lines 367 to 374 in 0e197e9
| stmt.isTSTypeAliasDeclaration() || | |
| (stmt.isTSDeclareFunction() && stmt.get("id").isIdentifier()) || | |
| stmt.isTSInterfaceDeclaration() || | |
| stmt.isClassDeclaration({ declare: true }) || | |
| stmt.isTSEnumDeclaration({ declare: true }) || | |
| (stmt.isTSModuleDeclaration({ declare: true }) && | |
| stmt.get("id").isIdentifier()) | |
| ) { |
Please check if the difference between these two are intentional. If not we can refactor and reuse.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.