🔴 CRITICAL: Widespread use of 'any' type bypassing TypeScript safety
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
- #1268 de @Harshit2405-2004 — cerrado sin fusionar
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Refactorización
- Claridad
- Necesita aclaración
- Estado de actividad
- Tranquilo
- Stack tecnológico
- typescript
- Área
- developer-experience
Línea de trabajo
Comienza auditando los archivos enumerados, incluidos packages/api/src/cloneArray.ts, packages/api/src/EmbeddedChatApi.ts, packages/auth/src/RocketChatAuth.ts, packages/auth/src/Api.ts y packages/rc-app/lib/getCallbackContent.ts; después, localiza las apariciones restantes. Revisa las estructuras de datos existentes y la configuración de TypeScript de los paquetes antes de cambiar las firmas. Se considera terminado cuando se hayan abordado los usos de any reportados, las rutas críticas estén tipadas y las comprobaciones estrictas propuestas puedan habilitarse sin errores de tipos sin resolver.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🔴 CRITICAL Type Safety Issue
Severity: CRITICAL
Type: TypeScript Type Safety / Code Quality
Impact: Runtime Errors / Broken Refactoring
📍 Scope
30+ occurrences of any type across the codebase, bypassing TypeScript's type safety.
Affected Files (sample):
packages/api/src/cloneArray.ts:1packages/api/src/EmbeddedChatApi.ts:16-20packages/auth/src/RocketChatAuth.ts:11packages/auth/src/Api.ts:7, 33-34packages/rc-app/lib/getCallbackContent.ts:1- And 25+ more files
🔥 Problem Description
Extensive use of any type eliminates TypeScript's core benefits:
- No compile-time type checking
- No IDE autocomplete
- No refactoring safety
- Runtime errors in production
Examples:
// Example 1: cloneArray - No type safety
const cloneArray = (array: any[]): any[] => [...array];
// Example 2: EmbeddedChatApi constructor - Callbacks not typed
constructor(
host: string,
rid: string,
{ getAuth, setAuth }: any, // No type checking
) {}
// Example 3: Message callbacks - Structure unknown
onMessage(callback: (message: any) => void) {
// Caller has no idea what message contains
}
// Example 4: RocketChatAuth - User shape unknown
currentUser: any = null;
💥 Impact
- No IDE autocomplete - Developers don't know available properties
- Runtime errors - Type mismatches caught only in production
- Broken refactoring - Renaming fields doesn't update all usages
- Impossible to trace data flow - No way to understand message structure
Example Runtime Error:
onMessage((message: any) => {
console.log(message.user.name); // Runtime error if user is undefined
});
✅ Recommended Fix
Define proper interfaces and use generic types:
// Define message interface
interface MessageData {
_id: string;
rid: string;
msg: string;
ts: Date;
u: {
_id: string;
username: string;
name?: string;
};
attachments?: Attachment[];
[key: string]: unknown; // Allow additional fields
}
// Fix cloneArray with generics
const cloneArray = <T extends Record<string, unknown>>(array: T[]): T[] => {
return [...array];
};
// Fix auth callbacks
interface AuthCallbacks {
getAuth: () => AuthToken | null;
setAuth: (token: AuthToken) => void;
}
constructor(
host: string,
rid: string,
callbacks: AuthCallbacks,
) {}
// Fix message callback
onMessage(callback: (message: MessageData) => void) {
// Now type-safe
}
// Fix currentUser
interface UserData {
_id: string;
username: string;
name?: string;
roles: string[];
// ... other fields
}
currentUser: UserData | null = null;
🎯 Action Items
- Define core interfaces (MessageData, UserData, AuthToken, etc.)
- Replace
anyin critical paths (EmbeddedChatApi, RocketChatAuth) - Update function signatures with proper types
- Add generic constraints where appropriate
- Enable strict TypeScript checks
- Audit remaining
anyusage
📝 Implementation Strategy
Phase 1 (Week 1): Type critical paths
- EmbeddedChatApi methods
- RocketChatAuth core methods
- Message handling callbacks
Phase 2 (Week 2): Type remaining packages
- Auth package
- RC-app package
- API utilities
Phase 3 (Ongoing): Enable strict mode
noImplicitAny: truestrictNullChecks: true
⏱️ Timeline
Start: Immediately
Complete Critical Paths: 1 week
Full Resolution: 2-3 weeks
Priority: P0 - Critical Code Quality
Discovered by: Automated codebase security analysis
Date: April 5, 2026
- Lenguaje dominante
- JavaScript
- Estrellas
- 171
- Forks
- 421
- Merge medio
- 3 d 6 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de RocketChat/EmbeddedChat
-
Bug: username fallback in updateUserUsername never runs since the ddp-client migrationPosiblemente ocupada @MuhammadFaizan-prog la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
RocketChat/EmbeddedChat#1489 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: Low contrast on color swatch borders in Theme Lab (Layout Editor)Posiblemente ocupada @yashsarvaiya45 la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
RocketChat/EmbeddedChat#1486 ·
Los mantenedores suelen responder en 1 día
-
bug(api): _doConnect swallows connection/auth errors and marks failed sessions as authenticatedPosiblemente ocupada @ashwanisingh011 la tomó hace 1 día. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
RocketChat/EmbeddedChat#1484 ·
Los mantenedores suelen responder en 1 día
-
Bug: White screen crash (`Cannot read properties of undefined (reading 'members')`) when rendering UserMention outside MarkupInteractionContextPosiblemente ocupada @swarnendusahu10-dotcom la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
RocketChat/EmbeddedChat#1482 ·
Los mantenedores suelen responder en 1 día
-
Bug: UIKit PreviewBlock cover image tiles repeatedly and stretches across viewport when zoomed outPosiblemente ocupada @swarnendusahu10-dotcom la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
RocketChat/EmbeddedChat#1480 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de RocketChat/EmbeddedChat
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Life-Framework/Life-Framework#7017 ·
Los mantenedores suelen responder en 1 día
-
e/DevOps enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Accenture/sfmc-devtools#2795 ·
Los mantenedores suelen responder en 1 día
-
agent/guide documentation help wanted stage/010-actionable
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
kubestellar/console-kb#4003 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
FilOzone/synapse-sdk#1201 · 1 comentario ·
Los mantenedores suelen responder en 1 día