@@ -15,10 +15,9 @@ class Carousel<T> extends Vue {
1515 "vue-class-component.d.ts" : `import Vue from "./vue";
1616export function Component(x: Config): any;`
1717 } ;
18- // Regression test for GH #18245 - bug in single line comment writer caused a debug assertion when attempting
19- // to write an alias to a module's default export was referrenced across files and had no default export
20- it ( "should be able to create a language service which can respond to deinition requests without throwing" , ( ) => {
21- const languageService = createLanguageService ( {
18+
19+ function createLanguageService ( ) {
20+ return ts . createLanguageService ( {
2221 getCompilationSettings ( ) {
2322 return { } ;
2423 } ,
@@ -39,8 +38,45 @@ export function Component(x: Config): any;`
3938 return getDefaultLibFilePath ( options ) ;
4039 } ,
4140 } ) ;
41+ }
42+ // Regression test for GH #18245 - bug in single line comment writer caused a debug assertion when attempting
43+ // to write an alias to a module's default export was referrenced across files and had no default export
44+ it ( "should be able to create a language service which can respond to deinition requests without throwing" , ( ) => {
45+ const languageService = createLanguageService ( ) ;
4246 const definitions = languageService . getDefinitionAtPosition ( "foo.ts" , 160 ) ; // 160 is the latter `vueTemplateHtml` position
4347 expect ( definitions ) . to . exist ; // eslint-disable-line no-unused-expressions
4448 } ) ;
49+
50+ it ( "getEmitOutput on language service has way to force dts emit" , ( ) => {
51+ const languageService = createLanguageService ( ) ;
52+ assert . deepEqual (
53+ languageService . getEmitOutput (
54+ "foo.ts" ,
55+ /*emitOnlyDtsFiles*/ true
56+ ) ,
57+ {
58+ emitSkipped : true ,
59+ outputFiles : emptyArray ,
60+ exportedModulesFromDeclarationEmit : undefined
61+ }
62+ ) ;
63+
64+ assert . deepEqual (
65+ languageService . getEmitOutput (
66+ "foo.ts" ,
67+ /*emitOnlyDtsFiles*/ true ,
68+ /*forceDtsEmit*/ true
69+ ) ,
70+ {
71+ emitSkipped : false ,
72+ outputFiles : [ {
73+ name : "foo.d.ts" ,
74+ text : "export {};\r\n" ,
75+ writeByteOrderMark : false
76+ } ] ,
77+ exportedModulesFromDeclarationEmit : undefined
78+ }
79+ ) ;
80+ } ) ;
4581 } ) ;
4682}
0 commit comments