googleapis / googleapis/google-api-nodejs-client

TypeScript typings cause very high memory usage in tsc

Abierto
#2,187 15 comentarios 33 reacciones 1 asignado Reclamado por @bcoe Ver en GitHub
type: feature request
Lenguaje dominante
TypeScript
Estrellas
12.2k
Forks
2k
Merge medio
1 d 9 h
PR fusionados (30 d)
24

Descripción

When importing `googleapis` within a TypeScript project, `tsc` takes up a large amount of memory (500 MB+). This appears to be the case because when `googleapis` is imported, it imports the type definition files for every single API that Google has, even if only a single API (e.g. `drive_v3`) is required.

#### Environment details

- OS: Ubuntu 20.04 LTS
- Node.js version: 10.20.1 (LTS)
- npm version: N/A (We don't use npm instally, but we use yarn v1.22.4)
- `googleapis` version: 51.0.0
- `typescript` version: 3.8.3

#### Steps to reproduce

Please see reproduction repository here: https://github.com/yjwong/tsc-googleapis-memory-usage

Essentially, even just a simple:

```typescript
import { google } from 'googleapis';
```

Will result in high memory usage from `tsc`.

There is also a related StackOverflow question:
https://stackoverflow.com/questions/56599477/typescript-googleapis-surge-in-memory-used

#### Workaround

Import the APIs individually, like so (example is Google Drive SDK v3):

```typescript
import { drive_v3 } from 'googleapis/build/src/apis/drive/v3';
import { AuthPlus } from 'googleapis-common/build/src/authplus';
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.