@@ -29,6 +29,10 @@ const imports = {
2929let outputFiles = { } ;
3030
3131function addType ( tsVersion , subset , template , options ) {
32+ const exportGlobalType = options . globalType ?? true ;
33+ if ( ! exportGlobalType && subset !== 'pure' ) {
34+ return ;
35+ }
3236 const filePath = buildFilePath ( tsVersion , subset ) ;
3337 if ( ! outputFiles [ filePath ] ) outputFiles [ filePath ] = '' ;
3438 const entryWithTypes = template ( options ) ;
@@ -44,6 +48,8 @@ async function buildType(entry, options) {
4448 let {
4549 entryFromNamespace,
4650 subset = entryFromNamespace ?? 'full' ,
51+ globalType,
52+ exportGlobalType = globalType ?? true ,
4753 template, templateStable, templateActual, templateFull, filter, modules, enforceEntryCreation,
4854 customType, tsVersion, proposal, types, ownEntryPoint,
4955 } = options ;
@@ -77,14 +83,18 @@ async function buildType(entry, options) {
7783 }
7884
7985 types . forEach ( type => {
80- imports . index . add ( type ) ;
81- imports [ subset ] . add ( type ) ;
86+ if ( exportGlobalType ) {
87+ imports . index . add ( type ) ;
88+ imports [ subset ] . add ( type ) ;
89+ }
8290 imports . pure . add ( path . join ( 'pure' , type ) ) ;
8391 } ) ;
8492
8593 if ( customType ) {
86- imports . index . add ( customType ) ;
87- imports [ subset ] . add ( customType ) ;
94+ if ( exportGlobalType ) {
95+ imports . index . add ( customType ) ;
96+ imports [ subset ] . add ( customType ) ;
97+ }
8898 imports . pure . add ( path . join ( 'pure' , customType ) ) ;
8999 }
90100 options = { ...options , modules, level, entry, types } ;
0 commit comments