[TS] Properly type RN.Platform.constants
This commit is contained in:
parent
5560a136e6
commit
82e41a5c27
2 changed files with 21 additions and 3 deletions
20
src/def.d.ts
vendored
20
src/def.d.ts
vendored
|
@ -1,6 +1,6 @@
|
|||
import * as _spitroast from "spitroast";
|
||||
import _React from "react";
|
||||
import _RN from "react-native";
|
||||
import _RN, { PlatformConstants } from "react-native";
|
||||
import _AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
|
||||
type MetroModules = { [id: number]: any };
|
||||
|
@ -64,6 +64,24 @@ interface Settings {
|
|||
developerSettings: boolean;
|
||||
}
|
||||
|
||||
interface RNConstants extends PlatformConstants {
|
||||
// Android
|
||||
Version: number;
|
||||
Release: string;
|
||||
Serial: string;
|
||||
Fingerprint: string;
|
||||
Model: string;
|
||||
Brand: string;
|
||||
Manufacturer: string;
|
||||
ServerHost?: string;
|
||||
|
||||
// iOS
|
||||
forceTouchAvailable: boolean;
|
||||
interfaceIdiom: string;
|
||||
osVersion: string;
|
||||
systemName: string;
|
||||
}
|
||||
|
||||
type Indexable<Type> = { [index: string]: Type }
|
||||
|
||||
interface VendettaObject {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { RNConstants } from "@types";
|
||||
import { ReactNative as RN } from "@metro/common";
|
||||
import { after } from "@lib/patcher";
|
||||
import { getAssetIDByName } from "@ui/assets";
|
||||
|
@ -48,8 +49,7 @@ export const versionHash = "__vendettaVersion";
|
|||
export function getDebugInfo() {
|
||||
const InfoDictionaryManager = RN.NativeModules.InfoDictionaryManager;
|
||||
const hermesProps = window.HermesInternal.getRuntimeProperties();
|
||||
// TODO: Type 'any' removes errors, but is it sensible?
|
||||
const PlatformConstants = RN.Platform.constants as any;
|
||||
const PlatformConstants = RN.Platform.constants as RNConstants;
|
||||
const rnVer = PlatformConstants.reactNativeVersion;
|
||||
const DCDDeviceManager = RN.NativeModules.DCDDeviceManager;
|
||||
|
||||
|
|
Loading…
Reference in a new issue