@anygridtech/frappe-types
v2.1.1
Published
TypeScript type definitions for Frappe
Downloads
43
Readme
📝 Table of Contents
- About
- What’s Included?
- Getting Started
- Installation
- Setup
- Usage
- Deployment
- Built Using
- Contributing
- Authors
- Acknowledgments
🧐 About
The Frappe Framework offers a powerful client-side API — but it’s built around plain JavaScript, which comes with common issues:
- ❌ Typing mistakes (e.g.
frm.doc.customer_namevsfrm.doc.customer_nam) - ❌ No clarity on the shape of API responses
- ❌ Fragile code during refactors
- ❌ Poor autocomplete and inline documentation
With @anygridtech/frappe-types, you get:
- ✅ Accurate autocompletion
- ✅ Compile-time error checking
- ✅ Inline documentation support
- ✅ Improved code maintainability and developer experience
📦 What’s Included?
Type definitions for commonly used global objects:
frappe:frappe.call,frappe.db,frappe.ui.form,frappe.msgprint, etc.cur_frm: The current form object (cur_frm.doc,cur_frm.set_value, etc.)__: Translation function- Utilities:
msgprint,cstr,flt, etc.
🧩 The list is continuously expanding as new globals and patterns are added.
🏁 Getting Started
These instructions will help you set up the package in a TypeScript project.
Prerequisites
Make sure your project is configured for TypeScript:
npm install typescript
npx tsc --init📥 Installation
Install as a dev dependency:
# npm
npm install --save-dev @anygridtech/frappe-types
# yarn
yarn add --dev @anygridtech/frappe-types
# pnpm
pnpm add -D @anygridtech/frappe-types⚙️ Setup
This package is designed to work with @anygridtech/frappe-ts-tools. You must set up frappe-ts-tools first:
👉 Follow @anygridtech/frappe-ts-tools Setup Instructions
The frappe-ts-tools package handles all TypeScript compilation and build configuration automatically.
🎈 Usage
After setup, you can use Frappe globals with full TypeScript support:
frappe.call({
method: "frappe.client.get",
args: {
doctype: "Customer",
name: "CUST-0001"
},
callback(r) {
console.log(r.message);
}
});🚀 Deployment
This is a type-only package. Just include it in your dev dependencies — no runtime deployment required.
⛏️ Built Using
🤝 Contributing
This project is a community effort.
Contributions are welcome! Open an issue or PR if you find missing or incorrect types.
✍️ Authors
- @anygridtech – Maintainers
- Inspired by @kylelobo – Initial template
🎉 Acknowledgements
- Frappe community for documentation and examples
- Inspiration from open-source type definition projects
