question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Shaka Typescript definition overriding Google Cast Sender with incomplete defs

See original GitHub issue

Have you read the FAQ and checked for duplicate open issues? Yes, this does probably relate to #1030, but I assume it is cleaner to report it as a separate bug.

What version of Shaka Player are you using? 3.0.8

Can you reproduce the issue with our latest release version? NA

Can you reproduce the issue with the latest code from master? Not tested

Are you using the demo app or your own custom app? Own

If custom app, can you reproduce the issue using our demo app? NA

What browser and OS are you using? Any

For embedded devices (smart TVs, etc.), what model and firmware version are you using? NA

What are the manifest and license server URIs? NA

What did you do? In code unrelated to the Shaka based player Typescript gives errors, example:

const sessionObj = session.getSessionObj();
sessionObj.addMediaListener(media => {
  onMediaSession(media);
});

What did you expect to happen? Type from node_modules/@types/chrome/chrome-cast/index.d.ts to be resolved. (That is included when using the @types/chromecast-caf-sender package.)

What actually happened? Type from node_modules/shaka-player/dist/shaka-player.compiled.d.ts seems to override, in this case:

// Generated from /usr/local/google/home/joeyparrish/hacking/shaka/clean/externs/chromecast.js
declare namespace chrome.cast {
  class Session {
    ...

Which does not contain the addMediaListener method.

I see there are similar issues reported for IMA types in #1030, maybe Shaka should not export these definitions for ‘externs’? or maybe not in the global scope at least?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
philippe-elsass-deltatrecommented, Feb 24, 2022

@PabloMoragaMeli

rm ./node_modules/shaka-player/dist/*.d.ts
5reactions
joeyparrishcommented, Nov 22, 2021

We apologize for the generated Typescript definitions. This is not a Typescript-native project, and the tools we are using to generate the definitions are clearly not able to do everything we need. I will increase the priority of this issue.

In the meantime, you may wish to work around the issue with hand-written definitions to import Shaka Player into your Typescript project. We apologize for the inconvenience.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shaka Typescript definition overriding Google Cast Sender ...
What did you do? In code unrelated to the Shaka based player Typescript gives errors, example: const sessionObj = session.getSessionObj(); ...
Read more >
How to override Shaka player version using new API released ...
The CastReceiverOptions object has an undocumented field shakaVersion . Simply set to e.g. "4.2.2".
Read more >
shaka-player/CHANGELOG.md - UNPKG
The CDN for shaka-player. ... 225, - Generate TypeScript defs with Clutz ... 639, - Fix missing EME polyfill in Cast receiver.
Read more >
@types/chromecast-caf-sender - npm
TypeScript definitions for Cast Application Framework Sender API. Latest version: 1.0.5, last published: a year ago.
Read more >
Source - GitHub
Changelog ## [4.3.0](https://github.com/shaka-project/shaka-player/compare/v4.2.0...v4.3.0) ... Add missing module export in generated typescript defs ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found