forge
forge copied to clipboard
feat: add ambient typings for React projects
PR Checklist
Please check if your PR fulfills the following requirements:
- Tests for the changes have been added/updated: N
- Docs have been added/updated: Y
- Does this PR introduce a breaking change? N
- I have linked any related GitHub issues to be closed when this PR is merged? N
Describe the new behavior?
Introduces a custom plugin into the custom elements manifest build pipeline to generate a .d.ts
file that can be consumed by React-based projects that are using TypeScript. This augments the global JSX.IntrinsicElements
interface with information about the <forge-*>
elements to ensure type safety for properties, attributes, and events.
Here is an example of how it would be used in a React project:
import type { ForgeCustomElements } from '@tylertech/forge/types/react-types';
declare global {
namespace JSX {
interface IntrinsicElements extends ForgeCustomElements {}
}
}
Additional information
This was specifically introduced for usage in React v19 projects now that it supports communication with custom elements natively. React projects prior to React v19 should continue to use the @tylertech/forge-react
adapter library.