Skip to content
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

Cannot build. Missing ImageEncodeOptions, VideoFrame, etc. #14976

Open
fudom opened this issue Apr 11, 2024 · 4 comments
Open

Cannot build. Missing ImageEncodeOptions, VideoFrame, etc. #14976

fudom opened this issue Apr 11, 2024 · 4 comments
Assignees
Milestone

Comments

@fudom
Copy link

fudom commented Apr 11, 2024

Cannot build on Angular 14 + TypeScript 4.7 with Babylon 7 or 6. Workaround: Use version 5 of Babylon.

Missing types:

  • ImageEncodeOptions
  • OffscreenRenderingContextId
  • OffscreenRenderingContext
  • VideoFrame

https://doc.babylonjs.com/setup/frameworkPackages/es6Support

Upgrading Angular and/or Typescript is currently impossible. It's not just a hello world project. ^^

Is there a compatibility info? What version is depending on what dependencies. And how to handle it? Not sure, but I also could just define the missing types as any-type. Or babylon could support these type fallbacks/polyfill. It's great that babylon comes with types. But it's sad that TypeScript (indirect) types are blocking the use. Since types have no effect on runtime. It's just the d.ts behind in node_modules of babylon. At least we could provide some docs and how to handle this. I just wondering how to avoid that.

@sebavan
Copy link
Member

sebavan commented Apr 11, 2024

cc @RaananW

@RaananW
Copy link
Member

RaananW commented Apr 11, 2024

Those classes require a newer version of typescript. Is is that possible for your project?

@fudom
Copy link
Author

fudom commented Apr 12, 2024

Unfortunately not at the moment. It's a complex project. Upgrading TypeScript is not possible without upgrading other dependencies like Angular and other deps. Not easy to find a sweet spot.

Btw. it's weird that ImageEncoderOptions is not found, since it should be available since TypeScript 3.x (e.g. 3.7). But it's not present in my typescript 4.x (4.7) version. I installed both versions and searched the lib.dom.d.ts in node_modules.

Another workaround:

types/dom.d.ts

// Suppress ts(2669): Augmentations for the global scope can only be directly nested in 
// external modules or ambient module declarations.
export {};

declare global {
  type VideoFrame = any;
  type ImageEncodeOptions = any;
  type OffscreenRenderingContextId = any;
  type OffscreenRenderingContext = any;
}

FYI https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame (Chrome >= 94, Firefox unsupported)
I only use supported stuff within the last 1-2 years. We either need a compat level (maybe Babel?) or going back to Babylon 5.

I just wondering if we could either support this within Babylon or have information on docs page about supported TypeScript (dependencies) versions. In this case, it's only about types, not runtime. It's sad that it failed on such trivial thing. And in this case, it's about indirect types, used from a package. An option to mute that would be great. But anyway, this is just an information. Do whatever you want (incl. closing). I found my workaround.

@RaananW
Copy link
Member

RaananW commented Apr 12, 2024

Adding the types is more than possible, we can look into that

@RaananW RaananW self-assigned this Apr 12, 2024
@bghgary bghgary added this to the 8.0 milestone Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants