File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed
Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -917,10 +917,42 @@ const printError = (diagnostic) => {
917917 }
918918
919919 if ( type . isUnion ( ) ) {
920+ let types = type . types ;
921+
922+ const origin =
923+ /** @type {ts.UnionType & { origin: ts.UnionType } | undefined } */
924+ ( type ) . origin ;
925+ const nodeJSOriginTypes =
926+ origin &&
927+ origin . types &&
928+ origin . types . filter ( ( item ) => {
929+ if ( ! item . aliasSymbol ) {
930+ return false ;
931+ }
932+
933+ const fullEscapedName = getFullEscapedName ( item . aliasSymbol ) ;
934+
935+ if ( fullEscapedName . includes ( "NodeJS." ) ) {
936+ return true ;
937+ }
938+ } ) ;
939+
940+ if ( nodeJSOriginTypes && nodeJSOriginTypes . length > 0 ) {
941+ types = types . filter ( ( item ) => {
942+ if ( ! item . symbol ) {
943+ return true ;
944+ }
945+
946+ return ! isArrayBufferLike ( getFullEscapedName ( item . symbol ) ) ;
947+ } ) ;
948+
949+ types . push ( ...nodeJSOriginTypes ) ;
950+ }
951+
920952 return {
921953 type : "union" ,
922954 symbolName : parseName ( type ) ,
923- types : type . types ,
955+ types,
924956 typeParameters :
925957 type . aliasTypeArguments && type . aliasTypeArguments . length > 0
926958 ? type . aliasTypeArguments
You can’t perform that action at this time.
0 commit comments