Start a conversation

React Component TypeScript Types

A rundown of how TypeScript Types work to help you develop React components.

TypeScript type definitions are bundled with the SDK, including its own documentation written in the type file.

These definitions assist in the development of custom React components.

Location of TypeScript type definitions

To access TypeScript types in the Aurora SDK, developers should navigate to the types/ directory of the SDK installation. This directory contains all predefined types essential for handling the operations and functionalities of Aurora components.

The types/ directory is organized as follows:

types/
|--- mf/
|    |--- aurora.d.ts
|--- pkg/
     |--- aurora.d.ts

The mf (module federation) directory contains a single aurora.d.ts file. This file defines the TypeScript types for custom React components and is the only file that should be referenced in creating them.

The pkg (module package) directory contains a single aurora.d.ts file. This file defines the TypeScript types for custom endpoints and is the only file that should be referenced in creating them.

Examples of TypeScript Type Usage

Using TypeScript types effectively in your React component can enhance the development process by providing clarity and consistency. We've provided a code snippet below for a custom component that incorporates the types as a React prop pointing to aurora/externalContext.

The prop includes the TypeScript types and Aurora's GraphQL schema.

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. ATLAS

  2. Posted
  3. Updated

Comments