-
Notifications
You must be signed in to change notification settings - Fork 0
TypeScript
This project uses TypeScript as opposed to plain JavaScript to improve clarity of data types and the availability of IDE auto-complete features.
First, run npm install
in the nefac-website
directory if you haven't already. Then, use the following command to generate TypeScript types based on the GraphQL schema:
npm run generate:types
This will generate types using graphql-codegen. These are deliberately gitignored.
This command is not to be confused with npm run generate
, which serves a different purpose. See documentation about Faust.js for more details.
Please reference the following Faust.js documentation pages for detailed information and examples related to using TypeScript in Faust.js.
Our project uses a few libraries maintained by WordPress for functionality and components related to custom blocks. For example, @wordpress/block-editor. These libraries are not typed for use in TypeScript out of the box. Fortunately, separate libraries containing type definitions for WordPress libraries are available, thanks to DefinitelyTyped. These are already installed in our project, and no local configuration or setup is needed. If another @wordpress library needs to be added, and it is not typed, check NPM to see if there is a type definition library for it.