Skip to content

Refactor(api): Remove "any" type casting in PriceModule (Price.ts) #133

Description

@Abhishek-singh88

Describe the Bug

While exploring the API codebase, I noticed there are a few TODO comments left in the PriceModule (apps/api/src/modules/Price.ts) regarding the removal of any casts when creating/updating a Price object.

Specifically around these lines when parsing the input:

  • currency_options: (input.currency_options as any) ?? null
  • tiers: (input.tiers as any) ?? null
  • validatedUpdate as Partial<PriceType>

To Reproduce

N/A - This is a codebase typing/tech-debt issue rather than a runtime bug.

Expected Behavior

We should strictly type these properties (likely by aligning the CreatePriceInput schema with the PriceType interface) so that we can remove the any and Partial casting, allowing the TypeScript compiler to properly enforce type safety here.

Actual Behavior

Currently, type safety is bypassed in these instances via manual type casting.

Environment

  • OS: Linux
  • Node.js Version: 20.x
  • Browser: N/A
  • Zoneless Version/Commit: main branch

Logs

N/A

Checklist

  • I have searched existing issues to ensure this bug hasn't been reported
  • I have provided all the requested information

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions