metadata is undefined (Babel)
See original GitHub issueI create a simple advice just like Get Started, but advices can’t find metadata.
- simple react demo project
- kaop-ts v1.2.0
App.js
import React, {Component} from 'react';
import logo from './logo.svg';
import './App.css';
import {afterMethod} from 'kaop-ts'
import {MyAdvices} from './MyAdvices'
class App extends Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
@afterMethod(MyAdvices.doubleResult)
handleClick() {
alert('You Click It!');
}
render() {
return (
<div className="App">
<div className="App-header" onClick={this.handleClick}>
<img src={logo} className="App-logo" alt="logo"/>
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
To get started, edit
<code>src/App.js</code>
and save to reload.
</p>
</div>
);
}
}
export default App;
MyAdvices.js
import { AdvicePool, adviceMetadata } from 'kaop-ts'
export class MyAdvices extends AdvicePool {
static doubleResult (@adviceMetadata metadata) {
console.log(metadata); // always output undefined here
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Metadata retention with Typescript, Babel 7, Decorators
In practice this means that : If the type is an interface or a type alias, the type name will be undefined at...
Read more >babel-plugin-transform-typescript-metadata - npm
Babel plugin to emit decorator metadata like typescript compiler. Latest version: 0.3.2, ... Inject()(Some.prototype, undefined, 0); ...
Read more >Metadata retention with Typescript, Babel 7, Decorators-babel.js
If the type is an interface or a type alias, the type name will be undefined at runtime, to avoid the undefined we...
Read more >babel/plugin-transform-typescript
--emitDecoratorMetadata This option isn't supported by an official Babel package since it is ... the reference to V will be undefined resulting in...
Read more >Code Dive: babel-loader - lik.ai
sourceMaps: loaderOptions.sourceMaps === undefined ? this.sourceMap : loaderOptions.sourceMaps, // Ensure that Webpack will get a full absolute path in the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@k1r0s gread job!
Although I prefer to use typescript now, but there are a lot of people use original javasciprt,which is very useful for them.
Thanks a lot @k1r0s ,
It is difficult to replace the whole project into typescript, but I wirte advices files use typescript (that I learned just last weekend 😛) according to your suggestion, use babel for other
.js
files, it works fine now!I also will keep an eye on this, thanks for you libarary!