Skip to content

Updated typescript template generator to use Models.DocumentBase #1113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bdblaere
Copy link

@bdblaere bdblaere commented Jul 20, 2025

What does this PR do?

The appwrite-cli type generation for TypeScript defined a Document type as:

import { Models } from 'appwrite';

export type Books = Models.Document & {
  name: string;
  author: string;
  releaseYear: string | null;
  ...
}

However, by extending Models.Document, the [key: string]: any still allows attributes that don't exist.

To solve this, PR appwrite/appwrite#10171 adds the DocumentBase type that defines the default attributes of a Document.

The type-generator can then use this type to define the specific types for the collections.

Test Plan

Did not write any tests (yet); Let me know if you think this is needed.

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

yes

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.

1 participant