I noticed some issues in index.d.ts that I noticed when integrating node-osu with a typescript project
- MultiplayerScore is missing types
- Some types are
Number but should be number
- 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.
I noticed some issues in index.d.ts that I noticed when integrating node-osu with a typescript project
Numberbut should benumberparseNumericis true, because the numeric fields are alwaysnumber. However, ifparseNumericis false (the default), then those types are wrong.To resolve 1 and 2 for my use case, I applied the following patch locally:
This issue body was partially generated by patch-package.