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

fix(types): improves quality of typescript definitions #8218

Merged
merged 6 commits into from
Sep 27, 2023

Conversation

gjanblaszczyk
Copy link
Member

Description

This PR squashes a few tsc errors and improves typescript definitions.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chrome, Firefox, IE)
    • Unit Tests updated or fixed
    • Docs/guides updated
    • Example created (starter template on JSBin)
  • Reviewed by Two Core Contributors

@codecov
Copy link

codecov bot commented Mar 29, 2023

Codecov Report

Merging #8218 (26d441f) into main (3e9ef0a) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##             main    #8218   +/-   ##
=======================================
  Coverage   82.68%   82.68%           
=======================================
  Files         113      113           
  Lines        7578     7578           
  Branches     1821     1821           
=======================================
  Hits         6266     6266           
  Misses       1312     1312           
Files Changed Coverage Δ
src/js/big-play-button.js 30.00% <0.00%> (ø)
src/js/button.js 64.00% <ø> (ø)
src/js/clickable-component.js 90.14% <ø> (ø)
src/js/close-button.js 93.33% <ø> (ø)
src/js/component.js 93.54% <ø> (ø)
src/js/menu/menu-item.js 88.88% <ø> (ø)
src/js/menu/menu.js 66.30% <ø> (ø)
src/js/player.js 90.89% <ø> (ø)
src/js/utils/events.js 81.00% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

src/js/big-play-button.js Outdated Show resolved Hide resolved
@misteroneill misteroneill added the ts TypeScript label Apr 4, 2023
@dasa
Copy link

dasa commented Apr 25, 2023

This fixes this error:

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

88     export { version as VERSION };
                ~~~~~~~
diff --git a/src/js/video.js b/src/js/video.js
index d271362c..1602fd71 100644
--- a/src/js/video.js
+++ b/src/js/video.js
@@ -2,7 +2,7 @@
  * @file video.js
  * @module videojs
  */
-import {version} from '../../package.json';
+import {version as pkgVersion} from '../../package.json';
 import window from 'global/window';
 import {
   hooks_,
@@ -37,6 +37,13 @@ import xhr from '@videojs/xhr';
 import Tech from './tech/tech.js';
 import { use as middlewareUse, TERMINATOR } from './tech/middleware.js';
 
+/**
+ * Current Video.js version. Follows [semantic versioning](https://semver.org/).
+ *
+ * @type {string}
+ */
+const version = pkgVersion;
+
 /**
  * Normalize an `id` value by trimming off a leading `#`
  *

Can this change be added to this PR too?

This is what gets added to video.d.ts

/**
 * Current Video.js version. Follows [semantic versioning](https://semver.org/).
 *
 * @type {string}
 */
declare const version: string;

@mister-ben
Copy link
Contributor

mister-ben commented Jul 7, 2023

Can't figure out why the tests fail here...

@mister-ben mister-ben changed the title feat(types): improves quality of typescript definitions fix(types): improves quality of typescript definitions Sep 6, 2023
@mister-ben mister-ben merged commit 781eb43 into main Sep 27, 2023
11 of 12 checks passed
@mister-ben mister-ben deleted the feat/improve-types branch September 27, 2023 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ts TypeScript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants