Skip to content

Instantly share code, notes, and snippets.

@olsonpm
Created December 3, 2016 05:31
Show Gist options
  • Save olsonpm/c71d8cad6a0a219cea11e84aed8723db to your computer and use it in GitHub Desktop.
Save olsonpm/c71d8cad6a0a219cea11e84aed8723db to your computer and use it in GitHub Desktop.
generator-option-type
'use strict';
var Base = require('yeoman-generator');
module.exports = Base.extend({
constructor() {
Base.apply(this, arguments);
this.option('aBoolOpt', {
type: Boolean
});
}
, initializing: {
doIt: function doIt() {
console.log('typeof aBoolOpt: ' + (typeof this.options.aBoolOpt));
}
}
});
@dwiyatci
Copy link

I've got the same issue, turns out that we cannot use both ES6's object method shorthand and arrow functions as a constructor. 😞

https://stackoverflow.com/a/45119651/2013891

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment