question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

experimentalDecorators support incomplete

See original GitHub issue

What version of Next.js are you using?

12.0.8-canary.13

What version of Node.js are you using?

v14

What browser are you using?

n/a

What operating system are you using?

macOS

How are you deploying your application?

other

Describe the Bug

After removing the babelrc and setting experimentalDecorators to true in compiler options, the build fails with error…

“Error: error: Using the export keyword between a decorator and a class is not allowed. Please use export @dec class instead.”

Granted, maybe should begin refactoring our legacy decorators anyway, but this should work right?

old .bablerc has…

"plugins": [["@babel/plugin-proposal-decorators", {"legacy": true}]]

jsconfig.json has…

{
    "compilerOptions" {
        "experimentalDecorators": true
    }
}

Expected Behavior

Project builds. Currently the build fails with above error.

To Reproduce

function wrapComponent(Component) {
    return (props) => <Component {...props} imDecorated />
}



@wrapComponent
export default class MyComponent extends Component {
    render() { return <div />; }
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
oyeanujcommented, Feb 21, 2022

Also seeing this in the latest 12.1.0 version.

0reactions
nol13commented, Dec 13, 2022

@timneutkens Any update on this one? Like with @rmsheppard, this is a pretty big change to make across our projects, stopping us from opting into swc. What’s the best workaround?

We ended up refactoring them all to use redux compose instead. Lot’s of files to change but all pretty straightforward.

// before
@wrapComponent1
@wrapComponent2
export default class MyComponent extends Component {
    render() { return <div />; }
}

// after
export default compose(wrapCompontent1, wrapCompontent2)(MyComponent)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Experimental decorators warning in TypeScript compilation
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option `to remove this ......
Read more >
How to remove experimentalDecorators warning in VSCode
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this ......
Read more >
[Editor:VSCode] Using decorators in native class syntax ...
... in native class syntax throws experimentalDecorators error #9050 ... enable the experimental decorator support in eslint configuration).
Read more >
Solving warning: “Experimental support for decorators is a ...
Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning”. This article describes how to solve this warning that could...
Read more >
grunt-ts - npm
Sets a root for output of transformed-to-TypeScript HTML files. See detailed explanation of grunt-ts HTML template support. //Note: incomplete - ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found