fix: Replace @ts-expect-error with typecasts

This commit is contained in:
April Hall 2025-02-05 18:32:27 -05:00
parent 95108ab9eb
commit 12df35b8db
Signed by: arithefirst
GPG Key ID: 4508A15C4DB91C5B

View File

@ -20,8 +20,7 @@ class Db {
PRIMARY KEY (channel_name, timestamp) PRIMARY KEY (channel_name, timestamp)
) WITH CLUSTERING ORDER BY (timestamp DESC);`); ) WITH CLUSTERING ORDER BY (timestamp DESC);`);
} catch (e) { } catch (e) {
// @ts-expect-error I don't like this thing yelling at me console.log(`Error creating new channel: ${e as Error}`);
console.log(`Error creating new channel: ${e.message}`);
} }
} }
@ -32,8 +31,7 @@ class Db {
await this.client.execute(`INSERT INTO channels.channel_${channelName} (id, message_content, channel_name, timestamp, sender) await this.client.execute(`INSERT INTO channels.channel_${channelName} (id, message_content, channel_name, timestamp, sender)
VALUES (${id}, '${content}', '${channelName}', ${now.getTime()}, ${sender})`); VALUES (${id}, '${content}', '${channelName}', ${now.getTime()}, ${sender})`);
} catch (e) { } catch (e) {
// @ts-expect-error I don't like this thing yelling at me console.log(`Error storing messages: ${e as Error}`);
console.log(`Error storing messages: ${e.message}`);
} }
} }
@ -43,8 +41,7 @@ class Db {
const res = await this.client.execute(`SELECT table_name FROM system_schema.tables WHERE keyspace_name = 'channels'`); const res = await this.client.execute(`SELECT table_name FROM system_schema.tables WHERE keyspace_name = 'channels'`);
return res.rows; return res.rows;
} catch (e) { } catch (e) {
// @ts-expect-error I don't like this thing yelling at me console.log(`Error fetching channels: ${e as Error}`);
console.log(`Error fetching channels: ${e.message}`);
return; return;
} }
} }
@ -57,8 +54,7 @@ class Db {
); );
return res.rows; return res.rows;
} catch (e) { } catch (e) {
// @ts-expect-error I don't like this thing yelling at me console.log(`Error fetching messages: ${(e as Error).message}`);
console.log(`Error fetching messages: ${e.message}`);
return; return;
} }
} }
@ -74,8 +70,7 @@ const client = new cassandra.Client({
try { try {
await client.connect(); await client.connect();
} catch (e) { } catch (e) {
// @ts-expect-error I don't like this thing yelling at me console.log(`Error connecting to DB: ${e as Error}`);
console.log(`Error connecting to DB: ${e.message}`);
process.exit(1); process.exit(1);
} }
@ -83,8 +78,7 @@ try {
await client.execute(`CREATE KEYSPACE IF NOT EXISTS users WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};`); await client.execute(`CREATE KEYSPACE IF NOT EXISTS users WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};`);
await client.execute(`CREATE KEYSPACE IF NOT EXISTS channels WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};`); await client.execute(`CREATE KEYSPACE IF NOT EXISTS channels WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1};`);
} catch (e) { } catch (e) {
// @ts-expect-error I don't like this thing yelling at me console.log(`Error generating keyspaces: ${e as Error}`);
console.log(`Error generating keyspaces: ${e.message}`);
process.exit(1); process.exit(1);
} }