Skip to content

Commit

Permalink
Include decorator and class field plugins after TypeScript, if p… (#311)
Browse files Browse the repository at this point in the history
Include decorator and class field plugins after TypeScript, if present
  • Loading branch information
rwjblue authored Dec 12, 2019
2 parents bc0dee4 + e08b59d commit 0d4dcc3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ module.exports = {
plugins,
[require.resolve('@babel/plugin-proposal-decorators'), { legacy: true }],
{
before: ['@babel/plugin-proposal-class-properties', '@babel/plugin-transform-typescript']
before: ['@babel/plugin-proposal-class-properties'],
after: ['@babel/plugin-transform-typescript']
}
);
}
Expand All @@ -357,8 +358,7 @@ module.exports = {
plugins,
[require.resolve('@babel/plugin-proposal-class-properties'), { loose: options.loose || false }],
{
after: ['@babel/plugin-proposal-decorators'],
before: ['@babel/plugin-transform-typescript']
after: ['@babel/plugin-proposal-decorators', '@babel/plugin-transform-typescript']
}
);
}
Expand Down
6 changes: 6 additions & 0 deletions node-tests/addon-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,12 @@ describe('ember-cli-babel', function() {

expect(loosePlugins[1][1].loose).to.equal(true, 'loose setting added correctly');
});

it('should include class fields and decorators after typescript if detected', function() {
let plugins = this.addon._addDecoratorPlugins(['@babel/plugin-transform-typescript'], {});
expect(plugins[0]).to.equal('@babel/plugin-transform-typescript', 'typescript still first');
expect(plugins.length).to.equal(3, 'class fields and decorators added');
});
});

describe('_shouldIncludeHelpers()', function() {
Expand Down

0 comments on commit 0d4dcc3

Please sign in to comment.