danigb / soundfont-player

Quick soundfont loader and player for browser
MIT License
455 stars 59 forks source link

Use AudioContext as type #71

Closed sslotsky closed 4 years ago

sslotsky commented 4 years ago

When I try to use this library from TypeScript, I get a type error when passing an AudioContext into the instrument function:

Argument of type 'AudioContext' is not assignable to parameter of type '{ new (contextOptions?: AudioContextOptions): AudioContext; prototype: AudioContext; }'.
  Property 'prototype' is missing in type 'AudioContext' but required in type '{ new (contextOptions?: AudioContextOptions): AudioContext; prototype: AudioContext; }'

It seems that the type of ac should just be AudioContext, rather than typeof AudioContext. When I make this change in your index.d.ts, the type error goes away.

danigb commented 4 years ago

Thanks!