Expected behavior
The app should start with no issue.
Actual behavior
The app could not compile.
Steps to reproduce
I wanted to migrate from react-beautiful-dnd to @hello-pangea/dnd, and after installation and changing the imports, my app could not be compiled.
Suggested solution?
I spent some time investigating the cause of the error, I think it's because of the optional chaining used on line 4488, as shown in the screenshot, I tried to remove the question mark ?, and after that I was able to run the app without any problems.
I learned that this is due to the old version of babel not supporting optional chaining, and the recommended fix is to install @babel/plugin-transform-optional-chaining and put it in the babel.config.ts file. However, the project I'm working on is using babel version 7.15 which should support optional chaining.
I also followed the recommendation to install the @babel/plugin-transform-optional-chaining, but the app still could not compile.
I was wondering that, since there's only this one line that's using the optional chaining, is it possible to replace it with old style null checking like:
var getWindowFromEl = el => {
if (!!el & !!el.ownerDocument && !!el.ownerDocument.defaultView) {
return el.ownerDocument.defaultView;
}
return window;
};
for best backwards compatibility?
What version of React are you using?
18.0.5
What version of @hello-pangea/dnd are you running?
16.3.0
What browser are you using?
Google Chrome 119
Demo

Expected behavior
The app should start with no issue.
Actual behavior
The app could not compile.
Steps to reproduce
I wanted to migrate from
react-beautiful-dndto@hello-pangea/dnd, and after installation and changing theimports, my app could not be compiled.Suggested solution?
I spent some time investigating the cause of the error, I think it's because of the
optional chainingused on line 4488, as shown in the screenshot, I tried to remove the question mark?, and after that I was able to run the app without any problems.I learned that this is due to the old version of
babelnot supportingoptional chaining, and the recommended fix is to install@babel/plugin-transform-optional-chainingand put it in thebabel.config.tsfile. However, the project I'm working on is usingbabelversion 7.15 which should supportoptional chaining.I also followed the recommendation to install the
@babel/plugin-transform-optional-chaining, but the app still could not compile.I was wondering that, since there's only this one line that's using the
optional chaining, is it possible to replace it with old stylenull checkinglike:for best backwards compatibility?
What version of
Reactare you using?18.0.5
What version of
@hello-pangea/dndare you running?16.3.0
What browser are you using?
Google Chrome 119
Demo