From 13deafec79134a545f77631113e166e75928c5e8 Mon Sep 17 00:00:00 2001 From: Hristo Deshev Date: Fri, 18 Sep 2015 11:20:17 +0300 Subject: [PATCH] Fix typescript 1.6 compile errors. - Remove unknown properties in object literals. - Don't use module-level `delete` statements. --- apps/tests/layouts/dock-layout-tests.ts | 8 ++++---- apps/tests/layouts/grid-layout-tests.ts | 6 +++--- apps/tests/layouts/stack-layout-tests.ts | 10 +++++----- apps/tests/ui/scroll-view/scroll-view-tests.ts | 6 +++--- apps/tests/ui/style/style-properties-tests.ts | 6 +++--- data/observable/observable.d.ts | 4 ++-- data/observable/observable.ts | 4 ++-- ui/animation/animation.ios.ts | 5 ++--- ui/builder/component-builder.ts | 4 +--- ui/button/button.android.ts | 9 +++++++-- ui/date-picker/date-picker.android.ts | 9 +++++++-- ui/list-picker/list-picker.android.ts | 11 ++++++++--- ui/list-view/list-view.android.ts | 6 +++++- ui/search-bar/search-bar.android.ts | 10 +++++++--- ui/switch/switch.android.ts | 8 ++++++-- ui/time-picker/time-picker.android.ts | 9 +++++++-- 16 files changed, 72 insertions(+), 43 deletions(-) diff --git a/apps/tests/layouts/dock-layout-tests.ts b/apps/tests/layouts/dock-layout-tests.ts index 807d8dbc7..d26349d3b 100644 --- a/apps/tests/layouts/dock-layout-tests.ts +++ b/apps/tests/layouts/dock-layout-tests.ts @@ -50,9 +50,9 @@ export function setUpModule() { export function tearDownModule() { navHelper.goBack(); - delete testPage; - delete rootLayout; - delete tmp; + testPage = null; + rootLayout = null; + tmp = null; } export function setUp() { @@ -212,4 +212,4 @@ export function test_codesnippets() { dockLayout.addChild(btnDockedToRight); // ``` // -} \ No newline at end of file +} diff --git a/apps/tests/layouts/grid-layout-tests.ts b/apps/tests/layouts/grid-layout-tests.ts index f9df850f8..52bbb5efa 100644 --- a/apps/tests/layouts/grid-layout-tests.ts +++ b/apps/tests/layouts/grid-layout-tests.ts @@ -52,9 +52,9 @@ export function setUpModule() { export function tearDownModule() { navHelper.goBack(); - delete tmp; - delete newPage; - delete rootLayout; + tmp = null; + newPage = null; + rootLayout = null; } export function setUp() { diff --git a/apps/tests/layouts/stack-layout-tests.ts b/apps/tests/layouts/stack-layout-tests.ts index c2366be2c..a011bf091 100644 --- a/apps/tests/layouts/stack-layout-tests.ts +++ b/apps/tests/layouts/stack-layout-tests.ts @@ -29,11 +29,11 @@ export function setUpModule() { export function tearDownModule() { navHelper.goBack(); - delete tmp; - delete newPage; - delete rootLayout; - delete btn1; - delete btn2; + tmp = null; + newPage = null; + rootLayout = null; + btn1 = null; + btn2 = null; } export function setUp() { diff --git a/apps/tests/ui/scroll-view/scroll-view-tests.ts b/apps/tests/ui/scroll-view/scroll-view-tests.ts index fa84a5865..d4972357a 100644 --- a/apps/tests/ui/scroll-view/scroll-view-tests.ts +++ b/apps/tests/ui/scroll-view/scroll-view-tests.ts @@ -49,9 +49,9 @@ export function setUpModule() { export function tearDownModule() { helper.goBack(); - delete tmp; - delete newPage; - delete scrollView; + tmp = null; + newPage = null; + scrollView = null; } export function setUp() { diff --git a/apps/tests/ui/style/style-properties-tests.ts b/apps/tests/ui/style/style-properties-tests.ts index 0b00df829..34ed9674e 100644 --- a/apps/tests/ui/style/style-properties-tests.ts +++ b/apps/tests/ui/style/style-properties-tests.ts @@ -25,8 +25,8 @@ export function setUpModule() { export function tearDownModule() { helper.goBack(); - delete testBtn; - delete testPage; + testBtn = null; + testPage = null; } export function tearDown() { @@ -362,4 +362,4 @@ function test_native_font(style: string, weight: string) { TKUnit.assertEqual((testView.ios).titleLabel.font.fontName.toLowerCase(), (fontName + "-" + fontNameSuffix).toLowerCase(), "native font " + weight + " " + style); } //TODO: If needed add tests for other platforms -} \ No newline at end of file +} diff --git a/data/observable/observable.d.ts b/data/observable/observable.d.ts index df3546ea6..939e762c2 100644 --- a/data/observable/observable.d.ts +++ b/data/observable/observable.d.ts @@ -97,7 +97,7 @@ declare module "data/observable" { * Notifies all the registered listeners for the event provided in the data.eventName. * @param data The data associated with the event. */ - notify(data: EventData): void; + notify(data: T): void; /** * Notifies all the registered listeners for the property change event. @@ -119,4 +119,4 @@ declare module "data/observable" { _emit(eventNames: string); //@endprivate } -} \ No newline at end of file +} diff --git a/data/observable/observable.ts b/data/observable/observable.ts index 9d2c0e48c..3fd51a3c3 100644 --- a/data/observable/observable.ts +++ b/data/observable/observable.ts @@ -127,7 +127,7 @@ export class Observable implements definition.Observable { this[data.propertyName] = data.value; } - public notify(data: definition.EventData) { + public notify(data: T) { var observers = this._getEventList(data.eventName); if (!observers) { return; @@ -206,4 +206,4 @@ export class Observable implements definition.Observable { public toString(): string { return this.typeName; } -} \ No newline at end of file +} diff --git a/ui/animation/animation.ios.ts b/ui/animation/animation.ios.ts index b2f9a1b0f..d7998e0cc 100644 --- a/ui/animation/animation.ios.ts +++ b/ui/animation/animation.ios.ts @@ -272,8 +272,7 @@ export class Animation extends common.Animation implements definition.Animation value: Animation._affineTransform(CGAffineTransformIdentity, propertyAnimations[i].property, propertyAnimations[i].value), duration: propertyAnimations[i].duration, delay: propertyAnimations[i].delay, - iterations: propertyAnimations[i].iterations, - iosUIViewAnimationCurve: propertyAnimations[i].curve + iterations: propertyAnimations[i].iterations }; trace.write("Created new transform animation: " + common.Animation._getAnimationInfo(newTransformAnimation), trace.categories.Animation); @@ -299,4 +298,4 @@ export class Animation extends common.Animation implements definition.Animation return result; } -} \ No newline at end of file +} diff --git a/ui/builder/component-builder.ts b/ui/builder/component-builder.ts index 3878a4d38..3a596f8d3 100644 --- a/ui/builder/component-builder.ts +++ b/ui/builder/component-builder.ts @@ -101,8 +101,6 @@ export function getComponentModule(elementName: string, namespace: string, attri } if (instance && instanceModule) { - var bindings = new Array(); - for (var attr in attributes) { var attrValue = attributes[attr]; @@ -136,7 +134,7 @@ export function getComponentModule(elementName: string, namespace: string, attri } } - componentModule = { component: instance, exports: instanceModule, bindings: bindings }; + componentModule = {component: instance, exports: instanceModule}; } return componentModule; diff --git a/ui/button/button.android.ts b/ui/button/button.android.ts index 55d1defbf..b5f29d114 100644 --- a/ui/button/button.android.ts +++ b/ui/button/button.android.ts @@ -2,6 +2,10 @@ global.moduleMerge(common, exports); +interface Owned { + owner: any; +} + export class Button extends common.Button { private _android: android.widget.Button; private _isPressed: boolean; @@ -22,7 +26,8 @@ export class Button extends common.Button { this._android = new android.widget.Button(this._context); - this._android.setOnClickListener(new android.view.View.OnClickListener({ + this._android.setOnClickListener(new android.view.View.OnClickListener( + { get owner() { return that.get(); }, @@ -34,4 +39,4 @@ export class Button extends common.Button { } })); } -} \ No newline at end of file +} diff --git a/ui/date-picker/date-picker.android.ts b/ui/date-picker/date-picker.android.ts index 34ea427e5..a121ae333 100644 --- a/ui/date-picker/date-picker.android.ts +++ b/ui/date-picker/date-picker.android.ts @@ -65,6 +65,10 @@ function onMinDatePropertyChanged(data: dependencyObservable.PropertyChangeData) global.moduleMerge(common, exports); +interface Owned { + owner: any; +} + export class DatePicker extends common.DatePicker { private _android: android.widget.DatePicker; public _listener: android.widget.DatePicker.OnDateChangedListener; @@ -78,7 +82,8 @@ export class DatePicker extends common.DatePicker { var that = new WeakRef(this); - this._listener = new android.widget.DatePicker.OnDateChangedListener({ + this._listener = new android.widget.DatePicker.OnDateChangedListener( + { get owner() { return that.get(); }, @@ -107,4 +112,4 @@ export class DatePicker extends common.DatePicker { this._android.setCalendarViewShown(false); this._android.init(0, 0, 0, this._listener); } -} \ No newline at end of file +} diff --git a/ui/list-picker/list-picker.android.ts b/ui/list-picker/list-picker.android.ts index 87221d5f2..46d55cd99 100644 --- a/ui/list-picker/list-picker.android.ts +++ b/ui/list-picker/list-picker.android.ts @@ -4,6 +4,10 @@ import types = require("utils/types"); global.moduleMerge(common, exports); +interface Owned { + owner: any; +} + export class ListPicker extends common.ListPicker { private _android: android.widget.NumberPicker; private _valueChangedListener: android.widget.NumberPicker.OnValueChangeListener; @@ -28,7 +32,8 @@ export class ListPicker extends common.ListPicker { var that = new WeakRef(this); - this._formatter = new android.widget.NumberPicker.Formatter({ + this._formatter = new android.widget.NumberPicker.Formatter( + { get owner(): ListPicker { return that.get(); }, @@ -43,7 +48,7 @@ export class ListPicker extends common.ListPicker { }); this._android.setFormatter(this._formatter); - this._valueChangedListener = new android.widget.NumberPicker.OnValueChangeListener({ + this._valueChangedListener = new android.widget.NumberPicker.OnValueChangeListener({ get owner() { return that.get(); }, @@ -106,4 +111,4 @@ export class ListPicker extends common.ListPicker { this._editText.invalidate(); //Force the EditText to redraw this.android.invalidate(); } -} \ No newline at end of file +} diff --git a/ui/list-view/list-view.android.ts b/ui/list-view/list-view.android.ts index 1668928b3..8810b4b69 100644 --- a/ui/list-view/list-view.android.ts +++ b/ui/list-view/list-view.android.ts @@ -27,6 +27,10 @@ function onSeparatorColorPropertyChanged(data: dependencyObservable.PropertyChan } } +interface Owned { + owner: any; +} + // register the setNativeValue callbacks (common.ListView.separatorColorProperty.metadata).onSetNativeValue = onSeparatorColorPropertyChanged; @@ -50,7 +54,7 @@ export class ListView extends common.ListView { var that = new WeakRef(this); // TODO: This causes many marshalling calls, rewrite in Java and generate bindings - this.android.setOnScrollListener(new android.widget.AbsListView.OnScrollListener({ + this.android.setOnScrollListener(new android.widget.AbsListView.OnScrollListener({ onScrollStateChanged: function (view: android.widget.AbsListView, scrollState: number) { var owner: ListView = this.owner; if (!owner) { diff --git a/ui/search-bar/search-bar.android.ts b/ui/search-bar/search-bar.android.ts index 2a05b0e83..c708ca2dc 100644 --- a/ui/search-bar/search-bar.android.ts +++ b/ui/search-bar/search-bar.android.ts @@ -92,6 +92,10 @@ function _changeSearchViewHintColor(bar: android.widget.SearchView, color: numbe global.moduleMerge(common, exports); +interface Owned { + owner: any; +} + export class SearchBar extends common.SearchBar { private _android: android.widget.SearchView; @@ -101,7 +105,7 @@ export class SearchBar extends common.SearchBar { this._android.setIconified(false); var that = new WeakRef(this); - this._android.setOnQueryTextListener(new android.widget.SearchView.OnQueryTextListener({ + this._android.setOnQueryTextListener(new android.widget.SearchView.OnQueryTextListener({ get owner() { return that.get(); }, @@ -132,7 +136,7 @@ export class SearchBar extends common.SearchBar { } })); - this._android.setOnCloseListener(new android.widget.SearchView.OnCloseListener({ + this._android.setOnCloseListener(new android.widget.SearchView.OnCloseListener({ get owner() { return that.get(); }, @@ -156,4 +160,4 @@ export class SearchBar extends common.SearchBar { get android(): android.widget.SearchView { return this._android; } -} \ No newline at end of file +} diff --git a/ui/switch/switch.android.ts b/ui/switch/switch.android.ts index 4363c6acf..7bd9d60cd 100644 --- a/ui/switch/switch.android.ts +++ b/ui/switch/switch.android.ts @@ -16,6 +16,10 @@ function onCheckedPropertyChanged(data: dependencyObservable.PropertyChangeData) global.moduleMerge(common, exports); +interface Owned { + owner: any; +} + export class Switch extends common.Switch { private _android: android.widget.Switch; @@ -28,7 +32,7 @@ export class Switch extends common.Switch { var that = new WeakRef(this); - this._android.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener({ + this._android.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener({ get owner() { return that.get(); }, @@ -40,4 +44,4 @@ export class Switch extends common.Switch { } })); } -} \ No newline at end of file +} diff --git a/ui/time-picker/time-picker.android.ts b/ui/time-picker/time-picker.android.ts index d966c6b30..370917f6c 100644 --- a/ui/time-picker/time-picker.android.ts +++ b/ui/time-picker/time-picker.android.ts @@ -18,6 +18,10 @@ function onMinutePropertyChanged(data: dependencyObservable.PropertyChangeData) global.moduleMerge(common, exports); +interface Owned { + owner: any; +} + export class TimePicker extends common.TimePicker { private _android: android.widget.TimePicker; private _listener: android.widget.TimePicker.OnTimeChangedListener; @@ -32,7 +36,8 @@ export class TimePicker extends common.TimePicker { var that = new WeakRef(this); - this._listener = new android.widget.TimePicker.OnTimeChangedListener({ + this._listener = new android.widget.TimePicker.OnTimeChangedListener( + { get owner() { return that.get(); }, @@ -80,4 +85,4 @@ export class TimePicker extends common.TimePicker { this._isSettingTime = false; } } -} \ No newline at end of file +}