fix: build TypeScript — moduleResolution Bundler + casts API — 117/117 tests

This commit is contained in:
Hermann_Kitio 2026-04-17 00:53:31 +03:00
parent 5b82c6bd46
commit dd2dfaa662
5 changed files with 19 additions and 12 deletions

View file

@ -100,7 +100,7 @@
### TD-14 — Erreurs TypeScript TS2835 pré-existantes ### TD-14 — Erreurs TypeScript TS2835 pré-existantes
**Priorité :** 🟡 Important **Priorité :** 🟡 Important
**Statut :** Ouvert **Statut :** Résolu — session correction build TypeScript
**Description :** Erreurs TS2835 sur plusieurs fichiers de routes. **Description :** Erreurs TS2835 sur plusieurs fichiers de routes.
Non bloquant (tests verts) mais à corriger. Non bloquant (tests verts) mais à corriger.
Gate de qualité actuel : npm run test. Gate de qualité actuel : npm run test.
@ -161,3 +161,4 @@ Gate de qualité actuel : npm run test.
|---|---|---|---| |---|---|---|---|
| TD-02 | planController.ts complété | 2026-04-16 | Session Stripe | | TD-02 | planController.ts complété | 2026-04-16 | Session Stripe |
| TD-03 | stripe.ts complété | 2026-04-16 | Session Stripe | | TD-03 | stripe.ts complété | 2026-04-16 | Session Stripe |
| TD-14 | Erreurs TS2835 + TS18046 + TS7053 corrigées | 2026-04-17 | Session build Render |

View file

@ -87,7 +87,9 @@ export async function correctEE(contenu: string, tache: string): Promise<EERappo
throw new Error(`DeepSeek API error: ${response.status} ${response.statusText}`) throw new Error(`DeepSeek API error: ${response.status} ${response.statusText}`)
} }
const data = await response.json() const data = (await response.json()) as {
choices?: { message?: { content?: string } }[]
}
const content = data.choices?.[0]?.message?.content const content = data.choices?.[0]?.message?.content
if (!content) { if (!content) {
@ -160,7 +162,9 @@ export async function correctEO(transcript: string, tache: string): Promise<EORa
throw new Error(`DeepSeek API error: ${response.status} ${response.statusText}`) throw new Error(`DeepSeek API error: ${response.status} ${response.statusText}`)
} }
const data = await response.json() const data = (await response.json()) as {
choices?: { message?: { content?: string } }[]
}
const content = data.choices?.[0]?.message?.content const content = data.choices?.[0]?.message?.content
if (!content) { if (!content) {

View file

@ -27,7 +27,9 @@ export async function transcribeAudio(
throw new Error(`Gemini API error: ${response.status} ${response.statusText}`) throw new Error(`Gemini API error: ${response.status} ${response.statusText}`)
} }
const data = await response.json() const data = (await response.json()) as {
candidates?: { content?: { parts?: { text?: string }[] } }[]
}
const text = data.candidates?.[0]?.content?.parts?.[0]?.text const text = data.candidates?.[0]?.content?.parts?.[0]?.text
if (!text || typeof text !== 'string' || text.trim().length === 0) { if (!text || typeof text !== 'string' || text.trim().length === 0) {

View file

@ -1,6 +1,6 @@
import type { Context, Next } from 'hono' import type { Context, Next } from 'hono'
import { getPlanPermissions } from '../lib/access' import { checkFeatureAccess, getPlanPermissions } from '../lib/access'
import type { Feature } from '../lib/access' import type { Feature, Plan } from '../lib/access'
import type { AppVariables } from './auth' import type { AppVariables } from './auth'
/** /**
@ -12,9 +12,9 @@ export function planMiddleware(feature: Feature) {
return async (c: Context<{ Variables: AppVariables }>, next: Next) => { return async (c: Context<{ Variables: AppVariables }>, next: Next) => {
const profile = c.get('profile') const profile = c.get('profile')
let perms: ReturnType<typeof getPlanPermissions> const plan = profile.plan as Plan
try { try {
perms = getPlanPermissions(profile.plan as 'free' | 'standard' | 'premium') getPlanPermissions(plan)
} catch { } catch {
return c.json( return c.json(
{ {
@ -26,7 +26,7 @@ export function planMiddleware(feature: Feature) {
) )
} }
if (!perms[feature]) { if (!checkFeatureAccess(plan, feature)) {
return c.json( return c.json(
{ {
error: true, error: true,

View file

@ -1,8 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2022", "target": "ES2022",
"module": "NodeNext", "module": "ESNext",
"moduleResolution": "NodeNext", "moduleResolution": "Bundler",
"lib": ["ES2022"], "lib": ["ES2022"],
"outDir": "./dist", "outDir": "./dist",
"rootDir": "./src", "rootDir": "./src",
@ -16,5 +16,5 @@
"sourceMap": true "sourceMap": true
}, },
"include": ["src/**/*"], "include": ["src/**/*"],
"exclude": ["node_modules", "dist"] "exclude": ["node_modules", "dist", "src/**/__tests__/**", "**/*.test.ts"]
} }