feat(types-minimal): minimal types for only the latest Android and iOS sdks (#9927)

This commit is contained in:
Nathan Walker
2022-06-04 10:07:59 -07:00
committed by GitHub
parent 81f57dc0c2
commit 80e6b8130a
25 changed files with 247943 additions and 0 deletions

View File

@ -12,6 +12,7 @@ platforms
tests
packages/types-android
packages/types-ios
packages/types-minimal
packages/ui-mobile-base
tools/assets/App_Resources
*.cmd

View File

@ -38,6 +38,8 @@ We love you and your PR's 🤗. Please follow our [contributing guide](https://g
* Types for iOS
* [@nativescript/types-android](https://github.com/NativeScript/NativeScript/tree/master/packages/types-android)
* Types for Android
* [@nativescript/types-minimal](https://github.com/NativeScript/NativeScript/tree/master/packages/types-minimal)
* A very minimal set of types for only the latest Android and iOS sdks. Most commonly used to optimize Web-based IDE's which auto load all type declarations from node_modules.
* [@nativescript/ui-mobile-base](https://github.com/NativeScript/NativeScript/tree/master/packages/ui-mobile-base)
* UI mobile base native classes used by core
* [@nativescript/webpack](https://github.com/NativeScript/NativeScript/tree/master/packages/webpack)

View File

@ -97,6 +97,7 @@
/// <reference path="objc-x86_64/objc!ModelIO.d.ts" />
/// <reference path="objc-x86_64/objc!MultipeerConnectivity.d.ts" />
/// <reference path="objc-x86_64/objc!NativeScriptEmbedder.d.ts" />
/// <reference path="objc-x86_64/objc!NativeScriptUtils.d.ts" />
/// <reference path="objc-x86_64/objc!NaturalLanguage.d.ts" />
/// <reference path="objc-x86_64/objc!NearbyInteraction.d.ts" />
/// <reference path="objc-x86_64/objc!Network.d.ts" />

View File

@ -13991,6 +13991,9 @@ declare const NS_UnknownByteOrder: number;
interface _expressionFlags {
_evaluationBlocked: number;
_usesKVC: number;
_validatedExpression: number;
_validatedKeys: number;
_reservedExpressionFlags: number;
}
declare var _expressionFlags: interop.StructType<_expressionFlags>;

View File

@ -0,0 +1,19 @@
declare class NativeScriptUtils extends NSObject {
static alloc(): NativeScriptUtils; // inherited from NSObject
static createMutableStringForSpanFontColorBackgroundColorTextDecorationBaselineOffset(text: string, font: UIFont, color: UIColor, backgroundColor: UIColor, textDecoration: string, baselineOffset: number): NSMutableAttributedString;
static createMutableStringWithDetails(details: NSDictionary<any, any>): NSMutableAttributedString;
static createUIFont(font: NSDictionary<any, any>): UIFont;
static getImageDataFormatQuality(image: UIImage, format: string, quality: number): NSData;
static getSystemFontWeightItalicSymbolicTraits(size: number, weight: number, italic: boolean, symbolicTraits: number): UIFont;
static new(): NativeScriptUtils; // inherited from NSObject
static scaleImageWidthHeightScaleFactor(image: UIImage, width: number, height: number, scaleFactor: number): UIImage;
}

View File

@ -1541,3 +1541,51 @@ declare class PKTransitPassProperties extends PKStoredValuePassProperties {
readonly transitBalanceCurrencyCode: string;
}
interface PKVehicleConnectionDelegate extends NSObjectProtocol {
sessionDidChangeConnectionState(newState: PKVehicleConnectionSessionConnectionState): void;
sessionDidReceiveData(data: NSData): void;
}
declare var PKVehicleConnectionDelegate: {
prototype: PKVehicleConnectionDelegate;
};
declare const enum PKVehicleConnectionErrorCode {
Unknown = 0,
SessionUnableToStart = 1,
SessionNotActive = 2
}
declare class PKVehicleConnectionSession extends NSObject {
static alloc(): PKVehicleConnectionSession; // inherited from NSObject
static new(): PKVehicleConnectionSession; // inherited from NSObject
static sessionForPassDelegateCompletion(pass: PKSecureElementPass, delegate: PKVehicleConnectionDelegate, completion: (p1: PKVehicleConnectionSession, p2: NSError) => void): void;
readonly connectionStatus: PKVehicleConnectionSessionConnectionState;
readonly delegate: PKVehicleConnectionDelegate;
invalidate(): void;
sendDataError(message: NSData): boolean;
}
declare const enum PKVehicleConnectionSessionConnectionState {
Disconnected = 0,
Connected = 1,
Connecting = 2,
FailedToConnect = 3
}

View File

@ -22628,6 +22628,10 @@ declare class UIView extends UIResponder implements CALayerDelegate, NSCoding, U
layoutSubviews(): void;
nativeScriptSetFormattedTextDecorationAndTransform(details: NSDictionary<any, any>): void;
nativeScriptSetTextDecorationAndTransformTextDecorationLetterSpacingLineHeight(text: string, textDecoration: string, letterSpacing: number, lineHeight: number): void;
needsUpdateConstraints(): boolean;
passThroughParent(): boolean;

View File

@ -800,10 +800,14 @@ declare class WKWebView extends UIView {
readonly loading: boolean;
readonly maximumViewportInset: UIEdgeInsets;
mediaType: string;
readonly microphoneCaptureState: WKMediaCaptureState;
readonly minimumViewportInset: UIEdgeInsets;
navigationDelegate: WKNavigationDelegate;
pageZoom: number;
@ -884,6 +888,8 @@ declare class WKWebView extends UIView {
setMicrophoneCaptureStateCompletionHandler(state: WKMediaCaptureState, completionHandler: () => void): void;
setMinimumViewportInsetMaximumViewportInset(minimumViewportInset: UIEdgeInsets, maximumViewportInset: UIEdgeInsets): void;
startDownloadUsingRequestCompletionHandler(request: NSURLRequest, completionHandler: (p1: WKDownload) => void): void;
stopLoading(): void;

View File

@ -0,0 +1,3 @@
# @nativescript/types-minimal
NativeScript 'Minimal' Types for only the latest Android and iOS sdks.

View File

@ -0,0 +1,11 @@
{
"name": "@nativescript/types-minimal",
"version": "8.2.0",
"description": "NativeScript 'Minimal' Types for only the latest Android and iOS sdks.",
"homepage": "https://nativescript.org",
"repository": {
"type": "git",
"url": "https://github.com/NativeScript/NativeScript"
},
"license": "Apache-2.0"
}

View File

@ -0,0 +1,16 @@
{
"root": "packages/types-minimal",
"sourceRoot": "packages/types-minimal/src",
"projectType": "library",
"generators": {},
"targets": {
"build": {
"executor": "@nrwl/workspace:run-commands",
"outputs": ["dist/packages"],
"options": {
"commands": ["./tools/scripts/typings-minimal-copy.sh", "mkdir -p dist/packages/types-minimal", "cp -R packages/types-minimal/src/* dist/packages/types-minimal", "cp packages/types-minimal/package.json dist/packages/types-minimal", "cp packages/types-minimal/README.md dist/packages/types-minimal/README.md"],
"parallel": false
}
}
}
}

2
packages/types-minimal/src/index.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
/// <reference path="./lib/ios/ios.d.ts" />
/// <reference path="./lib/android/android.d.ts" />

View File

@ -0,0 +1,3 @@
/// <reference path="./api/android-declarations.d.ts" />
/// <reference path="./api/android-platform-32.d.ts" />
/// <reference path="./api/androidx-32.d.ts" />

View File

@ -0,0 +1,24 @@
/* tslint:disable:no-unused-variable */
// Android specific TypeScript declarations
declare function float(num: number): any;
declare function long(num: number): any;
/**
* Triggers garbage collection in JavaScript
*/
declare var gc: () => void;
/**
* Releases the reference to the wrapped native object
* @param object The Java object to release.
*/
declare function __releaseNativeCounterpart(object: java.lang.Object): void;
interface ArrayConstructor {
create(type: any, count: number): any;
}
declare module androidNative { export class Array<T> { constructor(); length: number; [index: number]: T; } }
import globalAndroid = android;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,214 @@
/**
* Provides API for working with native C types, pointers, pointer arithmetic and memory.
*/
declare module interop {
/**
* A type that is used to represent a void*.
*/
interface Pointer {
/**
* Creates a new pointer with the given offset.
* @param offset The offset in bytes.
*/
new (offset: number);
/**
* Creates a new pointer by adding an offset to the current pointer.
* @param offset The offset in bytes.
*/
add(offset: number): Pointer;
/**
* Creates a new pointer by removing an offset from the current pointer.
* @param offset The offset in bytes.
*/
subtract(offset: number): Pointer;
/**
* Converts the value of this instance to a number.
*/
toNumber(): number;
}
var Pointer;
/**
* A pointer that will free the memory it points to automatically when garbage collected.
*/
interface AdoptedPointer extends Pointer {
}
/**
* Makes the pointer adopted.
* After a call to adopt the pointer will hold its memory.
* @param ptr The pointer to adopt.
*/
function adopt(ptr: Pointer): AdoptedPointer;
/**
* Allocates memory.
* @param size The size in bytes.
*/
function alloc(size: number): AdoptedPointer;
/**
* Releases the memory of a pointer.
* The pointer should not be adopted.
* @param ptr A pointer to the memory to free.
*/
function free(ptr: Pointer): void;
/**
* Returns the size of the provided type.
* @param type A class constructor (of Objective-C interface), an instance (wrapper of Objective-C interface), struct constructor, struct instance, reference, protocol, function (for c function), fundamental types.
*/
function sizeof(type: any): number;
/**
* From a JavaScript object gets a pointer to the backing native object.
* @param instance A class constructor (of Objective-C interface), an instance (wrapper of Objective-C interface), struct instance, reference, protocol, function (for c function) or block.
*/
function handleof(instance: any): Pointer;
/**
* Wraps an NSData instance in an ArrayBuffer.
*/
function bufferFromData(data: NSData): ArrayBuffer;
/**
* A type that wraps a pointer and allows read/write operations on its value.
*/
interface Reference<T> {
value: T;
}
/**
* A Reference constructor.
*/
var Reference: {
/**
* Creates a new reference around a value.
* The native representation of the type will be determined the first time the Reference is used
* in operation involving marshalling.
* @param value The JavaScript value used to initialize the reference.
*/
new <T>(value?: T): Reference<T>;
/**
* Creates a reference from to the pointer with a given type.
* @param type The type to interpret the pointer
*/
new <T>(type: Type<T>, data: Pointer): Reference<T>;
/**
* Creates a new reference around a value.
* @param type The type to interpret the value
*/
new <T>(type: Type<T>, value: any): Reference<T>;
/**
* Gets the value using pointer arithmetic.
*/
[index: number]: any;
}
interface FunctionReference<T> {
(...params);
}
/**
* Creates a function reference that can be marshalled as a native function pointer.
* The JavaScript reference must be held alive as long as the native code needs the function.
*/
var FunctionReference: {
new <T>(func: T): FunctionReference<T>;
}
interface Type<T> {
(ptr: Pointer): T;
}
var types: {
"void": Type<void>;
bool: Type<boolean>;
int8: Type<number>;
uint8: Type<number>;
int16: Type<number>;
uint16: Type<number>;
int32: Type<number>;
uint32: Type<number>;
int64: Type<number>;
uint64: Type<number>;
float: Type<number>;
double: Type<number>;
UTF8CString: Type<Reference<number>>;
unichar: Type<string>;
id: Type<any>;
protocol: Type<any>;
"class": Type<any>;
selector: Type<string>;
}
/**
* A type for JavaScript constructors for C structs.
*/
interface StructType<T> extends Type<T> {
/**
* Create a new instance of the struct.
*/
new (): T;
/**
* Create a new instance of the struct and initialize it from the fields of the provided object.
* @param obj Initializer.
*/
new (obj: T): T;
/**
* Create a new struct by copying the memory from the provided pointer.
*/
new (obj: Pointer): T;
/**
* Checks two structs for equality.
*/
equals(left: T, right: T): boolean;
}
/** A type for propagating an unmanaged object reference.
* When you use this type, you become partially responsible for
* keeping the object alive.
*/
interface Unmanaged<T> {
/**
* Get the value of this unmanaged reference as a managed
* reference and consume an unbalanced retain of it.
* This is useful when a function returns an unmanaged reference
* and you know that you're responsible for releasing the result.
*/
takeRetainedValue(): T;
/**
* Get the value of this unmanaged reference as a managed
* reference without consuming an unbalanced retain of it.
* This is useful when a function returns an unmanaged reference
* and you know that you're not responsible for releasing the result.
*/
takeUnretainedValue(): T;
}
interface NSErrorWrapper extends Error {
error: NSError;
}
var NSErrorWrapper: {
new (error: NSError): NSErrorWrapper;
(error: NSError): NSErrorWrapper;
prototype: NSErrorWrapper;
}
}

View File

@ -0,0 +1,5 @@
/// <reference path="runtime.d.ts" />
/// <reference path="objc-x86_64/objc!AVFoundation.d.ts" />
/// <reference path="objc-x86_64/objc!Foundation.d.ts" />
/// <reference path="objc-x86_64/objc!ObjectiveC.d.ts" />
/// <reference path="objc-x86_64/objc!UIKit.d.ts" />

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,664 @@
declare class NSObject implements NSObjectProtocol {
static alloc(): NSObject;
static automaticallyNotifiesObserversForKey(key: string): boolean;
static cancelPreviousPerformRequestsWithTarget(aTarget: any): void;
static cancelPreviousPerformRequestsWithTargetSelectorObject(aTarget: any, aSelector: string, anArgument: any): void;
static class(): typeof NSObject;
static classFallbacksForKeyedArchiver(): NSArray<string>;
static classForKeyedUnarchiver(): typeof NSObject;
static conformsToProtocol(protocol: any /* Protocol */): boolean;
static copyWithZone(zone: interop.Pointer | interop.Reference<any>): any;
static debugDescription(): string;
static description(): string;
static hash(): number;
static initialize(): void;
static instanceMethodForSelector(aSelector: string): interop.FunctionReference<() => void>;
static instanceMethodSignatureForSelector(aSelector: string): NSMethodSignature;
static instancesRespondToSelector(aSelector: string): boolean;
static isSubclassOfClass(aClass: typeof NSObject): boolean;
static keyPathsForValuesAffectingValueForKey(key: string): NSSet<string>;
static load(): void;
static mutableCopyWithZone(zone: interop.Pointer | interop.Reference<any>): any;
static new(): NSObject;
static resolveClassMethod(sel: string): boolean;
static resolveInstanceMethod(sel: string): boolean;
static setVersion(aVersion: number): void;
static superclass(): typeof NSObject;
static version(): number;
accessibilityActivationPoint: CGPoint;
accessibilityAttributedHint: NSAttributedString;
accessibilityAttributedLabel: NSAttributedString;
accessibilityAttributedUserInputLabels: NSArray<NSAttributedString>;
accessibilityAttributedValue: NSAttributedString;
accessibilityContainerType: UIAccessibilityContainerType;
accessibilityCustomActions: NSArray<UIAccessibilityCustomAction>;
accessibilityCustomRotors: NSArray<UIAccessibilityCustomRotor>;
accessibilityDragSourceDescriptors: NSArray<UIAccessibilityLocationDescriptor>;
accessibilityDropPointDescriptors: NSArray<UIAccessibilityLocationDescriptor>;
accessibilityElements: NSArray<any>;
accessibilityElementsHidden: boolean;
accessibilityFrame: CGRect;
accessibilityHint: string;
accessibilityLabel: string;
accessibilityLanguage: string;
accessibilityNavigationStyle: UIAccessibilityNavigationStyle;
accessibilityPath: UIBezierPath;
accessibilityRespondsToUserInteraction: boolean;
accessibilityTextualContext: string;
accessibilityTraits: number;
accessibilityUserInputLabels: NSArray<string>;
accessibilityValue: string;
accessibilityViewIsModal: boolean;
readonly autoContentAccessingProxy: any;
readonly classForCoder: typeof NSObject;
readonly classForKeyedArchiver: typeof NSObject;
isAccessibilityElement: boolean;
observationInfo: interop.Pointer | interop.Reference<any>;
shouldGroupAccessibilityChildren: boolean;
static readonly accessInstanceVariablesDirectly: boolean;
readonly debugDescription: string; // inherited from NSObjectProtocol
readonly description: string; // inherited from NSObjectProtocol
readonly hash: number; // inherited from NSObjectProtocol
readonly isProxy: boolean; // inherited from NSObjectProtocol
readonly superclass: typeof NSObject; // inherited from NSObjectProtocol
readonly // inherited from NSObjectProtocol
constructor();
accessibilityActivate(): boolean;
accessibilityAssistiveTechnologyFocusedIdentifiers(): NSSet<string>;
accessibilityDecrement(): void;
accessibilityElementAtIndex(index: number): any;
accessibilityElementCount(): number;
accessibilityElementDidBecomeFocused(): void;
accessibilityElementDidLoseFocus(): void;
accessibilityElementIsFocused(): boolean;
accessibilityIncrement(): void;
accessibilityPerformEscape(): boolean;
accessibilityPerformMagicTap(): boolean;
accessibilityScroll(direction: UIAccessibilityScrollDirection): boolean;
addObserverForKeyPathOptionsContext(observer: NSObject, keyPath: string, options: NSKeyValueObservingOptions, context: interop.Pointer | interop.Reference<any>): void;
attemptRecoveryFromErrorOptionIndex(error: NSError, recoveryOptionIndex: number): boolean;
attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo(error: NSError, recoveryOptionIndex: number, delegate: any, didRecoverSelector: string, contextInfo: interop.Pointer | interop.Reference<any>): void;
awakeAfterUsingCoder(coder: NSCoder): any;
awakeFromNib(): void;
class(): typeof NSObject;
conformsToProtocol(aProtocol: any /* Protocol */): boolean;
copy(): any;
dealloc(): void;
dictionaryWithValuesForKeys(keys: NSArray<string> | string[]): NSDictionary<string, any>;
didChangeValueForKey(key: string): void;
didChangeValueForKeyWithSetMutationUsingObjects(key: string, mutationKind: NSKeyValueSetMutationKind, objects: NSSet<any>): void;
didChangeValuesAtIndexesForKey(changeKind: NSKeyValueChange, indexes: NSIndexSet, key: string): void;
doesNotRecognizeSelector(aSelector: string): void;
fileManagerShouldProceedAfterError(fm: NSFileManager, errorInfo: NSDictionary<any, any>): boolean;
fileManagerWillProcessPath(fm: NSFileManager, path: string): void;
finalize(): void;
forwardInvocation(anInvocation: NSInvocation): void;
forwardingTargetForSelector(aSelector: string): any;
indexOfAccessibilityElement(element: any): number;
init(): this;
isEqual(object: any): boolean;
isKindOfClass(aClass: typeof NSObject): boolean;
isMemberOfClass(aClass: typeof NSObject): boolean;
methodForSelector(aSelector: string): interop.FunctionReference<() => void>;
methodSignatureForSelector(aSelector: string): NSMethodSignature;
mutableArrayValueForKey(key: string): NSMutableArray<any>;
mutableArrayValueForKeyPath(keyPath: string): NSMutableArray<any>;
mutableCopy(): any;
mutableOrderedSetValueForKey(key: string): NSMutableOrderedSet<any>;
mutableOrderedSetValueForKeyPath(keyPath: string): NSMutableOrderedSet<any>;
mutableSetValueForKey(key: string): NSMutableSet<any>;
mutableSetValueForKeyPath(keyPath: string): NSMutableSet<any>;
observeValueForKeyPathOfObjectChangeContext(keyPath: string, object: any, change: NSDictionary<string, any>, context: interop.Pointer | interop.Reference<any>): void;
performSelector(aSelector: string): any;
performSelectorInBackgroundWithObject(aSelector: string, arg: any): void;
performSelectorOnMainThreadWithObjectWaitUntilDone(aSelector: string, arg: any, wait: boolean): void;
performSelectorOnMainThreadWithObjectWaitUntilDoneModes(aSelector: string, arg: any, wait: boolean, array: NSArray<string> | string[]): void;
performSelectorOnThreadWithObjectWaitUntilDone(aSelector: string, thr: NSThread, arg: any, wait: boolean): void;
performSelectorOnThreadWithObjectWaitUntilDoneModes(aSelector: string, thr: NSThread, arg: any, wait: boolean, array: NSArray<string> | string[]): void;
performSelectorWithObject(aSelector: string, object: any): any;
performSelectorWithObjectAfterDelay(aSelector: string, anArgument: any, delay: number): void;
performSelectorWithObjectAfterDelayInModes(aSelector: string, anArgument: any, delay: number, modes: NSArray<string> | string[]): void;
performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any;
prepareForInterfaceBuilder(): void;
provideImageDataBytesPerRowOriginSizeUserInfo(data: interop.Pointer | interop.Reference<any>, rowbytes: number, x: number, y: number, width: number, height: number, info: any): void;
removeObserverForKeyPath(observer: NSObject, keyPath: string): void;
removeObserverForKeyPathContext(observer: NSObject, keyPath: string, context: interop.Pointer | interop.Reference<any>): void;
replacementObjectForCoder(coder: NSCoder): any;
replacementObjectForKeyedArchiver(archiver: NSKeyedArchiver): any;
respondsToSelector(aSelector: string): boolean;
retainCount(): number;
self(): this;
setNilValueForKey(key: string): void;
setValueForKey(value: any, key: string): void;
setValueForKeyPath(value: any, keyPath: string): void;
setValueForUndefinedKey(value: any, key: string): void;
setValuesForKeysWithDictionary(keyedValues: NSDictionary<string, any>): void;
validateValueForKeyError(ioValue: interop.Pointer | interop.Reference<any>, inKey: string): boolean;
validateValueForKeyPathError(ioValue: interop.Pointer | interop.Reference<any>, inKeyPath: string): boolean;
valueForKey(key: string): any;
valueForKeyPath(keyPath: string): any;
valueForUndefinedKey(key: string): any;
willChangeValueForKey(key: string): void;
willChangeValueForKeyWithSetMutationUsingObjects(key: string, mutationKind: NSKeyValueSetMutationKind, objects: NSSet<any>): void;
willChangeValuesAtIndexesForKey(changeKind: NSKeyValueChange, indexes: NSIndexSet, key: string): void;
}
interface NSObjectProtocol {
debugDescription?: string;
description: string;
hash: number;
isProxy: boolean;
superclass: typeof NSObject;
class(): typeof NSObject;
conformsToProtocol(aProtocol: any /* Protocol */): boolean;
isEqual(object: any): boolean;
isKindOfClass(aClass: typeof NSObject): boolean;
isMemberOfClass(aClass: typeof NSObject): boolean;
performSelector(aSelector: string): any;
performSelectorWithObject(aSelector: string, object: any): any;
performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any;
respondsToSelector(aSelector: string): boolean;
retainCount(): number;
self(): NSObjectProtocol;
}
declare var NSObjectProtocol: {
prototype: NSObjectProtocol;
};
declare const OBJC_CLEAR_RESIDENT_STACK: number;
declare const OBJC_COLLECT_IF_NEEDED: number;
declare const OBJC_EXHAUSTIVE_COLLECTION: number;
declare const OBJC_FULL_COLLECTION: number;
declare const OBJC_GENERATIONAL_COLLECTION: number;
declare const OBJC_RATIO_COLLECTION: number;
declare const OBJC_SYNC_NOT_OWNING_THREAD_ERROR: number;
declare const OBJC_SYNC_SUCCESS: number;
declare const OBJC_WAIT_UNTIL_DONE: number;
declare function _objc_flush_caches(cls: typeof NSObject): void;
declare function _objc_msgForward(): void;
declare function _objc_msgForward_stret(): void;
declare function _objc_realizeClassFromSwift(cls: typeof NSObject, previously: interop.Pointer | interop.Reference<any>): typeof NSObject;
declare function class_addIvar(cls: typeof NSObject, name: string | interop.Pointer | interop.Reference<any>, size: number, alignment: number, types: string | interop.Pointer | interop.Reference<any>): boolean;
declare function class_addMethod(cls: typeof NSObject, name: string, imp: interop.FunctionReference<() => void>, types: string | interop.Pointer | interop.Reference<any>): boolean;
declare function class_addProperty(cls: typeof NSObject, name: string | interop.Pointer | interop.Reference<any>, attributes: interop.Pointer | interop.Reference<objc_property_attribute_t>, attributeCount: number): boolean;
declare function class_addProtocol(cls: typeof NSObject, protocol: any /* Protocol */): boolean;
declare function class_conformsToProtocol(cls: typeof NSObject, protocol: any /* Protocol */): boolean;
declare function class_copyIvarList(cls: typeof NSObject, outCount: interop.Pointer | interop.Reference<number>): interop.Pointer | interop.Reference<interop.Pointer | interop.Reference<any>>;
declare function class_copyMethodList(cls: typeof NSObject, outCount: interop.Pointer | interop.Reference<number>): interop.Pointer | interop.Reference<interop.Pointer | interop.Reference<any>>;
declare function class_copyPropertyList(cls: typeof NSObject, outCount: interop.Pointer | interop.Reference<number>): interop.Pointer | interop.Reference<interop.Pointer | interop.Reference<any>>;
declare function class_copyProtocolList(cls: typeof NSObject, outCount: interop.Pointer | interop.Reference<number>): interop.Pointer | interop.Reference<any /* Protocol */>;
declare function class_createInstance(cls: typeof NSObject, extraBytes: number): any;
declare function class_createInstanceFunction(cls: typeof NSObject, extraBytes: number): any;
declare function class_getClassMethod(cls: typeof NSObject, name: string): interop.Pointer | interop.Reference<any>;
declare function class_getClassVariable(cls: typeof NSObject, name: string | interop.Pointer | interop.Reference<any>): interop.Pointer | interop.Reference<any>;
declare function class_getImageName(cls: typeof NSObject): string;
declare function class_getInstanceMethod(cls: typeof NSObject, name: string): interop.Pointer | interop.Reference<any>;
declare function class_getInstanceSize(cls: typeof NSObject): number;
declare function class_getInstanceVariable(cls: typeof NSObject, name: string | interop.Pointer | interop.Reference<any>): interop.Pointer | interop.Reference<any>;
declare function class_getIvarLayout(cls: typeof NSObject): string;
declare function class_getMethodImplementation(cls: typeof NSObject, name: string): interop.FunctionReference<() => void>;
declare function class_getMethodImplementation_stret(cls: typeof NSObject, name: string): interop.FunctionReference<() => void>;
declare function class_getName(cls: typeof NSObject): string;
declare function class_getProperty(cls: typeof NSObject, name: string | interop.Pointer | interop.Reference<any>): interop.Pointer | interop.Reference<any>;
declare function class_getSuperclass(cls: typeof NSObject): typeof NSObject;
declare function class_getVersion(cls: typeof NSObject): number;
declare function class_getWeakIvarLayout(cls: typeof NSObject): string;
declare function class_isMetaClass(cls: typeof NSObject): boolean;
declare function class_lookupMethod(cls: typeof NSObject, sel: string): interop.FunctionReference<() => void>;
declare function class_replaceMethod(cls: typeof NSObject, name: string, imp: interop.FunctionReference<() => void>, types: string | interop.Pointer | interop.Reference<any>): interop.FunctionReference<() => void>;
declare function class_replaceProperty(cls: typeof NSObject, name: string | interop.Pointer | interop.Reference<any>, attributes: interop.Pointer | interop.Reference<objc_property_attribute_t>, attributeCount: number): void;
declare function class_respondsToMethod(cls: typeof NSObject, sel: string): boolean;
declare function class_respondsToSelector(cls: typeof NSObject, sel: string): boolean;
declare function class_setIvarLayout(cls: typeof NSObject, layout: string | interop.Pointer | interop.Reference<any>): void;
declare function class_setSuperclass(cls: typeof NSObject, newSuper: typeof NSObject): typeof NSObject;
declare function class_setVersion(cls: typeof NSObject, version: number): void;
declare function class_setWeakIvarLayout(cls: typeof NSObject, layout: string | interop.Pointer | interop.Reference<any>): void;
declare function imp_getBlock(anImp: interop.FunctionReference<() => void>): any;
declare function imp_implementationWithBlock(block: any): interop.FunctionReference<() => void>;
declare function imp_removeBlock(anImp: interop.FunctionReference<() => void>): boolean;
declare function ivar_getName(v: interop.Pointer | interop.Reference<any>): string;
declare function ivar_getOffset(v: interop.Pointer | interop.Reference<any>): number;
declare function ivar_getTypeEncoding(v: interop.Pointer | interop.Reference<any>): string;
declare function method_copyArgumentType(m: interop.Pointer | interop.Reference<any>, index: number): string;
declare function method_copyReturnType(m: interop.Pointer | interop.Reference<any>): string;
declare function method_exchangeImplementations(m1: interop.Pointer | interop.Reference<any>, m2: interop.Pointer | interop.Reference<any>): void;
declare function method_getArgumentType(m: interop.Pointer | interop.Reference<any>, index: number, dst: string | interop.Pointer | interop.Reference<any>, dst_len: number): void;
declare function method_getDescription(m: interop.Pointer | interop.Reference<any>): interop.Pointer | interop.Reference<objc_method_description>;
declare function method_getImplementation(m: interop.Pointer | interop.Reference<any>): interop.FunctionReference<() => void>;
declare function method_getName(m: interop.Pointer | interop.Reference<any>): string;
declare function method_getNumberOfArguments(m: interop.Pointer | interop.Reference<any>): number;
declare function method_getReturnType(m: interop.Pointer | interop.Reference<any>, dst: string | interop.Pointer | interop.Reference<any>, dst_len: number): void;
declare function method_getTypeEncoding(m: interop.Pointer | interop.Reference<any>): string;
declare function method_invoke(): void;
declare function method_invoke_stret(): void;
declare function method_setImplementation(m: interop.Pointer | interop.Reference<any>, imp: interop.FunctionReference<() => void>): interop.FunctionReference<() => void>;
declare const enum objc_AssociationPolicy {
OBJC_ASSOCIATION_ASSIGN = 0,
OBJC_ASSOCIATION_RETAIN_NONATOMIC = 1,
OBJC_ASSOCIATION_COPY_NONATOMIC = 3,
OBJC_ASSOCIATION_RETAIN = 769,
OBJC_ASSOCIATION_COPY = 771
}
declare function objc_addLoadImageFunc(func: interop.FunctionReference<(p1: interop.Pointer | interop.Reference<mach_header>) => void>): void;
declare function objc_allocateClassPair(superclass: typeof NSObject, name: string | interop.Pointer | interop.Reference<any>, extraBytes: number): typeof NSObject;
declare function objc_allocateProtocol(name: string | interop.Pointer | interop.Reference<any>): any /* Protocol */;
declare function objc_begin_catch(exc_buf: interop.Pointer | interop.Reference<any>): any;
declare function objc_constructInstance(cls: typeof NSObject, bytes: interop.Pointer | interop.Reference<any>): any;
declare function objc_copyClassList(outCount: interop.Pointer | interop.Reference<number>): interop.Pointer | interop.Reference<typeof NSObject>;
declare function objc_copyClassNamesForImage(image: string | interop.Pointer | interop.Reference<any>, outCount: interop.Pointer | interop.Reference<number>): interop.Pointer | interop.Reference<string>;
declare function objc_copyImageNames(outCount: interop.Pointer | interop.Reference<number>): interop.Pointer | interop.Reference<string>;
declare function objc_copyProtocolList(outCount: interop.Pointer | interop.Reference<number>): interop.Pointer | interop.Reference<any /* Protocol */>;
declare function objc_destructInstance(obj: any): interop.Pointer | interop.Reference<any>;
declare function objc_disposeClassPair(cls: typeof NSObject): void;
declare function objc_duplicateClass(original: typeof NSObject, name: string | interop.Pointer | interop.Reference<any>, extraBytes: number): typeof NSObject;
declare function objc_end_catch(): void;
declare function objc_enumerationMutation(obj: any): void;
declare function objc_exception_rethrow(): void;
declare function objc_exception_throw(exception: any): void;
declare function objc_getAssociatedObject(object: any, key: interop.Pointer | interop.Reference<any>): any;
declare function objc_getClass(name: string | interop.Pointer | interop.Reference<any>): any;
declare function objc_getClassList(buffer: interop.Pointer | interop.Reference<typeof NSObject>, bufferCount: number): number;
declare function objc_getFutureClass(name: string | interop.Pointer | interop.Reference<any>): typeof NSObject;
declare function objc_getMetaClass(name: string | interop.Pointer | interop.Reference<any>): any;
declare function objc_getProtocol(name: string | interop.Pointer | interop.Reference<any>): any /* Protocol */;
declare function objc_getRequiredClass(name: string | interop.Pointer | interop.Reference<any>): typeof NSObject;
declare function objc_loadWeak(location: interop.Pointer | interop.Reference<any>): any;
declare function objc_lookUpClass(name: string | interop.Pointer | interop.Reference<any>): typeof NSObject;
interface objc_method_description {
name: string;
types: string;
}
declare var objc_method_description: interop.StructType<objc_method_description>;
declare function objc_msgSend(): void;
declare function objc_msgSendSuper(): void;
declare function objc_msgSendSuper_stret(): void;
declare function objc_msgSend_fp2ret(): void;
declare function objc_msgSend_fpret(): void;
declare function objc_msgSend_stret(): void;
interface objc_object {
isa: typeof NSObject;
}
declare var objc_object: interop.StructType<objc_object>;
interface objc_property_attribute_t {
name: string;
value: string;
}
declare var objc_property_attribute_t: interop.StructType<objc_property_attribute_t>;
declare function objc_registerClassPair(cls: typeof NSObject): void;
declare function objc_registerProtocol(proto: any /* Protocol */): void;
declare function objc_removeAssociatedObjects(object: any): void;
declare function objc_setAssociatedObject(object: any, key: interop.Pointer | interop.Reference<any>, value: any, policy: objc_AssociationPolicy): void;
declare function objc_setEnumerationMutationHandler(handler: interop.FunctionReference<(p1: any) => void>): void;
declare function objc_setExceptionMatcher(fn: interop.FunctionReference<(p1: typeof NSObject, p2: any) => number>): interop.FunctionReference<(p1: typeof NSObject, p2: any) => number>;
declare function objc_setExceptionPreprocessor(fn: interop.FunctionReference<(p1: any) => any>): interop.FunctionReference<(p1: any) => any>;
declare function objc_setForwardHandler(fwd: interop.Pointer | interop.Reference<any>, fwd_stret: interop.Pointer | interop.Reference<any>): void;
declare function objc_setHook_getClass(newValue: interop.FunctionReference<(p1: string, p2: interop.Pointer | interop.Reference<typeof NSObject>) => boolean>, outOldValue: interop.Pointer | interop.Reference<interop.FunctionReference<(p1: string, p2: interop.Pointer | interop.Reference<typeof NSObject>) => boolean>>): void;
declare function objc_setHook_getImageName(newValue: interop.FunctionReference<(p1: typeof NSObject, p2: interop.Pointer | interop.Reference<string>) => boolean>, outOldValue: interop.Pointer | interop.Reference<interop.FunctionReference<(p1: typeof NSObject, p2: interop.Pointer | interop.Reference<string>) => boolean>>): void;
declare function objc_setHook_lazyClassNamer(newValue: interop.FunctionReference<(p1: typeof NSObject) => string>, oldOutValue: interop.Pointer | interop.Reference<interop.FunctionReference<(p1: typeof NSObject) => string>>): void;
declare function objc_setUncaughtExceptionHandler(fn: interop.FunctionReference<(p1: any) => void>): interop.FunctionReference<(p1: any) => void>;
declare function objc_storeWeak(location: interop.Pointer | interop.Reference<any>, obj: any): any;
interface objc_super {
receiver: any;
super_class: typeof NSObject;
}
declare var objc_super: interop.StructType<objc_super>;
declare function objc_sync_enter(obj: any): number;
declare function objc_sync_exit(obj: any): number;
declare function objc_terminate(): void;
declare function object_copy(obj: any, size: number): any;
declare function object_dispose(obj: any): any;
declare function object_getClass(obj: any): typeof NSObject;
declare function object_getClassName(obj: any): string;
declare function object_getIndexedIvars(obj: any): interop.Pointer | interop.Reference<any>;
declare function object_getInstanceVariable(obj: any, name: string | interop.Pointer | interop.Reference<any>, outValue: interop.Pointer | interop.Reference<interop.Pointer | interop.Reference<any>>): interop.Pointer | interop.Reference<any>;
declare function object_getIvar(obj: any, ivar: interop.Pointer | interop.Reference<any>): any;
declare function object_isClass(obj: any): boolean;
declare function object_setClass(obj: any, cls: typeof NSObject): typeof NSObject;
declare function object_setInstanceVariable(obj: any, name: string | interop.Pointer | interop.Reference<any>, value: interop.Pointer | interop.Reference<any>): interop.Pointer | interop.Reference<any>;
declare function object_setInstanceVariableWithStrongDefault(obj: any, name: string | interop.Pointer | interop.Reference<any>, value: interop.Pointer | interop.Reference<any>): interop.Pointer | interop.Reference<any>;
declare function object_setIvar(obj: any, ivar: interop.Pointer | interop.Reference<any>, value: any): void;
declare function object_setIvarWithStrongDefault(obj: any, ivar: interop.Pointer | interop.Reference<any>, value: any): void;
declare function property_copyAttributeList(property: interop.Pointer | interop.Reference<any>, outCount: interop.Pointer | interop.Reference<number>): interop.Pointer | interop.Reference<objc_property_attribute_t>;
declare function property_copyAttributeValue(property: interop.Pointer | interop.Reference<any>, attributeName: string | interop.Pointer | interop.Reference<any>): string;
declare function property_getAttributes(property: interop.Pointer | interop.Reference<any>): string;
declare function property_getName(property: interop.Pointer | interop.Reference<any>): string;
declare function protocol_addMethodDescription(proto: any /* Protocol */, name: string, types: string | interop.Pointer | interop.Reference<any>, isRequiredMethod: boolean, isInstanceMethod: boolean): void;
declare function protocol_addProperty(proto: any /* Protocol */, name: string | interop.Pointer | interop.Reference<any>, attributes: interop.Pointer | interop.Reference<objc_property_attribute_t>, attributeCount: number, isRequiredProperty: boolean, isInstanceProperty: boolean): void;
declare function protocol_addProtocol(proto: any /* Protocol */, addition: any /* Protocol */): void;
declare function protocol_conformsToProtocol(proto: any /* Protocol */, other: any /* Protocol */): boolean;
declare function protocol_copyMethodDescriptionList(proto: any /* Protocol */, isRequiredMethod: boolean, isInstanceMethod: boolean, outCount: interop.Pointer | interop.Reference<number>): interop.Pointer | interop.Reference<objc_method_description>;
declare function protocol_copyPropertyList(proto: any /* Protocol */, outCount: interop.Pointer | interop.Reference<number>): interop.Pointer | interop.Reference<interop.Pointer | interop.Reference<any>>;
declare function protocol_copyPropertyList2(proto: any /* Protocol */, outCount: interop.Pointer | interop.Reference<number>, isRequiredProperty: boolean, isInstanceProperty: boolean): interop.Pointer | interop.Reference<interop.Pointer | interop.Reference<any>>;
declare function protocol_copyProtocolList(proto: any /* Protocol */, outCount: interop.Pointer | interop.Reference<number>): interop.Pointer | interop.Reference<any /* Protocol */>;
declare function protocol_getMethodDescription(proto: any /* Protocol */, aSel: string, isRequiredMethod: boolean, isInstanceMethod: boolean): objc_method_description;
declare function protocol_getName(proto: any /* Protocol */): string;
declare function protocol_getProperty(proto: any /* Protocol */, name: string | interop.Pointer | interop.Reference<any>, isRequiredProperty: boolean, isInstanceProperty: boolean): interop.Pointer | interop.Reference<any>;
declare function protocol_isEqual(proto: any /* Protocol */, other: any /* Protocol */): boolean;
declare function sel_getName(sel: string): string;
declare function sel_getNameFunction(sel: string): string;
declare function sel_getUid(str: string | interop.Pointer | interop.Reference<any>): string;
declare function sel_isEqual(lhs: string, rhs: string): boolean;
declare function sel_isMapped(sel: string): boolean;
declare function sel_registerName(str: string | interop.Pointer | interop.Reference<any>): string;
declare function sel_registerNameFunction(str: string | interop.Pointer | interop.Reference<any>): string;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
/// <reference path="interop.d.ts" />
/**
* Triggers garbage collection in JavaScript
*/
declare function __collect(): void;
/**
* Releases the reference to the wrapped native object
* @param object The Objective-C object to release.
*/
declare function __releaseNativeCounterpart(object: NSObject): void;
/**
* Gets accurate system timestamp in ms.
*/
declare function __time(): Number;

View File

@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -e -o pipefail
echo "Deleting old ios typings (ios/objc-x86_64)..."
rm packages/types-minimal/src/lib/ios/objc-x86_64/*
echo "Copying minimal typings to ios/objc-x86_64..."
array=( objc!AVFoundation.d.ts objc!Foundation.d.ts objc!ObjectiveC.d.ts objc!UIKit.d.ts )
for i in "${array[@]}"
do
echo "Including: $i"
cp -R packages/types-ios/src/lib/ios/objc-x86_64/$i packages/types-minimal/src/lib/ios/objc-x86_64/$i
done
pushd packages/types-minimal/src/lib/ios
rm ios.d.ts
echo '/// <reference path="runtime.d.ts" />' > ios.d.ts
for i in `ls objc-x86_64/*.d.ts`; do
echo "/// <reference path=\"$i\" />" >> ios.d.ts
done
popd
echo "Deleting old android typings..."
rm packages/types-minimal/src/lib/android/api/*
echo "Copying minimal typings to android/api..."
array=( android-declarations.d.ts android-platform-32.d.ts androidx-32.d.ts )
for i in "${array[@]}"
do
echo "Including: $i"
cp -R packages/types-android/src/lib/android/$i packages/types-minimal/src/lib/android/api/$i
done

View File

@ -9,6 +9,7 @@
"types": "packages/types",
"types-android": "packages/types-android",
"types-ios": "packages/types-ios",
"types-minimal": "packages/types-minimal",
"ui-mobile-base": "packages/ui-mobile-base",
"webpack": "packages/webpack",
"webpack5": "packages/webpack5"