Open artemkolotilkin opened 1 year ago
Thanks for reporting. Types are slowly being added by the community, focusing on the react components first #12513.
Icons haven't really been looked at or discussed yet, but an idea for @carbon/icons-react
is up at https://github.com/carbon-design-system/carbon/pull/12034
I did some research on this + a bit of (mostly unsuccessful) experiments.
What I've been successful with is I've been able to convert the Icon.js file into Icon.tsx and get it properly recognized and transformed by @carbon/icon-build-helpers (with a bit of babel configs tuning) to produce JS code. This means that we at least have some TS source to generate TS definitions for the base Icon type.
The bad news is, @carbon/icon-build-helpers uses rollup virtual plugin, which is not supported by the rollup typescript plugin: https://github.com/rollup/plugins/issues/567. Therefore, we don't get any TS definitions (even for the aforementioned base Icon component) directly out of the build process. Even if we could feed virtual code into rollup typescript plugin, we'd get the definitions for base types only, and not for the generated JS code (or the definitions would be useless).
Based on the above, I see 2 options:
@tay1orjones any suggestions / thoughts?
The carbon-icons-angular
docs show how to implement @carbon/icons
package in Angular (codesandbox link).
Since
@carbon/icons-angular
package is outdated and no longer maintained, I'm trying to use@carbon/icons
package in my Angular project. Unfortunately, Angular complains that types are missing. It would be great to have them added.