improve typing by making arguments generic
- Vorherrschende Sprache
- TypeScript
- Sterne
- 0
- Forks
- 0
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.