Merge pull request #3636 from NativeScript/hdeshev/no-grunt-ts

TypeScript and typings upgrade
This commit is contained in:
Hristo Deshev
2017-02-15 17:02:11 +02:00
committed by GitHub
48 changed files with 409 additions and 4868 deletions

View File

@@ -1,7 +1,7 @@
import * as application from "application";
declare var CACurrentMediaTime;
global.time = function(): number {
(<any>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" });
application.start({ moduleName: "css-perf-test/root" });

View File

@@ -2,6 +2,6 @@
export function navigatedTo(args: ObservableEventData) {
setTimeout(() => {
console.log(`Time: ${global.time() - global.startTime} ms`);
console.log(`Time: ${(<any>global).time() - (<any>global).startTime} ms`);
});
}
}

View File

@@ -1,7 +1,7 @@
import {Page} from "ui/page";
export function onTap(args: any) {
global.startTime = global.time();
(<any>global).startTime = (<any>global).time();
let page = <Page>args.object.page;
page.frame.navigate("css-perf-test/main-page");
}
}

View File

@@ -2,7 +2,4 @@
/// <reference path="../tns-platform-declarations/ios.d.ts" />
/// <reference path="../tns-core-modules/tns-core-modules.d.ts" />
/// <reference path="../tns-core-modules/lib.core.d.ts" />
/// <reference path="../tns-core-modules/lib.dom.d.ts" />
/// <reference path="../tns-core-modules/ui/styling/css-selector-parser.d.ts" />

View File

