tyler-technologies-oss / forge

Framework agnostic Web Component library that implements the Tyler Forge™ design system.
Apache License 2.0
42 stars 11 forks source link

feat: add ambient typings for React projects #659

Open DRiFTy17 opened 2 months ago

DRiFTy17 commented 2 months ago

PR Checklist

Please check if your PR fulfills the following requirements:

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.

stackblitz[bot] commented 2 months ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.