This package provides TypeScript definitions for AnyGrid Tech's custom Frappe application.
It extends @anygridtech/frappe-types to add strong typing for custom DocTypes, client scripts, and server-side methods, enabling a modern, type-safe development workflow.
While @anygridtech/frappe-types provides core types for the Frappe framework, custom applications introduce their own set of DocTypes and APIs. This package bridges that gap for AnyGrid Tech's specific modules.
Developing without it leads to common issues:
- ❌ Typing mistakes in custom DocType fields (e.g.,
frm.doc.custom_fieldvsfrm.doc.custom_feild) - ❌ No clarity on the shape of custom API responses
- ❌ Fragile code during refactors of custom scripts
- ❌ Poor autocomplete for proprietary functions
With @anygridtech/frappe-agt-types, you get:
- ✅ Accurate autocompletion for custom DocTypes and
agtnamespaces. - ✅ Compile-time error checking for your client and server scripts.
- ✅ Inline documentation for custom modules.
- ✅ Improved code maintainability and developer experience.
Type definitions for AnyGrid Tech's custom modules, including:
-
Custom DocTypes (26 total):
BrazilianInvoiceTaxesChecklistBatteryChecklistEVChargerChecklistInverterChecklistSmartEnergyManagerChecklistSmartMeterChecklistTableChecklistTrackerChecklistTransformerCompanyComplianceStatementCorrectionsChildListCorrectionsTrackerExternalIssueCodeIndexInitialAnalysisInvoiceTaxesIssueInvertersItemPurchaseOrderSalesOrderSerialNoSerialNoWorkflowStockEntryTicketWorkflow
-
Client-side
agtnamespace:agt.setup– General setup utilityagt.checklist– Checklist managementagt.checklist.table
agt.corrections_tracker– Corrections trackingagt.corrections_tracker.runagt.corrections_tracker.table
agt.growatt– Growatt integrationsagt.metadata– Metadata constantsagt.metadata.doctype.checklistagt.metadata.doctype.compliance_statementagt.metadata.doctype.initial_analysisagt.metadata.doctype.ticket
agt.ui– UI utilitiesagt.ui.ultra_dialog
agt.utils– Utility functionsagt.utils.brazilagt.utils.coreagt.utils.dbagt.utils.dialogagt.utils.docagt.utils.formagt.utils.tableagt.utils.text
agt.workflow– Workflow utilitiesagt.workflow.before_workflow_action
-
Server-side
agt.servernamespace:agt.server.growatt_oss_apiagt.server.growatt_public_api
🧩 The list is continuously expanding as the custom application evolves.
These instructions will help you integrate the custom types into your Frappe TypeScript project.
- Firstly, you need a working Frappe development environment.
In case you're not familiar, we recommend using our Frappe Custom Apps Development Environment for easier setup.
- After having your working Frappe development environment, you must create a new custom app or use an existing one.
Our Frappe Custom Apps Development Environment includes helper functions for quickly scaffolding apps using
create-app.shorinstall-app.sh.
-
Create a
tsfolder atyour_custom_app/your_custom_app/public/to hold your TypeScript files. -
Install Typescript and our package via your package manager of choice:
# npm
npm install typescript @anygridtech/frappe-agt-types
# yarn
yarn add typescript @anygridtech/frappe-agt-types
# pnpm
pnpm add typescript @anygridtech/frappe-agt-typesNotice:
@anygridtech/frappe-typesis a dependency of this project. You do not need to install it separately to have access tofrappetype definitions. Installing this package is sufficient to have type definitions for bothfrappeandagtglobals.
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.
-
Reload the TypeScript server to ensure the editor picks up the new types: Hit
Ctrl+Shift+P(orCmd+Shift+Pon Mac) in VSCode and selectTypeScript: Restart TS Server. For other editors, consult your editor's documentation on reloading the language server. -
Finally, your app folder structure should look similiar to this:
your_custom_app/
├── your_custom_app/
│ ├── public/
| | ├── css/
│ │ ├── js/
│ │ ├── ts/
│ │ ├── node_modules/
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ └── tsconfig.json
│ └── ...
└── ...
After setup, you can use the custom DocType and namespace types with full TypeScript support in your client scripts:
// Example: strong-typed form script while using metadata constants
import { CorrectionsTracker } from "@anygridtech/frappe-agt-types/agt/doctype/CorrectionsTracker";
const status_options = agt.metadata.doctype.corrections_tracker.status;
frappe.ui.form.on<CorrectionsTracker>('Corrections Tracker', {
refresh(frm) {
if (frm.doc.status === status_options.PENDING) {
// ...
}
}
});This project is maintained internally by AnyGrid Tech. If you are a developer at AnyGrid, please follow the internal contribution guidelines. For external users, feel free to open an issue if you believe there is a bug.
- @anygridtech – Maintainers