Browse Source

Make VSCode type detection happier

main
Cadence Ember 1 month ago
parent
commit
ec9b0edadc
No known key found for this signature in database GPG Key ID: BC1C2C61CF521B17
7 changed files with 13 additions and 1 deletions
  1. +2
    -0
      api/captions.js
  2. +2
    -0
      api/thumbnails.js
  3. +2
    -0
      api/video.js
  4. +2
    -0
      background/feed-update.js
  5. +1
    -1
      utils/converters.js
  6. +2
    -0
      utils/getuser.js
  7. +2
    -0
      utils/request.js

+ 2
- 0
api/captions.js View File

@ -1,3 +1,5 @@
/** @type {import("node-fetch").default} */
// @ts-ignore
const fetch = require("node-fetch")
const {getUser} = require("../utils/getuser")
const constants = require("../utils/constants.js")


+ 2
- 0
api/thumbnails.js View File

@ -1,3 +1,5 @@
/** @type {import("node-fetch").default} */
// @ts-ignore
const fetch = require("node-fetch")
const constants = require("../utils/constants.js")


+ 2
- 0
api/video.js View File

@ -1,4 +1,6 @@
const {request} = require("../utils/request")
/** @type {import("node-fetch").default} */
// @ts-ignore
const fetch = require("node-fetch")
const {render} = require("pinski/plugins")
const db = require("../utils/db")


+ 2
- 0
background/feed-update.js View File

@ -1,4 +1,6 @@
const Denque = require("denque")
/** @type {import("node-fetch").default} */
// @ts-ignore
const fetch = require("node-fetch")
const constants = require("../utils/constants")
const db = require("../utils/db")


+ 1
- 1
utils/converters.js View File

@ -151,7 +151,7 @@ function preroundedCountToText(count) {
for (const scale of [[1e9, "B"], [1e6, "M"], [1e3, "K"]]) {
if (count >= scale[0]) {
// YouTube returns 3 significant figures. At least it does for channels.
const rounded = (count/scale[0]).toPrecision(3)
const rounded = (count/+scale[0]).toPrecision(3)
return `${rounded}${scale[1]}`
}
}


+ 2
- 0
utils/getuser.js View File

@ -31,6 +31,7 @@ class User {
this.token = token
}
/** @return {{instance?: string, save_history?: boolean, local?: boolean, quality?: number}} */
getSettings() {
if (this.token) {
return db.prepare("SELECT * FROM Settings WHERE token = ?").get(this.token) || {}
@ -39,6 +40,7 @@ class User {
}
}
/** @return {{instance?: string, save_history?: boolean, local?: boolean, quality?: number}} */
getSettingsOrDefaults() {
const settings = this.getSettings()
for (const key of Object.keys(constants.user_settings)) {


+ 2
- 0
utils/request.js View File

@ -1,3 +1,5 @@
/** @type {import("node-fetch").default} */
// @ts-ignore
const fetch = require("node-fetch")
function request(url, options = {}) {


Loading…
Cancel
Save