@@ -5,6 +5,7 @@ const babel = require('@babel/core');
55const { stripIndent } = require ( 'common-tags' ) ;
66const ColocatedBabelPlugin = require ( '../lib/colocated-babel-plugin' ) ;
77const DecoratorsPlugin = [ require . resolve ( '@babel/plugin-proposal-decorators' ) , { legacy : true } ] ;
8+ const TypeScriptPlugin = [ require . resolve ( '@babel/plugin-transform-typescript' ) ] ;
89const ClassPropertiesPlugin = [
910 require . resolve ( '@babel/plugin-proposal-class-properties' ) ,
1011 { loose : true } ,
@@ -68,6 +69,31 @@ describe('ColocatedBabelPlugin', function () {
6869 ) ;
6970 } ) ;
7071
72+ it ( 'can be used with TypeScript merged declarations' , function ( ) {
73+ let { code } = babel . transformSync (
74+ stripIndent `
75+ import Component from 'somewhere';
76+ const __COLOCATED_TEMPLATE__ = 'ok';
77+ type MyArgs = { required: string; optional?: number };
78+
79+ export default interface MyComponent extends MyArgs {}
80+ export default class MyComponent extends Component {}
81+ ` ,
82+ { plugins : [ ColocatedBabelPlugin , TypeScriptPlugin ] }
83+ ) ;
84+
85+ assert . strictEqual (
86+ code ,
87+ stripIndent `
88+ import Component from 'somewhere';
89+ const __COLOCATED_TEMPLATE__ = 'ok';
90+ export default class MyComponent extends Component {}
91+
92+ Ember._setComponentTemplate(__COLOCATED_TEMPLATE__, MyComponent);
93+ `
94+ ) ;
95+ } ) ;
96+
7197 it ( 'sets the template for non-class default exports' , function ( ) {
7298 let { code } = babel . transformSync (
7399 stripIndent `
0 commit comments