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

A number of TypeScript errors in the exported types #8301

Closed
boris-petrov opened this issue Jun 2, 2023 · 0 comments · Fixed by #8333
Closed

A number of TypeScript errors in the exported types #8301

boris-petrov opened this issue Jun 2, 2023 · 0 comments · Fixed by #8333
Labels
needs: triage This issue needs to be reviewed

Comments

@boris-petrov
Copy link
Contributor

boris-petrov commented Jun 2, 2023

Description

node_modules/video.js/dist/types/event-target.d.ts:9:13 - error TS2395: Individual declarations in merged declaration 'EventTarget' must be all exported or all local.

9 export type EventTarget = () => any;
              ~~~~~~~~~~~

node_modules/video.js/dist/types/event-target.d.ts:18:15 - error TS2395: Individual declarations in merged declaration 'EventTarget' must be all exported or all local.

18 declare class EventTarget {
                 ~~~~~~~~~~~

node_modules/video.js/dist/types/plugin.d.ts:5:13 - error TS2395: Individual declarations in merged declaration 'Plugin' must be all exported or all local.

5 export type Plugin = {
              ~~~~~~

node_modules/video.js/dist/types/plugin.d.ts:35:15 - error TS2395: Individual declarations in merged declaration 'Plugin' must be all exported or all local.

35 declare class Plugin {
                 ~~~~~~

node_modules/video.js/dist/types/tech/tech.d.ts:5:13 - error TS2395: Individual declarations in merged declaration 'Tech' must be all exported or all local.

5 export type Tech = any | string;
              ~~~~

node_modules/video.js/dist/types/tech/tech.d.ts:12:15 - error TS2395: Individual declarations in merged declaration 'Tech' must be all exported or all local.

12 declare class Tech extends Component {
                 ~~~~

node_modules/video.js/dist/types/tech/tech.d.ts:239:15 - error TS2552: Cannot find name 'TimeRange'. Did you mean 'TimeRanges'?

239     played(): TimeRange;
                  ~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:22227:13
    22227 declare var TimeRanges: {
                      ~~~~~~~~~~
    'TimeRanges' is declared here.

node_modules/video.js/dist/types/tracks/audio-track-list.d.ts:15:26 - error TS2304: Cannot find name 'AudioTrack'.

15     constructor(tracks?: AudioTrack[]);
                            ~~~~~~~~~~

node_modules/video.js/dist/types/tracks/html-track-element.d.ts:8:15 - error TS2415: Class 'HTMLTrackElement' incorrectly extends base class 'EventTarget'.
  Property 'allowedEvents_' is private in type 'EventTarget' but not in type 'HTMLTrackElement'.

8 declare class HTMLTrackElement extends EventTarget {
                ~~~~~~~~~~~~~~~~

node_modules/video.js/dist/types/tracks/text-track-list.d.ts:17:5 - error TS2416: Property 'addTrack' in type 'TextTrackList' is not assignable to the same property in base type 'TrackList'.
  Type '(track: TextTrack) => void' is not assignable to type '(track: Track) => void'.
    Types of parameters 'track' and 'track' are incompatible.
      Type 'Track' is missing the following properties from type 'TextTrack': tech_, cues_, activeCues_, preload_, and 8 more.

17     addTrack(track: import('./text-track').default): void;
       ~~~~~~~~

node_modules/video.js/dist/types/tracks/text-track.d.ts:8:15 - error TS2415: Class 'TextTrack' incorrectly extends base class 'Track'.
  Property 'allowedEvents_' is private in type 'Track' but not in type 'TextTrack'.

8 declare class TextTrack extends Track {
                ~~~~~~~~~

node_modules/video.js/dist/types/tracks/track-list.d.ts:8:15 - error TS2415: Class 'TrackList' incorrectly extends base class 'EventTarget'.
  Types have separate declarations of a private property 'allowedEvents_'.

8 declare class TrackList extends EventTarget {
                ~~~~~~~~~

node_modules/video.js/dist/types/video.d.ts:88:14 - error TS2304: Cannot find name 'version'.

88     export { version as VERSION };
                ~~~~~~~

Reduced test case

No need for a test case

Steps to reproduce

Just install video.js and run a TypeScript check with this tsconfig.json:

{
  "compilerOptions": {
    "target": "ESNext",
    "allowJs": false,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "forceConsistentCasingInFileNames": true,
    "moduleResolution": "Node",
    "useDefineForClassFields": true,
    "strict": true,
    "exactOptionalPropertyTypes": true,
    "noUncheckedIndexedAccess": true,
    "newLine": "lf",
    "noFallthroughCasesInSwitch": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitOverride": true,
    "noImplicitReturns": true,
    "noEmitOnError": true,
    "noEmit": true,
    "verbatimModuleSyntax": true,
    "declaration": true,
    "declarationMap": true,
    "inlineSourceMap": true,
    "inlineSources": true,
    "baseUrl": ".",
    "module": "ESNext",
    "experimentalDecorators": true
  }
}

The only workaround is adding "skipLibCheck": true.

Perhaps related to #8141.

Happens on TypeScript 5.1.3 but most likely it happens also on older versions.

Errors

No response

What version of Video.js are you using?

8.3.0

Video.js plugins used.

No response

What browser(s) including version(s) does this occur with?

N/A

What OS(es) and version(s) does this occur with?

Linux

@boris-petrov boris-petrov added the needs: triage This issue needs to be reviewed label Jun 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: triage This issue needs to be reviewed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant