Skip to content

Commit

Permalink
Declare icon modules in global.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
bryophyta committed Sep 16, 2024
1 parent b4a1c22 commit 7d28d31
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
!jest.config.js
!jest.setup.js
!.eslintrc.js
*.d.ts
node_modules
dist

Expand All @@ -13,3 +12,5 @@ dist
cdk.out

*.tsbuildinfo

vite.config.d.ts
8 changes: 8 additions & 0 deletions newswires/client/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @see:
* - https://github.com/elastic/eui/issues/5463#issuecomment-1107665339
* - https://github.com/elastic/eui/tree/main/wiki/consuming-eui
* - https://stackoverflow.com/questions/76202223/vite-elastic-ui-failing-to-dynamically-import-icons-for-euiicon/77313511#77313511
*/
declare module '@elastic/eui/es/components/icon/*';
declare module '@elastic/eui/es/components/icon/icon';
9 changes: 9 additions & 0 deletions newswires/client/src/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ import { icon as search } from '@elastic/eui/es/components/icon/assets/search';
import { icon as warning } from '@elastic/eui/es/components/icon/assets/warning';
import { appendIconComponentCache } from '@elastic/eui/es/components/icon/icon';

/**
* @see:
* - https://github.com/elastic/eui/issues/5463#issuecomment-1107665339
* - https://github.com/elastic/eui/tree/main/wiki/consuming-eui
* - https://stackoverflow.com/questions/76202223/vite-elastic-ui-failing-to-dynamically-import-icons-for-euiicon/77313511#77313511
*/
declare module '@elastic/eui/es/components/icon/*';
declare module '@elastic/eui/es/components/icon/icon';

// One or more icons are passed in as an object of iconKey (string): IconComponent
appendIconComponentCache({
clock,
Expand Down

0 comments on commit 7d28d31

Please sign in to comment.