Fix typescript 1.6 compile errors.

- Remove unknown properties in object literals.
- Don't use module-level `delete` statements.
This commit is contained in:
Hristo Deshev
2015-09-18 11:20:17 +03:00
parent b7c87bba9c
commit 9fbcf5f143
16 changed files with 72 additions and 43 deletions

View File

@ -50,9 +50,9 @@ export function setUpModule() {
export function tearDownModule() { export function tearDownModule() {
navHelper.goBack(); navHelper.goBack();
delete testPage; testPage = null;
delete rootLayout; rootLayout = null;
delete tmp; tmp = null;
} }
export function setUp() { export function setUp() {
@ -212,4 +212,4 @@ export function test_codesnippets() {
dockLayout.addChild(btnDockedToRight); dockLayout.addChild(btnDockedToRight);
// ``` // ```
// </snippet> // </snippet>
} }

View File

@ -52,9 +52,9 @@ export function setUpModule() {
export function tearDownModule() { export function tearDownModule() {
navHelper.goBack(); navHelper.goBack();
delete tmp; tmp = null;
delete newPage; newPage = null;
delete rootLayout; rootLayout = null;
} }
export function setUp() { export function setUp() {

View File

@ -29,11 +29,11 @@ export function setUpModule() {
export function tearDownModule() { export function tearDownModule() {
navHelper.goBack(); navHelper.goBack();
delete tmp; tmp = null;
delete newPage; newPage = null;
delete rootLayout; rootLayout = null;
delete btn1; btn1 = null;
delete btn2; btn2 = null;
} }
export function setUp() { export function setUp() {

View File

@ -49,9 +49,9 @@ export function setUpModule() {
export function tearDownModule() { export function tearDownModule() {
helper.goBack(); helper.goBack();
delete tmp; tmp = null;
delete newPage; newPage = null;
delete scrollView; scrollView = null;
} }
export function setUp() { export function setUp() {

View File

@ -25,8 +25,8 @@ export function setUpModule() {
export function tearDownModule() { export function tearDownModule() {
helper.goBack(); helper.goBack();
delete testBtn; testBtn = null;
delete testPage; testPage = null;
} }
export function tearDown() { export function tearDown() {
@ -362,4 +362,4 @@ function test_native_font(style: string, weight: string) {
TKUnit.assertEqual((<UIButton>testView.ios).titleLabel.font.fontName.toLowerCase(), (fontName + "-" + fontNameSuffix).toLowerCase(), "native font " + weight + " " + style); TKUnit.assertEqual((<UIButton>testView.ios).titleLabel.font.fontName.toLowerCase(), (fontName + "-" + fontNameSuffix).toLowerCase(), "native font " + weight + " " + style);
} }
//TODO: If needed add tests for other platforms //TODO: If needed add tests for other platforms
} }

View File

@ -97,7 +97,7 @@ declare module "data/observable" {
* Notifies all the registered listeners for the event provided in the data.eventName. * Notifies all the registered listeners for the event provided in the data.eventName.
* @param data The data associated with the event. * @param data The data associated with the event.
*/ */
notify(data: EventData): void; notify<T extends EventData>(data: T): void;
/** /**
* Notifies all the registered listeners for the property change event. * Notifies all the registered listeners for the property change event.
@ -119,4 +119,4 @@ declare module "data/observable" {
_emit(eventNames: string); _emit(eventNames: string);
//@endprivate //@endprivate
} }
} }

View File

@ -118,7 +118,7 @@ export class Observable implements definition.Observable {
this[data.propertyName] = data.value; this[data.propertyName] = data.value;
} }
public notify(data: definition.EventData) { public notify<T extends definition.EventData>(data: T) {
var observers = this._getEventList(data.eventName); var observers = this._getEventList(data.eventName);
if (!observers) { if (!observers) {
return; return;
@ -197,4 +197,4 @@ export class Observable implements definition.Observable {
public toString(): string { public toString(): string {
return this.typeName; return this.typeName;
} }
} }

View File

@ -272,8 +272,7 @@ export class Animation extends common.Animation implements definition.Animation
value: Animation._affineTransform(CGAffineTransformIdentity, propertyAnimations[i].property, propertyAnimations[i].value), value: Animation._affineTransform(CGAffineTransformIdentity, propertyAnimations[i].property, propertyAnimations[i].value),
duration: propertyAnimations[i].duration, duration: propertyAnimations[i].duration,
delay: propertyAnimations[i].delay, delay: propertyAnimations[i].delay,
iterations: propertyAnimations[i].iterations, iterations: propertyAnimations[i].iterations
iosUIViewAnimationCurve: propertyAnimations[i].curve
}; };
trace.write("Created new transform animation: " + common.Animation._getAnimationInfo(newTransformAnimation), trace.categories.Animation); 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; return result;
} }
} }

View File

@ -101,8 +101,6 @@ export function getComponentModule(elementName: string, namespace: string, attri
} }
if (instance && instanceModule) { if (instance && instanceModule) {
var bindings = new Array<bindable.BindingOptions>();
for (var attr in attributes) { for (var attr in attributes) {
var attrValue = <string>attributes[attr]; var attrValue = <string>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; return componentModule;

View File

@ -2,6 +2,10 @@
global.moduleMerge(common, exports); global.moduleMerge(common, exports);
interface Owned {
owner: any;
}
export class Button extends common.Button { export class Button extends common.Button {
private _android: android.widget.Button; private _android: android.widget.Button;
private _isPressed: boolean; private _isPressed: boolean;
@ -22,7 +26,8 @@ export class Button extends common.Button {
this._android = new android.widget.Button(this._context); this._android = new android.widget.Button(this._context);
this._android.setOnClickListener(new android.view.View.OnClickListener({ this._android.setOnClickListener(new android.view.View.OnClickListener(
<Owned & android.view.View.IOnClickListener>{
get owner() { get owner() {
return that.get(); return that.get();
}, },
@ -34,4 +39,4 @@ export class Button extends common.Button {
} }
})); }));
} }
} }

View File

@ -65,6 +65,10 @@ function onMinDatePropertyChanged(data: dependencyObservable.PropertyChangeData)
global.moduleMerge(common, exports); global.moduleMerge(common, exports);
interface Owned {
owner: any;
}
export class DatePicker extends common.DatePicker { export class DatePicker extends common.DatePicker {
private _android: android.widget.DatePicker; private _android: android.widget.DatePicker;
public _listener: android.widget.DatePicker.OnDateChangedListener; public _listener: android.widget.DatePicker.OnDateChangedListener;
@ -78,7 +82,8 @@ export class DatePicker extends common.DatePicker {
var that = new WeakRef(this); var that = new WeakRef(this);
this._listener = new android.widget.DatePicker.OnDateChangedListener({ this._listener = new android.widget.DatePicker.OnDateChangedListener(
<Owned & android.widget.DatePicker.IOnDateChangedListener>{
get owner() { get owner() {
return that.get(); return that.get();
}, },
@ -107,4 +112,4 @@ export class DatePicker extends common.DatePicker {
this._android.setCalendarViewShown(false); this._android.setCalendarViewShown(false);
this._android.init(0, 0, 0, this._listener); this._android.init(0, 0, 0, this._listener);
} }
} }

View File

@ -4,6 +4,10 @@ import types = require("utils/types");
global.moduleMerge(common, exports); global.moduleMerge(common, exports);
interface Owned {
owner: any;
}
export class ListPicker extends common.ListPicker { export class ListPicker extends common.ListPicker {
private _android: android.widget.NumberPicker; private _android: android.widget.NumberPicker;
private _valueChangedListener: android.widget.NumberPicker.OnValueChangeListener; private _valueChangedListener: android.widget.NumberPicker.OnValueChangeListener;
@ -28,7 +32,8 @@ export class ListPicker extends common.ListPicker {
var that = new WeakRef(this); var that = new WeakRef(this);
this._formatter = new android.widget.NumberPicker.Formatter({ this._formatter = new android.widget.NumberPicker.Formatter(
<Owned & android.widget.NumberPicker.IFormatter>{
get owner(): ListPicker { get owner(): ListPicker {
return that.get(); return that.get();
}, },
@ -43,7 +48,7 @@ export class ListPicker extends common.ListPicker {
}); });
this._android.setFormatter(this._formatter); this._android.setFormatter(this._formatter);
this._valueChangedListener = new android.widget.NumberPicker.OnValueChangeListener({ this._valueChangedListener = new android.widget.NumberPicker.OnValueChangeListener(<Owned & android.widget.NumberPicker.IOnValueChangeListener>{
get owner() { get owner() {
return that.get(); return that.get();
}, },
@ -106,4 +111,4 @@ export class ListPicker extends common.ListPicker {
this._editText.invalidate(); //Force the EditText to redraw this._editText.invalidate(); //Force the EditText to redraw
this.android.invalidate(); this.android.invalidate();
} }
} }

View File

@ -27,6 +27,10 @@ function onSeparatorColorPropertyChanged(data: dependencyObservable.PropertyChan
} }
} }
interface Owned {
owner: any;
}
// register the setNativeValue callbacks // register the setNativeValue callbacks
(<proxy.PropertyMetadata>common.ListView.separatorColorProperty.metadata).onSetNativeValue = onSeparatorColorPropertyChanged; (<proxy.PropertyMetadata>common.ListView.separatorColorProperty.metadata).onSetNativeValue = onSeparatorColorPropertyChanged;
@ -50,7 +54,7 @@ export class ListView extends common.ListView {
var that = new WeakRef(this); var that = new WeakRef(this);
// TODO: This causes many marshalling calls, rewrite in Java and generate bindings // 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(<Owned & android.widget.AbsListView.IOnScrollListener>{
onScrollStateChanged: function (view: android.widget.AbsListView, scrollState: number) { onScrollStateChanged: function (view: android.widget.AbsListView, scrollState: number) {
var owner: ListView = this.owner; var owner: ListView = this.owner;
if (!owner) { if (!owner) {

View File

@ -92,6 +92,10 @@ function _changeSearchViewHintColor(bar: android.widget.SearchView, color: numbe
global.moduleMerge(common, exports); global.moduleMerge(common, exports);
interface Owned {
owner: any;
}
export class SearchBar extends common.SearchBar { export class SearchBar extends common.SearchBar {
private _android: android.widget.SearchView; private _android: android.widget.SearchView;
@ -101,7 +105,7 @@ export class SearchBar extends common.SearchBar {
this._android.setIconified(false); this._android.setIconified(false);
var that = new WeakRef(this); var that = new WeakRef(this);
this._android.setOnQueryTextListener(new android.widget.SearchView.OnQueryTextListener({ this._android.setOnQueryTextListener(new android.widget.SearchView.OnQueryTextListener(<Owned & android.widget.SearchView.IOnQueryTextListener>{
get owner() { get owner() {
return that.get(); 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(<Owned & android.widget.SearchView.IOnCloseListener>{
get owner() { get owner() {
return that.get(); return that.get();
}, },
@ -156,4 +160,4 @@ export class SearchBar extends common.SearchBar {
get android(): android.widget.SearchView { get android(): android.widget.SearchView {
return this._android; return this._android;
} }
} }

View File

@ -16,6 +16,10 @@ function onCheckedPropertyChanged(data: dependencyObservable.PropertyChangeData)
global.moduleMerge(common, exports); global.moduleMerge(common, exports);
interface Owned {
owner: any;
}
export class Switch extends common.Switch { export class Switch extends common.Switch {
private _android: android.widget.Switch; private _android: android.widget.Switch;
@ -28,7 +32,7 @@ export class Switch extends common.Switch {
var that = new WeakRef(this); var that = new WeakRef(this);
this._android.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener({ this._android.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener(<Owned & android.widget.CompoundButton.IOnCheckedChangeListener>{
get owner() { get owner() {
return that.get(); return that.get();
}, },
@ -40,4 +44,4 @@ export class Switch extends common.Switch {
} }
})); }));
} }
} }

View File

@ -18,6 +18,10 @@ function onMinutePropertyChanged(data: dependencyObservable.PropertyChangeData)
global.moduleMerge(common, exports); global.moduleMerge(common, exports);
interface Owned {
owner: any;
}
export class TimePicker extends common.TimePicker { export class TimePicker extends common.TimePicker {
private _android: android.widget.TimePicker; private _android: android.widget.TimePicker;
private _listener: android.widget.TimePicker.OnTimeChangedListener; private _listener: android.widget.TimePicker.OnTimeChangedListener;
@ -32,7 +36,8 @@ export class TimePicker extends common.TimePicker {
var that = new WeakRef(this); var that = new WeakRef(this);
this._listener = new android.widget.TimePicker.OnTimeChangedListener({ this._listener = new android.widget.TimePicker.OnTimeChangedListener(
<Owned & android.widget.TimePicker.IOnTimeChangedListener>{
get owner() { get owner() {
return that.get(); return that.get();
}, },
@ -80,4 +85,4 @@ export class TimePicker extends common.TimePicker {
this._isSettingTime = false; this._isSettingTime = false;
} }
} }
} }