Shared TypeScript types and empty constants for ss e-commerce backend and frontend
npm install @davidmashadow/ss-ecommerce-typesbash
npm install @your-org/shared-types
`
Usage
`typescript
import {
User,
EMPTY_USER,
ApiResponse,
createEmptyApiResponse
} from '@your-org/shared-types';
// Use types
const user: User = {
id: '123',
email: 'test@example.com',
firstName: 'John',
lastName: 'Doe',
createdAt: new Date(),
updatedAt: new Date(),
};
// Use empty constants for initialization
const emptyUser = { ...EMPTY_USER };
// Use generic API response
const response: ApiResponse = createEmptyApiResponse();
`
Development
`bash
Install dependencies
npm install
Build
npm run build
`
Publishing
1. Update the package name in package.json (replace @your-org with your npm org/username)
2. Login to npm: npm login
3. Publish: npm publish --access public
Project Structure
`
src/
├── index.ts # Main entry point
└── types/
├── index.ts # Types barrel export
├── user.types.ts # User related types & constants
└── api.types.ts # API related types & constants
`
Adding New Types
1. Create a new file in src/types/ (e.g., product.types.ts)
2. Define your interfaces and empty constants
3. Export from src/types/index.ts
4. Run npm run build` to compile