11import { ConfigIO , SecureCredentials } from '../../../lib' ;
2+ import type { DeployedState } from '../../../schema' ;
23import { AwsCredentialsError , validateAwsCredentials } from '../../aws/account' ;
34import { type CdkToolkitWrapper , type SwitchableIoHost , createSwitchableIoHost } from '../../cdk/toolkit-lib' ;
45import { getErrorMessage , isExpiredTokenError , isNoCredentialsError } from '../../errors' ;
@@ -640,9 +641,9 @@ export function useCdkPreflight(options: PreflightOptions): PreflightResult {
640641 if ( Object . keys ( deployedCredentials ) . length > 0 ) {
641642 const configIO = new ConfigIO ( ) ;
642643 const target = context . awsTargets [ 0 ] ;
643- const existingState = await configIO . readDeployedState ( ) . catch ( ( ) => ( { targets : { } } as any ) ) ;
644+ const existingState = await configIO . readDeployedState ( ) . catch ( ( ) => ( { targets : { } } as DeployedState ) ) ;
644645 const targetState = existingState . targets ?. [ target ! . name ] ?? { resources : { } } ;
645- if ( ! targetState . resources ) targetState . resources = { } ;
646+ targetState . resources ?? = { } ;
646647 targetState . resources . credentials = deployedCredentials ;
647648 if ( identityResult . kmsKeyArn ) targetState . resources . identityKmsKeyArn = identityResult . kmsKeyArn ;
648649 await configIO . writeDeployedState ( {
@@ -659,7 +660,7 @@ export function useCdkPreflight(options: PreflightOptions): PreflightResult {
659660 logger . startStep ( 'Synthesize CloudFormation' ) ;
660661 try {
661662 const synthResult = await synthesizeCdk ( context . cdkProject , {
662- ioHost : switchableIoHost ! . ioHost ,
663+ ioHost : switchableIoHost . ioHost ,
663664 previousWrapper : wrapperRef . current ,
664665 } ) ;
665666 wrapperRef . current = synthResult . toolkitWrapper ;
@@ -680,7 +681,7 @@ export function useCdkPreflight(options: PreflightOptions): PreflightResult {
680681 const bootstrapCheck = await checkBootstrapNeeded ( context . awsTargets ) ;
681682 if ( bootstrapCheck . needsBootstrap && bootstrapCheck . target ) {
682683 setBootstrapContext ( {
683- toolkitWrapper : wrapperRef . current ! ,
684+ toolkitWrapper : wrapperRef . current ,
684685 target : bootstrapCheck . target ,
685686 } ) ;
686687 setPhase ( 'bootstrap-confirm' ) ;
0 commit comments