asgardeo / asgardeo/javascript

chore: add TypeScript `Strict Mode` Support for the packages

Abierto
#142 17 comentarios 0 reacciones 0 asignados Ver en GitHub
@asgardeo/browser @asgardeo/javascript @asgardeo/nextjs @asgardeo/node @asgardeo/react Complexity/Medium Type/Improvement typings
Lenguaje dominante
TypeScript
Estrellas
18
Forks
67
Merge medio
4 h 6 min
PR fusionados (30 d)
13

Descripción

### Current Limitation

Currently, TypeScript strict mode is not consistently enabled across all packages in the monorepo. This leads to:

- Potential runtime errors that could be caught at compile time
- Implicit `any` types that reduce type safety
- Missing null/undefined checks that could cause runtime issues
- Inconsistent type checking standards across different packages
- Reduced developer experience due to less precise type inference

Without strict mode enabled, the codebase may contain:
- Functions with implicit return type `any`
- Variables that could be `null` or `undefined` without proper checks
- Less strict function parameter checking
- Weaker type checking for object property access

### Suggested Improvement

Enable TypeScript strict mode across all packages and fix related type issues:

## Implementation Plan

> [!NOTE]
> Start with the following order:
> 1. @asgardeo/javascript
> 2. @asgardeo/browser
> 3. @asgardeo/react
> 4. @asgardeo/node
> 5. @asgardeo/nextjs

1. **Enable strict mode in tsconfig.json files**
- Add `"strict": true` to all package-level `tsconfig.json` files
- Ensure consistent strict mode configuration across the monorepo

2. **Fix type errors systematically**
- Address implicit `any` types by adding proper type annotations
- Add null/undefined checks where needed using optional chaining and nullish coalescing
- Fix function return type annotations
- Resolve strict property initialization issues

3. **Update build process**
- Ensure CI/CD pipeline fails on strict mode violations
- Update lint rules to complement strict mode checks

4. **Documentation updates**
- Update contributing guidelines to mention strict mode requirements
- Add examples of proper typing patterns

## Files to be updated
- `packages/*/tsconfig.json` - Enable strict mode
- Various `*.ts` and `*.tsx` files - Fix type issues
- CI configuration - Ensure strict checking in build pipeline]

### Please select the package issue is related to

@asgardeo/express, @asgardeo/browser, @asgardeo/javascript, @asgardeo/nextjs, @asgardeo/node, @asgardeo/nuxt, @asgardeo/react, @asgardeo/react-router, @asgardeo/vue

### Version

current

### Reporter Checklist

- [x] I have searched the existing issues and this is not a duplicate.
- [x] I have provided all the necessary information.
- [x] I have verified the improvement is not available in the latest version of the package.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con el tsconfig.json a nivel de paquete de @asgardeo/javascript, luego sigue el orden de paquetes indicado e inspecciona los archivos *.ts y *.tsx afectados. Habilita el modo strict, resuelve los problemas de tipos resultantes, actualiza la documentación de CI y de contribución, y verifica que todos los paquetes pasen la comprobación strict.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
build-system, ci-cd, developer-experience, tooling
Tipo de issue
Refactorización
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.