Skip to content

Conversation

mdex-geek
Copy link

@mdex-geek mdex-geek commented Sep 8, 2025

What does this PR do?
This PR fixes the issue appwrite/sdk-for-cli#185 by correcting the code implementation. The changes ensure the expected behavior without altering any other parts of the CLI.

Test Plan
I manually verified the fix by running the CLI after applying the changes and confirmed that it works as intended. No automated test cases were added for this change.

Related PRs and Issues
Resolves appwrite/sdk-for-cli#185.

Have you read the Contributing Guidelines on issues?
Yes.

Summary by CodeRabbit

  • Refactor
    • Updated generated TypeScript code to use type-only imports for model types. This reduces runtime overhead, improves tree-shaking, and can lead to smaller bundles.
    • Enhances compatibility with modern TypeScript tooling and ESM/CJS interop by avoiding unnecessary runtime imports.
    • No functional changes to generated code or APIs; this is a type-level improvement only.

Copy link

coderabbitai bot commented Sep 8, 2025

Walkthrough

Updated the TypeScript code-generation template at templates/cli/lib/type-generation/languages/typescript.js.twig. The getTemplate() output changes the Models import to a type-only import: from `import { type Models } from '${this._getAppwriteDependency()}';` to `import type { Models } from '${this._getAppwriteDependency()}';`. No other parts of the template were modified.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • Failed to retrieve linked issues from the platform client.
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
templates/cli/lib/type-generation/languages/typescript.js.twig (1)

71-73: Confirm TS version floor and consider generator test

  • Sweep found no remaining import { type Models } occurrences in templates.
  • Confirm our documented minimum TypeScript version is ≥ 3.8 across CLI docs/CI.
  • (Optional) Add a small generator test or snapshot asserting the first line equals import type { Models } from '<resolved-dep>'; for both Node and Deno paths.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3b420d and 6e704e3.

📒 Files selected for processing (1)
  • templates/cli/lib/type-generation/languages/typescript.js.twig (1 hunks)
🔇 Additional comments (1)
templates/cli/lib/type-generation/languages/typescript.js.twig (1)

71-73: Correct type-only import in .d.ts — LGTM

Switching to import type { Models } ... is the canonical, side‑effect‑free form for declaration files and works on TS ≥ 3.8. This should resolve the CLI import issue without affecting runtime.

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.

🐛 Bug Report: Biome complains about the TS import rule
1 participant