Almenon / Almenon/throttle

improve typing by making arguments generic

Abierto
#1 3 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
TypeScript
Estrellas
0
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Current type:

```typescript
Limit.throttledUpdate(fn: Function, wait: number): (...args: any[]) => void
```
The problem is that when you make a function with it, like so:
```typescript
let throttledFunc = new Limit().throttledUpdate((x:string,y:number)=>"foo", 50)
```

The throttledFunc has type (...args: any[]) => void
But it should have type (x:string, y:number) => void

Ideally I would want to do something like this:
```typescript
Limit.throttledUpdate(fn: ...T, wait: number): (...T) => void
```

Unfortunately, it looks like this capability is still in the proposal stages: https://github.com/Microsoft/TypeScript/issues/5453

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

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.