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
Converting binary search helper to TS #2129
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one point
@@ -0,0 +1,44 @@ | |||
type BinarySearchComparison < T > = (candidate: T) => -1 | 0 | 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: <T>
Also we should export type
this. Generally anything that is used on the public path should be exported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
If I remember correctly, changing < T >
to <T>
resulted in this eslint error: https://eslint.org/docs/rules/space-infix-ops
I'd hate to suppress that eslint rule though, as it should error/warn in the case of const sum = 1+ 2
shouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah if it's a lint thing then fine as long as it is consistent everywhere :)
I think the type should still be exported from the file though
On 13 Feb 2019, at 18:18, John Bartos <notifications@github.com<mailto:notifications@github.com>> wrote:
Merged #2129<#2129> into master.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#2129 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ADG-WTZqZFvtP7oW5cpm0Ls6gJVSRR3Bks5vNEj3gaJpZM4a4YPa>.
|
* origin/master: (59 commits) Change networkDetails type to "unknown". mp4-remuxer / remuxAudio() : recompute mdatSize / dont rely on audioTrack.len (video-dev#2096) Typo fix for destory -> destroy. Change responseType to string Callbacks are defined, removing TODO. video-devGH-2082: Replacing usage of Array.prototype.find/findIndex (video-dev#2117) Reduce GC pressure from ID3._utf8ArrayToStr (video-dev#2035) (misc): converting binary search to typescript (video-dev#2129) (misc) Removing IE8-specific (dead) vtt/cue code Fixed case of 'They use hls.js in production!' header and updated Viacom image link to new domain and using https (video-dev#2127) remove events/EventEmitter && move Observer to ts (video-dev#2097) Basic typescript of event handler. Update webpack to use babel loader with support for TS. (video-dev#2119) Allow console statement in test bench and saucelabs code. Lint fixes Playlist Loader conversion to TypeScript. Playlist-loader rename. Change IV handling for initSegments to just log a warning. Add handling for AES-128 encrypted initialization segments needing IV. (misc) Adding ace editor to demo to enable advanced customization (video-dev#2077) ...
This PR will...
... convert our binary search helper to TypeScript
Why is this Pull Request needed?
Part of the on-going effort to introduce TypeScript to the project
Are there any points in the code the reviewer needs to double check?
The added function signature for
BinarySearchComparison
- thoughts on the return type/value enforcement? Was thinking simplynumber
would suffice.As well, the parameter
T
was added as it makes working with thesearch
function nicer looking IMO, example:Resolves issues:
None in particular
Checklist
[ ] new unit / functional tests have been added (whenever applicable)N/A[ ] API or design changes are documented in API.mdN/A