Skip to content

Commit 13deafe

Browse files
hdeshevVladimir Enchev
authored and
Vladimir Enchev
committed
Fix typescript 1.6 compile errors.
- Remove unknown properties in object literals. - Don't use module-level `delete` statements.
1 parent ccbd00d commit 13deafe

File tree

16 files changed

+72
-43
lines changed

16 files changed

+72
-43
lines changed

apps/tests/layouts/dock-layout-tests.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ export function setUpModule() {
5050

5151
export function tearDownModule() {
5252
navHelper.goBack();
53-
delete testPage;
54-
delete rootLayout;
55-
delete tmp;
53+
testPage = null;
54+
rootLayout = null;
55+
tmp = null;
5656
}
5757

5858
export function setUp() {
@@ -212,4 +212,4 @@ export function test_codesnippets() {
212212
dockLayout.addChild(btnDockedToRight);
213213
// ```
214214
// </snippet>
215-
}
215+
}

apps/tests/layouts/grid-layout-tests.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ export function setUpModule() {
5252
export function tearDownModule() {
5353
navHelper.goBack();
5454

55-
delete tmp;
56-
delete newPage;
57-
delete rootLayout;
55+
tmp = null;
56+
newPage = null;
57+
rootLayout = null;
5858
}
5959

6060
export function setUp() {

apps/tests/layouts/stack-layout-tests.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export function setUpModule() {
2929

3030
export function tearDownModule() {
3131
navHelper.goBack();
32-
delete tmp;
33-
delete newPage;
34-
delete rootLayout;
35-
delete btn1;
36-
delete btn2;
32+
tmp = null;
33+
newPage = null;
34+
rootLayout = null;
35+
btn1 = null;
36+
btn2 = null;
3737
}
3838

3939
export function setUp() {

apps/tests/ui/scroll-view/scroll-view-tests.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ export function setUpModule() {
4949

5050
export function tearDownModule() {
5151
helper.goBack();
52-
delete tmp;
53-
delete newPage;
54-
delete scrollView;
52+
tmp = null;
53+
newPage = null;
54+
scrollView = null;
5555
}
5656

5757
export function setUp() {

apps/tests/ui/style/style-properties-tests.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export function setUpModule() {
2525

2626
export function tearDownModule() {
2727
helper.goBack();
28-
delete testBtn;
29-
delete testPage;
28+
testBtn = null;
29+
testPage = null;
3030
}
3131

3232
export function tearDown() {
@@ -362,4 +362,4 @@ function test_native_font(style: string, weight: string) {
362362
TKUnit.assertEqual((<UIButton>testView.ios).titleLabel.font.fontName.toLowerCase(), (fontName + "-" + fontNameSuffix).toLowerCase(), "native font " + weight + " " + style);
363363
}
364364
//TODO: If needed add tests for other platforms
365-
}
365+
}

data/observable/observable.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ declare module "data/observable" {
9797
* Notifies all the registered listeners for the event provided in the data.eventName.
9898
* @param data The data associated with the event.
9999
*/
100-
notify(data: EventData): void;
100+
notify<T extends EventData>(data: T): void;
101101

102102
/**
103103
* Notifies all the registered listeners for the property change event.
@@ -119,4 +119,4 @@ declare module "data/observable" {
119119
_emit(eventNames: string);
120120
//@endprivate
121121
}
122-
}
122+
}

data/observable/observable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class Observable implements definition.Observable {
127127
this[data.propertyName] = data.value;
128128
}
129129

130-
public notify(data: definition.EventData) {
130+
public notify<T extends definition.EventData>(data: T) {
131131
var observers = this._getEventList(data.eventName);
132132
if (!observers) {
133133
return;
@@ -206,4 +206,4 @@ export class Observable implements definition.Observable {
206206
public toString(): string {
207207
return this.typeName;
208208
}
209-
}
209+
}

ui/animation/animation.ios.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,7 @@ export class Animation extends common.Animation implements definition.Animation
272272
value: Animation._affineTransform(CGAffineTransformIdentity, propertyAnimations[i].property, propertyAnimations[i].value),
273273
duration: propertyAnimations[i].duration,
274274
delay: propertyAnimations[i].delay,
275-
iterations: propertyAnimations[i].iterations,
276-
iosUIViewAnimationCurve: propertyAnimations[i].curve
275+
iterations: propertyAnimations[i].iterations
277276
};
278277
trace.write("Created new transform animation: " + common.Animation._getAnimationInfo(newTransformAnimation), trace.categories.Animation);
279278

@@ -299,4 +298,4 @@ export class Animation extends common.Animation implements definition.Animation
299298

300299
return result;
301300
}
302-
}
301+
}

ui/builder/component-builder.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ export function getComponentModule(elementName: string, namespace: string, attri
101101
}
102102

103103
if (instance && instanceModule) {
104-
var bindings = new Array<bindable.BindingOptions>();
105-
106104
for (var attr in attributes) {
107105

108106
var attrValue = <string>attributes[attr];
@@ -136,7 +134,7 @@ export function getComponentModule(elementName: string, namespace: string, attri
136134
}
137135
}
138136

139-
componentModule = { component: instance, exports: instanceModule, bindings: bindings };
137+
componentModule = {component: instance, exports: instanceModule};
140138
}
141139

142140
return componentModule;

ui/button/button.android.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
global.moduleMerge(common, exports);
44

5+
interface Owned {
6+
owner: any;
7+
}
8+
59
export class Button extends common.Button {
610
private _android: android.widget.Button;
711
private _isPressed: boolean;
@@ -22,7 +26,8 @@ export class Button extends common.Button {
2226

2327
this._android = new android.widget.Button(this._context);
2428

25-
this._android.setOnClickListener(new android.view.View.OnClickListener({
29+
this._android.setOnClickListener(new android.view.View.OnClickListener(
30+
<Owned & android.view.View.IOnClickListener>{
2631
get owner() {
2732
return that.get();
2833
},
@@ -34,4 +39,4 @@ export class Button extends common.Button {
3439
}
3540
}));
3641
}
37-
}
42+
}

ui/date-picker/date-picker.android.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ function onMinDatePropertyChanged(data: dependencyObservable.PropertyChangeData)
6565

6666
global.moduleMerge(common, exports);
6767

68+
interface Owned {
69+
owner: any;
70+
}
71+
6872
export class DatePicker extends common.DatePicker {
6973
private _android: android.widget.DatePicker;
7074
public _listener: android.widget.DatePicker.OnDateChangedListener;
@@ -78,7 +82,8 @@ export class DatePicker extends common.DatePicker {
7882

7983
var that = new WeakRef(this);
8084

81-
this._listener = new android.widget.DatePicker.OnDateChangedListener({
85+
this._listener = new android.widget.DatePicker.OnDateChangedListener(
86+
<Owned & android.widget.DatePicker.IOnDateChangedListener>{
8287
get owner() {
8388
return that.get();
8489
},
@@ -107,4 +112,4 @@ export class DatePicker extends common.DatePicker {
107112
this._android.setCalendarViewShown(false);
108113
this._android.init(0, 0, 0, this._listener);
109114
}
110-
}
115+
}

ui/list-picker/list-picker.android.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import types = require("utils/types");
44

55
global.moduleMerge(common, exports);
66

7+
interface Owned {
8+
owner: any;
9+
}
10+
711
export class ListPicker extends common.ListPicker {
812
private _android: android.widget.NumberPicker;
913
private _valueChangedListener: android.widget.NumberPicker.OnValueChangeListener;
@@ -28,7 +32,8 @@ export class ListPicker extends common.ListPicker {
2832

2933
var that = new WeakRef(this);
3034

31-
this._formatter = new android.widget.NumberPicker.Formatter({
35+
this._formatter = new android.widget.NumberPicker.Formatter(
36+
<Owned & android.widget.NumberPicker.IFormatter>{
3237
get owner(): ListPicker {
3338
return that.get();
3439
},
@@ -43,7 +48,7 @@ export class ListPicker extends common.ListPicker {
4348
});
4449
this._android.setFormatter(this._formatter);
4550

46-
this._valueChangedListener = new android.widget.NumberPicker.OnValueChangeListener({
51+
this._valueChangedListener = new android.widget.NumberPicker.OnValueChangeListener(<Owned & android.widget.NumberPicker.IOnValueChangeListener>{
4752
get owner() {
4853
return that.get();
4954
},
@@ -106,4 +111,4 @@ export class ListPicker extends common.ListPicker {
106111
this._editText.invalidate(); //Force the EditText to redraw
107112
this.android.invalidate();
108113
}
109-
}
114+
}

ui/list-view/list-view.android.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ function onSeparatorColorPropertyChanged(data: dependencyObservable.PropertyChan
2727
}
2828
}
2929

30+
interface Owned {
31+
owner: any;
32+
}
33+
3034
// register the setNativeValue callbacks
3135
(<proxy.PropertyMetadata>common.ListView.separatorColorProperty.metadata).onSetNativeValue = onSeparatorColorPropertyChanged;
3236

@@ -50,7 +54,7 @@ export class ListView extends common.ListView {
5054
var that = new WeakRef(this);
5155

5256
// TODO: This causes many marshalling calls, rewrite in Java and generate bindings
53-
this.android.setOnScrollListener(new android.widget.AbsListView.OnScrollListener({
57+
this.android.setOnScrollListener(new android.widget.AbsListView.OnScrollListener(<Owned & android.widget.AbsListView.IOnScrollListener>{
5458
onScrollStateChanged: function (view: android.widget.AbsListView, scrollState: number) {
5559
var owner: ListView = this.owner;
5660
if (!owner) {

ui/search-bar/search-bar.android.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ function _changeSearchViewHintColor(bar: android.widget.SearchView, color: numbe
9292

9393
global.moduleMerge(common, exports);
9494

95+
interface Owned {
96+
owner: any;
97+
}
98+
9599
export class SearchBar extends common.SearchBar {
96100
private _android: android.widget.SearchView;
97101

@@ -101,7 +105,7 @@ export class SearchBar extends common.SearchBar {
101105
this._android.setIconified(false);
102106

103107
var that = new WeakRef(this);
104-
this._android.setOnQueryTextListener(new android.widget.SearchView.OnQueryTextListener({
108+
this._android.setOnQueryTextListener(new android.widget.SearchView.OnQueryTextListener(<Owned & android.widget.SearchView.IOnQueryTextListener>{
105109
get owner() {
106110
return that.get();
107111
},
@@ -132,7 +136,7 @@ export class SearchBar extends common.SearchBar {
132136
}
133137
}));
134138

135-
this._android.setOnCloseListener(new android.widget.SearchView.OnCloseListener({
139+
this._android.setOnCloseListener(new android.widget.SearchView.OnCloseListener(<Owned & android.widget.SearchView.IOnCloseListener>{
136140
get owner() {
137141
return that.get();
138142
},
@@ -156,4 +160,4 @@ export class SearchBar extends common.SearchBar {
156160
get android(): android.widget.SearchView {
157161
return this._android;
158162
}
159-
}
163+
}

ui/switch/switch.android.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function onCheckedPropertyChanged(data: dependencyObservable.PropertyChangeData)
1616

1717
global.moduleMerge(common, exports);
1818

19+
interface Owned {
20+
owner: any;
21+
}
22+
1923
export class Switch extends common.Switch {
2024
private _android: android.widget.Switch;
2125

@@ -28,7 +32,7 @@ export class Switch extends common.Switch {
2832

2933
var that = new WeakRef(this);
3034

31-
this._android.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener({
35+
this._android.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener(<Owned & android.widget.CompoundButton.IOnCheckedChangeListener>{
3236
get owner() {
3337
return that.get();
3438
},
@@ -40,4 +44,4 @@ export class Switch extends common.Switch {
4044
}
4145
}));
4246
}
43-
}
47+
}

ui/time-picker/time-picker.android.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ function onMinutePropertyChanged(data: dependencyObservable.PropertyChangeData)
1818

1919
global.moduleMerge(common, exports);
2020

21+
interface Owned {
22+
owner: any;
23+
}
24+
2125
export class TimePicker extends common.TimePicker {
2226
private _android: android.widget.TimePicker;
2327
private _listener: android.widget.TimePicker.OnTimeChangedListener;
@@ -32,7 +36,8 @@ export class TimePicker extends common.TimePicker {
3236

3337
var that = new WeakRef(this);
3438

35-
this._listener = new android.widget.TimePicker.OnTimeChangedListener({
39+
this._listener = new android.widget.TimePicker.OnTimeChangedListener(
40+
<Owned & android.widget.TimePicker.IOnTimeChangedListener>{
3641
get owner() {
3742
return that.get();
3843
},
@@ -80,4 +85,4 @@ export class TimePicker extends common.TimePicker {
8085
this._isSettingTime = false;
8186
}
8287
}
83-
}
88+
}

0 commit comments

Comments
 (0)