Skip to content

Commit

Permalink
build(angular): remove event detail types patch by exporting them fro…
Browse files Browse the repository at this point in the history
…m the entry point (#8177)

**Related Issue:** #8084

I ran into build errors related to event detail types when adding the
Angular output target to the monorepo. Stencil's auto-generated Angular
code expected the types to be exported from the
`@esri/calcite-components` entry point, but they were not. Here is one
of the error messages:

```
angular-workspace:build: projects/component-library/src/lib/stencil-generated/components.ts:1014:15 - error TS2459: Module '"@esri/calcite-components"' declares 'HandleNudge' locally, but it is not exported.
angular-workspace:build:
angular-workspace:build: 1014 import type { HandleNudge as ICalciteHandleHandleNudge } from '@esri/calcite-components';
angular-workspace:build:                    ~~~~~~~~~~~
angular-workspace:build:
angular-workspace:build:   ../calcite-components/dist/types/components.d.ts:42:24
angular-workspace:build:     42 import { HandleChange, HandleNudge } from "./components/handle/interfaces";
angular-workspace:build:                               ~~~~~~~~~~~
angular-workspace:build:     'HandleNudge' is declared here.
```

To resolve the errors, I added a prebuild patch to the Angular output
target that fixed the import paths for the three event detail types. As
a result, a Calcite Components fix/feat that added a new event detail
would create an unrelated entry in the Angular changelog. This is
because the new event detail would need to be added to the patch, which
lived in the Angular package's directory. This came up in:
#8123 (comment)

This pull request exports the event detail types from the entry point,
so the patch can be removed. **When adding a new event detail, it must
be exported from
[`packages/calcite-components/src/index.ts`](https://github.com/Esri/calcite-design-system/blob/main/packages/calcite-components/src/index.ts)
to prevent build errors.**
  • Loading branch information
benelan authored and DitwanP committed Nov 16, 2023
1 parent 2620677 commit 0f4e3bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/calcite-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"es2015": "dist/esm/index.js",
"es2017": "dist/esm/index.js",
"jsnext:main": "dist/esm/index.js",
"types": "dist/types/components.d.ts",
"types": "dist/types/index.d.ts",
"type": "module",
"jsdelivr": "dist/calcite/calcite.js",
"unpkg": "dist/calcite/calcite.js",
Expand Down

0 comments on commit 0f4e3bb

Please sign in to comment.