JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 74
  • Score
    100M100P100Q87168F
  • License MIT

Shared TypeScript types for TJOC platform

Package Exports

  • @tjoc/types

Readme

@tjoc/types

Shared TypeScript type definitions for The Journey of Code (TJOC) platform.

Installation

yarn add @tjoc/types

Usage

Import the types you need:

import { User, UserRole, Status } from '@tjoc/types';

// Create a user object with type checking
const user: User = {
  id: '123',
  email: 'user@example.com',
  firstName: 'John',
  lastName: 'Doe',
  role: UserRole.USER,
  status: Status.ACTIVE,
  emailVerified: true,
  createdAt: new Date(),
  updatedAt: new Date(),
};

Available Types

Common Types

  • Status - Entity status enum (ACTIVE, INACTIVE, PENDING, etc.)
  • Environment - Environment type enum (DEVELOPMENT, STAGING, PRODUCTION)
  • PaginationParams - Parameters for paginated requests
  • PaginatedResponse<T> - Generic paginated response
  • ApiResponse<T> - Generic API response
  • ErrorResponse - Error response structure
  • SuccessResponse<T> - Success response structure
  • TimestampFields - Common timestamp fields

User Types

  • UserRole - User role enum (ADMIN, USER, INSTRUCTOR)
  • UserSettings - User preferences and settings
  • User - User entity
  • CreateUserPayload - User creation payload
  • UpdateUserPayload - User update payload

Authentication Types

  • LoginPayload - Login request payload
  • RegisterPayload - Registration request payload
  • AuthResponse - Authentication response
  • RefreshTokenPayload - Token refresh payload
  • ResetPasswordPayload - Password reset payload
  • VerifyEmailPayload - Email verification payload

Development

Setup

# Install dependencies
yarn install

# Build the package
yarn build

# Run tests
yarn test

# Run type checking
yarn typecheck

# Run linting
yarn lint

Testing

Tests are written using Jest. Run them with:

# Run tests once
yarn test

# Run tests in watch mode
yarn test:watch

Building

The package is built using tsup. Build commands:

# Build once
yarn build

# Build in watch mode
yarn dev

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This package is private and for use within TJOC platform only.