Typescript type definition generator for Frappe DocTypes.
To use the app, install it on your local development bench:
$ bench get-app https://github.com/nikkothari22/frappe-types
That's it.
Now whenever you create or update any DocType on your local machine, the app will generate .ts
files under at the following path: app/types/<module_def>/<doctype_name>.ts
.
- Supports most Frappe field types
- Runs automatically whenever you save/update a DocType
- Adds JSDoc comments for every field in the interface
Let's say you create a DocType in a module called "Project Management" called "Project" with the following fields:
The app will automatically create a file called Project.ts
at the path <your_app_folder>/types/ProjectManagement/Project
like this:
(Notice that spaces in the Module and DocType names will be removed)
If you are developing custom Frappe apps with a Frappe backend and a frontend single-page app using React/Vue/other frameworks, you can use this app to generate TypeScript definitions to be used in your frontend app.
- Support for Table fields. Currently defaults to any[]
- Ability to define path for types folder and select apps for which types are to be generated
- Looking at how to improve speed so that DocType saving does not take a lot of time.
- Adding a CLI option to run type generation on existing DocTypes without having to update them.
Maintainer | GitHub | Social |
---|---|---|
Nikhil Kothari | nikkothari22 | @nik_kothari22 |
MIT