fix: fix Typescript types #5
No reviewers
Labels
No labels
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Priority
Zero
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: firepup650/million-stats#5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/types"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -38,2 +38,2 @@if (!doLogging) {console.warn("WARN: No logging channel! No logs of any kind will be sent to slack!")// this is used instead of doLogging so typescript can coerce loggingChannel into just a stringif (!loggingChannel) {uncertain why this is needed- since the channel is only ever used after checking doLogging
It is not. I will fix it
@ -53,3 +58,2 @@const goalDate = new Date(!!process.env.DATE? process.env.DATE : "3027/01/01");if (Number.isNaN(goalDate.getDate())) throw new Error("DATE must be a valid date (e.g. yyyy/mm/dd)")const goalDate = new Date(process.env.DATE ? process.env.DATE : "3027/01/01");I'd prefer this left as !!, to be explicit
Will add it
@ -140,0 +155,4 @@* @param {Error} error the error object*/async function publishError(error) {console.error("ERROR: ", error);Does this log more than the error message? if so- changed functionality, if not- I'd prefer to explicitly know this is logging the message
I believe it does. I'll make this
error.messagethen.@ -140,0 +156,4 @@*/async function publishError(error) {console.error("ERROR: ", error);if (error) console.error(error);redundant check now? also removed an !!
Oops
@ -140,0 +160,4 @@if (doLogging)await publishMessage(loggingChannel,`ERROR: ${error.message}. Stack: ${error.stack}`,Change in functionality- the stack isn't supposed to be sent to slack
Will remove
@ -198,0 +242,4 @@new Error(`Tried to post a duplicate '${emoji}' reaction to message ${ts} in ${channelId}`,),);this is why publishError never required an error object to be sent- this really shouldn't be treated like an error with a stack.
If it's not an error, then it shouldn't be published as one. Either
@ -298,0 +372,4 @@// this _should_ always pass, but the type checker doesn't know thatif (error instanceof Error) {publishError(error);}Why ignore logging an error here if it isn't one by some chance? You do elsewhere
Oops. Didn't realise there could be a sql error
@ -352,1 +434,3 @@publishError(String(error), error);if (error instanceof Error) {publishError(error);}Ditto of above
@ -370,1 +454,3 @@publishError(String(error), error);if (error instanceof Error) {publishError(error);}Ditto
@ -499,1 +596,3 @@publishError(String(error), error);if (error instanceof Error) {publishError(error);}Ditto
@ -32,3 +32,4 @@const start =regularStartQuotes[Math.floor(Math.random() * regularStartQuotes.length)];/** @type {string | undefined} */type is always a string here, never undefined, you literally typehint a similar case as only strings on L260 of app.js
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.