Platform-specific TypeScript declarations for NativeScript for accessing native objects
84
Create a simple NativeScript utility that retrieves basic device information from both Android and iOS platforms.
Your utility should provide a function that returns a JavaScript object containing the following device information:
export interface DeviceInfo {
platform: 'android' | 'ios';
osVersion: string;
manufacturer?: string; // Android only
deviceModel: string;
deviceName: string;
}
export function getDeviceInfo(): DeviceInfo;@generates
The function should detect the current platform and retrieve the appropriate information from the native APIs. Return the data as a properly typed object.
Provides TypeScript type definitions for accessing native Android and iOS platform APIs.
Install with Tessl CLI
npx tessl i tessl/npm-tns-platform-declarationsevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10