diff --git a/apps/app/css-perf-test/app.ts b/apps/app/css-perf-test/app.ts index 03ce124b0..ad69ef94b 100644 --- a/apps/app/css-perf-test/app.ts +++ b/apps/app/css-perf-test/app.ts @@ -1,7 +1,7 @@ import * as application from "application"; declare var CACurrentMediaTime; -global.time = function(): number { +(global).time = function(): number { if (global.android) { return java.lang.System.nanoTime() / 1000000; // 1 ms = 1000000 ns } @@ -10,4 +10,4 @@ global.time = function(): number { } } -application.start({ moduleName: "css-perf-test/root" }); \ No newline at end of file +application.start({ moduleName: "css-perf-test/root" }); diff --git a/apps/app/css-perf-test/main-page.ts b/apps/app/css-perf-test/main-page.ts index 0833dcc32..67fee2d7f 100644 --- a/apps/app/css-perf-test/main-page.ts +++ b/apps/app/css-perf-test/main-page.ts @@ -2,6 +2,6 @@ export function navigatedTo(args: ObservableEventData) { setTimeout(() => { - console.log(`Time: ${global.time() - global.startTime} ms`); + console.log(`Time: ${(global).time() - (global).startTime} ms`); }); -} \ No newline at end of file +} diff --git a/apps/app/css-perf-test/root.ts b/apps/app/css-perf-test/root.ts index b67d9911a..f2da88fdb 100644 --- a/apps/app/css-perf-test/root.ts +++ b/apps/app/css-perf-test/root.ts @@ -1,7 +1,7 @@ import {Page} from "ui/page"; export function onTap(args: any) { - global.startTime = global.time(); + (global).startTime = (global).time(); let page = args.object.page; page.frame.navigate("css-perf-test/main-page"); -} \ No newline at end of file +} diff --git a/gruntfile.js b/gruntfile.js index 506124953..253a4df79 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -84,13 +84,9 @@ module.exports = function(grunt) { }); var combinedDtsPath = path.join(outDir, outFile); grunt.file.write(combinedDtsPath, dtsLines.join('\n')); - } - + }; + var generateModulesDts = function generateModulesDts(outDir, srcDir) { - var angularConflicts = ['module.d.ts']; - var angularExcludes = angularConflicts.map(function(file) { - return '!' + file; - }); var dtsFiles = grunt.file.expand({cwd: srcDir }, [ "**/*.d.ts", //Exclude the d.ts files in the apps folder - these are part of the apps and are already packed there! @@ -99,24 +95,14 @@ module.exports = function(grunt) { "!android17.d.ts", "!**/*.android.d.ts", "!ios/**", - "!lib.core.d.ts", - "!lib.dom.d.ts", "!**/*.ios.d.ts", "!tns-core-modules.d.ts", - "!tns-core-modules.es6.d.ts", - "!tns-core-modules.es2016.d.ts", - "!tns-core-modules.base.d.ts", "!references.d.ts", - "!webworker.es2016.d.ts" - ].concat(localCfg.defaultExcludes).concat(angularExcludes)); + ].concat(localCfg.defaultExcludes)); dtsFiles.sort(); - writeDtsFile(dtsFiles, outDir, 'tns-core-modules/tns-core-modules.base.d.ts'); - var es6Files = angularConflicts.concat(['tns-core-modules.base.d.ts']); - writeDtsFile(es6Files, outDir, 'tns-core-modules/tns-core-modules.es6.d.ts'); - var allFiles = angularConflicts.concat(['tns-core-modules.base.d.ts']); - writeDtsFile(allFiles, outDir, 'tns-core-modules/tns-core-modules.d.ts'); - } + writeDtsFile(dtsFiles, outDir, "tns-core-modules/tns-core-modules.d.ts"); + }; // Configure localCfg var outDir = tsconfig.compilerOptions.outDir || "./bin/dist"; @@ -411,9 +397,9 @@ module.exports = function(grunt) { }); grunt.registerTask("generate-tns-core-modules-dev-dts", generateModulesDts.bind(null, ".", localCfg.srcTnsCoreModules)); - + grunt.registerTask("generate-tns-core-modules-dts", generateModulesDts.bind(null, localCfg.outDir, localCfg.outTnsCoreModules)); - + //aliasing pack-modules for backwards compatibility grunt.registerTask("pack-modules", [ "compile-modules", diff --git a/tns-core-modules/application/application-common.ts b/tns-core-modules/application/application-common.ts index 75378d0ce..c880d3f6e 100644 --- a/tns-core-modules/application/application-common.ts +++ b/tns-core-modules/application/application-common.ts @@ -1,5 +1,4 @@ require("globals"); -import * as definition from "application"; import * as observable from "data/observable"; // TODO: Raise event on("livesync") and attach this handler in the ui/frame module. import { NavigationEntry, reloadPage } from "ui/frame"; @@ -62,7 +61,7 @@ export function setResources(res: any) { resources = res; } -export var onUncaughtError: (error: definition.NativeScriptError) => void = undefined; +export var onUncaughtError: (error: NativeScriptError) => void = undefined; export var onLaunch: (context: any) => any = undefined; @@ -118,9 +117,9 @@ export function parseCss(cssText: string, cssFileName?: string): RuleSet[] { export function __onLiveSync() { // Close the error page if available and remove the reference from global context. - if (global.errorPage) { - global.errorPage.closeModal(); - global.errorPage = undefined; + if ((global).errorPage) { + (global).errorPage.closeModal(); + (global).errorPage = undefined; } try { @@ -132,13 +131,13 @@ export function __onLiveSync() { // Reload app.css in case it was changed. loadCss(); - global.__onLiveSyncCore(); + (global).__onLiveSyncCore(); } catch (ex) { // Show the error as modal page, save reference to the page in global context. ensureBuilder(); - global.errorPage = builder.parse(``); - global.errorPage.showModal(); + (global).errorPage = builder.parse(``); + (global).errorPage.showModal(); } } @@ -146,7 +145,7 @@ export function __onLiveSyncCore() { // Reload current page. reloadPage(); } -global.__onLiveSyncCore = __onLiveSyncCore; +(global).__onLiveSyncCore = __onLiveSyncCore; export function _onOrientationChanged(){ ensurePlatform(); @@ -154,4 +153,4 @@ export function _onOrientationChanged(){ ensureFileNameResolver(); fileNameResolver._invalidateResolverInstance(); -} \ No newline at end of file +} diff --git a/tns-core-modules/application/application.android.ts b/tns-core-modules/application/application.android.ts index 58550c542..8b8aede58 100644 --- a/tns-core-modules/application/application.android.ts +++ b/tns-core-modules/application/application.android.ts @@ -334,7 +334,7 @@ global.__onLiveSync = function () { loadCss(); }; -global.__onUncaughtError = function (error: definition.NativeScriptError) { +global.__onUncaughtError = function (error: NativeScriptError) { const types: typeof typesModule = require("utils/types"); // TODO: Obsolete this diff --git a/tns-core-modules/application/application.d.ts b/tns-core-modules/application/application.d.ts index 1b4dda94c..ee1052cc6 100644 --- a/tns-core-modules/application/application.d.ts +++ b/tns-core-modules/application/application.d.ts @@ -5,16 +5,6 @@ declare module "application" { import { RuleSet } from "ui/styling/css-selector"; import { NavigationEntry, View, Observable } from "ui/frame"; - /** - * An extended JavaScript Error which will have the nativeError property initialized in case the error is caused by executing platform-specific code. - */ - export interface NativeScriptError extends Error { - /** - * Represents the native error object. - */ - nativeError: any; - } - /** * String value used when hooking to launch event. */ diff --git a/tns-core-modules/application/application.ios.ts b/tns-core-modules/application/application.ios.ts index 7245bc343..19057d850 100644 --- a/tns-core-modules/application/application.ios.ts +++ b/tns-core-modules/application/application.ios.ts @@ -215,7 +215,7 @@ class IOSApplication implements definition.iOSApplication { var iosApp = new IOSApplication(); typedExports.ios = iosApp; -global.__onUncaughtError = function (error: definition.NativeScriptError) { +global.__onUncaughtError = function (error: NativeScriptError) { var types: typeof typesModule = require("utils/types"); // TODO: This should be obsoleted diff --git a/tns-core-modules/console/console.d.ts b/tns-core-modules/console/console.d.ts deleted file mode 100644 index 486408665..000000000 --- a/tns-core-modules/console/console.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Allows printing messages to the device's console. - */ -declare module "console" { - /** - * Encapsulates methods used to print some information in the console. - * Instance of this class is declared in the global JavaScript context and is accessible by directly calling console.[xxx] methods. - */ - class Console { - /** - * Begins counting a time span for a given name (key). - * @param reportName The key for the operation. - */ - public time(reportName: string): void; - - /** - * Ends a previously started time span through the time method. - * @param reportName The key for the operation. Must have an already started time(reportName) operation with the same key. - */ - public timeEnd(reportName: string): void; - - /** - * Asserts a boolean condition and prints a message in case the assert fails. - * @param test A value that should not be Falsy. - * @param message The message to be displayed in case the asserted value is Falsy. - * @param formatParams Optional formatting parameters to be applied to the printed message. - */ - public assert(test: boolean, message: string, ...formatParams: any[]): void; - - /** - * Reports some information. - * @param message The information message to be printed to the console. - * @param formatParams Optional formatting parameters to be applied to the printed message. - */ - public info(message: any, ...formatParams: any[]): void; - - /** - * Reports a warning. - * @param message The warning message to be printed to the console. - * @param formatParams Optional formatting parameters to be applied to the printed message. - */ - public warn(message: any, ...formatParams: any[]): void; - - /** - * Reports an error. - * @param message The error message to be printed to the console. - * @param formatParams Optional formatting parameters to be applied to the printed message. - */ - public error(message: any, ...formatParams: any[]): void; - - /** - * Verbously logs a message. - * @param message The message to be printed to the console. - * @param formatParams Optional formatting parameters to be applied to the printed message. - */ - public log(message: any, ...formatParams: any[]): void; - - /** - * Prints the current stack trace in the console. - */ - public trace(): void; - - /** - * Prints the state of the specified object to the console. - * @param obj The object instance to be dumped. - */ - public dump(obj: any): void; - - /** - * Prints the state of the specified object to the console. - */ - public dir(obj: any): void; - } -} \ No newline at end of file diff --git a/tns-core-modules/console/console.ts b/tns-core-modules/console/console.ts index 833f9282d..1f66cded6 100644 --- a/tns-core-modules/console/console.ts +++ b/tns-core-modules/console/console.ts @@ -1,8 +1,13 @@ -import * as definition from "console"; import * as trace from "trace"; import * as platform from "platform"; -export class Console implements definition.Console { +function __message(message: any, level: string) { + if ((global).__consoleMessage) { + (global).__consoleMessage(message, level); + } +} + +export class Console { private TAG: string = "JS"; private _timers: any; private _stripFirstTwoLinesRegEx: RegExp; @@ -250,9 +255,7 @@ export class Console implements definition.Console { Array.prototype.shift.apply(arguments); let formatedMessage = this.formatParams.apply(this, arguments); this.error(formatedMessage, trace.messageType.error); - if (global.__consoleMessage) { - global.__consoleMessage(formatedMessage, "error"); - } + __message(formatedMessage, "error"); } } @@ -263,29 +266,23 @@ export class Console implements definition.Console { public warn(message: any, ...formatParams: any[]): void { let formatedMessage = this.formatParams.apply(this, arguments); this.logMessage(formatedMessage, trace.messageType.warn); - if (global.__consoleMessage) { - global.__consoleMessage(formatedMessage, "warning"); - } + __message(formatedMessage, "warning"); } public error(message: any, ...formatParams: any[]): void { let formatedMessage = this.formatParams.apply(this, arguments); this.logMessage(formatedMessage, trace.messageType.error); - if (global.__consoleMessage) { - global.__consoleMessage(formatedMessage, "error") - } + __message(formatedMessage, "error"); } public log(message: any, ...formatParams: any[]): void { let formatedMessage = this.formatParams.apply(this, arguments); this.logMessage(formatedMessage, trace.messageType.log); - if (global.__consoleMessage) { - global.__consoleMessage(formatedMessage, "log") - } + __message(formatedMessage, "log"); } private logMessage(message: string, messageType: number): void { - if (!global.android) { + if (!(global).android) { // This case may be entered during heap snapshot where the global.android is not present return; } diff --git a/tns-core-modules/declarations.d.ts b/tns-core-modules/declarations.d.ts index 91c505703..325f386a0 100644 --- a/tns-core-modules/declarations.d.ts +++ b/tns-core-modules/declarations.d.ts @@ -98,22 +98,24 @@ declare type RequestInfo = Request|string; declare function fetch(url: string, init?: RequestInit): Promise; +/** + * Allows printing messages to the device's console. + */ interface Console { - time(reportName: string): void; - timeEnd(reportName: string): void; - assert(test: boolean, message: string, ...formatParams: any[]): void; - info(message: any, ...formatParams: any[]): void; - warn(message: any, ...formatParams: any[]): void; - error(message: any, ...formatParams: any[]): void; - log(message: any, ...formatParams: any[]): void; + /** + * Prints the current stack trace in the console. + */ trace(): void; + + /** + * Prints the state of the specified object to the console. + * @param obj The object instance to be dumped. + */ dump(obj: any): void; - createDump(obj: any): string; - dir(obj: any): void; } declare var console: Console; -declare var require: NativeScriptRequire; +declare var require: NodeRequire; // Global functions declare function Deprecated(target: Object, key?: string | symbol, value?: any): void; @@ -179,7 +181,7 @@ declare class WeakRef { clear(): void; } -declare var module: NativeScriptModule; +declare var module: NodeModule; // Same as module.exports declare var exports: any; diff --git a/tns-core-modules/globals/decorators.ts b/tns-core-modules/globals/decorators.ts index f3050cbe8..8541d28a3 100644 --- a/tns-core-modules/globals/decorators.ts +++ b/tns-core-modules/globals/decorators.ts @@ -1,10 +1,10 @@ -if (typeof global.__decorate !== "function") { - global.__decorate = function (decorators, target, key, desc) { +if (typeof (global).__decorate !== "function") { + (global).__decorate = function (decorators, target, key, desc) { var c = arguments.length; var r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof global.Reflect === "object" && typeof global.Reflect.decorate === "function") { - r = global.Reflect.decorate(decorators, target, key, desc); + if (typeof (global).Reflect === "object" && typeof (global).Reflect.decorate === "function") { + r = (global).Reflect.decorate(decorators, target, key, desc); } else { for (var i = decorators.length - 1; i >= 0; i--) { @@ -17,16 +17,16 @@ if (typeof global.__decorate !== "function") { } } -if (typeof global.__metadata !== "function") { - global.__metadata = function (k, v) { - if (typeof global.Reflect === "object" && typeof global.Reflect.metadata === "function") { - return global.Reflect.metadata(k, v); +if (typeof (global).__metadata !== "function") { + (global).__metadata = function (k, v) { + if (typeof (global).Reflect === "object" && typeof (global).Reflect.metadata === "function") { + return (global).Reflect.metadata(k, v); } }; } -if (typeof global.__param !== "function") { - global.__param = (global && global.__param) || function (paramIndex, decorator) { +if (typeof (global).__param !== "function") { + (global).__param = (global && (global).__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; -} \ No newline at end of file +} diff --git a/tns-core-modules/globals/globals.ts b/tns-core-modules/globals/globals.ts index 6998809bf..71a8bdcc8 100644 --- a/tns-core-modules/globals/globals.ts +++ b/tns-core-modules/globals/globals.ts @@ -46,13 +46,13 @@ global.loadModule = function(name: string): any { } global.zonedCallback = function (callback: Function): Function { - if (global.zone) { + if ((global).zone) { // Zone v0.5.* style callback wrapping - return global.zone.bind(callback); + return (global).zone.bind(callback); } - if (global.Zone) { + if ((global).Zone) { // Zone v0.6.* style callback wrapping - return global.Zone.current.wrap(callback); + return (global).Zone.current.wrap(callback); } else { return callback; } @@ -86,28 +86,28 @@ function registerOnGlobalContext(name: string, module: string): void { }); } -if (global.__snapshot) { +if ((global).__snapshot) { // when we have a snapshot, it is better to pre-populate these on the global context to get them saved within the blob var timer: typeof timerModule = require("timer"); - global.setTimeout = timer.setTimeout; - global.clearTimeout = timer.clearTimeout; - global.setInterval = timer.setInterval; - global.clearInterval = timer.clearInterval; + (global).setTimeout = timer.setTimeout; + (global).clearTimeout = timer.clearTimeout; + (global).setInterval = timer.setInterval; + (global).clearInterval = timer.clearInterval; var dialogs: typeof dialogsModule = require("ui/dialogs"); - global.alert = dialogs.alert; - global.confirm = dialogs.confirm; - global.prompt = dialogs.prompt; + (global).alert = dialogs.alert; + (global).confirm = dialogs.confirm; + (global).prompt = dialogs.prompt; var xhr = require("xhr"); - global.XMLHttpRequest = xhr.XMLHttpRequest; - global.FormData = xhr.FormData; + (global).XMLHttpRequest = xhr.XMLHttpRequest; + (global).FormData = xhr.FormData; var fetch = require("fetch"); - global.fetch = fetch.fetch; - global.Headers = fetch.Headers; - global.Request = fetch.Request; - global.Response = fetch.Response; + (global).fetch = fetch.fetch; + (global).Headers = fetch.Headers; + (global).Request = fetch.Request; + (global).Response = fetch.Response; } else { registerOnGlobalContext("setTimeout", "timer"); registerOnGlobalContext("clearTimeout", "timer"); @@ -122,14 +122,14 @@ if (global.__snapshot) { } import * as platform from "platform"; -import * as consoleModule from "console"; +let consoleModule = require("console"); var c = new consoleModule.Console(); if (platform.device.os === platform.platformNames.android) { - global.console = c; + (global).console = c; } else if (platform.device.os === platform.platformNames.ios) { - global.console.dump = function (args) { c.dump(args); }; + (global).console.dump = function (args) { c.dump(args); }; } export function Deprecated(target: Object, key?: string | symbol, descriptor?: any) { diff --git a/tns-core-modules/module.d.ts b/tns-core-modules/module.d.ts index 772a2cc9b..a23628de0 100644 --- a/tns-core-modules/module.d.ts +++ b/tns-core-modules/module.d.ts @@ -1,13 +1,50 @@ -//Base module declarations -//Not required in Angular apps since it clashes with its typings. -declare var global: any; +declare var global: NodeJS.Global; -interface NativeScriptRequire { +//Augment the NodeJS global type with our own extensions +declare namespace NodeJS { + interface Global { + android?: any; + require(id: string): any; + registerModule(name: string, loader: ((name: string) => any)): void; + loadModule(name: string): any; + moduleExists(name: string): boolean; + moduleMerge(sourceExports: any, destExports: any): void; + zonedCallback(callback: Function): Function; + Reflect?: any; + Deprecated(target: Object, key?: string | symbol, descriptor?: any): any; + Experimental(target: Object, key?: string | symbol, descriptor?: any): any; + __native?: any; + __extends: any; + __onLiveSync: () => void; + __onUncaughtError: (error: NativeScriptError) => void; + TNS_WEBPACK?: boolean; + } +} + +declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): number; +declare function clearTimeout(timeoutId: number): void; +declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): number; +declare function clearInterval(intervalId: number): void; + +/** + * An extended JavaScript Error which will have the nativeError property initialized in case the error is caused by executing platform-specific code. + */ +interface NativeScriptError extends Error { + /** + * Represents the native error object. + */ + nativeError: any; +} + +// Define a minimal subset of NodeRequire and NodeModule so user apps can compile without +// installing @types/node + +interface NodeRequire { (id: string): any; } -interface NativeScriptModule { +interface NodeModule { + exports: any; id: string; filename: string; - exports: any; } diff --git a/tns-core-modules/package.json b/tns-core-modules/package.json index 72468603b..36311ab58 100644 --- a/tns-core-modules/package.json +++ b/tns-core-modules/package.json @@ -2,7 +2,7 @@ "name": "tns-core-modules", "description": "Telerik NativeScript Core Modules", "version": "3.0.0", - "homepage":"https://www.nativescript.org", + "homepage": "https://www.nativescript.org", "repository": { "type": "git", "url": "https://github.com/NativeScript/NativeScript" @@ -27,6 +27,7 @@ "tns-core-modules-widgets": "rc" }, "devDependencies": { + "@types/node": "~7.0.5", "tns-platform-declarations": "*" }, "nativescript": { diff --git a/tns-core-modules/timer/timer.android.ts b/tns-core-modules/timer/timer.android.ts index 8013c017c..100b436f5 100644 --- a/tns-core-modules/timer/timer.android.ts +++ b/tns-core-modules/timer/timer.android.ts @@ -38,9 +38,10 @@ export function setTimeout(callback: Function, milliseconds = 0): number { } export function clearTimeout(id: number): void { - if (timeoutCallbacks[id]) { - timeoutHandler.removeCallbacks(timeoutCallbacks[id]); - delete timeoutCallbacks[id]; + let index = id; + if (timeoutCallbacks[index]) { + timeoutHandler.removeCallbacks(timeoutCallbacks[index]); + delete timeoutCallbacks[index]; } } diff --git a/tns-core-modules/timer/timer.d.ts b/tns-core-modules/timer/timer.d.ts index 5ca7ba793..ce9156d78 100644 --- a/tns-core-modules/timer/timer.d.ts +++ b/tns-core-modules/timer/timer.d.ts @@ -27,4 +27,4 @@ declare module "timer" { * @param id The identifier returned by the setInterval() method. */ export function clearInterval(id: number): void; -} \ No newline at end of file +} diff --git a/tns-core-modules/timer/timer.ios.ts b/tns-core-modules/timer/timer.ios.ts index 33c12cd92..b4906dc87 100644 --- a/tns-core-modules/timer/timer.ios.ts +++ b/tns-core-modules/timer/timer.ios.ts @@ -68,7 +68,7 @@ export function setTimeout(callback: Function, milliseconds = 0): number { } export function clearTimeout(id: number): void { - let pair = timeoutCallbacks.get(id); + let pair = timeoutCallbacks.get(id); if (pair) { pair.v.unregister(); } @@ -78,4 +78,4 @@ export function setInterval(callback: Function, milliseconds = 0): number { return createTimerAndGetId(zonedCallback(callback), milliseconds, true); } -export var clearInterval = clearTimeout; \ No newline at end of file +export var clearInterval = clearTimeout; diff --git a/tns-core-modules/tns-core-modules.base.d.ts b/tns-core-modules/tns-core-modules.base.d.ts deleted file mode 100644 index ca4676ee5..000000000 --- a/tns-core-modules/tns-core-modules.base.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// \ No newline at end of file diff --git a/tns-core-modules/tns-core-modules.d.ts b/tns-core-modules/tns-core-modules.d.ts index fd4d5c474..e83f2cd6c 100644 --- a/tns-core-modules/tns-core-modules.d.ts +++ b/tns-core-modules/tns-core-modules.d.ts @@ -1,2 +1,101 @@ /// -/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// diff --git a/tns-core-modules/tns-core-modules.es2016.d.ts b/tns-core-modules/tns-core-modules.es2016.d.ts deleted file mode 100644 index f427a16a9..000000000 --- a/tns-core-modules/tns-core-modules.es2016.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/// -/// - -// Use this .d.ts with TypeScript 2+ and compiler options "lib": ["es2016", "dom"] diff --git a/tns-core-modules/tns-core-modules.es6.d.ts b/tns-core-modules/tns-core-modules.es6.d.ts deleted file mode 100644 index 3ff27978a..000000000 --- a/tns-core-modules/tns-core-modules.es6.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// \ No newline at end of file diff --git a/tns-core-modules/ui/animation/animation.ios.ts b/tns-core-modules/ui/animation/animation.ios.ts index f3e4796bf..2aea2e088 100644 --- a/tns-core-modules/ui/animation/animation.ios.ts +++ b/tns-core-modules/ui/animation/animation.ios.ts @@ -47,7 +47,7 @@ class AnimationDelegateImpl extends NSObject implements CAAnimationDelegate { public nextAnimation: Function; // The CAAnimationDelegate protocol has been introduced in the iOS 10 SDK - static ObjCProtocols = global.CAAnimationDelegate ? [global.CAAnimationDelegate] : []; + static ObjCProtocols = (global).CAAnimationDelegate ? [(global).CAAnimationDelegate] : []; private _finishedCallback: Function; private _propertyAnimation: PropertyAnimationInfo; @@ -598,4 +598,4 @@ export function _getTransformMismatchErrorMessage(view: View): string { } return undefined; -} \ No newline at end of file +} diff --git a/tns-core-modules/ui/editable-text-base/editable-text-base.android.ts b/tns-core-modules/ui/editable-text-base/editable-text-base.android.ts index 6000d90b9..f2f3e223e 100644 --- a/tns-core-modules/ui/editable-text-base/editable-text-base.android.ts +++ b/tns-core-modules/ui/editable-text-base/editable-text-base.android.ts @@ -56,7 +56,7 @@ class TextWatcher extends java.lang.Object implements android.text.TextWatcher { } //https://github.com/NativeScript/NativeScript/issues/2942 -let dismissKeyboardTimeoutId: number; +let dismissKeyboardTimeoutId: any; @Interfaces([android.view.View.OnFocusChangeListener]) class FocusChangeListener extends java.lang.Object implements android.view.View.OnFocusChangeListener { @@ -436,4 +436,4 @@ export abstract class EditableTextBase extends EditableTextBaseCommon { this._android.setHintTextColor(value); } } -} \ No newline at end of file +} diff --git a/tns-core-modules/xml/xml.ts b/tns-core-modules/xml/xml.ts index cda740f77..c4f740378 100644 --- a/tns-core-modules/xml/xml.ts +++ b/tns-core-modules/xml/xml.ts @@ -84,7 +84,7 @@ function _generateAmpMap(): any { } // android-specific implementation, which pre-populates the map to get it saved into the heap blob -if (global.__snapshot) { +if ((global).__snapshot) { _ampCodes = _generateAmpMap(); }