code quality
This commit is contained in:
@@ -92,16 +92,16 @@ describe('ApplicationErrorCode', () => {
|
||||
// This test verifies the type compatibility
|
||||
type MyErrorCodes = 'USER_NOT_FOUND' | 'VALIDATION_ERROR' | 'PERMISSION_DENIED';
|
||||
|
||||
const userNotFound: ApplicationErrorCode<'USER_NOT_FOUND'> = {
|
||||
const userNotFound: ApplicationErrorCode<MyErrorCodes> = {
|
||||
code: 'USER_NOT_FOUND'
|
||||
};
|
||||
|
||||
const validationError: ApplicationErrorCode<'VALIDATION_ERROR', { field: string }> = {
|
||||
const validationError: ApplicationErrorCode<MyErrorCodes, { field: string }> = {
|
||||
code: 'VALIDATION_ERROR',
|
||||
details: { field: 'email' }
|
||||
};
|
||||
|
||||
const permissionError: ApplicationErrorCode<'PERMISSION_DENIED', { resource: string }> = {
|
||||
const permissionError: ApplicationErrorCode<MyErrorCodes, { resource: string }> = {
|
||||
code: 'PERMISSION_DENIED',
|
||||
details: { resource: 'admin-panel' }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user