@@ -4,6 +4,7 @@ import { getExportedDeclarationsBySourceFile } from "../../../../core/parser/sou
44import { getTsProject } from "../../../../core/get-ts-project.js" ;
55import { getTsConfigPath } from "../../../../core/get-ts-config-path.js" ;
66import { createE2EWorkspace , E2EWorkspace } from "../../../utils/create-e2e-workspace.js" ;
7+ import { ExportDeclaration , StandardizedFilePath } from "../../../../core/types/parser.types.js" ;
78
89describe ( "excludeBarrelReExports" , ( ) => {
910 let workspace : E2EWorkspace ;
@@ -92,4 +93,19 @@ describe("excludeBarrelReExports", () => {
9293 expect ( filePaths . some ( path => path . includes ( "math.ts" ) ) ) . toBe ( true ) ;
9394 expect ( filePaths . some ( path => path . includes ( "string.ts" ) ) ) . toBe ( true ) ;
9495 } ) ;
96+
97+ it ( "should keep both exports when symbolName is same but kind differs" , ( ) => {
98+ const result = excludeBarrelReExports ( [
99+ mockExport ( "Foo" , "type" , "/src/foo.ts" ) ,
100+ mockExport ( "Foo" , "function" , "/src/foo.ts" ) ,
101+ ] ) ;
102+
103+ expect ( result ) . toHaveLength ( 2 ) ;
104+ expect ( result . find ( exp => exp . kind === "type" ) ) . toBeDefined ( ) ;
105+ expect ( result . find ( exp => exp . kind === "function" ) ) . toBeDefined ( ) ;
106+ } ) ;
95107} ) ;
108+
109+ function mockExport ( symbolName : string , kind : ExportDeclaration [ "kind" ] , filePath : string ) : ExportDeclaration {
110+ return { symbolName, kind, filePath : filePath as StandardizedFilePath } as ExportDeclaration ;
111+ }
0 commit comments