Fixing type errors in tests

This commit is contained in:
Panayot Cankov
2016-12-16 17:31:48 +02:00
parent 745388c3da
commit 6feeb140e3
313 changed files with 1690 additions and 1655 deletions

View File

@@ -1,4 +1,4 @@
import definition = require("ui/core/bindable");
import * as definition from "ui/core/bindable";
import { Observable, PropertyChangeData } from "data/observable";
import { unsetValue, DependencyObservable, Property, PropertyMetadata, PropertyMetadataSettings, PropertyChangeData as DependencyPropertyChangeData } from "ui/core/dependency-observable";
import { addWeakEventListener, removeWeakEventListener } from "ui/core/weak-event-listener";

View File

@@ -7,7 +7,8 @@ declare module "ui/core/dependency-observable" {
/**
* Value specifing that Property value should be reset. Used when bindingContext on bound property is creared/null.
*/
export const unsetValue: Object;
export const unsetValue: any;
/**
* Interface used by Propery 'defaultValueGetter' function to specify if the default value returned by the native instance can be cached or not.
* One example is - android.widget.Button background. It is state drawable so it cannot be reused/cached.

View File

@@ -1,6 +1,6 @@
import bindable = require("ui/core/bindable");
import dependencyObservable = require("ui/core/dependency-observable");
import definition = require("ui/core/proxy");
import * as bindable from "ui/core/bindable";
import * as dependencyObservable from "ui/core/dependency-observable";
import * as definition from "ui/core/proxy";
import * as types from "utils/types";
import * as observable from "data/observable";

View File

@@ -950,6 +950,14 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
// // Check for a valid _nativeView instance
// return !!this._nativeView;
// }
public _getValue(): never {
throw new Error("The View._setValue is obsolete. There is a new property system.")
}
public _setValue(): never {
throw new Error("The View._setValue is obsolete. There is a new property system.")
}
}
export function getLengthEffectiveValue(param: Length): number {
@@ -1045,6 +1053,9 @@ export namespace PercentLength {
return value;
}
}
export function equals(a: PercentLength, b: PercentLength): boolean {
return a.value == b.value && a.unit == b.unit;
}
}
export namespace Length {
@@ -1074,6 +1085,10 @@ export namespace Length {
return value;
}
}
export function equals(a: Length, b: Length): boolean {
return a.value == b.value && a.unit == b.unit;
}
}
export function booleanConverter(v: string): boolean {

View File

@@ -202,7 +202,7 @@ export class View extends ViewCommon {
// Widgets like buttons and such have reference to their native view in both properties.
if (this[NATIVE_VIEW] === this[ANDROID]) {
this[NATIVE_VIEW] = undefined;
(<any>this)[NATIVE_VIEW] = undefined;
}
// Handle layout and content view

View File

@@ -99,18 +99,18 @@ declare module "ui/core/view" {
readonly unit: "dip" | "px";
readonly value: number;
}
export namespace Length {
export function parse(text: string): Length;
export function equals(a: Length, b: Length): boolean;
}
export interface PercentLength {
readonly unit: "%" | "dip" | "px";
readonly value: number;
}
export namespace Length {
function parse(text: string): Length;
}
export namespace PercentLength {
function parse(text: string): PercentLength;
export function parse(text: string): PercentLength;
export function equals(a: PercentLength, b: PercentLength): boolean;
}
/**
@@ -555,7 +555,7 @@ declare module "ui/core/view" {
* A property has changed on the native side directly - e.g. the user types in a TextField.
*/
public nativePropertyChanged(property: Property<any, any>, newValue: any): void;
public bind(options: BindingOptions, source: any): void;
public bind(options: BindingOptions, source?: any): void;
public unbind(property: string): void;
isCollapsed: boolean;
@@ -603,6 +603,16 @@ declare module "ui/core/view" {
_setNativeViewFrame(nativeView: any, frame: any): void;
// _onStylePropertyChanged(property: dependencyObservable.Property): void;
//@endprivate
// /**
// * __Obsolete:__ There is a new property system that does not rely on _getValue.
// */
// public _getValue(property: any): never;
// /**
// * __Obsolete:__ There is a new property system that does not rely on _setValue.
// */
// public _setValue(property: any, value: any): never;
}
/**