Shared Types
Shared TypeScript type definitions and interfaces used across the Substrate monorepo.
For detailed usage documentation, see the Shared Types documentation on the docs site.
Contributing
Prerequisites
- Node.js 20+ and Yarn
- Strong understanding of TypeScript and type systems
Commands
# Build the package
nx build shared-types
# Run tests
nx test shared-types
# Run type checking
nx typecheck shared-types
# Lint the package
nx lint shared-types
Project Structure
packages/shared-types/
├── src/
│ ├── lib/
│ │ ├── core.ts # Core type definitions
│ │ └── core.type-spec.ts # Compile-time type verification
│ └── index.ts # Package exports
├── docs/ # Documentation (built to docs site)
└── README.md # This file
Environment Variables
No environment variables required for this package.
Type Organization
Types are organized by domain:
- Database types - Prisma ORM compatible types
- GraphQL types - API request/response types
- Authentication types - User and session types
- Utility types - Common type helpers
Adding New Types
- Create or edit a file in
src/for the appropriate domain - Define your types/interfaces
- Export from
src/index.ts - Run
nx build shared-typesto compile - Update documentation as needed
Type Safety
This package ensures type consistency across:
- Database models (Prisma)
- GraphQL schemas
- Application code (React components and utilities)
When adding types, ensure they are compatible with existing related types in other packages.
Related Documentation
- Root README - Substrate overview
- Docs README - Documentation site
- Shared DB README - Database integration