@@ -195,22 +195,29 @@ export class TypeOnlyFixer {
195
195
this . DEBUG && console . log ( `${ node . name . getFullText ( ) } is a type` ) ;
196
196
this . types . add ( alias ) ;
197
197
198
- if ( ts . isTypeReferenceNode ( node . type ) && ts . isIdentifier ( node . type . typeName ) ) {
199
- const reference = node . type . typeName . text ;
200
- const aliasHint = parseTypeOnlyName ( alias ) ;
201
-
202
- if ( aliasHint . isTypeOnly ) {
203
- this . DEBUG && console . log ( `${ reference } is a type (from type-only hint)` ) ;
204
- this . types . add ( reference ) ;
205
- this . typeHints . set ( reference , ( this . typeHints . get ( reference ) || 0 ) + 1 ) ;
206
- if ( aliasHint . isReExport ) {
207
- const reExportName = alias . split ( TYPE_ONLY_RE_EXPORT ) [ 0 ] !
208
- this . DEBUG && console . log ( `${ reExportName } is a type (from type-only re-export hint)` ) ;
209
- this . reExportTypeHints . set ( reExportName , ( this . reExportTypeHints . get ( reExportName ) || 0 ) + 1 ) ;
210
- }
211
- this . code . remove ( node . getStart ( ) , node . getEnd ( ) ) ;
212
- }
213
- }
198
+ /**
199
+ * TODO: type-only import/export fixer.
200
+ * Temporarily disable the type-only import/export transformation,
201
+ * because the current implementation is unsafe.
202
+ *
203
+ * Issue: https://github.com/Swatinem/rollup-plugin-dts/issues/340
204
+ */
205
+ // if (ts.isTypeReferenceNode(node.type) && ts.isIdentifier(node.type.typeName)) {
206
+ // const reference = node.type.typeName.text;
207
+ // const aliasHint = parseTypeOnlyName(alias);
208
+
209
+ // if(aliasHint.isTypeOnly) {
210
+ // this.DEBUG && console.log(`${reference} is a type (from type-only hint)`);
211
+ // this.types.add(reference);
212
+ // this.typeHints.set(reference, (this.typeHints.get(reference) || 0) + 1);
213
+ // if(aliasHint.isReExport) {
214
+ // const reExportName = alias.split(TYPE_ONLY_RE_EXPORT)[0]!
215
+ // this.DEBUG && console.log(`${reExportName} is a type (from type-only re-export hint)`);
216
+ // this.reExportTypeHints.set(reExportName, (this.reExportTypeHints.get(reExportName) || 0) + 1);
217
+ // }
218
+ // this.code.remove(node.getStart(), node.getEnd());
219
+ // }
220
+ // }
214
221
continue ;
215
222
}
216
223
0 commit comments