The Custom Element Types generator will use a custom-elements.json file to generate
a specific type definition files or shims for a given framework enabling type checking in
type aware templates such as TSX in React or Angular HTML templates.
Most Web Component libraries ship with a custom-elements.json. However if not provided, a manifest can be generated using the Custom Elements Manifest Generator.
npm install --save-dev custom-element-types
custom-element-types --write --type react --entrypoint @blueprintui/components
Add a types.d.ts file to your project (React example).
Add custom-element-types.module.ts file to your project.
Import and add CustomElementTypeModule to your app module (Angular example).
Add a types.d.ts file to your project (Preact example).
Add a types.d.ts file to your project. If using a third party library it is likely this definition is already included.
- Add
event-handlers.jstowwwroot. -
Add script tag reference to
index.html
<script type="module" src="js/event-handlers.js"></script> -
Add
EventHandlers.csto the root of the project. - (Blazor example).