@@ -84,22 +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 nonES6Files = [
'es-collections.d.ts',
'es6-promise.d.ts',
'es6.d.ts',
'weakmap.d.ts',
];
var es6Excludes = nonES6Files.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!
@@ -108,27 +95,17 @@ 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(es6Excludes).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(nonES6Files).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";
var outDir = "./bin/dist";
var srcDir = ".";
var tnsCoreModulesDir = path.join(srcDir, "tns-core-modules");;
var srcAppDirs = ["tests/app", "apps/app"]; //Don't move the tests folder from index 0!
@@ -169,13 +146,6 @@ module.exports = function(grunt) {
"!obj/**/*.*"
];
localCfg.defaultExcludes = localCfg.typeScriptSrc.filter(function(item) { return /^!/.test(item); });
localCfg.typeScriptSrcForTsLint = localCfg.typeScriptSrc.concat([
"!tns-core-modules/libjs.d.ts",
"!tns-core-modules/lib.core.es6.d.ts",
"!tns-core-modules/lib.dom.d.ts",
"!tns-core-modules.es2016.d.ts",
"!tns-platform-declarations/**/*"
]);
localCfg.srcTsdFiles = [
"tns-core-modules/**/*.d.ts",
"!tns-core-modules/ios/**",
@@ -186,15 +156,6 @@ module.exports = function(grunt) {
"!**/*.ios.d.ts"
].concat(localCfg.defaultExcludes);
var tsOptions = tsconfig.compilerOptions;
tsOptions.fast = 'never';
tsOptions.removeComments = !grunt.option('leavecomments') || '';
tsOptions.compiler = "node_modules/typescript/bin/tsc";
tsOptions.failOnTypeErrors = true;
tsOptions.outDir = localCfg.outDir;
var removeCommentsArgument = tsOptions.removeComments ? " --removeComments" : "";
tsOptions.additionalFlags = "--outDir " + localCfg.outDir + removeCommentsArgument;
// Config
grunt.initConfig({
localCfg : localCfg,
@@ -321,69 +282,6 @@ module.exports = function(grunt) {
dest: "<%= grunt.option('path') %>/node_modules/tns-core-modules/",
}
},
ts: {
build: {
tsconfig: {
tsconfig: 'tsconfig.json',
passThrough: true,
},
outDir: localCfg.outDir,
dest: localCfg.outDir,
options: tsOptions
},
buildNodeTests: {
src: [
'tns-core-modules/js-libs/easysax/**/*.ts',
'tns-core-modules/module.d.ts',
'tns-core-modules/xml/**/*.ts',
'tns-core-modules/lib.core.d.ts',
'tns-core-modules/lib.dom.d.ts',
'tns-core-modules/es-collections.d.ts',
'tns-core-modules/declarations.d.ts',
'tns-core-modules/es6-promise.d.ts',
'node-tests/**/*.ts'
],
outDir: localCfg.outDir,
dest: localCfg.outDir,
options: tsOptions
},
buildDts: {
src: [
'tns-core-modules/**/*.d.ts',
'!org.nativescript.widgets.d.ts',
'!**/*.android.d.ts',
'!**/node_modules/**/*',
'!**/platforms/**/*',
'!bin/**/*',
'!**/references.d.ts',
'!tns-core-modules/references.d.ts',
'!tns-core-modules/android17.d.ts',
'!tns-core-modules/ios/**/*',
'!tns-core-modules/org.nativescript.widgets.d.ts',
],
outDir: localCfg.outDir,
dest: localCfg.outDir,
options: tsOptions
},
testCombinedDts: {
src: [
path.join(localCfg.outTnsCoreModules, 'tns-core-modules.d.ts'),
],
outDir: localCfg.outDir,
dest: localCfg.outDir,
options: Object.assign({}, tsOptions, { noLib: false })
}
},
tslint: {
build: {
files: {
src: localCfg.typeScriptSrcForTsLint
},
options: {
configuration: grunt.file.readJSON("./build/tslint.json")
}
}
},
exec: {
packModules: {
cmd: "npm pack",
@@ -400,6 +298,11 @@ module.exports = function(grunt) {
callback: assignGitSHA
}
},
compileAll: "npm run compile-all",
compileNodeTests: "npm run compile-node-tests",
compileCheckBaseDts: "npm run compile-check-base-dts",
compileCheckCombinedDts: "npm run compile-check-combined-dts",
tslint: "npm run tslint",
},
simplemocha: {
node: {
@@ -431,8 +334,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-ts");
grunt.loadNpmTasks("grunt-tslint");
grunt.loadNpmTasks("grunt-exec");
grunt.loadNpmTasks("grunt-shell");
grunt.loadNpmTasks("grunt-simple-mocha");
@@ -446,8 +347,8 @@ module.exports = function(grunt) {
]);
grunt.registerTask("compile-ts", [
"ts:buildDts",
"ts:build",
"shell:compileCheckBaseDts",
"shell:compileAll",
"clean:typeScriptLeftovers",
"copy:childPackageFiles"
]);
@@ -487,9 +388,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",
@@ -508,12 +409,12 @@ module.exports = function(grunt) {
"copy:definitionFiles",
"copy:jsLibs",
"generate-tns-core-modules-dts",
"ts:testCombinedDts",
"shell:compileCheckCombinedDts",
]);
grunt.registerTask("node-tests", [
"clean:nodeTests",
"ts:buildNodeTests",
"shell:compileNodeTests",
"copy:childPackageFiles",
"copy:jsLibs",
"env:nodeTests",
@@ -580,7 +481,7 @@ module.exports = function(grunt) {
grunt.registerTask("get-ready-packages", ["copy:readyPackages"]);
grunt.registerTask("default", (skipTsLint ? [] : ["tslint:build"]).concat([
grunt.registerTask("default", (skipTsLint ? [] : ["shell:tslint"]).concat([
"build-all",
"pack-apps",
"get-ready-packages"

View File

@@ -1,6 +1,6 @@
import {assert} from "chai";
import * as xmlModule from "xml";
var xml: typeof xmlModule = require("../tns-core-modules/xml");
//TODO: use a path mapping to the "xml" module after upgrading to TS 2.1
var xml = require("../tns-core-modules/xml");
describe("angular xml parser", () => {
let last_element = null;
@@ -8,7 +8,7 @@ describe("angular xml parser", () => {
let parser = null;
beforeEach(() => {
parser = new xml.XmlParser(function (event: xmlModule.ParserEvent) {
parser = new xml.XmlParser(function (event) {
switch (event.eventType) {
case xml.ParserEventType.StartElement:
last_element = event.elementName;

View File

@@ -1,6 +1,6 @@
import {assert} from "chai";
import * as xmlModule from "xml";
var xml: typeof xmlModule = require("../tns-core-modules/xml");
//TODO: use a path mapping to the "xml" module after upgrading to TS 2.1
var xml = require("../tns-core-modules/xml");
describe("xml parser", () => {
let last_element = null;
@@ -9,7 +9,7 @@ describe("xml parser", () => {
let parser = null;
beforeEach(() => {
parser = new xml.XmlParser(function (event: xmlModule.ParserEvent) {
parser = new xml.XmlParser(function (event) {
switch (event.eventType) {
case xml.ParserEventType.StartElement:
last_element = event.elementName;

View File

@@ -16,13 +16,10 @@
"grunt-env": "0.4.4",
"grunt-exec": "1.0.1",
"grunt-mkdir": "1.0.0",
"grunt-multi-dest": "1.0.0",
"grunt-shell": "2.1.0",
"grunt-ts": "6.0.0-beta.11",
"grunt-simple-mocha": "0.4.1",
"grunt-ts": "5.3.2",
"grunt-tslint": "4.0.0",
"grunt-typedoc": "0.2.4",
"grunt-untar": "0.0.1",
"http-server": "^0.9.0",
"markdown-snippet-injector": "0.1.1",
"mocha": "2.2.5",
@@ -31,11 +28,15 @@
"time-grunt": "1.3.0",
"tslint": "^4.4.2",
"typedoc": "0.4.5",
"typescript": "^2.0.10"
"typescript": "~2.1.5"
},
"scripts": {
"setup": "npm run dev-link-tns-platform-declarations && npm run dev-link-tns-core-modules && npm run dev-link-tests && npm run dev-link-apps",
"tsc": "tsc",
"compile-all": "tsc -p tsconfig.json --outDir bin/dist",
"compile-check-base-dts": "tsc -p tsconfig.base-dts.json",
"compile-node-tests": "tsc -p tsconfig.node-tests.json --outDir bin/dist/node-tests",
"compile-check-combined-dts": "tsc -p tsconfig.combined-dts.json",
"tsc-w": "tsc --skipLibCheck -w",
"dev-tsc-tns-platform-declarations": "tsc -p tns-platform-declarations",
"dev-tsc-tests": "tsc -p tests",

View File

@@ -5,6 +5,7 @@ import {Label} from "ui/label";
import {StackLayout} from "ui/layouts/stack-layout";
import * as colorModule from "color";
import * as enums from "ui/enums";
import { AnimationPromise } from "ui/animation";
// >> animation-require
import * as animation from "ui/animation";
@@ -105,7 +106,7 @@ export function test_CancellingAnimate(done) {
}
// << (hide)
});
animation1.cancel();
(<AnimationPromise>animation1).cancel();
// << animation-cancel2
}
@@ -484,4 +485,4 @@ function assertIOSNativeTransformIsCorrect(view: viewModule.View) {
TKUnit.assert(false, errorMessage);
}
}
}
}

View File

@@ -2,7 +2,4 @@
/// <reference path="../tns-platform-declarations/ios.d.ts" />
/// <reference path="../tns-core-modules/tns-core-modules.d.ts" />
/// <reference path="../tns-core-modules/lib.core.d.ts" />
/// <reference path="../tns-core-modules/lib.dom.d.ts" />
/// <reference path="../tns-core-modules/ui/styling/css-selector-parser.d.ts" />

View File

@@ -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 ((<any>global).errorPage) {
(<any>global).errorPage.closeModal();
(<any>global).errorPage = undefined;
}
try {
@@ -132,13 +131,13 @@ export function __onLiveSync() {
// Reload app.css in case it was changed.
loadCss();
global.__onLiveSyncCore();
(<any>global).__onLiveSyncCore();
} catch (ex) {
// Show the error as modal page, save reference to the page in global context.
ensureBuilder();
global.errorPage = builder.parse(`<Page><ScrollView><Label text="${ex}" textWrap="true" style="color: red;" /></ScrollView></Page>`);
global.errorPage.showModal();
(<any>global).errorPage = builder.parse(`<Page><ScrollView><Label text="${ex}" textWrap="true" style="color: red;" /></ScrollView></Page>`);
(<any>global).errorPage.showModal();
}
}
@@ -146,7 +145,7 @@ export function __onLiveSyncCore() {
// Reload current page.
reloadPage();
}
global.__onLiveSyncCore = __onLiveSyncCore;
(<any>global).__onLiveSyncCore = __onLiveSyncCore;
export function _onOrientationChanged(){
ensurePlatform();
@@ -154,4 +153,4 @@ export function _onOrientationChanged(){
ensureFileNameResolver();
fileNameResolver._invalidateResolverInstance();
}
}

View File

@@ -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

View File

@@ -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.
*/

View File

@@ -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

View File

@@ -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;
}
}

View File

@@ -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 ((<any>global).__consoleMessage) {
(<any>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 (!(<any>global).android) {
// This case may be entered during heap snapshot where the global.android is not present
return;
}

View File

@@ -42,6 +42,24 @@ declare class Headers {
set(name: string, value: string): void;
}
interface Blob {
readonly size: number;
readonly type: string;
msClose(): void;
msDetachStream(): any;
slice(start?: number, end?: number, contentType?: string): Blob;
}
declare var Blob: {
prototype: Blob;
new (blobParts?: any[], options?: BlobPropertyBag): Blob;
}
interface BlobPropertyBag {
type?: string;
endings?: string;
}
declare class Body {
bodyUsed: boolean;
/*
@@ -80,26 +98,24 @@ declare type RequestInfo = Request|string;
declare function fetch(url: string, init?: RequestInit): Promise<Response>;
interface XMLHttpRequest {
send(data?: FormData): void;
}
/**
* 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;
@@ -165,10 +181,14 @@ declare class WeakRef<T> {
clear(): void;
}
declare var module: NativeScriptModule;
declare var module: NodeModule;
// Same as module.exports
declare var exports: any;
interface Array<T> {
filter<U extends T>(pred: (a: T) => a is U): U[];
}
//Dialogs
declare function alert(message?: any): void;
declare function confirm(message?: string): boolean;

View File

@@ -1,61 +0,0 @@
/* tslint:disable */
/////////////////////////////
/// IE11 ECMAScript Extensions
/////////////////////////////
interface List<T> extends Array<T> {}
interface Map<K, V> {
clear(): void;
delete(key: K): boolean;
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
get(key: K): V;
has(key: K): boolean;
set(key: K, value: V): Map<K, V>;
size: number;
keys(): Array<K>;
values(): Array<V>;
}
declare var Map: {
new <K, V>(): Map<K, V>;
// needed by Angular
// alexeagle: PATCHED
new<K, V>(m: Map<K, V>): Map<K, V>;
new<K, V>(l: List<any>): Map<K, V>;
prototype: Map<any, any>;
}
//For compatibility - some libs insist on the Map/Set types being named that way
declare type MapConstructor = typeof Map;
declare type SetConstructor = typeof Set;
interface Set<T> {
add(value: T): Set<T>;
clear(): void;
delete(value: T): boolean;
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
has(value: T): boolean;
size: number;
}
declare var Set: {
new <T>(): Set<T>;
// needed by Angular
// alexeagle PATCHED
new<T>(s: Set<T>): Set<T>;
new<T>(l: List<T>): Set<T>;
prototype: Set<any>;
}
//Compatibility interfaces for rxjs
interface IteratorResult<T> {
done: boolean;
value?: T;
}
interface Iterator<T> {
next(value?: any): IteratorResult<T>;
return?(value?: any): IteratorResult<T>;
throw?(e?: any): IteratorResult<T>;
}

View File

@@ -1,146 +0,0 @@
/* tslint:disable */
// Type definitions for es6-promise
// Project: https://github.com/jakearchibald/ES6-Promise
// Definitions by: François de Campredon <https://github.com/fdecampredon/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface PromiseLike<T> {
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => PromiseLike<U>): PromiseLike<U>;
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => U): PromiseLike<U>;
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => void): PromiseLike<U>;
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => PromiseLike<U>): PromiseLike<U>;
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U): PromiseLike<U>;
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => void): PromiseLike<U>;
}
interface Promise<T> extends PromiseLike<T> {
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => PromiseLike<U>): Promise<U>;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => U): Promise<U>;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => void): Promise<U>;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => PromiseLike<U>): Promise<U>;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U): Promise<U>;
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => void): Promise<U>;
/**
* Sugar for promise.then(undefined, onRejected)
* @param onRejected called when/if "promise" rejects
*/
catch<U>(onRejected?: (error: any) => PromiseLike<U>): Promise<U>;
/**
* Sugar for promise.then(undefined, onRejected)
* @param onRejected called when/if "promise" rejects
*/
catch<U>(onRejected?: (error: any) => U): Promise<U>;
/**
* Sugar for promise.then(undefined, onRejected)
* @param onRejected called when/if "promise" rejects
*/
catch<U>(onRejected?: (error: any) => void): Promise<U>;
}
interface PromiseConstructor {
/**
* A reference to the prototype.
*/
prototype: Promise<any>;
/**
* Creates a new Promise.
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
* a resolve callback used resolve the promise with a value or the result of another promise,
* and a reject callback used to reject the promise with a provided reason or error.
*/
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
/**
* Returns promise (only if promise.constructor == Promise)
*/
cast<T>(promise: Promise<T>): Promise<T>;
/**
* Make a promise that fulfills to obj.
*/
cast<T>(object: T): Promise<T>;
/**
* Make a new promise from the PromiseLike.
* A promise-like can be anything as far as it has a "then" method.
* This also creates a new promise if you pass it a genuine JavaScript promise, making it less efficient for casting than Promise.cast.
*/
resolve<T>(promise?: PromiseLike<T>): Promise<T>;
/**
* Make a promise that fulfills to obj. Same as Promise.cast(obj) in this situation.
*/
resolve<T>(object?: T): Promise<T>;
/**
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
*/
reject(error: any): Promise<any>;
/**
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
* the array passed to all can be a mixture of promise-like objects and other objects.
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
*/
all<T>(promises: Promise<T>[]): Promise<T[]>;
/**
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
*/
race<T>(promises: Promise<T>[]): Promise<T>;
}
declare var Promise: PromiseConstructor;

View File

@@ -1,12 +0,0 @@
interface Symbol {
toString(): string;
valueOf(): Object;
}
interface SymbolConstructor {
prototype: Symbol;
(description?: string | number): symbol;
iterator: symbol;
}
declare var Symbol: SymbolConstructor;

View File

@@ -1,10 +1,10 @@
if (typeof global.__decorate !== "function") {
global.__decorate = function (decorators, target, key, desc) {
if (typeof (<any>global).__decorate !== "function") {
(<any>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 (<any>global).Reflect === "object" && typeof (<any>global).Reflect.decorate === "function") {
r = (<any>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 (<any>global).__metadata !== "function") {
(<any>global).__metadata = function (k, v) {
if (typeof (<any>global).Reflect === "object" && typeof (<any>global).Reflect.metadata === "function") {
return (<any>global).Reflect.metadata(k, v);
}
};
}
if (typeof global.__param !== "function") {
global.__param = (global && global.__param) || function (paramIndex, decorator) {
if (typeof (<any>global).__param !== "function") {
(<any>global).__param = (global && (<any>global).__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
}
}

View File

@@ -46,13 +46,13 @@ global.loadModule = function(name: string): any {
}
global.zonedCallback = function (callback: Function): Function {
if (global.zone) {
if ((<any>global).zone) {
// Zone v0.5.* style callback wrapping
return global.zone.bind(callback);
return (<any>global).zone.bind(callback);
}
if (global.Zone) {
if ((<any>global).Zone) {
// Zone v0.6.* style callback wrapping
return global.Zone.current.wrap(callback);
return (<any>global).Zone.current.wrap(callback);
} else {
return callback;
}
@@ -86,28 +86,28 @@ function registerOnGlobalContext(name: string, module: string): void {
});
}
if (global.__snapshot) {
if ((<any>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;
(<any>global).setTimeout = timer.setTimeout;
(<any>global).clearTimeout = timer.clearTimeout;
(<any>global).setInterval = timer.setInterval;
(<any>global).clearInterval = timer.clearInterval;
var dialogs: typeof dialogsModule = require("ui/dialogs");
global.alert = dialogs.alert;
global.confirm = dialogs.confirm;
global.prompt = dialogs.prompt;
(<any>global).alert = dialogs.alert;
(<any>global).confirm = dialogs.confirm;
(<any>global).prompt = dialogs.prompt;
var xhr = require("xhr");
global.XMLHttpRequest = xhr.XMLHttpRequest;
global.FormData = xhr.FormData;
(<any>global).XMLHttpRequest = xhr.XMLHttpRequest;
(<any>global).FormData = xhr.FormData;
var fetch = require("fetch");
global.fetch = fetch.fetch;
global.Headers = fetch.Headers;
global.Request = fetch.Request;
global.Response = fetch.Response;
(<any>global).fetch = fetch.fetch;
(<any>global).Headers = fetch.Headers;
(<any>global).Request = fetch.Request;
(<any>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;
(<any>global).console = c;
} else if (platform.device.os === platform.platformNames.ios) {
global.console.dump = function (args) { c.dump(args); };
(<any>global).console.dump = function (args) { c.dump(args); };
}
export function Deprecated(target: Object, key?: string | symbol, descriptor?: any) {

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,201 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
interface Event {
bubbles: boolean;
cancelBubble: boolean;
cancelable: boolean;
currentTarget: EventTarget;
defaultPrevented: boolean;
eventPhase: number;
isTrusted: boolean;
returnValue: boolean;
srcElement: any /* Element */;
target: EventTarget;
timeStamp: number;
type: string;
initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;
preventDefault(): void;
stopImmediatePropagation(): void;
stopPropagation(): void;
AT_TARGET: number;
BUBBLING_PHASE: number;
CAPTURING_PHASE: number;
}
interface EventInit {
bubbles?: boolean;
cancelable?: boolean;
}
interface ProgressEventInit extends EventInit {
lengthComputable?: boolean;
loaded?: number;
total?: number;
}
interface ProgressEvent extends Event {
lengthComputable: boolean;
loaded: number;
total: number;
initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void;
}
declare var ProgressEvent: {
prototype: ProgressEvent;
new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent;
}
interface ErrorEvent extends Event {
colno: number;
error: any;
filename: string;
lineno: number;
message: string;
initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void;
}
declare var ErrorEvent: {
prototype: ErrorEvent;
new(): ErrorEvent;
}
interface EventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
dispatchEvent(evt: Event): boolean;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var EventTarget: {
prototype: EventTarget;
new(): EventTarget;
}
interface EventListenerObject {
handleEvent(evt: Event): void;
}
interface EventListener {
(evt: Event): void;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface XMLHttpRequestEventTarget {
onabort: (ev: Event) => any;
onerror: (ev: Event) => any;
onload: (ev: Event) => any;
onloadend: (ev: ProgressEvent) => any;
onloadstart: (ev: Event) => any;
onprogress: (ev: ProgressEvent) => any;
ontimeout: (ev: ProgressEvent) => any;
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: "timeout", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
msCaching: string;
onreadystatechange: (ev: ProgressEvent) => any;
readyState: number;
response: any;
responseBody: any;
responseText: string;
responseType: string;
responseXML: any;
status: number;
statusText: string;
timeout: number;
upload: XMLHttpRequestUpload;
withCredentials: boolean;
abort(): void;
getAllResponseHeaders(): string;
getResponseHeader(header: string): string;
msCachingEnabled(): boolean;
open(method: string, url: string, async?: boolean, user?: string, password?: string): void;
overrideMimeType(mime: string): void;
// send(data?: Document): void;
send(data?: string): void;
send(data?: any): void;
setRequestHeader(header: string, value: string): void;
DONE: number;
HEADERS_RECEIVED: number;
LOADING: number;
OPENED: number;
UNSENT: number;
addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void;
addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void;
addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: "readystatechange", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: "timeout", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var XMLHttpRequest: {
prototype: XMLHttpRequest;
new(): XMLHttpRequest;
DONE: number;
HEADERS_RECEIVED: number;
LOADING: number;
OPENED: number;
UNSENT: number;
create(): XMLHttpRequest;
}
interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var XMLHttpRequestUpload: {
prototype: XMLHttpRequestUpload;
new(): XMLHttpRequestUpload;
}
interface FormData {
append(name: any, value: any, blobName?: string): void;
}
declare var FormData: {
prototype: FormData;
new (/* form?: HTMLFormElement */): FormData;
}
interface BlobPropertyBag {
type?: string;
endings?: string;
}
interface Blob {
size: number;
type: string;
msClose(): void;
msDetachStream(): any;
slice(start?: number, end?: number, contentType?: string): Blob;
}
declare var Blob: {
prototype: Blob;
new (blobParts?: any[], options?: BlobPropertyBag): Blob;
}
declare function alert(message?: any): void;

View File

@@ -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;
}

View File

@@ -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": {

View File

@@ -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];
}
}

View File

@@ -27,4 +27,4 @@ declare module "timer" {
* @param id The identifier returned by the setInterval() method.
*/
export function clearInterval(id: number): void;
}
}

View File

@@ -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(<number><any>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;
export var clearInterval = clearTimeout;

View File

@@ -1,101 +0,0 @@
/// <reference path="application-settings/application-settings.d.ts" />
/// <reference path="application/application.d.ts" />
/// <reference path="camera/camera.d.ts" />
/// <reference path="color/color.d.ts" />
/// <reference path="color/known-colors.d.ts" />
/// <reference path="connectivity/connectivity.d.ts" />
/// <reference path="console/console.d.ts" />
/// <reference path="css-value/reworkcss-value.d.ts" />
/// <reference path="css/reworkcss.d.ts" />
/// <reference path="data/observable-array/observable-array.d.ts" />
/// <reference path="data/observable/observable.d.ts" />
/// <reference path="data/virtual-array/virtual-array.d.ts" />
/// <reference path="declarations.d.ts" />
/// <reference path="file-system/file-name-resolver.d.ts" />
/// <reference path="file-system/file-system-access.d.ts" />
/// <reference path="file-system/file-system.d.ts" />
/// <reference path="fps-meter/fps-meter.d.ts" />
/// <reference path="fps-meter/fps-native.d.ts" />
/// <reference path="http/http-request.d.ts" />
/// <reference path="http/http.d.ts" />
/// <reference path="image-asset/image-asset.d.ts" />
/// <reference path="image-source/image-source.d.ts" />
/// <reference path="js-libs/easysax/easysax.d.ts" />
/// <reference path="js-libs/esprima/esprima.d.ts" />
/// <reference path="js-libs/polymer-expressions/polymer-expressions.d.ts" />
/// <reference path="location/location.d.ts" />
/// <reference path="platform/platform.d.ts" />
/// <reference path="text/formatted-string.d.ts" />
/// <reference path="text/span.d.ts" />
/// <reference path="text/text.d.ts" />
/// <reference path="timer/timer.d.ts" />
/// <reference path="trace/trace.d.ts" />
/// <reference path="ui/definitions.d.ts" />
/// <reference path="ui/action-bar/action-bar.d.ts" />
/// <reference path="ui/activity-indicator/activity-indicator.d.ts" />
/// <reference path="ui/animation/animation.d.ts" />
/// <reference path="ui/animation/keyframe-animation.d.ts" />
/// <reference path="ui/border/border.d.ts" />
/// <reference path="ui/builder/binding-builder.d.ts" />
/// <reference path="ui/builder/builder.d.ts" />
/// <reference path="ui/builder/component-builder.d.ts" />
/// <reference path="ui/builder/special-properties.d.ts" />
/// <reference path="ui/button/button.d.ts" />
/// <reference path="ui/content-view/content-view.d.ts" />
/// <reference path="ui/core/bindable.d.ts" />
/// <reference path="ui/core/control-state-change.d.ts" />
/// <reference path="ui/core/dependency-observable.d.ts" />
/// <reference path="ui/core/view.d.ts" />
/// <reference path="ui/core/weak-event-listener.d.ts" />
/// <reference path="ui/date-picker/date-picker.d.ts" />
/// <reference path="ui/dialogs/dialogs.d.ts" />
/// <reference path="ui/editable-text-base/editable-text-base.d.ts" />
/// <reference path="ui/enums/enums.d.ts" />
/// <reference path="ui/frame/frame.d.ts" />
/// <reference path="ui/gestures/gestures.d.ts" />
/// <reference path="ui/html-view/html-view.d.ts" />
/// <reference path="ui/image-cache/image-cache.d.ts" />
/// <reference path="ui/image/image.d.ts" />
/// <reference path="ui/label/label.d.ts" />
/// <reference path="ui/layouts/absolute-layout/absolute-layout.d.ts" />
/// <reference path="ui/layouts/dock-layout/dock-layout.d.ts" />
/// <reference path="ui/layouts/grid-layout/grid-layout.d.ts" />
/// <reference path="ui/layouts/flexbox-layout/flexbox-layout.d.ts" />
/// <reference path="ui/layouts/layout-base.d.ts" />
/// <reference path="ui/layouts/layout.d.ts" />
/// <reference path="ui/layouts/stack-layout/stack-layout.d.ts" />
/// <reference path="ui/layouts/wrap-layout/wrap-layout.d.ts" />
/// <reference path="ui/list-picker/list-picker.d.ts" />
/// <reference path="ui/list-view/list-view.d.ts" />
/// <reference path="ui/page/page.d.ts" />
/// <reference path="ui/placeholder/placeholder.d.ts" />
/// <reference path="ui/progress/progress.d.ts" />
/// <reference path="ui/proxy-view-container/proxy-view-container.d.ts" />
/// <reference path="ui/repeater/repeater.d.ts" />
/// <reference path="ui/scroll-view/scroll-view.d.ts" />
/// <reference path="ui/search-bar/search-bar.d.ts" />
/// <reference path="ui/segmented-bar/segmented-bar.d.ts" />
/// <reference path="ui/slider/slider.d.ts" />
/// <reference path="ui/styling/background.d.ts" />
/// <reference path="ui/styling/css-selector.d.ts" />
/// <reference path="ui/styling/font.d.ts" />
/// <reference path="ui/styling/style-property.d.ts" />
/// <reference path="ui/styling/style-scope.d.ts" />
/// <reference path="ui/styling/style.d.ts" />
/// <reference path="ui/styling/styling.d.ts" />
/// <reference path="ui/switch/switch.d.ts" />
/// <reference path="ui/tab-view/tab-view.d.ts" />
/// <reference path="ui/text-base/text-base.d.ts" />
/// <reference path="ui/text-field/text-field.d.ts" />
/// <reference path="ui/text-view/text-view.d.ts" />
/// <reference path="ui/time-picker/time-picker.d.ts" />
/// <reference path="ui/transition/fade-transition.d.ts" />
/// <reference path="ui/transition/slide-transition.d.ts" />
/// <reference path="ui/transition/transition.d.ts" />
/// <reference path="ui/utils.d.ts" />
/// <reference path="ui/web-view/web-view.d.ts" />
/// <reference path="utils/debug.d.ts" />
/// <reference path="utils/lazy.d.ts" />
/// <reference path="utils/types.d.ts" />
/// <reference path="utils/utils.d.ts" />
/// <reference path="xml/xml.d.ts" />

View File

@@ -1,6 +1,101 @@
/// <reference path="module.d.ts" />
/// <reference path="es-collections.d.ts" />
/// <reference path="es6-promise.d.ts" />
/// <reference path="es6.d.ts" />
/// <reference path="weakmap.d.ts" />
/// <reference path="tns-core-modules.base.d.ts" />
/// <reference path="application-settings/application-settings.d.ts" />
/// <reference path="application/application.d.ts" />
/// <reference path="camera/camera.d.ts" />
/// <reference path="color/color.d.ts" />
/// <reference path="color/known-colors.d.ts" />
/// <reference path="connectivity/connectivity.d.ts" />
/// <reference path="css-value/reworkcss-value.d.ts" />
/// <reference path="css/reworkcss.d.ts" />
/// <reference path="data/observable-array/observable-array.d.ts" />
/// <reference path="data/observable/observable.d.ts" />
/// <reference path="data/virtual-array/virtual-array.d.ts" />
/// <reference path="declarations.d.ts" />
/// <reference path="file-system/file-name-resolver.d.ts" />
/// <reference path="file-system/file-system-access.d.ts" />
/// <reference path="file-system/file-system.d.ts" />
/// <reference path="fps-meter/fps-meter.d.ts" />
/// <reference path="fps-meter/fps-native.d.ts" />
/// <reference path="http/http-request.d.ts" />
/// <reference path="http/http.d.ts" />
/// <reference path="image-asset/image-asset.d.ts" />
/// <reference path="image-source/image-source.d.ts" />
/// <reference path="js-libs/easysax/easysax.d.ts" />
/// <reference path="js-libs/esprima/esprima.d.ts" />
/// <reference path="js-libs/polymer-expressions/polymer-expressions.d.ts" />
/// <reference path="location/location.d.ts" />
/// <reference path="platform/platform.d.ts" />
/// <reference path="text/formatted-string.d.ts" />
/// <reference path="text/span.d.ts" />
/// <reference path="text/text.d.ts" />
/// <reference path="timer/timer.d.ts" />
/// <reference path="trace/trace.d.ts" />
/// <reference path="ui/definitions.d.ts" />
/// <reference path="ui/action-bar/action-bar.d.ts" />
/// <reference path="ui/activity-indicator/activity-indicator.d.ts" />
/// <reference path="ui/animation/animation.d.ts" />
/// <reference path="ui/animation/keyframe-animation.d.ts" />
/// <reference path="ui/border/border.d.ts" />
/// <reference path="ui/builder/binding-builder.d.ts" />
/// <reference path="ui/builder/builder.d.ts" />
/// <reference path="ui/builder/component-builder.d.ts" />
/// <reference path="ui/builder/special-properties.d.ts" />
/// <reference path="ui/button/button.d.ts" />
/// <reference path="ui/content-view/content-view.d.ts" />
/// <reference path="ui/core/bindable.d.ts" />
/// <reference path="ui/core/control-state-change.d.ts" />
/// <reference path="ui/core/dependency-observable.d.ts" />
/// <reference path="ui/core/view.d.ts" />
/// <reference path="ui/core/weak-event-listener.d.ts" />
/// <reference path="ui/date-picker/date-picker.d.ts" />
/// <reference path="ui/dialogs/dialogs.d.ts" />
/// <reference path="ui/editable-text-base/editable-text-base.d.ts" />
/// <reference path="ui/enums/enums.d.ts" />
/// <reference path="ui/frame/frame.d.ts" />
/// <reference path="ui/gestures/gestures.d.ts" />
/// <reference path="ui/html-view/html-view.d.ts" />
/// <reference path="ui/image-cache/image-cache.d.ts" />
/// <reference path="ui/image/image.d.ts" />
/// <reference path="ui/label/label.d.ts" />
/// <reference path="ui/layouts/absolute-layout/absolute-layout.d.ts" />
/// <reference path="ui/layouts/dock-layout/dock-layout.d.ts" />
/// <reference path="ui/layouts/grid-layout/grid-layout.d.ts" />
/// <reference path="ui/layouts/flexbox-layout/flexbox-layout.d.ts" />
/// <reference path="ui/layouts/layout-base.d.ts" />
/// <reference path="ui/layouts/layout.d.ts" />
/// <reference path="ui/layouts/stack-layout/stack-layout.d.ts" />
/// <reference path="ui/layouts/wrap-layout/wrap-layout.d.ts" />
/// <reference path="ui/list-picker/list-picker.d.ts" />
/// <reference path="ui/list-view/list-view.d.ts" />
/// <reference path="ui/page/page.d.ts" />
/// <reference path="ui/placeholder/placeholder.d.ts" />
/// <reference path="ui/progress/progress.d.ts" />
/// <reference path="ui/proxy-view-container/proxy-view-container.d.ts" />
/// <reference path="ui/repeater/repeater.d.ts" />
/// <reference path="ui/scroll-view/scroll-view.d.ts" />
/// <reference path="ui/search-bar/search-bar.d.ts" />
/// <reference path="ui/segmented-bar/segmented-bar.d.ts" />
/// <reference path="ui/slider/slider.d.ts" />
/// <reference path="ui/styling/background.d.ts" />
/// <reference path="ui/styling/css-selector.d.ts" />
/// <reference path="ui/styling/font.d.ts" />
/// <reference path="ui/styling/style-property.d.ts" />
/// <reference path="ui/styling/style-scope.d.ts" />
/// <reference path="ui/styling/style.d.ts" />
/// <reference path="ui/styling/styling.d.ts" />
/// <reference path="ui/switch/switch.d.ts" />
/// <reference path="ui/tab-view/tab-view.d.ts" />
/// <reference path="ui/text-base/text-base.d.ts" />
/// <reference path="ui/text-field/text-field.d.ts" />
/// <reference path="ui/text-view/text-view.d.ts" />
/// <reference path="ui/time-picker/time-picker.d.ts" />
/// <reference path="ui/transition/fade-transition.d.ts" />
/// <reference path="ui/transition/slide-transition.d.ts" />
/// <reference path="ui/transition/transition.d.ts" />
/// <reference path="ui/utils.d.ts" />
/// <reference path="ui/web-view/web-view.d.ts" />
/// <reference path="utils/debug.d.ts" />
/// <reference path="utils/lazy.d.ts" />
/// <reference path="utils/types.d.ts" />
/// <reference path="utils/utils.d.ts" />
/// <reference path="xml/xml.d.ts" />

View File

@@ -1,6 +0,0 @@
/// <reference path="./tns-core-modules.base.d.ts" />
/// <reference path="./webworker.es2016.d.ts" />
/// <reference path="./module.d.ts" />
/// <reference path="./lib.dom.d.ts" />
// Use this .d.ts with TypeScript 2+ and compiler options "lib": ["es2016"]

View File

@@ -1,2 +0,0 @@
/// <reference path="module.d.ts" />
/// <reference path="tns-core-modules.base.d.ts" />

View File

@@ -5,6 +5,7 @@
AnimationDefinition,
Pair
} from "ui/animation";
export { AnimationPromise } from "ui/animation";
import { View, Color, traceEnabled, traceWrite, traceCategories } from "ui/core/view";
@@ -43,14 +44,6 @@ export class CubicBezierAnimationCurve implements CubicBezierAnimationCurveDefin
}
}
// This is a BOGUS Class to make TypeScript happy - This is not needed other than to make TS happy.
// We didn't want to actually modify Promise; as the cancel() is ONLY valid for animations "Promise"
export class AnimationPromise implements AnimationPromiseDefinition {
public cancel(): void { /* Do Nothing */ }
public then(onFulfilled?: (value?: any) => void, onRejected?: (error?: any) => void): AnimationPromise { return new AnimationPromise(); }
public catch(onRejected?: (error?: any) => void): AnimationPromise { return new AnimationPromise(); }
}
export abstract class AnimationBase implements AnimationBaseDefinition {
public _propertyAnimations: Array<PropertyAnimation>;
public _playSequentially: boolean;
@@ -87,14 +80,14 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
abstract _resolveAnimationCurve(curve: any): any;
public play(): AnimationPromise {
public play(): AnimationPromiseDefinition {
if (this.isPlaying) {
throw new Error("Animation is already playing.");
}
// We have to actually create a "Promise" due to a bug in the v8 engine and decedent promises
// We just cast it to a animationPromise so that all the rest of the code works fine
var animationFinishedPromise = <AnimationPromise>new Promise<void>((resolve, reject) => {
var animationFinishedPromise = <AnimationPromiseDefinition>new Promise<void>((resolve, reject) => {
this._resolve = resolve;
this._reject = reject;
});
@@ -105,7 +98,7 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
return animationFinishedPromise;
}
private fixupAnimationPromise(promise: AnimationPromise): void {
private fixupAnimationPromise(promise: AnimationPromiseDefinition): void {
// Since we are using function() below because of arguments, TS won't automatically do a _this for those functions.
var _this = this;
promise.cancel = () => {
@@ -255,4 +248,4 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
curve: animation.curve
});
}
}
}

View File

@@ -80,17 +80,15 @@
y: number;
}
/**
* Create Promise that can cancel the animation, we have to pretend our returns itself along with the cancel
*/
export class AnimationPromise extends Promise<void> {
export interface Cancelable {
cancel(): void;
then(onFulfilled?: (value?: any) => PromiseLike<void>, onRejected?: (error?: any) => PromiseLike<void>): AnimationPromise;
then(onFulfilled?: (value?: any) => void, onRejected?: (error?: any) => void): AnimationPromise;
catch(onRejected?: (error?: any) => PromiseLike<void>): AnimationPromise;
catch(onRejected?: (error?: any) => void): AnimationPromise;
}
/**
* A Promise that can cancel the animation.
*/
export type AnimationPromise = Promise<void> & Cancelable;
/**
* Defines a animation set.
*/
@@ -103,4 +101,4 @@
}
export function _resolveAnimationCurve(curve: any): any;
}
}

View File

@@ -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 = (<any>global).CAAnimationDelegate ? [(<any>global).CAAnimationDelegate] : [];
private _finishedCallback: Function;
private _propertyAnimation: PropertyAnimationInfo;
@@ -598,4 +598,4 @@ export function _getTransformMismatchErrorMessage(view: View): string {
}
return undefined;
}
}

View File

@@ -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);
}
}
}
}

View File

@@ -409,14 +409,14 @@ class TouchGestureEventData implements TouchGestureEventData {
android: any = undefined;
action: string;
view: View;
ios: { touches: NSSet<any>, event: UIEvent };
ios: { touches: NSSet<any>, event: _UIEvent };
object: any;
private _activePointers: Array<Pointer>;
private _allPointers: Array<Pointer>;
private _mainPointer: UITouch;
public prepare(view: View, action: string, touches: NSSet<any>, event: UIEvent) {
public prepare(view: View, action: string, touches: NSSet<any>, event: _UIEvent) {
this.action = action;
this.view = view;
this.object = view;
@@ -473,4 +473,4 @@ class TouchGestureEventData implements TouchGestureEventData {
getY(): number {
return this.getMainPointer().locationInView(this.view._nativeView).y
}
}
}

View File

@@ -1,13 +0,0 @@
/* tslint:disable:no-unused-variable */
interface WeakMap<K, V> {
clear(): void;
delete(key: K): boolean;
get(key: K): V;
has(key: K): boolean;
set(key: K, value: V): WeakMap<K, V>;
}
declare var WeakMap: {
new <K, V>(): WeakMap<K, V>;
}

View File

@@ -1,88 +0,0 @@
/**
* Used to create, destroy and communicate with worker threads
*/
declare class Worker {
/**
* Creates a new worker with the given main script.
* @param script The first module to be loaded on the worker thread.
*/
public constructor(script: string);
/**
* Sends message to the worker thread.
* @param message The message to be serialized and sent to the worker thread.
*/
public postMessage(message: any) : void;
/**
* Terminates the execution the worker thread without calling `onclose` handler.
*/
public terminate() : void;
/**
* Called by the runtime when a new message is received by the worker instance.
*/
public onmessage : Worker.OnMessageHandler;
/**
* Called by the runtime when an uncaught error is propagated to the parent thread.
*/
public onerror : Worker.OnErrorHandler;
}
/**
* Exists only in worker context. Returns the worker global object.
*/
declare var self: any;
/**
* Exists only in worker context. It is called by the runtime when a new message is received by the worker thread.
*/
declare var onmessage : Worker.OnMessageHandler;
/**
* Exists only in worker context. Handles uncaught errors in the worker thread. If return false the error is propagated to the parent context and passed to Worker.onerror handler.
*/
declare var onerror : Worker.OnErrorHandler;
/**
* Exists only in worker context. Called before the worker is closed with the close() function.
*/
declare var onclose : Worker.OnCloseHandler;
/**
* Exists only in worker context. Sends message to the parent thread.
*/
declare function postMessage(message: any) : void;
/**
* Exists only in worker context. Closes the worker thread on the next run loop tick.
*/
declare function close() : void;
declare namespace Worker {
interface MessageEvent {
data: any;
}
interface ErrorEvent {
message: string;
filename: string;
lineno: number;
}
interface OnErrorHandler {
(error: ErrorEvent): boolean;
}
interface OnMessageHandler {
(message: MessageEvent): void;
}
interface OnCloseHandler {
(): void;
}
}

View File

@@ -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 ((<any>global).__snapshot) {
_ampCodes = _generateAmpMap();
}

View File

@@ -1,14 +1,14 @@
interface AudioBuffer {
interface _AudioBuffer {
mNumberChannels: number;
mDataByteSize: number;
mData: interop.Pointer | interop.Reference<any>;
}
declare var AudioBuffer: interop.StructType<AudioBuffer>;
declare var _AudioBuffer: interop.StructType<_AudioBuffer>;
interface AudioBufferList {
mNumberBuffers: number;
mBuffers: interop.Reference<AudioBuffer>;
mBuffers: interop.Reference<any /*AudioBuffer*/>;
}
declare var AudioBufferList: interop.StructType<AudioBufferList>;

View File

@@ -1978,9 +1978,9 @@ declare class UIApplication extends UIResponder {
scheduleLocalNotification(notification: UILocalNotification): void;
sendActionToFromForEvent(action: string, target: any, sender: any, event: UIEvent): boolean;
sendActionToFromForEvent(action: string, target: any, sender: any, event: _UIEvent): boolean;
sendEvent(event: UIEvent): void;
sendEvent(event: _UIEvent): void;
setKeepAliveTimeoutHandler(timeout: number, keepAliveHandler: () => void): boolean;
@@ -4009,17 +4009,17 @@ declare class UIControl extends UIView {
addTargetActionForControlEvents(target: any, action: string, controlEvents: UIControlEvents): void;
beginTrackingWithTouchWithEvent(touch: UITouch, event: UIEvent): boolean;
beginTrackingWithTouchWithEvent(touch: UITouch, event: _UIEvent): boolean;
cancelTrackingWithEvent(event: UIEvent): void;
cancelTrackingWithEvent(event: _UIEvent): void;
continueTrackingWithTouchWithEvent(touch: UITouch, event: UIEvent): boolean;
continueTrackingWithTouchWithEvent(touch: UITouch, event: _UIEvent): boolean;
endTrackingWithTouchWithEvent(touch: UITouch, event: UIEvent): void;
endTrackingWithTouchWithEvent(touch: UITouch, event: _UIEvent): void;
removeTargetActionForControlEvents(target: any, action: string, controlEvents: UIControlEvents): void;
sendActionToForEvent(action: string, target: any, event: UIEvent): void;
sendActionToForEvent(action: string, target: any, event: _UIEvent): void;
sendActionsForControlEvents(controlEvents: UIControlEvents): void;
}
@@ -4951,11 +4951,11 @@ declare function UIEdgeInsetsFromString(string: string): UIEdgeInsets;
declare var UIEdgeInsetsZero: UIEdgeInsets;
declare class UIEvent extends NSObject {
declare class _UIEvent extends NSObject {
static alloc(): UIEvent; // inherited from NSObject
static alloc(): _UIEvent; // inherited from NSObject
static new(): UIEvent; // inherited from NSObject
static new(): _UIEvent; // inherited from NSObject
readonly allTouches: NSSet<UITouch>;
@@ -5456,7 +5456,7 @@ declare class UIGestureRecognizer extends NSObject {
ignorePressForEvent(button: UIPress, event: UIPressesEvent): void;
ignoreTouchForEvent(touch: UITouch, event: UIEvent): void;
ignoreTouchForEvent(touch: UITouch, event: _UIEvent): void;
initWithTargetAction(target: any, action: string): this;
@@ -5482,15 +5482,15 @@ declare class UIGestureRecognizer extends NSObject {
shouldRequireFailureOfGestureRecognizer(otherGestureRecognizer: UIGestureRecognizer): boolean;
touchesBeganWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesBeganWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesCancelledWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesCancelledWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesEndedWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesEndedWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesEstimatedPropertiesUpdated(touches: NSSet<UITouch>): void;
touchesMovedWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesMovedWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
}
interface UIGestureRecognizerDelegate extends NSObjectProtocol {
@@ -6266,7 +6266,7 @@ declare class UIInputViewController extends UIViewController implements UITextIn
dismissKeyboard(): void;
handleInputModeListFromViewWithEvent(view: UIView, event: UIEvent): void;
handleInputModeListFromViewWithEvent(view: UIView, event: _UIEvent): void;
isEqual(object: any): boolean;
@@ -8072,7 +8072,7 @@ declare const enum UIPressType {
PlayPause = 6
}
declare class UIPressesEvent extends UIEvent {
declare class UIPressesEvent extends _UIEvent {
static alloc(): UIPressesEvent; // inherited from NSObject
@@ -8845,11 +8845,11 @@ declare class UIResponder extends NSObject implements UIResponderStandardEditAct
makeTextWritingDirectionRightToLeft(sender: any): void;
motionBeganWithEvent(motion: UIEventSubtype, event: UIEvent): void;
motionBeganWithEvent(motion: UIEventSubtype, event: _UIEvent): void;
motionCancelledWithEvent(motion: UIEventSubtype, event: UIEvent): void;
motionCancelledWithEvent(motion: UIEventSubtype, event: _UIEvent): void;
motionEndedWithEvent(motion: UIEventSubtype, event: UIEvent): void;
motionEndedWithEvent(motion: UIEventSubtype, event: _UIEvent): void;
paste(sender: any): void;
@@ -8869,7 +8869,7 @@ declare class UIResponder extends NSObject implements UIResponderStandardEditAct
reloadInputViews(): void;
remoteControlReceivedWithEvent(event: UIEvent): void;
remoteControlReceivedWithEvent(event: _UIEvent): void;
resignFirstResponder(): boolean;
@@ -8893,15 +8893,15 @@ declare class UIResponder extends NSObject implements UIResponderStandardEditAct
toggleUnderline(sender: any): void;
touchesBeganWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesBeganWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesCancelledWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesCancelledWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesEndedWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesEndedWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
touchesEstimatedPropertiesUpdated(touches: NSSet<UITouch>): void;
touchesMovedWithEvent(touches: NSSet<UITouch>, event: UIEvent): void;
touchesMovedWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void;
updateUserActivityState(activity: NSUserActivity): void;
}
@@ -9199,7 +9199,7 @@ declare class UIScrollView extends UIView implements NSCoding {
setZoomScaleAnimated(scale: number, animated: boolean): void;
touchesShouldBeginWithEventInContentView(touches: NSSet<UITouch>, event: UIEvent, view: UIView): boolean;
touchesShouldBeginWithEventInContentView(touches: NSSet<UITouch>, event: _UIEvent, view: UIView): boolean;
touchesShouldCancelInContentView(view: UIView): boolean;
@@ -13113,7 +13113,7 @@ declare class UIView extends UIResponder implements CALayerDelegate, NSCoding, U
gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer): boolean;
hitTestWithEvent(point: CGPoint, event: UIEvent): UIView;
hitTestWithEvent(point: CGPoint, event: _UIEvent): UIView;
initWithCoder(aDecoder: NSCoder): this;
@@ -13153,7 +13153,7 @@ declare class UIView extends UIResponder implements CALayerDelegate, NSCoding, U
performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any;
pointInsideWithEvent(point: CGPoint, event: UIEvent): boolean;
pointInsideWithEvent(point: CGPoint, event: _UIEvent): boolean;
removeConstraint(constraint: NSLayoutConstraint): void;
@@ -14354,7 +14354,7 @@ declare class UIWindow extends UIView {
resignKeyWindow(): void;
sendEvent(event: UIEvent): void;
sendEvent(event: _UIEvent): void;
}
declare var UIWindowDidBecomeHiddenNotification: string;

32
tsconfig.base-dts.json Normal file
View File

@@ -0,0 +1,32 @@
{
"extends": "./tsconfig.shared",
"compilerOptions": {
"noEmit": true
},
"include": [
"tns-core-modules/**/*.d.ts"
],
"exclude": [
"tns-platform-declarations/node_modules/",
"tns-platform-declarations/package/",
"tns-core-modules/node_modules/",
"tns-core-modules/package/",
"tests/node_modules",
"tests/package/",
"tests/platforms",
"apps/node_modules",
"apps/package/",
"apps/platforms",
"node_modules/",
"package/",
"bin",
"build",
"Deploy",
"out",
"obj",
"tns-platform-declarations/references.d.ts",
"tns-core-modules/references.d.ts",
"tns-platform-declarations/ios/objc-x86_64/",
"tns-platform-declarations/android/"
]
}

View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.shared",
"compilerOptions": {
"noEmit": true
},
"include": [
"bin/dist/tns-core-modules/tns-core-modules.d.ts"
]
}

View File

@@ -1,21 +1,5 @@
{
"compilerOptions": {
"noEmitOnError": false,
"noEmitHelpers": true,
"target": "es5",
"module": "commonjs",
"declaration": false,
"noImplicitAny": false,
"noImplicitUseStrict": true,
"experimentalDecorators": true,
"diagnostics": true,
"sourceMap": true,
"jsx": "react",
"reactNamespace": "UIBuilder",
"lib": [
"es2016"
]
},
"extends": "./tsconfig.shared",
"exclude": [
"tns-platform-declarations/node_modules/",
"tns-platform-declarations/package/",
@@ -38,4 +22,4 @@
"tns-core-modules/references.d.ts",
"tns-platform-declarations/ios/objc-x86_64/"
]
}
}

13
tsconfig.node-tests.json Normal file
View File

@@ -0,0 +1,13 @@
{
"extends": "./tsconfig.shared",
"include": [
"tns-core-modules/js-libs/easysax/**/*.ts",
"tns-core-modules/module.d.ts",
"tns-core-modules/lib.core.d.ts",
"tns-core-modules/lib.dom.d.ts",
"tns-core-modules/es-collections.d.ts",
"tns-core-modules/declarations.d.ts",
"tns-core-modules/es6-promise.d.ts",
"node-tests/**/*.ts"
]
}

20
tsconfig.shared.json Normal file
View File

@@ -0,0 +1,20 @@
{
"compilerOptions": {
"noEmitOnError": false,
"noEmitHelpers": true,
"target": "es5",
"module": "commonjs",
"declaration": false,
"noImplicitAny": false,
"noImplicitUseStrict": true,
"removeComments": true,
"experimentalDecorators": true,
"diagnostics": true,
"sourceMap": true,
"jsx": "react",
"reactNamespace": "UIBuilder",
"lib": [
"es6", "dom"
]
}
}