fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use non-null assertions in for loops and Array/ReadonlyArray syntax

- Replaced unnecessary null checks with non-null assertions (!) in for loops accessing array items
- Changed all [] type syntax to Array<T> or ReadonlyArray<T> format for consistency

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>

+8 -14
+4 -7
packages/openapi-ts/src/openApi/3.0.x/parser/schema.ts
··· 91 91 context: Context; 92 92 discriminator: NonNullable<SchemaObject['discriminator']>; 93 93 schemaRef: string; 94 - }): string[] => { 95 - const values: string[] = []; 94 + }): Array<string> => { 95 + const values: Array<string> = []; 96 96 97 97 // Check each entry in the discriminator mapping 98 98 for (const [value, mappedSchemaRef] of Object.entries( ··· 405 405 isRequired: boolean; 406 406 values: ReadonlyArray<string>; 407 407 }; 408 - const discriminatorsToAdd: DiscriminatorInfo[] = []; 408 + const discriminatorsToAdd: Array<DiscriminatorInfo> = []; 409 409 const addedDiscriminators = new Set<string>(); 410 410 411 411 for (const compositionSchema of compositionSchemas) { ··· 527 527 // The inline schema should be the last non-$ref item in schemaItems 528 528 let inlineSchema: IR.SchemaObject | undefined; 529 529 for (let i = schemaItems.length - 1; i >= 0; i--) { 530 - const item = schemaItems[i]; 531 - if (!item) { 532 - continue; 533 - } 530 + const item = schemaItems[i]!; 534 531 // Check if this is not a $ref schema by looking for properties or checking if it came from an inline schema 535 532 if (item.type === 'object' || item.properties) { 536 533 inlineSchema = item;
+4 -7
packages/openapi-ts/src/openApi/3.1.x/parser/schema.ts
··· 95 95 context: Context; 96 96 discriminator: NonNullable<SchemaObject['discriminator']>; 97 97 schemaRef: string; 98 - }): string[] => { 99 - const values: string[] = []; 98 + }): Array<string> => { 99 + const values: Array<string> = []; 100 100 101 101 // Check each entry in the discriminator mapping 102 102 for (const [value, mappedSchemaRef] of Object.entries( ··· 487 487 isRequired: boolean; 488 488 values: ReadonlyArray<string>; 489 489 }; 490 - const discriminatorsToAdd: DiscriminatorInfo[] = []; 490 + const discriminatorsToAdd: Array<DiscriminatorInfo> = []; 491 491 const addedDiscriminators = new Set<string>(); 492 492 493 493 for (const compositionSchema of compositionSchemas) { ··· 608 608 // The inline schema should be the last non-$ref item in schemaItems 609 609 let inlineSchema: IR.SchemaObject | undefined; 610 610 for (let i = schemaItems.length - 1; i >= 0; i--) { 611 - const item = schemaItems[i]; 612 - if (!item) { 613 - continue; 614 - } 611 + const item = schemaItems[i]!; 615 612 // Check if this is not a $ref schema by looking for properties or checking if it came from an inline schema 616 613 if (item.type === 'object' || item.properties) { 617 614 inlineSchema = item;