node-osu icon indicating copy to clipboard operation
node-osu copied to clipboard

Some typings are incorrect

Open cory2067 opened this issue 2 years ago • 0 comments

I noticed some issues in index.d.ts that I noticed when integrating node-osu with a typescript project

  1. MultiplayerScore is missing types
  2. Some types are Number but should be number
  3. Types assume that parseNumeric is true, because the numeric fields are always number. However, if parseNumeric is false (the default), then those types are wrong.

To resolve 1 and 2 for my use case, I applied the following patch locally:

diff --git a/node_modules/node-osu/index.d.ts b/node_modules/node-osu/index.d.ts
index 0c587eb..317386a 100644
--- a/node_modules/node-osu/index.d.ts
+++ b/node_modules/node-osu/index.d.ts
@@ -218,8 +218,23 @@ export class Game {
 }
 
 export class MultiplayerScore {
-    constructor(...args: any[]);
-
+    slot: number;
+    team: string;
+    userId: string;
+    score: number;
+    maxCombo: string;
+    counts: {
+        '300': number,
+        '100': number,
+        '50': number,
+        'geki': number,
+        'katu': number,
+        'miss': number
+    }
+    perfect: boolean;
+    pass: boolean;
+    raw_mods: number;
+    mods: string[];
 }
 
 export class Score {
@@ -274,9 +289,9 @@ export class User {
         total: number;
     };
     pp: {
-        raw: Number,
-        rank: Number,
-        countryRank: Number
+        raw: number,
+        rank: number,
+        countryRank: number
     };
     country: string;
     level: number;

This issue body was partially generated by patch-package.

cory2067 avatar Mar 18 '22 23:03 cory2067