[babel 8] Rename TSImportType.argument to .source#17610
[babel 8] Rename TSImportType.argument to .source#17610nicolo-ribaudo merged 4 commits intobabel:mainfrom
TSImportType.argument to .source#17610Conversation
nicolo-ribaudo
commented
Nov 26, 2025
| Q | A |
|---|---|
| Fixed Issues? | Fixes #17506 |
| Patch: Bug Fix? | |
| Major: Breaking Change? | |
| Minor: New Feature? | |
| Tests Added + Pass? | Yes |
| Documentation PR Link | |
| Any Dependency Changes? | |
| License | MIT |
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/60275 |
|
commit: |
|
@fisker Any chance you could update prettier to check for the new property too? :) |
|
Prettier already use |
|
Or do you prefer add an env flag to bypass these checks when running test? |
| "start":41,"end":59,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":25}}, | ||
| "argument": { | ||
| "source": { | ||
| "type": "TSLiteralType", |
There was a problem hiding this comment.
.source should be StringLiteral
| : validateType("StringLiteral"), | ||
| ...(process.env.BABEL_8_BREAKING | ||
| ? { source: validateType("TSLiteralType") } | ||
| : { argument: validateType("StringLiteral") }), |
There was a problem hiding this comment.
Did some previous change in v8 created TSLiteralType? We need revert that change.
|
It was #17046, to align with TS-ESLint. I'll undo it now that TS-ESLint changed their AST shape. |
c731caa to
791d73b
Compare
I don't want to cause trouble for you, I can make this change if you want. I added these checks to make sure our visitor keys logic is up to date. |
| if (process.env.BABEL_8_BREAKING) { | ||
| // Consume as an non-conditional type so that we can recover from this error | ||
| node.argument = this.tsParseNonConditionalType() as any; | ||
| node.source = this.tsParseNonConditionalType() as any; |
There was a problem hiding this comment.
This is for error revovery, right? Should it use the one same as below? super.parseExprAtom.
There was a problem hiding this comment.
It's mostly so that we parse in types mode rather than in values mode.
Nah it's fine, we already patch prettier's tests anyway, I didn't realize it was easy for this one too. |
liuxingbaoyu
left a comment
There was a problem hiding this comment.
It appears that typescript-eslint has been released.
Yes and we should bump the |
c4e6119 to
44f2b6a
Compare
44f2b6a to
7e4441f
Compare