Type number trivially inferred from a number literal, remove type annotation
1026 viewRange = 0;
1027 }
1028
1029 var timeRange: number = 0;1030
1031 if (leastAndGreatestObject["greatestTime"] && leastAndGreatestObject["leastTime"]) {
1032 timeRange = leastAndGreatestObject["greatestTime"] -
Type number trivially inferred from a number literal, remove type annotation
1018 });
1019 }
1020 // Stream ended, there aren't any more rows
1021 var viewRange: number = 0;1022 if (leastAndGreatestObject["greatestViews"] && leastAndGreatestObject["leastViews"]) {
1023 viewRange = leastAndGreatestObject["greatestViews"] -
1024 leastAndGreatestObject["leastViews"];
Type boolean trivially inferred from a boolean literal, remove type annotation
804 // var percentageOffsetFromLeft = offsetCalcLeft(stat.unixtime)
805 // var percentageOffsetFromBottomViews = offsetCalcBottom(stat.views)
806
807 var shouldDrawDot: boolean = true; 808
809 var modulusStat = 2;
810
Type boolean trivially inferred from a boolean literal, remove type annotation
254
255 //contentOfMessageReply.components = [confirm]
256
257 var keepsending: boolean = true;258
259 if (type === "interaction") {
260 if (message.replied === true) {
Type string trivially inferred from a string literal, remove type annotation
526 Promise.all(sortedFormattedRowsPromise).then(async (sortedFormatedRows) => {
527 console.log("second promise")
528 var currentPage: string = "";
529 var currentPageStage: string = "";530 var pages: Array<string> = []
531
532 console.log(sortedFormatedRows)
Type string trivially inferred from a string literal, remove type annotation
525
526 Promise.all(sortedFormattedRowsPromise).then(async (sortedFormatedRows) => {
527 console.log("second promise")
528 var currentPage: string = "";529 var currentPageStage: string = "";
530 var pages: Array<string> = []
531
Type string trivially inferred from a string literal, remove type annotation
218 Promise.all(sortedFormattedRowsPromise).then(async (sortedFormatedRows) => {
219 console.log("second promise")
220 var currentPage: string = "";
221 var currentPageStage: string = "";222 var pages: Array<string> = []
223
224 console.log(sortedFormatedRows)
Type string trivially inferred from a string literal, remove type annotation
217
218 Promise.all(sortedFormattedRowsPromise).then(async (sortedFormatedRows) => {
219 console.log("second promise")
220 var currentPage: string = "";221 var currentPageStage: string = "";
222 var pages: Array<string> = []
223
Type boolean trivially inferred from a boolean literal, remove type annotation
835 if ((!isDM)) {
836
837 //also allow adorabot admins to change this
838 var isauthorizedtoaddbanstodatabase: boolean = false; 839
840 var loadedConfigData = importconfigfile.get()
841
Type boolean trivially inferred from a boolean literal, remove type annotation
777 //check if server is registered
778 const lookupexistingsubscriptionquery = 'SELECT * FROM adoramoderation.guildssubscribedtoautoban WHERE serverid = ?';
779
780 var readExistingSubscriptionStatus: boolean = false; 781
782 await cassandraclient.execute(lookupexistingsubscriptionquery, [message.guild.id])
783 .then(fetchExistingSubscriptionResult => {
Type boolean trivially inferred from a boolean literal, remove type annotation
519 .then(async returnBanDatabaseAmount => {
520 var initialnumberofrowsindatabase = returnBanDatabaseAmount.rows[0].count.low
521
522 var isauthorizedtoaddbanstodatabase: boolean = false; 523
524 var loadedConfigData = importconfigfile.get()
525
Type boolean trivially inferred from a boolean literal, remove type annotation
431
432 if (command === "updatebans") {
433
434 var isauthorizedtoaddbanstodatabase: boolean = false; 435
436 var loadedConfigData = importconfigfile.get()
437
Type boolean trivially inferred from a boolean literal, remove type annotation
179}
180
181export async function isAuthorizedAdmin(userid) {
182 var isauthorizedtoaddbanstodatabase: boolean = false; 183
184 var loadedConfigData = importconfigfile.get()
185
Type boolean trivially inferred from a boolean literal, remove type annotation
36 await cassandraclient.execute(lookuphowmanybannedusersquery)
37 .then(async returnBanDatabaseAmount => {
38
39 var readExistingSubscriptionStatus: boolean = false; 40 var numberofrowsindatabase = returnBanDatabaseAmount.rows[0].count.low
41
42 numberOfBannedUsersInDatabase = numberofrowsindatabase;
Type boolean trivially inferred from a boolean literal, remove type annotation
345 //check if server is registered
346 const lookupexistingsubscriptionquery = 'SELECT * FROM adoramoderation.guildssubscribedtoautoban WHERE serverid = ?';
347
348 var readExistingSubscriptionStatus: boolean = false;349
350 await cassandraclient.execute(lookupexistingsubscriptionquery, [guildid])
351 .then(fetchExistingSubscriptionResult => {
Type boolean trivially inferred from a boolean literal, remove type annotation
300 //check if server is registered
301 const lookupexistingsubscriptionquery = 'SELECT * FROM adoramoderation.guildssubscribedtoautoban WHERE serverid = ?';
302
303 var readExistingSubscriptionStatus: boolean = false;304
305 await cassandraclient.execute(lookupexistingsubscriptionquery, [guildid])
306 .then(fetchExistingSubscriptionResult => {
Type boolean trivially inferred from a boolean literal, remove type annotation
197
198export async function inspectGuild(message,guildid,client) {
199 try {
200 var readExistingSubscriptionStatus: boolean = false;201 if (isAuthorizedAdmin(message.author.id)) {
202 var guild = await getServer(guildid,client)
203
Type number trivially inferred from a number literal, remove type annotation
344
345 //not the http response.... the genius response
346 var hitNumberCounter:number = 0;
347 var hitNumberToUse:number = 0;348
349 console.log('response inside genius number to use', response)
350
Type number trivially inferred from a number literal, remove type annotation
343try {
344
345 //not the http response.... the genius response
346 var hitNumberCounter:number = 0;347 var hitNumberToUse:number = 0;
348
349 console.log('response inside genius number to use', response)
Type string trivially inferred from a string literal, remove type annotation
229 // console.log(charts); // prints array of all charts
230
231 var currentPage:string = "";
232 var currentPageStage:string = "";233
234 var injected = [
235{
Type string trivially inferred from a string literal, remove type annotation
228 if (err) return logger.discordErrorLogger.error(err);
229 // console.log(charts); // prints array of all charts
230
231 var currentPage:string = "";232 var currentPageStage:string = "";
233
234 var injected = [
Type boolean trivially inferred from a boolean literal, remove type annotation
21
22export function manuallyAddVote(manualVoteArgs) {
23
24 var isauthorizedtoaddbanstodatabase: boolean = false;25
26 var loadedConfigData = importconfigfile.get()
27
Type boolean trivially inferred from a boolean literal, remove type annotation
1 //also allow adorabot admins to change this
2 var isauthorizedtoaddbanstodatabase: boolean = false; 3
4
5 const TimeUuid = require('cassandra-driver').types.TimeUuid;
Type boolean trivially inferred from a boolean literal, remove type annotation
1import editJsonFile = require("edit-json-file");
2var startupTime = Date.now()
3var recievedFirstMessageState:boolean = false; 4
5const regexBanRoute = /\/guilds\/\d*\/bans\/:id/g;
6
Type boolean trivially inferred from a boolean literal, remove type annotation
1
2import editJsonFile = require("edit-json-file");
3var startupTime = Date.now()
4var recievedFirstMessageState:boolean = false; 5
6const regexBanRoute = /\/guilds\/\d*\/bans\/:id/g;
7
Description
Explicit types where they can be easily inferred may add unnecessary verbosity for variables or parameters initialized to a number, string, or boolean
Bad Practice
const a: bigint = 10n;
const a: bigint = -10n;
const a: bigint = BigInt(10);
const a: bigint = -BigInt(10);
const a: boolean = false;
const a: boolean = true;
const a: boolean = Boolean(null);
const a: boolean = !0;
const a: number = -10;
const a: number = Number('1');
const a: number = +Number('1');
const a: number = -Number('1');
const a: null = null;
const a: RegExp = /a/;
const a: RegExp = RegExp('a');
const a: RegExp = new RegExp('a');
const a: string = 'str';
const a: string = String(1);
const a: symbol = Symbol('a');
const a: undefined = void someValue;
class Foo {
prop: number = 5;
}
function fn(a: number = 5, b: boolean = true) {}
Recommended
const a = 10n;
const a = -10n;
const a = BigInt(10);
const a = -BigInt(10);
const a = false;
const a = true;
const a = Boolean(null);
const a = !0;
const a = 10;
const a = +10;
const a = -Number('1');
const a = null;
const a = /a/;
const a = RegExp('a');
const a = 'str';
const a = String(1);
const a = Symbol('a');
const a = void someValue;
class Foo {
prop = 5;
}
function fn(a = 5, b = true) {}
function fn(a: number, b: boolean, c: string) {}