Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@types/git-url-parse": "^9.0.3",
"@types/jest": "^29.5.14",
"@types/js-yaml": "^4.0.9",
"@types/node": "22.15.30",
"@types/node": "26.1.0",
"@types/yargs": "^17.0.33",
"aws-cdk": "2.1110.0",
"aws-cdk-lib": "2.241.0",
Expand All @@ -51,7 +51,7 @@
"ts-jest": "^29.4.9",
"ts-node": "^10.9.2",
"typedoc": "^0.28.19",
"typescript": "5.1.6"
"typescript": "5.9.3"
Comment thread
jorgeazevedo marked this conversation as resolved.
},
"dependencies": {
"@aws-sdk/client-ec2": "^3.1034.0",
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class GuStack extends Stack implements StackStageIdentity {
return this.node
.findAll()
.filter((construct) => construct instanceof CfnParameter)
.reduce((acc, param) => ({ ...acc, [param.node.id]: param as CfnParameter }), {});
.reduce((acc, param) => ({ ...acc, [param.node.id]: param }), {});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akash1810 upgrading the typescript version has been on our radar for a while (https://app.asana.com/1/1210045093164357/project/1214113788426225/task/1214114210834985) I had a go with an AI agent and it appears the code change we need is a nice simplification: we no longer need to cast these types. What do you reckon? Is a green CI build here sufficient to know it's good? Can this cause problems to clients or anything like that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh perfect! Removing this cast is preferable; the function's return type should be enough as should the instanceof in the previous filter.

}

// eslint-disable-next-line custom-rules/valid-constructors -- GuStack is the exception as it must take an App
Expand Down
8 changes: 4 additions & 4 deletions src/riff-raff-yaml-file/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ function validateAllRegionsAreResolved(regions: Region[]): void {
}

function getLambdas(cdkStack: GuStack): GuLambdaFunction[] {
return cdkStack.node.findAll().filter((_) => _ instanceof GuLambdaFunction) as GuLambdaFunction[];
return cdkStack.node.findAll().filter((_) => _ instanceof GuLambdaFunction);
}

function getAutoScalingGroups(cdkStack: GuStack): GuAutoScalingGroup[] {
return cdkStack.node.findAll().filter((_) => _ instanceof GuAutoScalingGroup) as GuAutoScalingGroup[];
return cdkStack.node.findAll().filter((_) => _ instanceof GuAutoScalingGroup);
}

function getGuStackDependencies(cdkStack: GuStack): GuStack[] {
return cdkStack.dependencies.filter((_) => _ instanceof GuStack) as GuStack[];
return cdkStack.dependencies.filter((_) => _ instanceof GuStack);
}

interface MissingStack {
Expand Down Expand Up @@ -122,7 +122,7 @@ export class RiffRaffYamlFile {

// eslint-disable-next-line custom-rules/valid-constructors -- this needs to sit above GuStack on the cdk tree
constructor(app: App) {
const allCdkStacks = app.node.findAll().filter((_) => _ instanceof GuStack) as GuStack[];
const allCdkStacks = app.node.findAll().filter((_) => _ instanceof GuStack);
const allRegions = Array.from(new Set(allCdkStacks.map((_) => _.region)));

validateAllRegionsAreResolved(allRegions);
Expand Down