Skip to content

Commit

Permalink
Start updating README.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinquillen committed Jan 19, 2024
1 parent 514dbaa commit f3fb84c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# TS Generator
# Drupal TypeScript Generator

This is a Drupal module, that generates Typescript type definitions for certain entities. It can optionally also generate cleaned up target type definitions and functions to convert objects from the initials types to the target types (parsers).

## Installation

```sh
composer require hoppinger/ts_generator
composer require kevinquillen/ts_generator
```

## Versions

Version 2.0.0 is Drupal 9 compatible.
Version 2.0.0 is Drupal 9+ compatible.

## Usage

The generator runs as a Drush command that needs a configuration file.
The generator runs as a Drush command that needs a configuration file.

Create `.yml` file with the following contents:

Expand Down Expand Up @@ -56,7 +56,7 @@ export type Result<T> = T | "error"
export async function drupalGetEntity(alias: string): Promise<Result<ParsedInputEntity>> {
const res = await fetch(`/${alias}?format=_json`), { method: "get", credentials: "include" })
if (!res.ok) return "error"

const json = await res.json()
if (!input_entity_guard(json)) return "error"

Expand Down

0 comments on commit f3fb84c

Please sign in to comment.