bitmovin / bitmovin-player-ui

The Bitmovin Adaptive Streaming Player UI
MIT License
126 stars 87 forks source link

Typescript definitions are not compatible with `strictNullChecks` mode #105

Closed MichalLytek closed 6 years ago

MichalLytek commented 6 years ago

The error:

Property 'value' of type 'string | undefined' is not assignable to string index type 'string'..

is located in bitmovin-player-ui/src/ts/player.d.ts (678,7):

interface MediaTrackRole {
    schemeIdUri: string;
    value?: string;
    id?: string;
    [key: string]: string;
}

This is because in strictNullChecks mode type of value and id evaluate to string | undefined which is incompatible with [key: string]: string index signature. It should be changed to [key: string]: string | undefined; if id and value might be undefined.

protyposis commented 6 years ago

Released in 2.15.0

MichalLytek commented 6 years ago

@protyposis

The same problem exist in the core typings:

export interface MediaTrackRole {
    schemeIdUri: string;
    value?: string;
    id?: string;
    [key: string]: string;
}

I have this error:

node_modules/bitmovin-player/types/core/PlayerAPI.d.ts:158:5 - error TS2411: Property 'value' of type 'string | undefined' is not assignable to string index type 'string'.
158     value?: string;
        ~~~~~
node_modules/bitmovin-player/types/core/PlayerAPI.d.ts:159:5 - error TS2411: Property 'id' of type 'string | undefined' is not assignable to string index type 'string'.

159     id?: string;
        ~~

node_modules/bitmovin-player/types/core/PlayerConfigAPI.d.ts:1027:5
- error TS2411: Property 'receiverStylesheetUrl' of type 'string | undefined' is not assignable to string index type 'string'.

1027     receiverStylesheetUrl?: string;
         ~~~~~~~~~~~~~~~~~~~~~

And there's no github repo for bitmovin-player package 😕