Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function shouldDeepCopyObject(value: any): value is Object {
function copyArray<T>(array: T[], inherited: boolean): T[] {
return array.map(function(item: T): T {
if (Array.isArray(item)) {
return <any>copyArray(<any>item, inherited);
return copyArray(item, inherited) as any;
}

return !shouldDeepCopyObject(item)
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/util/globalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ export function globalizeDelegator<T, O, R>(
}

const globalize = getGlobalize(locale);
return (<any>globalize)[method].apply(globalize, methodArgs);
return (globalize as any)[method].apply(globalize, methodArgs);
}
6 changes: 3 additions & 3 deletions src/shim/Symbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ if (!has('es6-symbol')) {
/* Decorate the Symbol.prototype */
defineProperties(Symbol.prototype, {
toString: getValueDescriptor(function(this: Symbol) {
return 'Symbol (' + (<any>validateSymbol(this)).__description__ + ')';
return 'Symbol (' + (validateSymbol(this) as any).__description__ + ')';
}),
valueOf: getValueDescriptor(function(this: Symbol) {
return validateSymbol(this);
Expand All @@ -149,12 +149,12 @@ if (!has('es6-symbol')) {
defineProperty(
InternalSymbol.prototype,
Symbol.toPrimitive,
getValueDescriptor((<any>Symbol).prototype[Symbol.toPrimitive], false, false, true)
getValueDescriptor((Symbol as any).prototype[Symbol.toPrimitive], false, false, true)
);
defineProperty(
InternalSymbol.prototype,
Symbol.toStringTag,
getValueDescriptor((<any>Symbol).prototype[Symbol.toStringTag], false, false, true)
getValueDescriptor((Symbol as any).prototype[Symbol.toStringTag], false, false, true)
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/shim/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ if (has('es6-array') && has('es6-array-fill')) {

/* tslint:disable-next-line:variable-name */
const Constructor = this;
const length: number = toLength((<any>arrayLike).length);
const length: number = toLength((arrayLike as any).length);

// Support extension
const array: any[] =
Expand Down Expand Up @@ -222,7 +222,7 @@ if (has('es6-array') && has('es6-array-fill')) {
}
}

if ((<any>arrayLike).length !== undefined) {
if ((arrayLike as any).length !== undefined) {
array.length = length;
}

Expand Down
34 changes: 17 additions & 17 deletions src/shim/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ export const MIN_FLOAT32 = 1.401298464324817e-45;
* @param n The number to use in calculation
* @return The result
*/
export let acosh: (n: number) => number = (<any>Math).acosh;
export let acosh: (n: number) => number = (Math as any).acosh;

/**
* Returns the hyperbolic arcsine of a number.
*
* @param n The number to use in calculation
* @return The result
*/
export let asinh: (n: number) => number = (<any>Math).asinh;
export let asinh: (n: number) => number = (Math as any).asinh;

/**
* Returns the hyperbolic arctangent of a number.
*
* @param n The number to use in calculation
* @return The result
*/
export let atanh: (n: number) => number = (<any>Math).atanh;
export let atanh: (n: number) => number = (Math as any).atanh;

/**
* Returns the cube root of a number.
*
* @param n The number to use in calculation
* @return The result
*/
export let cbrt: (n: number) => number = (<any>Math).cbrt;
export let cbrt: (n: number) => number = (Math as any).cbrt;

/**
* Returns the number of leading zero bits in the 32-bit
Expand All @@ -43,38 +43,38 @@ export let cbrt: (n: number) => number = (<any>Math).cbrt;
* @param n The number to use in calculation
* @return The result
*/
export let clz32: (n: number) => number = (<any>Math).clz32;
export let clz32: (n: number) => number = (Math as any).clz32;

/**
* Returns the hyperbolic cosine of a number.
*
* @param n The number to use in calculation
* @return The result
*/
export let cosh: (n: number) => number = (<any>Math).cosh;
export let cosh: (n: number) => number = (Math as any).cosh;

/**
* Returns e raised to the specified power minus one.
*
* @param n The number to use in calculation
* @return The result
*/
export let expm1: (n: number) => number = (<any>Math).expm1;
export let expm1: (n: number) => number = (Math as any).expm1;

/**
* Returns the nearest single-precision float representation of a number.
*
* @param n The number to use in calculation
* @return The result
*/
export let fround: (n: number) => number = (<any>Math).fround;
export let fround: (n: number) => number = (Math as any).fround;

/**
* Returns the square root of the sum of squares of its arguments.
*
* @return The result
*/
export let hypot: (...args: number[]) => number = (<any>Math).hypot;
export let hypot: (...args: number[]) => number = (Math as any).hypot;

/**
* Returns the result of the 32-bit multiplication of the two parameters.
Expand All @@ -83,63 +83,63 @@ export let hypot: (...args: number[]) => number = (<any>Math).hypot;
* @param m The number to use in calculation
* @return The result
*/
export let imul: (n: number, m: number) => number = (<any>Math).imul;
export let imul: (n: number, m: number) => number = (Math as any).imul;

/**
* Returns the base 2 logarithm of a number.
*
* @param n The number to use in calculation
* @return The result
*/
export let log2: (n: number) => number = (<any>Math).log2;
export let log2: (n: number) => number = (Math as any).log2;

/**
* Returns the base 10 logarithm of a number.
*
* @param n The number to use in calculation
* @return The result
*/
export let log10: (n: number) => number = (<any>Math).log10;
export let log10: (n: number) => number = (Math as any).log10;

/**
* Returns the natural logarithm of 1 + a number.
*
* @param n The number to use in calculation
* @return The result
*/
export let log1p: (n: number) => number = (<any>Math).log1p;
export let log1p: (n: number) => number = (Math as any).log1p;

/**
* Returns the sign of a number, indicating whether the number is positive.
*
* @param n The number to use in calculation
* @return 1 if the number is positive, -1 if the number is negative, or 0 if the number is 0
*/
export let sign: (n: number) => number = (<any>Math).sign;
export let sign: (n: number) => number = (Math as any).sign;

/**
* Returns the hyperbolic sine of a number.
*
* @param n The number to use in calculation
* @return The result
*/
export let sinh: (n: number) => number = (<any>Math).sinh;
export let sinh: (n: number) => number = (Math as any).sinh;

/**
* Returns the hyperbolic tangent of a number.
*
* @param n The number to use in calculation
* @return The result
*/
export let tanh: (n: number) => number = (<any>Math).tanh;
export let tanh: (n: number) => number = (Math as any).tanh;

/**
* Returns the integral part of a number by removing any fractional digits.
*
* @param n The number to use in calculation
* @return The result
*/
export let trunc: (n: number) => number = (<any>Math).trunc;
export let trunc: (n: number) => number = (Math as any).trunc;

if (!has('es6-math')) {
acosh = function acosh(n: number): number {
Expand Down
2 changes: 1 addition & 1 deletion src/shim/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ if (has('es6-object')) {

getOwnPropertyDescriptor = function<T, K extends keyof T>(o: T, prop: K): PropertyDescriptor | undefined {
if (isSymbol(prop)) {
return (<any>Object).getOwnPropertyDescriptor(o, prop);
return Object.getOwnPropertyDescriptor(o, prop);
} else {
return Object.getOwnPropertyDescriptor(o, prop);
}
Expand Down
4 changes: 2 additions & 2 deletions src/shim/support/has.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ add(
() => {
if ('fill' in global.Array.prototype) {
/* Some versions of Safari do not properly implement this */
return (<any>[1]).fill(9, Number.POSITIVE_INFINITY)[0] === 1;
return ([1] as any).fill(9, Number.POSITIVE_INFINITY)[0] === 1;
}
return false;
},
Expand Down Expand Up @@ -93,7 +93,7 @@ add(
() => {
if ('imul' in global.Math) {
/* Some versions of Safari on ios do not properly implement this */
return (<any>Math).imul(0xffffffff, 5) === -5;
return (Math as any).imul(0xffffffff, 5) === -5;
}
return false;
},
Expand Down
2 changes: 1 addition & 1 deletion src/shim/tslib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as tslib from 'tslib';
/**
* Provide any overrides and then load the TypeScript helpers.
*/
(<any>tslib).__values = global.__values = function(o: any) {
(tslib as any).__values = global.__values = function(o: any) {
let m = typeof Symbol === 'function' && o[Symbol.iterator],
i = 0;
if (m) {
Expand Down
4 changes: 2 additions & 2 deletions tests/core/unit/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ registerSuite('util functions', {
};
b: number;
hidden: number;
} = <any>Object.create({
} = Object.create({
a: 1
});
source.c = 3;
Expand Down Expand Up @@ -208,7 +208,7 @@ registerSuite('util functions', {
d: Date;
e: RegExp;
hidden: number;
} = <any>Object.create({
} = Object.create({
nested: {
a: 1,
b: [2, [3], { f: 4 }]
Expand Down
2 changes: 1 addition & 1 deletion tests/i18n/unit/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function getKeys<T extends DateOptionsKeys>(
object: SkeletonOptions | DateOptions,
key: T
): Array<keyof DateOptionsTypes[T]> {
return <any>Object.keys(object);
return Object.keys(object) as any;
}

registerSuite('date', {
Expand Down
2 changes: 1 addition & 1 deletion tests/i18n/unit/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ registerSuite('i18n', {
},

afterEach() {
const loadCldrData = <any>cldrLoad.default;
const loadCldrData = cldrLoad.default as any;
if (typeof loadCldrData.restore === 'function') {
loadCldrData.restore();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/routing/unit/history/StateHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('StateHistory', () => {

afterEach(() => {
document.body.removeChild(sandbox);
sandbox = <any>null;
sandbox = null as any;
onChange.reset();
});

Expand Down
8 changes: 4 additions & 4 deletions tests/shim/unit/Observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,31 +161,31 @@ registerSuite('shim/Observable', {
new Observable((observer) => {
observer.complete();

return <any>null;
return null as any;
}).subscribe({});
},
'subscriber cannot return a number/string/boolean'() {
assert.throws(() => {
new Observable((observer) => {
observer.complete();

return <any>1;
return 1 as any;
}).subscribe({});
});

assert.throws(() => {
new Observable((observer) => {
observer.complete();

return <any>'test';
return 'test' as any;
}).subscribe({});
});

assert.throws(() => {
new Observable((observer) => {
observer.complete();

return <any>false;
return false as any;
}).subscribe({});
});
}
Expand Down
10 changes: 5 additions & 5 deletions tests/shim/unit/Promise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function addPromiseTests(suite: { [key: string]: Tests }, Promise: TypeUn
'foreign thenables': function() {
let dfd = this.async();
let normal = Promise.resolve(1);
let foreign = <any>{
let foreign = {
then: function(f: Function) {
f(2);
}
Expand All @@ -81,7 +81,7 @@ export function addPromiseTests(suite: { [key: string]: Tests }, Promise: TypeUn
'non-callable thenables': function() {
let dfd = this.async();
let normal = Promise.resolve(1);
let foreign = <any>{ then: 'foo' };
let foreign = { then: 'foo' };

Promise.all([normal, foreign]).then(
dfd.callback(function(value: number[]) {
Expand Down Expand Up @@ -202,7 +202,7 @@ export function addPromiseTests(suite: { [key: string]: Tests }, Promise: TypeUn
'foreign thenables': function() {
let dfd = this.async();
let normal = Promise.resolve(1);
let foreign = <any>{
let foreign = {
then: function(f: Function) {
f(2);
}
Expand Down Expand Up @@ -239,7 +239,7 @@ export function addPromiseTests(suite: { [key: string]: Tests }, Promise: TypeUn
'rejected thenable'() {
let dfd = this.async();
let resolved = false;
let thenable = <any>{
let thenable = {
then: function(f: Function, r: Function) {
r(new Error('foo'));
}
Expand Down Expand Up @@ -283,7 +283,7 @@ export function addPromiseTests(suite: { [key: string]: Tests }, Promise: TypeUn
thenable() {
let dfd = this.async();
let resolved = false;
let thenable = <any>{
let thenable = {
then: function(f: Function) {
f(2);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/widget-core/benchmark/runner/src/benchmarkRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,12 @@ function buildDriver() {
options = options.addArguments('--disable-extensions');
options = options.addArguments('--window-size=1200,800');
options = options.setLoggingPrefs(logPref);
options = options.setPerfLoggingPrefs(<any>{
options = options.setPerfLoggingPrefs({
enableNetwork: false,
enablePage: false,
// enableTimeline: false, // This throws an error
traceCategories: 'devtools.timeline, disabled-by-default-devtools.timeline,blink.user_timing'
});
} as any);
return new Builder()
.forBrowser('chrome')
.setChromeOptions(options)
Expand Down Expand Up @@ -492,7 +492,7 @@ export async function runBench(frameworkNames: string[], benchmarkNames: string[
console.log('Frameworks that will be benchmarked', runFrameworks);
console.log('Benchmarks that will be run', runBenchmarks.map((b) => b.id));

let data: [[FrameworkData, Benchmark]] = <any>[];
let data: [[FrameworkData, Benchmark]] = [] as any;
for (let i = 0; i < runFrameworks.length; i++) {
for (let j = 0; j < runBenchmarks.length; j++) {
data.push([runFrameworks[i], runBenchmarks[j]]);
Expand Down
Loading