aws-samples / amazon-ivs-player-web-sample

This project contains code samples demonstrating how to build, package, and integrate with the Amazon IVS Player Web SDK.
https://docs.aws.amazon.com/ivs/
MIT No Attribution
81 stars 32 forks source link

Failing typescript type checks #47

Closed mikesea closed 2 months ago

mikesea commented 2 years ago

Describe the bug I'm setting up the amazon-ivs-player in a new project, importing the library via NPM using the instructions here, and using typescript to compile my code.

amazon-ivs-player is causing failures on typescript compilation because of the following type errors:

node_modules/amazon-ivs-player/dist/index.d.ts:1:33 - error TS2307: Cannot find module 'types/autoplay-options' or its corresponding type declarations.

1 import { AutoPlayOptions } from 'types/autoplay-options';
                                  ~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/amazon-ivs-player/dist/index.d.ts:783:5 - error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.

783     [PlayerEventType.STATE_CHANGED]: PlayerState;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/amazon-ivs-player/dist/index.d.ts:783:22 - error TS2339: Property 'STATE_CHANGED' does not exist on type 'typeof PlayerEventType'.

783     [PlayerEventType.STATE_CHANGED]: PlayerState;
                         ~~~~~~~~~~~~~

Found 3 errors in the same file, starting at: node_modules/amazon-ivs-player/dist/index.d.ts:1

To Reproduce

  1. Clone the sample repo at https://github.com/mikesea/ivs-tsc-test and run npx lint in the repo to see the failing checks

Expected behavior Library does not fail typescript compiler.

johnBartos commented 2 years ago

Hey @mikesea, thanks for the report. We're aware of this bug and it will be fixed in the next release

johnBartos commented 2 years ago

Are you able to work around this issue?

mikesea commented 2 years ago

@johnBartos nice, thanks! Any idea when a release might be coming? 😉

Are you able to work around this issue?

I can use the skipLibCheck option with the compiler, but that's not ideal. Thanks for your quick response!

johnBartos commented 2 years ago

Happy to help! We plan to release the next version later next month.