Skip to content

Commit

Permalink
docs: revise docs to provide more detail
Browse files Browse the repository at this point in the history
  • Loading branch information
Gumball12 committed Mar 10, 2024
1 parent 60539ba commit 79a721c
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,56 @@

> Check out the [Online Sandbox](https://gumball12.github.io/google-spreadsheet-dts/)!
This library automatically generates TypeScript types (`*.d.ts`) by parsing Google Sheets.
This library **automatically generates TypeScript types (`*.d.ts`) by parsing Google Sheets**. It is useful for event tracking systems(like Mixpanel and Google Analytics) or managing internationalized(I18N) data in Google Sheets. Here's an example:

Google Sheet:

| Key | Property | Type |
| ----------------------------- | ------------------ | ------------------------------ |
| click_conversation_data | conversation_id | string |
| | created_at | Date |
| | agent_type | string |
| | status | StatusEnum |
| | generate_position | 'conversation' \| 'playground' |
| click_message_feedback_button | conversation_id | string |
| | message_id | string |
| | generated_position | 'conversation' \| 'playground' |

Generated TypeScript types:

```ts
// GoogleSheets.d.ts

// Generated by google-spreadsheet-dts
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
import { StatusEnum } from './StatusEnum';
export {};
declare global {
export interface GoogleSheets {
click_conversation_data: {
conversation_id: string;
created_at: Date;
agent_type: string;
status: StatusEnum;
generate_position: 'conversation' | 'playground';
};
click_message_feedback_button: {
conversation_id: string;
message_id: string;
generated_position: 'conversation' | 'playground';
};
}
}
```

## 💫 Features

- [Parser presets](./src/parser) and Generate types(`*.d.ts`) for **public and private Google Sheets**
- Customize the type and type file name
- Customizable type and file name
- Import types from other files

### Performance

Expand Down Expand Up @@ -129,10 +173,10 @@ node scripts/generate-google-sheets-dts.js

### 3. Use generated types

The above command generates the src/GoogleSheets.ts file as follows:
The above command generates the src/GoogleSheets.d.ts file as follows:

```ts
// src/GoogleSheets.ts
// src/GoogleSheets.d.ts

// Generated by google-spreadsheet-dts
/* eslint-disable */
Expand Down

0 comments on commit 79a721c

Please sign in to comment.