Skip to content

Commit 03c7a0c

Browse files
committed
fix: remove unnecessary non-null assertions after .default([]) revert
1 parent 8c5cdfe commit 03c7a0c

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/cli/operations/deploy/__tests__/post-deploy-config-bundles.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ describe('resolveConfigBundleComponentKeys', () => {
537537
});
538538

539539
const result = resolveConfigBundleComponentKeys(spec, deployedState, 'target1');
540-
const keys = Object.keys(result.configBundles![0]!.components);
540+
const keys = Object.keys(result.configBundles[0]!.components);
541541
expect(keys).toEqual(['arn:aws:bedrock-agentcore:us-east-1:123:runtime/rt-1']);
542542
});
543543

@@ -550,7 +550,7 @@ describe('resolveConfigBundleComponentKeys', () => {
550550
});
551551

552552
const result = resolveConfigBundleComponentKeys(spec, deployedState, 'target1');
553-
const keys = Object.keys(result.configBundles![0]!.components);
553+
const keys = Object.keys(result.configBundles[0]!.components);
554554
expect(keys).toEqual(['arn:aws:bedrock-agentcore:us-east-1:123:gateway/gw-1']);
555555
});
556556

@@ -563,7 +563,7 @@ describe('resolveConfigBundleComponentKeys', () => {
563563
});
564564

565565
const result = resolveConfigBundleComponentKeys(spec, deployedState, 'target1');
566-
const keys = Object.keys(result.configBundles![0]!.components);
566+
const keys = Object.keys(result.configBundles[0]!.components);
567567
expect(keys).toEqual(['arn:mcp:gw:resolved']);
568568
});
569569

@@ -574,7 +574,7 @@ describe('resolveConfigBundleComponentKeys', () => {
574574
const deployedState = makeDeployedState('target1', { runtimes: {} });
575575

576576
const result = resolveConfigBundleComponentKeys(spec, deployedState, 'target1');
577-
const keys = Object.keys(result.configBundles![0]!.components);
577+
const keys = Object.keys(result.configBundles[0]!.components);
578578
expect(keys).toEqual(['arn:existing:key']);
579579
});
580580

@@ -585,7 +585,7 @@ describe('resolveConfigBundleComponentKeys', () => {
585585
const deployedState = makeDeployedState('target1', { runtimes: {} });
586586

587587
const result = resolveConfigBundleComponentKeys(spec, deployedState, 'target1');
588-
const keys = Object.keys(result.configBundles![0]!.components);
588+
const keys = Object.keys(result.configBundles[0]!.components);
589589
expect(keys).toEqual(['some-plain-key']);
590590
});
591591

@@ -629,9 +629,9 @@ describe('resolveConfigBundleComponentKeys', () => {
629629

630630
const result = resolveConfigBundleComponentKeys(spec, deployedState, 'target1');
631631
// Original should still have the placeholder
632-
expect(Object.keys(spec.configBundles![0]!.components)).toEqual(['{{runtime:my-rt}}']);
632+
expect(Object.keys(spec.configBundles[0]!.components)).toEqual(['{{runtime:my-rt}}']);
633633
// Result should have the resolved key
634-
expect(Object.keys(result.configBundles![0]!.components)).toEqual(['arn:resolved']);
634+
expect(Object.keys(result.configBundles[0]!.components)).toEqual(['arn:resolved']);
635635
});
636636

637637
it('prefers HTTP gateway over MCP gateway when both exist with same name', () => {
@@ -644,7 +644,7 @@ describe('resolveConfigBundleComponentKeys', () => {
644644
});
645645

646646
const result = resolveConfigBundleComponentKeys(spec, deployedState, 'target1');
647-
const keys = Object.keys(result.configBundles![0]!.components);
647+
const keys = Object.keys(result.configBundles[0]!.components);
648648
// HTTP gateway should take precedence (checked first in code)
649649
expect(keys).toEqual(['arn:http:gw']);
650650
});

src/cli/primitives/ABTestPrimitive.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export class ABTestPrimitive extends BasePrimitive<AddABTestOptions, RemovableAB
7878
return { success: false, error: `AB test "${testName}" not found.` };
7979
}
8080

81-
const removedTest = project.abTests![index]!;
82-
project.abTests!.splice(index, 1);
81+
const removedTest = project.abTests[index]!;
82+
project.abTests.splice(index, 1);
8383

8484
// Cascade: remove auto-created online eval configs for target-based tests
8585
// Only remove eval configs that were auto-created (matching the {testName}_eval_ prefix pattern)

src/cli/primitives/ConfigBundlePrimitive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class ConfigBundlePrimitive extends BasePrimitive<AddConfigBundleOptions,
5050
return { success: false, error: `Configuration bundle "${bundleName}" not found.` };
5151
}
5252

53-
project.configBundles!.splice(index, 1);
53+
project.configBundles.splice(index, 1);
5454
await this.writeProjectSpec(project);
5555

5656
return { success: true };

0 commit comments

Comments
 (0)