refactor(types): eliminate explicit any casts across components (F3.3)
Extend ComponentModelPiece/Product with optional typePiece/typeProduct nested objects. Replace 12 'as any' casts in assignment node, convert Promise<any> to Promise<unknown>, use Record<string, unknown> at API boundaries. ~15 casts eliminated. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ export interface ComponentModelCustomField {
|
||||
export interface ComponentModelPiece {
|
||||
typePieceId?: string
|
||||
typePieceLabel?: string
|
||||
typePiece?: { id?: string; name?: string; code?: string } | null
|
||||
reference?: string
|
||||
familyCode?: string
|
||||
role?: string
|
||||
@@ -25,6 +26,7 @@ export interface ComponentModelPiece {
|
||||
export interface ComponentModelProduct {
|
||||
typeProductId?: string
|
||||
typeProductLabel?: string
|
||||
typeProduct?: { id?: string; name?: string; code?: string } | null
|
||||
reference?: string
|
||||
familyCode?: string
|
||||
role?: string
|
||||
@@ -33,6 +35,7 @@ export interface ComponentModelProduct {
|
||||
export interface ComponentModelStructureNode {
|
||||
typeComposantId?: string
|
||||
typeComposantLabel?: string
|
||||
typeComposant?: { id?: string; name?: string }
|
||||
modelId?: string
|
||||
familyCode?: string
|
||||
alias?: string
|
||||
@@ -151,8 +154,8 @@ const validatePiece = (
|
||||
const typePieceId = ensureString(value.typePieceId)
|
||||
const typePieceLabel = ensureString(value.typePieceLabel)
|
||||
const reference = ensureString(value.reference)
|
||||
const familyCode = ensureString((value as any).familyCode)
|
||||
const role = ensureString((value as any).role)
|
||||
const familyCode = ensureString(value.familyCode)
|
||||
const role = ensureString(value.role)
|
||||
|
||||
if (!typePieceId && !typePieceLabel && !reference && !familyCode) {
|
||||
issues.push(`${path}: au moins un identifiant, une famille ou une référence de pièce est requis`)
|
||||
@@ -184,8 +187,8 @@ const validateStructureNode = (
|
||||
const familyCode = ensureString(value.familyCode)
|
||||
const alias = ensureString(value.alias)
|
||||
|
||||
const rawSubcomponents = Array.isArray((value as any).subcomponents)
|
||||
? (value as any).subcomponents
|
||||
const rawSubcomponents = Array.isArray(value.subcomponents)
|
||||
? value.subcomponents
|
||||
: []
|
||||
|
||||
const subcomponents: ComponentModelStructureNode[] = []
|
||||
|
||||
Reference in New Issue
Block a user