Skip to content

Commit

Permalink
fix(compiler): prefer localName over originalName by running an e…
Browse files Browse the repository at this point in the history
…mpty check on `originalName` (#5943)

* fix(compiler): properly resolve type imports

* prettier
  • Loading branch information
christian-bromann authored Aug 16, 2024
1 parent 0e261d6 commit 0f42656
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/compiler/types/generate-app-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ const generateComponentTypesFile = (
return `{ ${typeData
.sort(sortImportNames)
.map((td) => {
if (td.originalName === td.importName) {
if (td.originalName === '') {
return `${td.localName}`;
} else if (td.originalName === td.importName) {
return `${td.originalName}`;
} else {
return `${td.originalName} as ${td.importName}`;
Expand Down
7 changes: 7 additions & 0 deletions src/compiler/types/tests/generate-app-types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,11 @@ declare module "@stencil/core" {
location: 'import',
path: '@utils',
},
Fragment: {
location: 'import',
path: '@stencil/core',
id: '',
},
},
},
}),
Expand All @@ -1767,7 +1772,9 @@ declare module "@stencil/core" {
*/
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
import { MyType as UserImplementedPropType } from "@utils";
import { Fragment } from "@stencil/core";
export { MyType as UserImplementedPropType } from "@utils";
export { Fragment } from "@stencil/core";
export namespace Components {
/**
* docs
Expand Down

0 comments on commit 0f42656

Please sign in to comment.