Use Frappe with TypeScript
mainThe library provides built-in type support. You can pass a generic type to methods like updateDoc<T> to enforce schema.
Additionally, all document responses are returned as an intersection of the specified type and the FrappeDoc<T> type, which includes standard Frappe fields:
name: Primary keyowner: Creatorcreation: ISO timestampmodified: ISO timestampmodified_by: Last modifierdocstatus: 0 (Saved), 1 (Submitted), 2 (Cancelled)idx: Index
interface TestDoc {
test_field: string;
}
// Enforcing types on database calls
db.updateDoc<TestDoc>('My Custom DocType', 'Test', {
test_field: 'This is an updated test field.',
});