Remove namespace and export default interface

This commit is contained in:
Maroxy 2021-10-17 22:28:26 +02:00
parent 3049aaeff2
commit 3d10bfc3c7
2 changed files with 63 additions and 65 deletions

124
src/ts/GIJSON.d.ts vendored
View file

@ -1,73 +1,69 @@
declare module GIJSON { interface VoicePack {
language: string;
name: string;
path: string;
size: string;
md5: string;
}
interface VoicePack { interface Latest {
language: string; name: string;
name: string; version: string;
path: string; path: string;
size: string; size: string;
md5: string; md5: string;
} entry: string;
voice_packs: VoicePack[];
decompressed_path: string;
segments: any[];
}
interface Latest { interface Diff {
name: string; name: string;
version: string; version: string;
path: string; path: string;
size: string; size: string;
md5: string; md5: string;
entry: string; is_recommended_update: boolean;
voice_packs: VoicePack[]; voice_packs: VoicePack[];
decompressed_path: string; }
segments: any[];
}
interface Diff { interface Game {
name: string; latest: Latest;
version: string; diffs: Diff[];
path: string; }
size: string;
md5: string;
is_recommended_update: boolean;
voice_packs: VoicePack[];
}
interface Game { interface Plugins {
latest: Latest; name: string;
diffs: Diff[]; version: string;
} path: string;
size: string;
md5: string;
entry: string;
}
interface Plugins { interface Plugin {
name: string; plugins: Plugins[];
version: string; version: string;
path: string; }
size: string;
md5: string;
entry: string;
}
interface Plugin { interface DeprecatedPackage {
plugins: Plugins[]; name: string;
version: string; md5: string;
} }
interface DeprecatedPackage { interface Data {
name: string; game: Game;
md5: string; plugin: Plugin;
} web_url: string;
force_update?: any;
interface Data { pre_download_game?: any;
game: Game; deprecated_packages: DeprecatedPackage[];
plugin: Plugin; sdk?: any;
web_url: string; }
force_update?: any;
pre_download_game?: any;
deprecated_packages: DeprecatedPackage[];
sdk?: any;
}
export interface Type {
retcode: number;
message: string;
data: Data;
}
export default interface GIJSON {
retcode: number;
message: string;
data: Data;
} }

View file

@ -1,3 +1,5 @@
import GIJSON from "./GIJSON";
const https = require('https'); const https = require('https');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
@ -74,7 +76,7 @@ export class Genshinlib
response.on('data', (chunk: any) => data += chunk); response.on('data', (chunk: any) => data += chunk);
response.on('end', () => { response.on('end', () => {
let jsondata: GIJSON.Type = JSON.parse(data); let jsondata: GIJSON = JSON.parse(data);
return jsondata.message === 'OK' ? resolve(jsondata.data) : reject(null); return jsondata.message === 'OK' ? resolve(jsondata.data) : reject(null);
}); });