mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-20 20:16:06 -04:00
Do strict type checking on incoming data.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "revolt.js",
|
||||
"version": "5.0.0-alpha.20",
|
||||
"version": "5.0.0-alpha.21",
|
||||
"main": "dist/index.js",
|
||||
"repository": "https://gitlab.insrt.uk/revolt/revolt.js",
|
||||
"author": "Paul Makles <insrt.uk>",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
export * from './Client';
|
||||
export { UserPermission, ChannelPermission, ServerPermission } from './api/permissions';
|
||||
|
||||
export const LIBRARY_VERSION = '5.0.0-alpha.20';
|
||||
export const LIBRARY_VERSION = '5.0.0-alpha.21';
|
||||
|
||||
export const defaultConfig = {
|
||||
apiURL: 'https://api.revolt.chat',
|
||||
|
||||
@@ -188,7 +188,7 @@ export class Channel {
|
||||
const apply = (key: string, target?: string) => {
|
||||
// This code has been tested.
|
||||
// @ts-expect-error
|
||||
if (data[key] && !isEqual(this[target ?? key], data[key])) {
|
||||
if (typeof data[key] !== 'undefined' && !isEqual(this[target ?? key], data[key])) {
|
||||
// @ts-expect-error
|
||||
this[target ?? key] = data[key];
|
||||
}
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ export class Member {
|
||||
const apply = (key: string) => {
|
||||
// This code has been tested.
|
||||
// @ts-expect-error
|
||||
if (data[key] && !isEqual(this[key], data[key])) {
|
||||
if (typeof data[key] !== 'undefined' && !isEqual(this[key], data[key])) {
|
||||
// @ts-expect-error
|
||||
this[key] = data[key];
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ export class Message {
|
||||
const apply = (key: string, target?: string, transform?: (obj: unknown) => unknown) => {
|
||||
// This code has been tested.
|
||||
// @ts-expect-error
|
||||
if (data[key] && !isEqual(this[target ?? key], data[key])) {
|
||||
if (typeof data[key] !== 'undefined' && !isEqual(this[target ?? key], data[key])) {
|
||||
// @ts-expect-error
|
||||
this[target ?? key] = transform ? transform(data[key]) : data[key];
|
||||
}
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ export class Server {
|
||||
const apply = (key: string, target?: string) => {
|
||||
// This code has been tested.
|
||||
// @ts-expect-error
|
||||
if (data[key] && !isEqual(this[target ?? key], data[key])) {
|
||||
if (typeof data[key] !== 'undefined' && !isEqual(this[target ?? key], data[key])) {
|
||||
// @ts-expect-error
|
||||
this[target ?? key] = data[key];
|
||||
}
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ export class User {
|
||||
const apply = (key: string) => {
|
||||
// This code has been tested.
|
||||
// @ts-expect-error
|
||||
if (data[key] && !isEqual(this[key], data[key])) {
|
||||
if (typeof data[key] !== 'undefined' && !isEqual(this[key], data[key])) {
|
||||
// @ts-expect-error
|
||||
this[key] = data[key];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user