1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-12-22 05:06:57 +00:00

Make VSCode type detection happier

This commit is contained in:
Cadence Ember 2021-05-11 21:27:57 +12:00
parent cd7969973b
commit ec9b0edadc
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17
7 changed files with 13 additions and 1 deletions

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")

View File

@ -1,3 +1,5 @@
/** @type {import("node-fetch").default} */
// @ts-ignore
const fetch = require("node-fetch")
const constants = require("../utils/constants.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")

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")

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]}`
}
}

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)) {

View File

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