Skip to content

Commit 0f42656

Browse files
authoredAug 16, 2024··
fix(compiler): prefer localName over originalName by running an empty check on originalName (#5943)
* fix(compiler): properly resolve type imports * prettier
1 parent 0e261d6 commit 0f42656

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
 

‎src/compiler/types/generate-app-types.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ const generateComponentTypesFile = (
108108
return `{ ${typeData
109109
.sort(sortImportNames)
110110
.map((td) => {
111-
if (td.originalName === td.importName) {
111+
if (td.originalName === '') {
112+
return `${td.localName}`;
113+
} else if (td.originalName === td.importName) {
112114
return `${td.originalName}`;
113115
} else {
114116
return `${td.originalName} as ${td.importName}`;

‎src/compiler/types/tests/generate-app-types.spec.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,11 @@ declare module "@stencil/core" {
17471747
location: 'import',
17481748
path: '@utils',
17491749
},
1750+
Fragment: {
1751+
location: 'import',
1752+
path: '@stencil/core',
1753+
id: '',
1754+
},
17501755
},
17511756
},
17521757
}),
@@ -1767,7 +1772,9 @@ declare module "@stencil/core" {
17671772
*/
17681773
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
17691774
import { MyType as UserImplementedPropType } from "@utils";
1775+
import { Fragment } from "@stencil/core";
17701776
export { MyType as UserImplementedPropType } from "@utils";
1777+
export { Fragment } from "@stencil/core";
17711778
export namespace Components {
17721779
/**
17731780
* docs

0 commit comments

Comments
 (0)
Please sign in to comment.