Skip to content

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jul 11, 2025

Q                       A
Fixed Issues? Fixes #17430, fixes #17434
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

In this PR we remove the OptionalMemberExpression from the LVal alias. The left of the AssignmentExpression still allows OptionalMemberExpression, so the builder usage and the internal typings are generally not affected.

This PR partially reverts #17391.

@JLHwung JLHwung added the PR: Revert ↩️ A type of pull request used for our changelog categories label Jul 11, 2025
@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/59722

Copy link

pkg-pr-new bot commented Jul 11, 2025

Open in StackBlitz

commit: 3bdd2e7

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Releasing this soon!

@nicolo-ribaudo nicolo-ribaudo changed the title Reverts OptionalMemberExpression LVal alias Do not mark OptionalMemberExpresion as LVal Jul 12, 2025
@nicolo-ribaudo nicolo-ribaudo merged commit 8b2e9b4 into babel:main Jul 12, 2025
60 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the revert-optional-member-expression-lval branch July 12, 2025 08:03
@aldobarr
Copy link

@JLHwung I just tested 7.28.1 and while the issue I reported in #17434 appears to be resolved, my builds are still failing. They succeed in 7.27.* though. My project is open, you can try it out if it'd help you at all. Here's what I see now on 7.28.1:

error during build:
Cannot add property 0, object is not extensible
    at Array.push (<anonymous>)
    at ConditionalExpression.getLiteralValueAtPath (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:12270:45)
    at file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:5064:30
    at EntityPathTracker.withTrackedEntityAtPath (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:2014:24)
    at LocalVariable.getLiteralValueAtPath (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:5062:33)
    at Identifier.getLiteralValueAtPath (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:5207:48)
    at MemberExpression.getDynamicPropertyKey (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:7636:41)
    at MemberExpression.hasAccessEffect (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:7652:65)
    at MemberExpression.hasEffects (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:7433:18)
    at AssignmentExpression.hasEffects (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:11567:23)
    at ExpressionStatement.hasEffects (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:2809:28)
    at ExpressionStatement.shouldBeIncluded (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:2928:62)
    at ExpressionStatement.shouldBeIncluded (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:6470:22)
    at BlockStatement.include (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:6518:56)
    at includeLoopBody (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:12451:10)
    at WhileStatement.include (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:15421:9)
    at BlockStatement.include (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:6519:26)
    at FunctionDeclaration.include (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:6715:19)
    at FunctionDeclaration.include (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:6809:15)
    at Graph.includeStatements (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:22548:36)
    at Graph.build (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:22487:14)
    at async file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:23172:13
    at async catchUnfinishedHookActions (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:22643:16)
    at async rollupInternal (file:///home/workspaces/node_modules/rollup/dist/es/shared/node-entry.js:23167:5)
    at async buildEnvironment (file:///home/workspaces/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:46206:14)
    at async Object.defaultBuildApp [as buildApp] (file:///home/workspaces/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:46684:5)
    at async CAC.<anonymous> (file:///home/workspaces/node_modules/vite/dist/node/cli.js:863:7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: types PR: Revert ↩️ A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7.28.0 Regression on TypeScript transform when passing references OptionalMemberExpressions are being reported as LVal's
5 participants