Skip to content
FrameworkStyle

TypeScript

TypeScript version and module resolution requirements for Video.js packages

Video.js packages require TypeScript 5.0 or newer. TypeScript must also follow the import paths that each package publishes.

TypeScript version

Video.js type files use syntax introduced in TypeScript 5.0. Older versions cannot read that syntax. The skipLibCheck option does not help because TypeScript must read a type file before it can skip checking it.

Module resolution

Video.js packages define their supported import paths using package exports. Most web applications should use the following configuration. It makes TypeScript follow the same package rules as the bundler that builds the application:

{
  "compilerOptions": {
    "module": "ESNext",
    "moduleResolution": "bundler"
  }
}

If Node.js runs files emitted directly by TypeScript, use node16 for both module and moduleResolution, or use nodenext for both.

Do not use the older node setting, now called node10. It does not understand package exports and can report valid Video.js imports or types as missing.

Errors from other dependencies

The older node setting allowed applications to import almost any file inside a dependency. Modern settings allow only the paths that dependency publishes. Changing the setting can therefore reveal an existing import into another package’s private files.

If the error names a package outside @videojs/*, update that dependency or use one of its supported import paths. A TypeScript paths override can be a temporary bridge when no supported replacement exists. Do not switch back to the older resolver because that also breaks Video.js type resolution.