Skip to content

chore: [SVLS-5187] improve typing#669

Merged
ava-silver merged 3 commits intomainfrom
ava.silver/svls-5187/improve-typing
Mar 18, 2026
Merged

chore: [SVLS-5187] improve typing#669
ava-silver merged 3 commits intomainfrom
ava.silver/svls-5187/improve-typing

Conversation

@ava-silver
Copy link
Contributor

@ava-silver ava-silver commented Mar 18, 2026

What does this PR do?

Replaces TypeScript any types with proper type definitions throughout the codebase to improve type safety and code maintainability.

Motivation

The codebase contained numerous any type annotations which bypass TypeScript's type checking system. This refactoring introduces proper type definitions including Record<string, unknown>, specific interfaces, and union types to provide better type safety and developer experience.

Testing Guidelines

Existing tests should continue to pass as this is primarily a type safety improvement without changing runtime behavior. Type checking should now catch more potential issues at compile time.

Additional Notes

Key changes include:

  • Replaced any with Record<string, unknown> for object types
  • Added proper interfaces for CloudFormation resources (CfnResource, StateMachineCfnResource)
  • Created specific types for step function configurations (StepFunctionConfig, StepFunctionLoggingConfig)
  • Improved type guards with proper null checking
  • Used nullish coalescing operator (??) for cleaner default value assignments
  • Added proper type assertions where necessary while maintaining type safety

Minor bug fixes included

  • Fixed stateMachine.Properties.Tags default value: Changed from ??= {} (object) to ??= [] (array), since CloudFormation Tags are arrays of {Key, Value} objects.
  • Fixed isLogsConfig null handling: Added an explicit obj === null check, since typeof null === "object" in JavaScript would previously allow null to pass the type guard.

Types of changes

  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ava-silver ava-silver marked this pull request as ready for review March 18, 2026 13:37
@ava-silver ava-silver requested a review from a team as a code owner March 18, 2026 13:37
@ava-silver ava-silver requested a review from nina9753 March 18, 2026 13:37
@ava-silver ava-silver changed the title [SVLS-5187] improve typing chore: [SVLS-5187] improve typing Mar 18, 2026
Copy link
Contributor

@nina9753 nina9753 left a comment

Choose a reason for hiding this comment

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

The linter just needs to pass

@ava-silver ava-silver merged commit e91ba13 into main Mar 18, 2026
7 checks passed
@ava-silver ava-silver deleted the ava.silver/svls-5187/improve-typing branch March 18, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants