Upgrade to TypeScript 2.1, and latest grunt-ts. (#3609)

* Upgrade to TypeScript 2.1, and latest grunt-ts.
* Remove AudioBuffer and UIEvent from the definitions, we now should be compatible with dom
* Update the tns-platform-declarations readme
This commit is contained in:
Hristo Deshev
2017-02-08 16:11:40 +02:00
committed by Hristo Deshev
parent 513aeaa47b
commit 489be1e460
23 changed files with 85 additions and 4475 deletions

View File

@@ -4,28 +4,10 @@ Offically supported entry points:
- `android.d.ts` - For android SDK and runtime types.
- `ios.d.ts` - For iOS SDK and runtime types.
Using the declarations may conflict with DOM typings,
consider using TypeScript 2.0.3 or newer,
and the following settings in your `tsconfig.json`:
Add to the content of `reference.d.ts`:
```
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"experimentalDecorators": true,
"lib": [
"es2016"
]
}
}
```
And modify the content of `reference.d.ts` as follows:
```
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
```
d.ts files require a lot of memory and CPU. Consider adding skipLibCheck option to tsconfig file.
d.ts files require a lot of memory and CPU. Consider adding `--skipLibCheck` option to tsconfig file.

View File

@@ -1,10 +1,11 @@
interface AudioBuffer {
mNumberChannels: number;
mDataByteSize: number;
mData: interop.Pointer | interop.Reference<any>;
}
declare var AudioBuffer: interop.StructType<AudioBuffer>;
// // Clashes with the JavaScript dom AudioBuffer
// interface AudioBuffer {
// mNumberChannels: number;
// mDataByteSize: number;
// mData: interop.Pointer | interop.Reference<any>;
// }
// declare var AudioBuffer: interop.StructType<AudioBuffer>;
interface AudioBufferList {
mNumberBuffers: number;

View File

@@ -1978,9 +1978,9 @@ declare class UIApplication extends UIResponder {
scheduleLocalNotification(notification: UILocalNotification): void;
sendActionToFromForEvent(action: string, target: any, sender: any, event: UIEvent): boolean;
sendActionToFromForEvent(action: string, target: any, sender: any, event: _UIEvent): boolean;
sendEvent(event: UIEvent): void;
sendEvent(event: _UIEvent): void;
setKeepAliveTimeoutHandler(timeout: number, keepAliveHandler: () => void): boolean;
@@ -4009,17 +4009,17 @@ declare class UIControl extends UIView {
addTargetActionForControlEvents(target: any, action: string, controlEvents: UIControlEvents): void;
beginTrackingWithTouchWithEvent(touch: UITouch, event: UIEvent): boolean;
beginTrackingWithTouchWithEvent(touch: UITouch, event: _UIEvent): boolean;
cancelTrackingWithEvent(event: UIEvent): void;
cancelTrackingWithEvent(event: _UIEvent): void;
continueTrackingWithTouchWithEvent(touch: UITouch, event: UIEvent): boolean;
continueTrackingWithTouchWithEvent(touch: UITouch, event: _UIEvent): boolean;
endTrackingWithTouchWithEvent(touch: UITouch, event: UIEvent): void;
endTrackingWithTouchWithEvent(touch: UITouch, event: _UIEvent): void;
removeTargetActionForControlEvents(target: any, action: string, controlEvents: UIControlEvents): void;
sendActionToForEvent(action: string, target: any, event: UIEvent): void;
sendActionToForEvent(action: string, target: any, event: _UIEvent): void;
sendActionsForControlEvents(controlEvents: UIControlEvents): void;
}
@@ -4951,11 +4951,14 @@ declare function UIEdgeInsetsFromString(string: string): UIEdgeInsets;
declare var UIEdgeInsetsZero: UIEdgeInsets;
declare class UIEvent extends NSObject {
/**
* Note this is renamed from UIEvent, but UIEvent clashes with the JavaScript DOM UIEvent.
*/
declare class _UIEvent extends NSObject {
static alloc(): UIEvent; // inherited from NSObject
static alloc(): _UIEvent; // inherited from NSObject
static new(): UIEvent; // inherited from NSObject
static new(): _UIEvent; // inherited from NSObject
readonly allTouches: NSSet<UITouch>;
@@ -5456,7 +5459,7 @@ declare class UIGestureRecognizer extends NSObject {
ignorePressForEvent(button: UIPress, event: UIPressesEvent): void;
ignoreTouchForEvent(touch: UITouch, event: UIEvent): void;
ignoreTouchForEvent(touch: UITouch, event: _UIEvent): void;
initWithTargetAction(target: any, action: string): this;
@@ -5482,15 +5485,15 @@ declare class UIGestureRecognizer extends NSObject {
shouldRequireFailureOfGestureRecognizer(otherGestureRecognizer: UIGestureRecognizer): boolean;
touchesBeganWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesBeganWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesCancelledWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesCancelledWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesEndedWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesEndedWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesEstimatedPropertiesUpdated(touches: NSSet<UITouch>): void;
touchesMovedWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesMovedWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
}
interface UIGestureRecognizerDelegate extends NSObjectProtocol {
@@ -6266,7 +6269,7 @@ declare class UIInputViewController extends UIViewController implements UITextIn
dismissKeyboard(): void;
handleInputModeListFromViewWithEvent(view: UIView, event: UIEvent): void;
handleInputModeListFromViewWithEvent(view: UIView, event: _UIEvent): void;
isEqual(object: any): boolean;
@@ -8072,7 +8075,7 @@ declare const enum UIPressType {
PlayPause = 6
}
declare class UIPressesEvent extends UIEvent {
declare class UIPressesEvent extends _UIEvent {
static alloc(): UIPressesEvent; // inherited from NSObject
@@ -8845,11 +8848,11 @@ declare class UIResponder extends NSObject implements UIResponderStandardEditAct
makeTextWritingDirectionRightToLeft(sender: any): void;
motionBeganWithEvent(motion: UIEventSubtype, event: UIEvent): void;
motionBeganWithEvent(motion: UIEventSubtype, event: _UIEvent): void;
motionCancelledWithEvent(motion: UIEventSubtype, event: UIEvent): void;
motionCancelledWithEvent(motion: UIEventSubtype, event: _UIEvent): void;
motionEndedWithEvent(motion: UIEventSubtype, event: UIEvent): void;
motionEndedWithEvent(motion: UIEventSubtype, event: _UIEvent): void;
paste(sender: any): void;
@@ -8869,7 +8872,7 @@ declare class UIResponder extends NSObject implements UIResponderStandardEditAct
reloadInputViews(): void;
remoteControlReceivedWithEvent(event: UIEvent): void;
remoteControlReceivedWithEvent(event: _UIEvent): void;
resignFirstResponder(): boolean;
@@ -8893,15 +8896,15 @@ declare class UIResponder extends NSObject implements UIResponderStandardEditAct
toggleUnderline(sender: any): void;
touchesBeganWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesBeganWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesCancelledWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesCancelledWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesEndedWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesEndedWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesEstimatedPropertiesUpdated(touches: NSSet<UITouch>): void;
touchesMovedWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesMovedWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
updateUserActivityState(activity: NSUserActivity): void;
}
@@ -9199,7 +9202,7 @@ declare class UIScrollView extends UIView implements NSCoding {
setZoomScaleAnimated(scale: number, animated: boolean): void;
touchesShouldBeginWithEventInContentView(touches: NSSet<UITouch>, event: UIEvent, view: UIView): boolean;
touchesShouldBeginWithEventInContentView(touches: NSSet<UITouch>, event: _UIEvent, view: UIView): boolean;
touchesShouldCancelInContentView(view: UIView): boolean;
@@ -13113,7 +13116,7 @@ declare class UIView extends UIResponder implements CALayerDelegate, NSCoding, U
gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer): boolean;
hitTestWithEvent(point: CGPoint, event: UIEvent): UIView;
hitTestWithEvent(point: CGPoint, event: _UIEvent): UIView;
initWithCoder(aDecoder: NSCoder): this;
@@ -13153,7 +13156,7 @@ declare class UIView extends UIResponder implements CALayerDelegate, NSCoding, U
performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any;
pointInsideWithEvent(point: CGPoint, event: UIEvent): boolean;
pointInsideWithEvent(point: CGPoint, event: _UIEvent): boolean;
removeConstraint(constraint: NSLayoutConstraint): void;
@@ -14354,7 +14357,7 @@ declare class UIWindow extends UIView {
resignKeyWindow(): void;
sendEvent(event: UIEvent): void;
sendEvent(event: _UIEvent): void;
}
declare var UIWindowDidBecomeHiddenNotification: string;