From 5449cfa23810b05cc6a6969654416e0db2fd31e8 Mon Sep 17 00:00:00 2001 From: Martin Bektchiev Date: Wed, 20 Feb 2019 13:58:09 +0200 Subject: [PATCH] fix(docs): Move `NativeScriptError` declaration to a separate file (#6927) It is used by `application.d.ts` and needs to be documented. The reason that it wasn't included in the documentation by now is that `tns-core-modules.d.ts` (which imports `module.d.ts`) defines types which are part of the internal modules and runtimes APIs. As such they are excluded from the generation of API documentation. --- tns-core-modules/application/application-common.ts | 2 +- tns-core-modules/application/application.d.ts | 4 ++-- tns-core-modules/module.d.ts | 11 +---------- tns-core-modules/nativescript-error.d.ts | 9 +++++++++ tns-core-modules/ui/core/view/view.d.ts | 1 - tns-core-modules/ui/page/page.d.ts | 5 ++--- 6 files changed, 15 insertions(+), 17 deletions(-) create mode 100644 tns-core-modules/nativescript-error.d.ts diff --git a/tns-core-modules/application/application-common.ts b/tns-core-modules/application/application-common.ts index 0b877e1e7..b585578fa 100644 --- a/tns-core-modules/application/application-common.ts +++ b/tns-core-modules/application/application-common.ts @@ -39,7 +39,7 @@ import { iOSApplication, LoadAppCSSEventData, UnhandledErrorEventData, - DiscardedErrorEventData + DiscardedErrorEventData, } from "./application"; export { UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData }; diff --git a/tns-core-modules/application/application.d.ts b/tns-core-modules/application/application.d.ts index 582a19786..16d8f2409 100644 --- a/tns-core-modules/application/application.d.ts +++ b/tns-core-modules/application/application.d.ts @@ -2,8 +2,8 @@ * Contains the application abstraction with all related methods. * @module "application" */ /** */ +/// -/// Include global typings import { NavigationEntry, View, Observable, EventData } from "../ui/frame"; /** @@ -607,4 +607,4 @@ export function hasLaunched(): boolean; export interface LoadAppCSSEventData extends EventData { cssFile: string; -} \ No newline at end of file +} diff --git a/tns-core-modules/module.d.ts b/tns-core-modules/module.d.ts index 406efac7c..573831c1b 100644 --- a/tns-core-modules/module.d.ts +++ b/tns-core-modules/module.d.ts @@ -1,3 +1,4 @@ +/// declare var global: NodeJS.Global; interface ModuleResolver { @@ -86,16 +87,6 @@ interface ModuleContext { path: string; } -/** - * 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 diff --git a/tns-core-modules/nativescript-error.d.ts b/tns-core-modules/nativescript-error.d.ts new file mode 100644 index 000000000..0373f06a2 --- /dev/null +++ b/tns-core-modules/nativescript-error.d.ts @@ -0,0 +1,9 @@ +/** + * An extended JavaScript Error which will have the nativeError property initialized in case the error is caused by executing platform-specific code. + */ +declare interface NativeScriptError extends Error { + /** + * Represents the native error object. + */ + nativeError: any; +} diff --git a/tns-core-modules/ui/core/view/view.d.ts b/tns-core-modules/ui/core/view/view.d.ts index 505ff3faf..792a2f174 100644 --- a/tns-core-modules/ui/core/view/view.d.ts +++ b/tns-core-modules/ui/core/view/view.d.ts @@ -2,7 +2,6 @@ * @module "ui/core/view" */ /** */ -/// Include global typings import { ViewBase, Property, InheritedProperty, EventData, Color } from "../view-base"; import { Animation, AnimationDefinition, AnimationPromise } from "../../animation"; import { HorizontalAlignment, VerticalAlignment, Visibility, Length, PercentLength } from "../../styling/style-properties"; diff --git a/tns-core-modules/ui/page/page.d.ts b/tns-core-modules/ui/page/page.d.ts index a9ace3677..109244584 100644 --- a/tns-core-modules/ui/page/page.d.ts +++ b/tns-core-modules/ui/page/page.d.ts @@ -3,7 +3,6 @@ * @module "ui/page" */ /** */ -/// Include global typings import { ShownModallyData } from "../core/view"; import { ContentView, EventData, Property, Color, CssProperty, Style } from "../content-view"; import { Frame } from "../frame"; @@ -106,7 +105,7 @@ export class Page extends ContentView { /** * A basic method signature to hook an event listener (shortcut alias to the addEventListener method). - * @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change"). + * @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change"). * @param callback - Callback function which will be executed when event is raised. * @param thisArg - An optional parameter which will be used as `this` context for callback execution. */ @@ -198,4 +197,4 @@ export const statusBarStyleProperty: CssProperty; /** * Property backing androidStatusBarBackground. */ -export const androidStatusBarBackgroundProperty: CssProperty; \ No newline at end of file +export const androidStatusBarBackgroundProperty: CssProperty;