Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ambient typings for React projects #659

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

DRiFTy17
Copy link
Collaborator

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.

@DRiFTy17 DRiFTy17 added minor Increment the minor version when merged skip-release Preserve the current version when merged labels Jul 16, 2024
@DRiFTy17 DRiFTy17 requested a review from a team as a code owner July 16, 2024 17:29
Copy link

stackblitz bot commented Jul 16, 2024

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

@DRiFTy17 DRiFTy17 marked this pull request as draft October 22, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged skip-release Preserve the current version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants