-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AudioContext and webkitAudioContext missing in Window definition in lib.dom.d.ts #31686
Comments
For anyone else running into this, in the meantime you can extend the window in your
I've had to take this approach a handful of times when vendor prefixed APIs aren't included in |
I am also facing this issue, any update on this? |
me too! AudioContext is defined webkitAudioContext is still missing |
webkitAudioContext is old naming conventions in the Web Audio which is now the AudioContext. which i think nothing will be done anytime soon. The way around is to add
remember to make sure your declaration files are added into you tsconfig.json
|
Any update on this? |
@sandersn any thoughts on this? Pinging you because I see you as assigned on the issue |
@jcleefw is right. AudioContext is the standard name, and you can add an alias on |
Why is this closed? |
@fatcerberus Try just You might open a new issue for mirroring global types into |
How do I write/type this function if the globals don't exist on |
replace |
Hmm, isn’t |
It's not flagged -- if you use it as a value, you're expected to bring your own shim. |
Hmm, I guess that’s convenient, but inconsistent with how other ES-defined globals are treated so I wouldn’t have guessed on my own that that was the case. Thanks. More to the point though: Why are |
I'm not sure whether interface Window {
browserSpecific: number
} |
Safari doesn't implement window.AudioContext, but it does have the Web Audio API with a vendor prefix. Older versions of Chrome need this too, I hear. I think the 'as any' declaration could be avoided by including a type definition for webkitAudioContext in the window interface (see microsoft/TypeScript#31686 ) and I believe these are in some community definitions somewhere?
Thanks it still helps |
For most modern browsers, there exists some type of AudioContext on the window, however the current definition for
Window
has neither of these.window.AudioContext
window.webkitAudioContext
I would expect the definition of
Window
inlib.dom.d.ts
too look something similar to this:Search Terms:
AudioContext, webkitAudioContext , audio context missing in window
Code
Expected behavior:
AudioContext and webkitAudioContext are defined on the window object
Actual behavior:
AudioContext and webkitAudioContext are not defined on the window object
Playground Link:
https://www.typescriptlang.org/play/#src=window.AudioContext%0Awindow.webkitAudioContext
The text was updated successfully, but these errors were encountered: