From 853deb1f46ba82f9feff2c0184e1cdd533c0ff8b Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Tue, 17 Jan 2017 00:41:59 +0000 Subject: [PATCH 001/567] Initial commit of typings for OpenFin API --- openfin/index.d.ts | 1493 ++++++++++++++++++++++++++++++++++++++ openfin/openfin-tests.ts | 718 ++++++++++++++++++ openfin/tsconfig.json | 20 + openfin/tslint.json | 1 + 4 files changed, 2232 insertions(+) create mode 100644 openfin/index.d.ts create mode 100644 openfin/openfin-tests.ts create mode 100644 openfin/tsconfig.json create mode 100644 openfin/tslint.json diff --git a/openfin/index.d.ts b/openfin/index.d.ts new file mode 100644 index 0000000000..2c37e6f9b2 --- /dev/null +++ b/openfin/index.d.ts @@ -0,0 +1,1493 @@ +// Type definitions for OpenFin API 15.0 +// Project: https://openfin.co/ +// Definitions by: Chris Barker +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// based on v6.49.15.18 +// see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean + + +/** + * JavaScript API + * The JavaScript API allows you to create an HTML/JavaScript application that has access to the native windowing environment, can communicate with other applications and has access to sandboxed system-level features. + * + * API Ready + * When using the OpenFin API, it is important to ensure that it has been fully loaded before making any API calls. To verify that the API is in fact ready, be sure to make any API calls either from within the fin.desktop.main() method or explicitly after it has returned. This avoids the situation of trying to access methods that are not yet fully injected. + * + * Overview + * When running within the OpenFin Runtime your web applications have access to the "fin" namespace and all the modules within the API without the need to include additional source files. You can treat the "fin" namespace as you would the "window", "navigator" or "document" objects. + **/ +declare namespace fin { + const desktop: OpenFinDesktop; + + interface OpenFinDesktop { + main(f: () => any): void; + Application: OpenFinApplication; + ExternalApp: OpenFinExternalApplication; + InterApplicationBus: OpenFinInterApplicationBus; + Notification: OpenFinNotification; + System: OpenFinSystem; + Window: OpenFinWindow; + } + + /** + * Application + * An object representing an application.Allows the developer to create, execute, show / close an application as well as listen to application events. + */ + interface OpenFinApplication { + /** + * Creates a new Application. + * An object representing an application. Allows the developer to create, execute, show/close an application as well as listen to application events. + */ + new (options: ApplicationOptions, callback?: (successObj: { httpResponseCode: number }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinApplication; + /** + * Returns an Application object that represents an existing application. + */ + getCurrent(): OpenFinApplication; + /** + * Returns an Application object that represents an existing application. + */ + wrap(uuid: string): OpenFinApplication; + /** + * Returns an instance of the main Window of the application + */ + getWindow(): OpenFinWindow; + /** + * Registers an event listener on the specified event. + */ + addEventListener(type: OpenFinApplicationEventType, listener: (event: ApplicationBaseEvent | TrayIconClickedEvent | WindowEvent | WindowAlertRequestedEvent | WindowAuthRequested | WindowNavigationRejectedEvent | WindowEndLoadEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Closes the application and any child windows created by the application. + */ + close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of wrapped fin.desktop.Windows for each of the applications child windows. + */ + getChildWindows(callback?: (children: OpenFinWindow[]) => any, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of active window groups for all of the application's windows. Each group is represented as an array of wrapped fin.desktop.Windows. + */ + getGroups(callback?: (groups: OpenFinWindow[][]) => any, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the JSON manifest that was used to create the application. Invokes the error callback if the application was not created from a manifest. + */ + getManifest(callback?: (manifest: any) => any, errorCallback?: (reason: string) => void): void; + /** + * Retrieves UUID of the application that launches this application. Invokes the error callback if the application was created from a manifest. + */ + getParentUuid(callback?: (uuid: string) => any, errorCallback?: (reason: string) => void): void; + /** + * Retrieves current configuration of application's shortcuts. + */ + getShortcuts(callback?: (config: ShortCutConfig) => void, errorCallback?: (reason: string) => void): void; + /** + * Determines if the application is currently running. + */ + isRunning(callback?: (running: boolean) => void, errorCallback?: (reason: string) => void): void; + /** + * Passes in custom data that will be relayed to the RVM + */ + registerCustomData(data: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener(type: OpenFinApplicationEventType, previouslyRegisteredListener: (event: ApplicationBaseEvent | TrayIconClickedEvent | WindowEvent | WindowAlertRequestedEvent | WindowAuthRequested | WindowNavigationRejectedEvent | WindowEndLoadEvent) => any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes the applications icon from the tray. + */ + removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Restarts the application. + */ + restart(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Runs the application. When the application is created, run must be called. + */ + run(callback?: (successObj: SuccessObj) => any, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => any): void; + /** + * Tells the rvm to relaunch the main application once upon a complete shutdown + */ + scheduleRestart(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets new shortcut configuration for current application. Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest to be able to change shortcut states. + */ + setShortcuts(config: ShortCutConfig, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Adds a customizable icon in the system tray and notifies the application when clicked. + */ + setTrayIcon(iconUrl: string, listener: (clickInfo: TrayIconClickedEvent) => any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Closes the application by terminating its process. + */ + terminate(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Waits for a hanging application. This method can be called in response to an application "not-responding" to allow the application to continue and to generate another "not-responding" message after a certain period of time. + */ + wait(callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface ShortCutConfig { + /** + * application has a shortcut on the desktop + */ + desktop: boolean; + /** + * application has no shortcut in the start menu + */ + startMenu: boolean; + /** + * application will be launched on system startup + */ + systemStartup: boolean; + } + + interface SuccessObj { + httpResponseCode: number; + } + + interface NetworkErrorInfo extends ErrorInfo { + networkErrorCode: number; + } + + interface ErrorInfo { + stack: string; + message: string; + } + + interface ApplicationOptions { + url: string; + uuid: string; + name: string; + mainWindowOptions: WindowOptions; + } + + interface WindowOptions { + /** + * Enable keyboard shortcuts for devtools and zoom. Default: false for both. + */ + accelerator?: { + devtools?: boolean, + zoom?: boolean + }; + /** + * A flag to always position the window at the top of the window stack. Default: false. + */ + alwaysOnTop?: boolean; + /** + * A flag to automatically show the Window when it is created. Default: false. + */ + autoShow?: boolean; + /** + * A flag to show the context menu when right-clicking on a window. Gives access to the Developer Console for the Window. Default: true + */ + contextMenu?: boolean; + /** + * This defines and applies rounded corners for a frameless window. Default for both width and height: 0. + */ + cornerRounding?: { + width: number; + height: number; + }; + /** + * A field that the user can attach serializable data to to be ferried around with the window options. Default: ''. + */ + customData?: any; + /** + * Specifies that the window will be positioned in the center of the primary monitor when loaded for the first time on a machine. When the window corresponding to that id is loaded again, the position from before the window was closed is used. This option overrides defaultLeft and defaultTop. Default: false. + */ + defaultCentered?: boolean; + /** + * The default height of the window. Specifies the height of the window when loaded for the first time on a machine. When the window corresponding to that id is loaded again, the height is taken to be the last height of the window before it was closed. Default: 500. + */ + defaultHeight?: number; + /** + * The default left position of the window. Specifies the position of the left of the window when loaded for the first time on a machine. When the window corresponding to that id is loaded again, the value of left is taken to be the last value before the window was closed. Default: 100. + */ + defaultWidth?: number; + /** + * The default top position of the window. Specifies the position of the top of the window when loaded for the first time on a machine. When the window corresponding to that id is loaded again, the value of top is taken to be the last value before the window was closed. Default: 100. + */ + defaultTop?: number; + /** + * The default width of the window. Specifies the width of the window when loaded for the first time on a machine. When the window corresponding to that id is loaded again, the width is taken to be the last width of the window before it was closed. Default: 800. + */ + defaultLeft?: number; + /** + * A flag to show the frame. Default: true. + */ + frame?: boolean; + /** + * A flag to allow a window to be hidden when the close button is clicked.Default: false. + */ + hideOnClose?: boolean; + /** + * A URL for the icon to be shown in the window title bar and the taskbar.Default: The parent application's applicationIcon. + */ + icon?: string; + /** + * The maximum height of a window.Will default to the OS defined value if set to - 1. Default: -1. + */ + maxHeight?: number; + /** + * A flag that lets the window be maximized.Default: true. + */ + maximizable?: boolean; + /** + * The maximum width of a window.Will default to the OS defined value if set to - 1. Default: -1. + */ + maxWidth?: number; + /** + * The minimum height of a window.Default: 0. + */ + minHeight?: number; + /** + * A flag that lets the window be minimized.Default: true. + */ + minimizable?: boolean; + /** + * The minimum width of a window.Default: 0. + */ + minWidth?: number; + /** + * The name for the window which must be unique within the context of the invoking Application. + */ + name?: string; + /** + * A flag that specifies how transparent the window will be.This value is clamped between 0.0 and 1.0.Default: 1.0. + */ + opacity?: number; + /** + * A flag to drop to allow the user to resize the window.Default: true. + */ + resizable?: boolean; + /** + * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. + */ + resizeRegion?: { + /** + * The size in pixels (Default: 2), + */ + size: number; + /** + * The size in pixels of an additional + * square resizable region located at the + * bottom right corner of a + * frameless window. (Default: 4) + */ + bottomRightCorner: number; + }; + /** + * A flag to show the Window's icon in the taskbar. Default: true. + */ + showTaskbarIcon?: boolean; + /** + * A flag to cache the location of the window or not. Default: true. + */ + saveWindowState?: boolean; + /** + * Specify a taskbar group for the window. Default: app's uuid. + */ + taskbarIconGroup?: string; + /** + * A string that sets the window to be "minimized", "maximized", or "normal" on creation. Default: "normal". + */ + state?: string; + /** + * The URL of the window. Default: "about:blank". + */ + url?: string; + /** + * When set to false, the window will render before the "load" event is fired on the content's window. Caution, when false you will see an initial empty white window. Default: true. + */ + waitForPageLoad?: boolean; + } + + /** + * Clipboard + * Clipboard API allows reading and writting to the clipboard in multiple formats. + */ + interface OpenFinClipboard { + /** + * Reads available formats for the clipboard type + */ + availableFormats(type: string | null, callback?: (formats: string[]) => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Reads available formats for the clipboard type + */ + readHtml(type: string | null, callback?: (html: string) => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Read the content of the clipboard as Rtf + */ + readRtf(type: string | null, callback?: (rtf: string) => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Read the content of the clipboard as plain text + */ + readText(type: string | null, callback?: (text: string) => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Writes data into the clipboard + */ + write(data: any, type: string | null, callback?: () => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Writes data into the clipboard as Html + */ + writeHtml(data: string, type: string | null, callback?: () => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Writes data into the clipboard as Rtf + */ + writeRtf(data: string, type: string | null, callback?: () => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Writes data into the clipboard as plain text + */ + writeText(data: string, type: string | null, callback?: () => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + } + + /** + * ExternalApplication + * An object representing an application. Allows the developer to create, execute, show and close an application, as well as listen to application events. + */ + interface OpenFinExternalApplication { + /** + * Returns an External Application object that represents an existing external application. + */ + wrap(uuid: string): OpenFinExternalApplication; + /** + * Registers an event listener on the specified event. + */ + addEventListener(type: OpenFinExternalApplicationEventType, listener: () => any, callback?: () => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener(type: OpenFinExternalApplicationEventType, listener: () => any, callback?: () => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + } + + /** + * InterApplicationBus + * A messaging bus that allows for pub/sub messaging between different applications. + */ + interface OpenFinInterApplicationBus { + /** + * Adds a listener that gets called when applications subscribe to the current application's messages. + */ + addSubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Adds a listener that gets called when applications unsubscribe to the current application's messages. + */ + addUnsubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Removes a previously registered subscribe listener. + */ + removeSubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Removes a previously registered unsubscribe listener. + */ + removeUnsubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Publishes a message to all applications running on OpenFin Runtime that are subscribed to the specified topic. + */ + publish(topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sends a message to a specific application on a specific topic. + */ + send(destinationUuid: string, name: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + send(destinationUuid: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Subscribes to messages from the specified application on the specified topic. If the subscription is for a uuid, [name], topic combination that has already been published to upon subscription you will receive the last 20 missed messages in the order they were published. + */ + subscribe(senderUuid: string, name: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + subscribe(senderUuid: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Unsubscribes to messages from the specified application on the specified topic. + */ + unsubscribe(senderUuid: string, name: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + unsubscribe(senderUuid: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + /** + * Notification + * Notification represents a window on OpenFin Runtime which is shown briefly to the user on the bottom-right corner of the primary monitor. A notification is typically used to alert the user of some important event which requires his or her attention. Notifications are a child or your application that are controlled by the runtime. + */ + interface OpenFinNotification { + /** + * + */ + new (options: NotificationOptions, callback?: () => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinNotification; + /** + * Gets an instance of the current notification. For use within a notification window to close the window or send a message back to its parent application. + */ + getCurrent(): OpenFinNotification; + /** + * Closes the notification. + */ + close(callback?: () => void): void; + /** + * Sends a message to the notification. + */ + sendMessage(message: any, callback?: () => void): void; + /** + * Sends a message from the notification to the application that created the notification. The message is handled by the notification's onMessage callback. + */ + sendMessageToApplication(message: any, callback?: () => void): void; + } + + interface NotificationOptions { + /** + * A boolean that will force dismissal even if the mouse is hovering over the notification + */ + ignoreMouseOver?: boolean; + /** + * A message of any primitive or composite-primitive type to be passed to the notification upon creation. + */ + message: any; + /** + * The timeout for displaying a notification.Can be in milliseconds or "never". + */ + duration?: number | "never"; + /** + * The url of the notification + */ + url: string; + /** + * A function that is called when a notification is clicked. + */ + onClick?(callback: () => void): void; + /** + * Invoked when the notification is closed via .close() method on the created notification instance or the by the notification itself via fin.desktop.Notification.getCurrent().close(). NOTE: this is not invoked when the notification is dismissed via a swipe. For the swipe dismissal callback see onDismiss + */ + onClose?(callback: () => void): void; + /** + * Invoked when a the notification is dismissed by swiping it off the screen to the right. NOTE: this is no fired on a programmatic close. + */ + onDismiss?(callback: () => void): void; + /** + * A function that is called when an error occurs.The reason for the error is passed as an argument. + */ + onError?(errorCallback: (reason: string, errorObj: NetworkErrorInfo) => void): void; + /** + * The onMessage function will respond to messages sent from notification.sendMessageToApplication.The function is passed the message, which can be of any primitive or composite-primitive type. + */ + onMessage?(callback: (message: any) => void): void; + /** + * A function that is called when a notification is shown. + */ + onShow?(callback: (successObj: SuccessObj) => void): void; + } + + /** + * System + * An object representing the core of OpenFin Runtime. Allows the developer to perform system-level actions, such as accessing logs, viewing processes, clearing the cache and exiting the runtime. + */ + interface OpenFinSystem { + /** + * + */ + Clipboard: OpenFinClipboard; + /** + * Registers an event listener on the specified event. + */ + addEventListener(type: OpenFinSystemEventType, listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Clears cached data containing window state/positions, application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage. + */ + clearCache(options: CacheOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Clears all cached data when OpenFin Runtime exits. + */ + deleteCacheOnExit(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Downloads the given application asset + */ + downloadAsset(assetObj: AppAssetInfo, progressListener?: (progress: { downloadedBytes: number, totalBytes: number }) => void, callback?: (successObj: { path: string }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): void; + /** + * Exits the Runtime. + */ + exit(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data for all applications. + */ + getAllApplications(callback?: (applicationInfoList: ApplicationInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data for all external applications. + */ + getAllExternalApplications(callback?: (applicationInfoList: ApplicationInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data (name, ids, bounds) for all application windows. + */ + getAllWindows(callback?: (windowInfoList: WindowDetails[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the command line argument string that started OpenFin Runtime. + */ + getCommandLineArguments(callback?: (args: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the configuration object that started the OpenFin Runtime. + */ + getDeviceId(callback?: (uuid: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the value of a given environment variable on the computer on which the runtime is installed. + */ + getEnvironmentVariable(envVar: string, callback?: (variable: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the contents of the log with the specified filename. + */ + getLog(logFileName: string, callback?: (variable: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array containing information for each log file. + */ + getLogList(callback?: (logInfoList: LogInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an object that contains data about the about the monitor setup of the computer that the runtime is running on. + */ + getMonitorInfo(callback?: (monitorInfo: MonitorInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the mouse in virtual screen coordinates (left, top). + */ + getMousePosition(callback?: (mousePosition: VirtualScreenCoordinates) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of all of the runtime processes that are currently running. Each element in the array is an object containing the uuid and the name of the application to which the process belongs. + */ + getProcessList(callback?: (processInfoList: ProcessInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the Proxy settings. + */ + getProxySettings(callback?: (proxy: ProxyInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns information about the running RVM in an object. + */ + getRvmInfo(callback?: (rvmInfo: RvmInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the version of the runtime. The version contains the major, minor, build and revision numbers. + */ + getVersion(callback?: (version: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Runs an executable or batch file. + */ + launchExternalProcess(options: ExternalProcessLaunchInfo, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; + /** + * Writes the passed message into both the log file and the console. + */ + log(level: "debug" | "info" | "warn" | "error", message: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Monitors a running process. + */ + monitorExternalProcess(options: ExternalProcessInfo, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; + /** + * Opens the passed URL in the default web browser. + */ + openUrlWithBrowser(url: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * This function call will register a unique id and produce a token. The token can be used to broker an external connection. + */ + registerExternalConnection(uuid: string, callback?: (detail: { + /** + * this will be unique each time + */ + token: string; + /** + * "remote-connection-uuid" + */ + uuid: string; + }) => void, errorCallback?: (reason: string) => void): void; + /** + * Removes the process entry for the passed UUID obtained from a prior call of fin.desktop.System.launchExternalProcess(). + */ + releaseExternalProcess(processUuid: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener(type: OpenFinSystemEventType, listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the Chrome Developer Tools for the specified window. + */ + showDeveloperTools(uuid: string, name: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Attempt to close an external process. The process will be terminated if it has not closed after the elapsed timeout in milliseconds. + */ + terminateExternalProcess(processUuid: string, timeout: number, killTree: boolean, callback?: (info: { result: "clean" | "terminated" | "failed" }) => void, errorCallback?: (reason: string) => void): void; + terminateExternalProcess(processUuid: string, timeout: number, callback?: (info: { result: "clean" | "terminated" | "failed" }) => void, errorCallback?: (reason: string) => void): void; + /** + * Update the OpenFin Runtime Proxy settings. + */ + updateProxySettings(type: string, address: string, port: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + + } + + interface CacheOptions { + cache?: boolean; + cookies?: boolean; + localStorage?: boolean; + appcache?: boolean; + userData?: boolean; + } + + interface AppAssetInfo { + 'src': string; + 'alias': string; + 'version': string; + 'target': string; + 'args': string; + } + + interface ApplicationInfo { + /** + * true when the application is running. + */ + isRunning: boolean; + /** + * uuid of the application. + */ + uuid: string; + /** + * uuid of the application that launches this application. + */ + parentUuid: string; + } + + interface WindowDetails { + uuid: string; + mainWindow: WindowInfo; + childWindows: WindowInfo[]; + } + + interface WindowInfo { + /** + * name of the child window + */ + name: string; + /** + * top-most coordinate of the child window + */ + top: number; + /** + * right-most coordinate of the child window + */ + right: number; + /** + * bottom-most coordinate of the child window + */ + bottom: number; + /** + * left-most coordinate of the child window + */ + left: number; + } + + interface LogInfo { + /** + * the filename of the log + */ + name: string; + /** + * the size of the log in bytes + */ + size: number; + /** + * the unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)" + */ + date: string; + } + + interface ProcessInfo { + /** + * the percentage of total CPU usage + */ + cpuUsage?: number; + /** + * the application name + */ + name?: string; + /** + * the current nonpaged pool usage in bytes + */ + nonPagedPoolUsage?: number; + /** + * the number of page faults + */ + pageFaultCount?: number; + /** + * the current paged pool usage in bytes + */ + pagedPoolUsage?: number; + /** + * the total amount of memory in bytes that the memory manager has committed + */ + pagefileUsage?: number; + /** + * the peak nonpaged pool usage in bytes + */ + peakNonPagedPoolUsage?: number; + /** + * the peak paged pool usage in bytes + */ + peakPagedPoolUsage?: number; + /** + * the peak value in bytes of pagefileUsage during the lifetime of this process + */ + peakPagefileUsage?: number; + /** + * the peak working set size in bytes + */ + peakWorkingSetSize?: number; + /** + * the native process identifier + */ + processId?: number; + /** + * the application UUID + */ + uuid?: string; + /** + * the current working set size (both shared and private data) in bytes + */ + workingSetSize?: number; + } + + interface ProxyInfo { + /** + * the configured Proxy Address + */ + proxyAddress: string; + /** + * the configured Proxy port + */ + proxyPort: number; + /** + * Proxy Type + */ + type: string; + } + + interface RvmInfo { + version: string; + "start-time": string; + } + + interface ExternalProcessLaunchInfo { + path?: string; + /** + * Additionally note that the executable found in the zip file specified in appAssets + * will default to the one mentioned by appAssets.target + * If the the path below refers to a specific path it will override this default + */ + alias?: string; + /** + * When using alias; if no arguments are passed then the arguments (if any) + * are taken from the 'app.json' file, from the 'args' parameter + * of the 'appAssets' Object with the relevant 'alias'. + * If 'arguments' is passed as a parameter it takes precedence + * over any 'args' set in the 'app.json'. + */ + arguments?: string; + listener?: (result: { + /** + * "Exited" Or "released" on a call to releaseExternalProcess + */ + topic: string; + /** + * The mapped UUID which identifies the launched process + */ + uuid: string; + /* + * Process exit code + */ + exitCode: number; + }) => void; + certificate?: CertificationInfo; + } + + interface CertificationInfo { + /** + * A hex string with or without spaces + */ + serial?: string; + /** + * An internally tokenized and comma delimited string allowing partial or full checks of the subject fields + */ + subject: string; + /** + * A hex string with or without spaces + */ + publickey?: string; + /** + * A hex string with or without spaces + */ + thumbprint: string; + /** + * A boolean indicating that the certificate is trusted and not revoked + */ + trusted: boolean; + } + + interface ExternalProcessInfo { + pid: number; + listener?: (result: { + /** + * "Exited" Or "released" on a call to releaseExternalProcess + */ + topic: string; + /** + * The mapped UUID which identifies the launched process + */ + uuid: string; + /* + * Process exit code + */ + exitCode: number; + }) => void; + } + + /** + * Window + * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. The new window appears in the same process as the parent window. + */ + interface OpenFinWindow { + /** + * Class: Window + * + * new Window(options, callbackopt, errorCallbackopt) + * + * Creates a new OpenFin Window + * + * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. The new window appears in the same process as the parent window. + * @param {any} options - The options of the window + * @param {Function} [callback] - Called if the window creation was successful + * @param {number} [callback.successObj] - httpResponseCode + */ + new (options: WindowOptions, callback?: (successObj: { httpResponseCode: number }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinWindow; + /** + * Name of window + */ + name: string; + /** + * Returns an instance of the current window. + * @returns {OpenFinWindow} Current window + */ + getCurrent(): OpenFinWindow; + /** + * Returns the native JavaScript "window" object for the window. This method can only be used by the parent application or the window itself, otherwise it will return undefined. The same Single-Origin-Policy (SOP) rules apply for child windows created by window.open(url) in that the contents of the window object are only accessible if the URL has the same origin as the invoking window. See example below. Also, will not work with fin.desktop.Window objects created with fin.desktop.Window.wrap(). + * @returns {Window} Native window + */ + getNativeWindow(): Window; + /** + * Gets the parent application. + * @returns {OpenFinApplication} Parent application + */ + getParentApplication(): OpenFinApplication; + /** + * Gets the parent window. + */ + getParentWindow(): OpenFinWindow; + /** + * Returns a Window object that wraps an existing window. + */ + wrap(appUuid: string, windowName: string): OpenFinWindow; + /** + * Registers an event listener on the specified event. + */ + addEventListener(type: OpenFinWindowEventType, listener: (event: WindowBaseEvent | WindowAuthRequestedEvent | WindowBoundsEvent | WindowExternalProcessStartedEvent | WindowExternalProcessExited | WindowGroupChangedEvent | WindowHiddenEvent | Window_NavigationRejectedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Performs the specified window transitions + */ + animate(transitions: AnimationTransition, options: AnimationOptions, callback?: (event: any) => void, errorCallback?: (reason: string) => void): void; + /** + * Provides credentials to authentication requests + */ + authenticate(userName: string, password: string, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Removes focus from the window. + */ + blur(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Brings the window to the front of the OpenFin window stack. + */ + bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Closes the window. + * @param {force} Close will be prevented from closing when force is false and close-requested has been subscribed to for applications main window. + */ + close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Prevents a user from changing a window's size/position when using the window's frame. + * 'disabled-frame-bounds-changing' is generated at the start of and during a user move/size operation. + * 'disabled-frame-bounds-changed' is generated after a user move/size operation. + * The events provide the bounds that would have been applied if the frame was enabled. + * 'frame-disabled' is generated when an enabled frame becomes disabled. + */ + disableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Re-enables user changes to a window's size/position when using the window's frame. + * 'disabled-frame-bounds-changing' is generated at the start of and during a user move/size operation. + * 'disabled-frame-bounds-changed' is generated after a user move/size operation. + * The events provide the bounds that would have been applied if the frame was enabled. + * 'frame-enabled' is generated when a disabled frame has becomes enabled. + */ + enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Flashes the windows frame and taskbar icon until the window is activated. + */ + flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Gives focus to the window. + */ + focus(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current bounds (top, left, width, height) of the window. + */ + getBounds(callback?: (bounds: WindowBounds) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned. Please note that calling window is included in the result array. + */ + getGroup(callback?: (group: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current settings of the window. + */ + getOptions(callback?: (options: WindowOptions) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets a base64 encoded PNG snapshot of the window. + */ + getSnapshot(callback?: (base64Snapshot: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current state ("minimized", "maximized", or "restored") of the window. + */ + getState(callback?: (state: "minimized" | "maximized" | "restored") => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the zoom level of the window. + */ + getZoomLevel(callback?: (level: number) => void, errorCallback?: (reason: string) => void): void; + /** + * Hides the window. + */ + hide(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Determines if the window is currently showing. + */ + isShowing(callback?: (showing: boolean) => void, errorCallback?: (reason: string) => void): void; + /** + * Joins the same window group as the specified window. + */ + joinGroup(target: OpenFinWindow, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Leaves the current window group so that the window can be move independently of those in the group. + */ + leaveGroup(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Maximizes the window. + */ + maximize(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Merges the instance's window group with the same window group as the specified window + */ + mergeGroups(target: OpenFinWindow, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Minimizes the window. + */ + minimize(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Moves the window by a specified amount. + */ + moveBy(deltaLeft: number, deltaTop: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Moves the window to a specified location. + */ + moveTo(left: number, top: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener(type: OpenFinWindowEventType, listener: (event: WindowBaseEvent | WindowAuthRequestedEvent | WindowBoundsEvent | WindowExternalProcessStartedEvent | WindowExternalProcessExited | WindowGroupChangedEvent | WindowHiddenEvent | Window_NavigationRejectedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Resizes the window by a specified amount. + */ + resizeBy(deltaWidth: number, deltaHeight: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Resizes the window by a specified amount. + */ + resizeTo(width: number, height: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Restores the window to its normal state (i.e., unminimized, unmaximized). + */ + restore(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Will bring the window to the front of the entire stack and give it focus. + */ + setAsForeground(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets the window's size and position + */ + setBounds(left: number, top: number, width: number, height: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets the zoom level of the window. + */ + setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the window if it is hidden. + * @param {force} Show will be prevented from closing when force is false and show-requested has been subscribed to for applications main window. + */ + show(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the window if it is hidden at the specified location. If the toggle parameter is set to true, the window will alternate between showing and hiding. + */ + showAt(left: number, top: number, force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Stops the taskbar icon from flashing. + */ + stopFlashing(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Updates the window using the passed options + */ + updateOptions(options: WindowOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface ApplicationBaseEvent { + topic: string; + type: OpenFinApplicationEventType; + uuid: string; + } + + interface TrayIconClickedEvent extends ApplicationBaseEvent { + button: number; // 0 for left, 1 for middle, 2 for right + monitorInfo: MonitorInfo; + x: number; // the cursor x coordinate + y: number; // the cursor y coordinate + } + + interface WindowEvent extends ApplicationBaseEvent { + name: string; + } + + interface WindowAlertRequestedEvent extends WindowEvent { + message: string; + url: string; + } + + interface WindowAuthRequested extends WindowEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; + } + + interface WindowNavigationRejectedEvent extends WindowEvent { + sourceName: string; + url: string; + } + + interface WindowEndLoadEvent extends WindowEvent { + documentName: string; + isMain: boolean; + } + + interface MonitorInfoChangedEvent extends MonitorInfo { + topic: "system"; + type: "monitor-info-changed"; + } + + interface MonitorInfo { + nonPrimaryMonitors: MonitorInfoDetail[]; + primaryMonitor: MonitorInfoDetail; + reason: string; + taskbar: { + edge: "left" | "right" | "top" | "bottom", + rect: MontiorCoordinates + }; + topic: "system"; + type: "monitor-info-changed"; + virtualScreen: MontiorCoordinates; + } + + interface MonitorInfoDetail { + availableRect: MontiorCoordinates; + deviceId: string; + displayDeviceActive: boolean; + monitorRect: MontiorCoordinates; + name: string; + } + + interface MontiorCoordinates { + bottom: number; + left: number; + right: number; + top: number; + } + + interface VirtualScreenCoordinates { + left: number; + top: number; + } + + interface SystemBaseEvent { + topic: string; + type: OpenFinSystemEventType; + uuid: string; + } + + interface DesktopIconClickedEvent { + mouse: { + /** + * the left virtual screen coordinate of the mouse + */ + left: number, + /** + * the top virtual screen coordinate of the mouse + */ + top: number + }; + /** + * the number of milliseconds that have elapsed since the system was started, + */ + tickCount: number; + topic: "system"; + type: "desktop-icon-clicked"; + } + + interface IdleStateChangedEvent { + /** + * How long in milliseconds since the user has been idle. + */ + elapsedTime: number; + /** + * true when the user is idle,false when the user has returned; + */ + isIdle: boolean; + topic: "system"; + type: "idle-state-changed"; + } + + interface WindowBaseEvent { + /** + * the name of the window + */ + name: string; + /** + * always window + */ + topic: "window"; + /** + * window event type + */ + type: OpenFinWindowEventType; + /** + * the UUID of the application the window belongs to + */ + uuid: string; + } + + interface WindowAuthRequestedEvent extends WindowBaseEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; + } + + interface WindowBoundsEvent extends WindowBaseEvent { + /** + * describes what kind of change occurred. + * 0 means a change in position. + * 1 means a change in size. + * 2 means a change in position and size. + */ + changeType: number; + /** + * true when pending changes have been applied to the window. + */ + deferred: boolean; + /** + * the new height of the window. + */ + height: number; + /** + * the left-most coordinate of the window. + */ + left: number; + /** + * the top-most coordinate of the window. + */ + top: number; + /** + * + */ + type: "bounds-changed" | "bounds-changing" | "disabled-frame-bounds-changed" | "disabled-frame-bounds-changing"; + /** + * the new width of the window. + */ + width: number; + } + + interface WindowExternalProcessStartedEvent extends WindowBaseEvent { + /** + * the process handle uuid + */ + processUuid: string; + type: "external-process-started"; + } + + interface WindowExternalProcessExited extends WindowBaseEvent { + /** + * the process exit code + */ + exitCode: number; + /** + * the process handle uuid + */ + processUuid: string; + type: "external-process-exited"; + } + + interface WindowGroupChangedEvent extends WindowBaseEvent { + /** + * Which group array the window that the event listener was registered on is included in: + * 'source' The window is included in sourceGroup. + * 'target' The window is included in targetGroup. + * 'nothing' The window is not included in sourceGroup nor targetGroup. + */ + memberOf: "source" | "target" | "nothing"; + /** + * The reason this event was triggered. + * 'leave' A window has left the group due to a leave or merge with group. + * 'join' A window has joined the group. + * 'merge' Two groups have been merged together. + * 'disband' There are no other windows in the group. + */ + reason: "leave" | "join" | "merge" | "disband"; + /** + * All the windows in the group the sourceWindow originated from. + */ + sourceGroup: WindowOfGroupInfo[]; + /** + * The UUID of the application the sourceWindow belongs to The source window is the window in which (merge/join/leave)group(s) was called. + */ + sourceWindowAppUuid: string; + /** + * the name of the sourcewindow.The source window is the window in which(merge / join / leave) group(s) was called. + */ + sourceWindowName: string; + /** + * All the windows in the group the targetWindow orginated from + */ + targetGroup: WindowOfGroupInfo[]; + /** + * The UUID of the application the targetWindow belongs to. The target window is the window that was passed into (merge/join) group(s). + */ + targetWindowAppUuid: string; + /** + * The name of the targetWindow. The target window is the window that was passed into (merge/join) group(s). + */ + targetWindowName: string; + type: "group-changed"; + } + + interface WindowOfGroupInfo { + /** + * The UUID of the application this window entry belongs to. + */ + appUuid: string; + /** + * The name of this window entry. + */ + windowName: string; + } + + interface WindowHiddenEvent extends WindowBaseEvent { + /** + * What action prompted the close. + * The reasons are: "hide", "hide-on-close" + */ + reason: "hide" | "hide-on-close"; + type: "hidden"; + } + + interface Window_NavigationRejectedEvent { + name: string; + /** + * source of navigation window name + */ + sourceName: string; + topic: "navigation-rejected"; + /** + * Url that was not reached "http://blocked-content.url" + */ + url: string; + /** + * the UUID of the application the window belongs to. + */ + uuid: string; + } + + interface AnimationTransition { + opacity?: { + /** + * This value is clamped from 0.0 to 1.0 + */ + opacity: number; + /** + * The total time in milliseconds this transition should take. + */ + duration: number; + /** + * Treat 'opacity' as absolute or as a delta. Defaults to false. + */ + relative?: boolean; + }; + position?: { + /** + * Defaults to the window's current left position in virtual screen coordinates. + */ + left?: number; + /** + * Defaults to the window's current top position in virtual screen coordinates. + */ + top?: number; + /** + * The total time in milliseconds this transition should take. + */ + duration: number; + /** + * Treat 'left' and 'top' as absolute or as deltas. Defaults to false. + */ + relative?: boolean; + }; + size?: { + /** + * Optional if height is present. Defaults to the window's current width. + */ + width?: number; + /** + * Optional if width is present. Defaults to the window's current height. + */ + height?: number; + /** + * The total time in milliseconds this transition should take. + */ + duration: number; + /** + * Treat 'width' and 'height' as absolute or as deltas. Defaults to false. + */ + relative?: boolean; + }; + } + + interface AnimationOptions { + /** + * This option interrupts the current animation. When false it pushes this animation onto the end of the animation queue. + */ + interrupt?: boolean; + /** + * Transition effect. Defaults to 'ease-in-out'. + */ + tween?: OpenFinTweenType; + } + + interface WindowBounds { + /** + * the height of the window. + */ + height: number; + /** + * left-most coordinate of the window. + */ + left: number; + /** + * top-most coordinate of the window. + */ + top: number; + /** + * the width of the window. + */ + width: number; + } + + interface SessionChangedEvent { + /** + * the action that triggered this event: + */ + reason: "lock" + | "unlock" + | "remote-connect" + | "remote-disconnect" + | "unknown"; + topic: "system"; + type: "session-changed"; + } + + type OpenFinTweenType = "linear" + | "ease-in" + | "ease-out" + | "ease-in-out" + | "ease-in-quad" + | "ease-out-quad" + | "ease-in-out-quad" + | "ease-in-cubic" + | "ease-out-cubic" + | "ease-in-out-cubic" + | "ease-out-bounce" + | "ease-in-back" + | "ease-out-back" + | "ease-in-out-back" + | "ease-in-elastic" + | "ease-out-elastic" + | "ease-in-out-elastic"; + + type OpenFinApplicationEventType = "closed" + | "connected" + | "crashed" + | "initialized" + | "manifest-changed" + | "not-responding" + | "out-of-memory" + | "responding" + | "run-requested" + | "started" + | "tray-icon-clicked" + | "window-alert-requested" + | "window-auth-requested" + | "window-closed" + | "window-created" + | "window-end-load" + | "window-navigation-rejected" + | "window-show-requested" + | "window-start-load"; + + type OpenFinExternalApplicationEventType = "connected" + | "disconnected"; + + type OpenFinSystemEventType = "application-closed" + | "application-crashed" + | "application-created" + | "application-started" + | "desktop-icon-clicked" + | "idle-state-changed" + | "monitor-info-changed" + | "session-changed"; + + type OpenFinWindowEventType = "auth-requested" + | "blurred" + | "bounds-changed" + | "bounds-changing" + | "close-requested" + | "closed" + | "disabled-frame-bounds-changed" + | "disabled-frame-bounds-changing" + | "embedded" + | "external-process-exited" + | "external-process-started" + | "focused" + | "frame-disabled" + | "frame-enabled" + | "group-changed" + | "hidden" + | "initialized" + | "maximized" + | "minimized" + | "navigation-rejected" + | "restored" + | "show-requested" + | "shown"; + + type OpenFinAnchor = "top-left" + | "top-right" + | "bottom-left" + | "bottom-right"; +} \ No newline at end of file diff --git a/openfin/openfin-tests.ts b/openfin/openfin-tests.ts new file mode 100644 index 0000000000..7aa2930089 --- /dev/null +++ b/openfin/openfin-tests.ts @@ -0,0 +1,718 @@ + +function test_application() { + let application: fin.OpenFinApplication; + // constructor + application = new fin.desktop.Application({ + url: "application.html", + uuid: "74BED629-2D8E-4141-8582-73E364BDFA74", + name: "Application Name", + mainWindowOptions: { + defaultHeight: 600, + defaultWidth: 800, + defaultTop: 300, + defaultLeft: 300, + autoShow: true + } + }, function (successObj) { + console.log("Application successfully created, HTTP response code:", successObj); + application.run(); + }, function (error) { + console.log("Error creating application:", error); + }); + // getCurrent + application = fin.desktop.Application.getCurrent(); + // wrap + application = fin.desktop.Application.wrap("454C7F31-A915-4EA2-83F2-CFA655453C52"); + // getWindow + application.getWindow(); + // addEventListener + application.addEventListener("closed", function (event) { + console.log("The application has closed"); + }, function () { + console.log("The registration was successful"); + }, function (reason) { + console.log("failure: " + reason); + }); + // close + application.close(); + // getChildWindows + application.getChildWindows(function (children) { + children.forEach(function (childWindow) { + console.log("Showing child: " + childWindow.name); + childWindow.show(); + }); + }); + // getGroups + application.getGroups(function (allGroups) { + console.log("There are a total of " + allGroups.length + " groups."); + + var groupCounter = 1; + allGroups.forEach(function (windowGroup) { + console.log("Group " + groupCounter + " contains " + + windowGroup.length + " windows."); + ++groupCounter; + }); + }); + // getManifest + application.getManifest(function (manifest) { + console.log("Application manifest:"); + console.log(manifest); + }); + // getParentUuid + application.getParentUuid(function (parentUuid) { + console.log("UUID of parent application:"); + console.log(parentUuid); + }); + // getShortcuts + application.getShortcuts(function (config) { + console.log("Desktop shortcut is enabled: ", config.desktop); + console.log("Start Menu shortcut is enabled: ", config.startMenu); + console.log("System Startup shortcut is enabled: ", config.systemStartup); + }); + // isRunning + application.isRunning(function (running) { + console.log("the application is", running ? "running" : "not running"); + }); + // registerCustomData + application.registerCustomData({ + someData: "this is custom" + }, function () { + console.log("You will not read this."); + }, function (err) { + console.log("failure:", err); + }); + // removeEventListener + let previousCallback = function (event: fin.WindowEvent) { }; + application.removeEventListener("closed", previousCallback, function () { + console.log("The unregistration was successful"); + }, function (err) { + console.log("failure:", err); + }); + // removeTrayIcon + application.removeTrayIcon(function () { + console.log("Removed the tray icon."); + }, function (err) { + console.log("failure:", err); + }); + // restart + application.restart(function () { + console.log("You will not read this."); + }, function (err) { + console.log("failure:", err); + }); + // schedule restart + application.scheduleRestart(function () { + console.log("You will not read this."); + }, function (err) { + console.log("failure:", err); + }); + // setShortcuts + application.setShortcuts({ + desktop: true, + startMenu: false, + systemStartup: true + }, function () { + console.log("Successfully set new shortcut states"); + }, function (error) { + console.log("Failed to set new shortcut states. Error: ", error); + }); + // setTrayIcon + application.setTrayIcon("https://developer.openf.in/download/openfin.png", function (clickInfo) { + console.log("The mouse has clicked at (" + clickInfo.x + "," + clickInfo.y + ")"); + }); + // terminate + application.terminate(); + // wait + application.addEventListener("not-responding", function () { + console.log("waiting for hung application"); + application.wait(); + }); +} + +function test_external_application() { + let externalApp: fin.OpenFinExternalApplication; + // wrap + externalApp = fin.desktop.ExternalApp.wrap('my-uuid'); + // addEventListener + externalApp.addEventListener('connected', () => { + console.log('external app connected'); + }, () => { + console.log('The registration was successful'); + }, (reason, err) => { + console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`); + }); + // removeEventListener + let previousCallback = function () { }; + externalApp.removeEventListener('connected', previousCallback, () => { + console.log('The unregistration was successful'); + }, (reason, err) => { + console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`); + }); +} + +function test_inter_application_bus() { + // addSubscribeListener + fin.desktop.InterApplicationBus.addSubscribeListener(function (uuid, topic, name) { + console.log("The application " + uuid + " has subscribed to " + topic); + }); + // addUnsubscribeListener + fin.desktop.InterApplicationBus.addUnsubscribeListener(function (uuid, topic, name) { + console.log("The application " + uuid + " has unsubscribed to " + topic); + }); + // removeSubscribeListener + let aRegisteredListener = function (uuid: string, topic: string, name: string) { }; + fin.desktop.InterApplicationBus.removeSubscribeListener(aRegisteredListener); + // removeUnsubscribeListener + fin.desktop.InterApplicationBus.removeUnsubscribeListener(aRegisteredListener); + // publish + fin.desktop.InterApplicationBus.publish("a topic", { + field1: "value1", + field2: "value2" + }); + // send + fin.desktop.InterApplicationBus.send("an application's uuid", "a topic", { + field1: "value1", + field2: "value2" + }); + // subscribe + fin.desktop.InterApplicationBus.subscribe("*", "a topic", function (message, uuid, name) { + console.log("The application " + uuid + " sent this message: " + message); + }); + // unsubscribe + let aRegisteredMessageListener = function (message: any, senderUuid: string) { + console.log(message, senderUuid); + }; + fin.desktop.InterApplicationBus.unsubscribe("*", "a topic", aRegisteredMessageListener); +} + +function test_notification() { + let notification: fin.OpenFinNotification; + // getCurrent + notification = fin.desktop.Notification.getCurrent(); + // close + notification.close(); + // sendMessage + notification = new fin.desktop.Notification({ + duration: 10, + url: "http://localhost:5000/Account/Register", + message: "Hello", + onShow: () => { }, + //onClose: () => { }, + onDismiss: () => { }, + //onClick: () => { }, + onMessage: () => { }, + onError: () => { } + }); + // sendMessageToApplication + notification.sendMessageToApplication("some message"); +} + +function test_system() { + // addEventListener + fin.desktop.System.addEventListener('monitor-info-changed', function (event) { + console.log("The monitor information has changed to: ", event); + }, function () { + console.log("The registration was successful"); + }, function (err) { + console.log("failure: " + err); + }); + // clearCache + fin.desktop.System.clearCache({ + cache: true, + cookies: true, + localStorage: true, + appcache: true, + userData: true + }); + // deleteCacheOnExit + fin.desktop.System.deleteCacheOnExit(function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // downloadAsset + let dirAppAsset = { + 'src': 'http://local:8000/dir.zip', + 'alias': 'dirApp', + 'version': '1.23.24', + 'target': 'dir.bat', + 'args': '' + }; + fin.desktop.System.downloadAsset(dirAppAsset, progress => { + let downloadedPercent = Math.floor((progress.downloadedBytes / progress.totalBytes) * 100); + console.log(`Downloaded ${downloadedPercent}%`); + }, p => { + console.log(`Downlod complete, can be found on ${p.path}`); + //lets launch our application asset. + //launchDirApp(); + }, (reason, err) => { + console.log(reason, err); + }); + // exit + fin.desktop.System.exit(function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // getAllApplications + fin.desktop.System.getAllApplications(function (applicationInfoList) { + applicationInfoList.forEach(function (applicationInfo) { + console.log("Showing information for application with uuid: " + + applicationInfo.uuid); + console.log("isRunning: ", applicationInfo.isRunning); + }); + }); + // getAllExternalApplications + fin.desktop.System.getAllExternalApplications(externalAppsInfoList => { + externalAppsInfoList.forEach(appInfo => { + console.log(`External app connected to the runtime with UUID ${appInfo.uuid}`); + }); + }); + // getAllWindows + fin.desktop.System.getAllWindows(function (windowInfoList) { + windowInfoList.forEach(function (windowInfo) { + console.log("Showing information for application with uuid: ", windowInfo.uuid); + console.log("Main window: ", windowInfo.mainWindow); + console.log("Child windows: ", windowInfo.childWindows); + }); + }); + // getCommandLineArguments + fin.desktop.System.getCommandLineArguments(function (args) { + console.log("The command line arguments are " + args); + }); + // getDeviceId + fin.desktop.System.getDeviceId(function (id) { + console.log("The id of the device is: " + id); + }); + // getEnvironmentVariable + fin.desktop.System.getEnvironmentVariable("APPDATA", function (variable) { + console.log("this is the APPDATA value", variable); + }); + // getLog + fin.desktop.System.getLog('debug-2015-01-08-22-27-53.log', function (log) { + console.log(log); + }); + // getLogList + fin.desktop.System.getLogList(function (logList) { + logList.forEach(function (logInfo) { + console.log("The filename of the log is " + + logInfo.name + ", the size is " + + logInfo.size + ", and the date of creation is " + + logInfo.date); + }); + }); + // getMonitorInfo + fin.desktop.System.getMonitorInfo(function (monitorInfo) { + console.log("This object contains information about all monitors: ", monitorInfo); + }); + // getMousePosition + fin.desktop.System.getMousePosition(function (mousePosition) { + console.log("The mouse is located at left: " + mousePosition.left + ", top: " + mousePosition.top); + }); + // getProcessList + fin.desktop.System.getProcessList(function (list) { + list.forEach(function (process) { + console.log("UUID: " + process.uuid + ", Application Name: " + process.name); + }); + }); + // getProxySettings + fin.desktop.System.getProxySettings(function (proxy) { + console.log(proxy); + }); + // getRvmInfo + fin.desktop.System.getRvmInfo(function (rvmInfoObject) { + console.log("RVM version:", rvmInfoObject.version); + console.log("RVM has been running since:", rvmInfoObject["start-time"]); + }, function (err) { + console.log("Failed to get rvm info, error message:", err); + }); + // getVersion + fin.desktop.System.getVersion(function (version) { + console.log("The version is " + version); + }); + // launchExternalProcess + fin.desktop.System.launchExternalProcess({ + path: "notepad", + arguments: "", + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // + fin.desktop.System.launchExternalProcess({ + //Additionally note that the executable found in the zip file specified in appAssets + //will default to the one mentioned by appAssets.target + //If the the path below refers to a specific path it will override this default + alias: "myApp", + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // + fin.desktop.System.launchExternalProcess({ + alias: "myApp", + arguments: "e f g", + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // + fin.desktop.System.launchExternalProcess({ + path: "C:\Users\ExampleUser\AppData\Local\OpenFin\OpenFinRVM.exe", + arguments: "--version", + certificate: { + trusted: true, + subject: 'O=OpenFin INC., L=New York, S=NY, C=US', + thumbprint: '‎3c a5 28 19 83 05 fe 69 88 e6 8f 4b 3a af c5 c5 1b 07 80 5b' + }, + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // log + fin.desktop.System.log("info", "An example log message", function () { + console.log("message successfully logged"); + }, function (err) { + console.log(err); + }); + // monitorExternalProcess + fin.desktop.System.monitorExternalProcess({ + pid: 2508, + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log("The process is now being monitored: ", payload.uuid); + }, function (error) { + console.log("Error:", error); + }); + // openUrlWithBrowser + fin.desktop.System.openUrlWithBrowser("https://developer.openf.in/", function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // registerExternalConnection + fin.desktop.System.registerExternalConnection("remote-connection-uuid", function () { + console.log(arguments); + }); + // releaseExternalProcess + fin.desktop.System.launchExternalProcess({ + path: "notepad", + arguments: "", + listener: function (result) { + console.log("The exit code", result.exitCode); + } + }, function (result) { + console.log("Result UUID is " + result.uuid); + + //release it. + fin.desktop.System.releaseExternalProcess(result.uuid, function () { + console.log("Process has been unmapped!"); + }, function (reason) { + console.log("failure: " + reason); + }); + }); + // removeEventListener + let aRegisteredListener = (event: fin.SystemBaseEvent) => { }; + fin.desktop.System.removeEventListener("monitor-info-changed", aRegisteredListener, function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // showDeveloperTools + fin.desktop.System.showDeveloperTools("uuid", "name", function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // terminateExternalProcess + fin.desktop.System.launchExternalProcess({ + // notepad is in the system’s PATH + path: "notepad", + arguments: "", + listener: function (result) { + console.log("The exit code", result.exitCode); + } + }, function (result) { + console.log("Result UUID is " + result.uuid); + + // Attempt to close the process. Terminate after 4 seconds if it + // has not done so. + fin.desktop.System.terminateExternalProcess(result.uuid, 4000, function (info) { + console.log("Termination result " + info.result); + }, function (reason) { + console.log("failure: " + reason); + }); + }); + // updateProxySettings + fin.desktop.System.updateProxySettings("type", "proxyAddress", 8080, function () { + console.log('success'); + }, function (err) { + console.log(err); + }); +} + +function test_system_clipboard() { + // availableFormats + fin.desktop.System.Clipboard.availableFormats(null, formats => { + formats.forEach(format => console.log(`The format ${format} is available to read`)); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // readHtml + fin.desktop.System.Clipboard.readHtml(null, html => { + console.log(`This is the html from the clipboard: ${html}`); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // readRtf + fin.desktop.System.Clipboard.readRtf(null, rtf => { + console.log(`This is the rtf from the clipboard: ${rtf}`); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // readText + fin.desktop.System.Clipboard.readText(null, text => { + console.log(`This is the text from the clipboard: ${text}`); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // write + fin.desktop.System.Clipboard.write({ + text: 'Hello Text!', + html: '

Hello Html

', + rtf: 'Hello Rtf' + }, null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // writeHtml + fin.desktop.System.Clipboard.writeHtml('

Hello World

', null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // writeRtf + fin.desktop.System.Clipboard.writeRtf('Hello World!', null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // writeText + fin.desktop.System.Clipboard.writeText('Hello World', null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); +} + +function test_window() { + let finWindow: fin.OpenFinWindow; + // constructor + finWindow = new fin.desktop.Window({ + name: "childWindow", + url: "child.html", + defaultWidth: 320, + defaultHeight: 320, + defaultTop: 10, + defaultLeft: 300, + frame: false, + resizable: false, + state: "normal" + }, function () { + var _win = finWindow.getNativeWindow(); + _win.addEventListener("DOMContentLoaded", function () { finWindow.show(); }); + }, function (error) { + console.log("Error creating window:", error); + }); + // getCurrent + finWindow = fin.desktop.Window.getCurrent(); + // getNativeWindow + let nativeWindow: Window; + nativeWindow = finWindow.getNativeWindow(); + // getParentApplication + let parentApp: fin.OpenFinApplication; + parentApp = finWindow.getParentApplication(); + // getParentWindow + let parentFinWindow: fin.OpenFinWindow; + parentFinWindow = finWindow.getParentWindow(); + // wrap + finWindow = fin.desktop.Window.wrap("uuid", "name"); + // addEventListener + finWindow.addEventListener("bounds-changed", function (event) { + console.log("The window has been moved or resized"); + }, function () { + console.log("The registration was successful"); + }, function (reason) { + console.log("failure:" + reason); + }); + // animate + finWindow.animate({ + opacity: { + opacity: 0.15, + duration: 1000 + }, + position: { + left: 10, + top: 10, + duration: 3000 + } + }, { + interrupt: false + }, function (evt) { + // Callback will only fire after both "opacity" and "position" have finished animating. + }); + // authenticate + finWindow.addEventListener('auth-requested', evt => { + finWindow.authenticate('userName', 'P@assw0rd', () => { }, (reason, err) => { + console.log("failure:", err); + }); + }); + // blur + finWindow.blur(); + // bringToFront + finWindow.bringToFront(); + // close + finWindow.close(); + // disableFrame + finWindow.disableFrame(); + // enableFrame + finWindow.enableFrame(); + // flash + finWindow.flash(); + // focus + finWindow.focus(); + // getBounds + finWindow.getBounds(function (bounds) { + console.log("top: " + bounds.top + + "left: " + bounds.left + + "height: " + bounds.height + + "width: " + bounds.width); + }); + // getOptions + finWindow.getOptions(function (options) { + console.log(options); + }); + // getSnapshot + finWindow.getSnapshot(function (base64Snapshot) { + console.log("data:image/png;base64," + base64Snapshot); + }); + // getState + finWindow.getState(function (state) { + console.log("state: " + state); + }); + // getZoomLevel + finWindow.getZoomLevel(function (level) { + console.log("zoom level: " + level); + }, function (error) { + console.log('error:', error); + }); + // hide + finWindow.hide(); + // isShowing + finWindow.isShowing(function (showing) { + console.log("the window is " + (showing ? "showing" : "hidden")); + }); + // joinGroup + let secondWindow = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "secondWindow", + autoShow: true + }, function () { + // When mainWindow moves or is moved, secondWindow moves by the same amount + secondWindow.joinGroup(finWindow); + }); + // leaveGroup + secondWindow = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "secondWindow", + autoShow: true + }, function () { + // When finWindow moves or is moved, secondWindow moves by the same amount + secondWindow.joinGroup(finWindow, function () { + //once we are in the group, lets leave it. + secondWindow.leaveGroup(); + }); + }); + // maximize + finWindow.maximize(); + // mergeGroups + { + let finWindowOne = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowOne", + autoShow: true + }); + let finWindowTwo = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowTwo", + autoShow: true + }); + let finWindowThree = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowThree", + autoShow: true + }); + let finWindowFour = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowFour", + autoShow: true + }); + // When finWindowOne moves or is moved, finWindowTwo moves by the same amount + finWindowOne.joinGroup(finWindowTwo); + // When finWindowThree moves or is moved, finWindowFour moves by the same amount + finWindowThree.joinGroup(finWindowFour); + // finWindowOne, finWindowTwo, finWindowThree, and finWindowFour now move together in the same group + finWindowOne.mergeGroups(finWindowThree); + } + // minimize + finWindow.minimize(); + // moveBy + finWindow.moveBy(10, 10); + // moveTo + finWindow.moveTo(100, 200); + // removeEventListener + let aRegisteredListener = (event: fin.WindowBaseEvent) => { }; + finWindow.removeEventListener("bounds-changed", aRegisteredListener); + // resizeBy + finWindow.resizeBy(10, 10, "top-right"); + // resizeTo + finWindow.resizeTo(10, 10, "top-right"); + // restore + finWindow.restore(); + // setAsForeground + finWindow.setAsForeground(); + // setBounds + finWindow.setBounds(100, 200, 400, 400); + // setZoomLevel + finWindow.setZoomLevel(10); + // show + finWindow.show(); + // showAt + finWindow.showAt(10, 10, false); + // stopFlashing + finWindow.stopFlashing(); + // updateOptions + finWindow.updateOptions({ + frame: false, + maxWidth: 500 + }); +} \ No newline at end of file diff --git a/openfin/tsconfig.json b/openfin/tsconfig.json new file mode 100644 index 0000000000..8785bdb90f --- /dev/null +++ b/openfin/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "openfin-tests.ts" + ] +} diff --git a/openfin/tslint.json b/openfin/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/openfin/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From b24d2ab7d9003eff940302e77edec81a2375c117 Mon Sep 17 00:00:00 2001 From: Olmo del Corral Date: Thu, 2 Feb 2017 21:14:23 +0100 Subject: [PATCH 002/567] rename language to culture in numbro --- numbro/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numbro/index.d.ts b/numbro/index.d.ts index ccb0892a0d..55234aad81 100644 --- a/numbro/index.d.ts +++ b/numbro/index.d.ts @@ -24,7 +24,7 @@ interface Numbro { (value?: any): Numbro; version: string; isNumbro: boolean; - language(key: string, values?: NumbroLanguage): Numbro; + culture(key: string, values?: NumbroLanguage): Numbro; zeroFormat(format: string): string; clone(): Numbro; format(inputString?: string): string; From d09124c0dadba0706409036d1b2948ee5d08496f Mon Sep 17 00:00:00 2001 From: Olmo del Corral Date: Sun, 5 Feb 2017 20:34:10 +0100 Subject: [PATCH 003/567] remove numbro and add it to notNeededPackages.json --- notNeededPackages.json | 6 ++++++ numbro/index.d.ts | 49 ------------------------------------------ numbro/numbro-tests.ts | 43 ------------------------------------ numbro/tsconfig.json | 22 ------------------- 4 files changed, 6 insertions(+), 114 deletions(-) delete mode 100644 numbro/index.d.ts delete mode 100644 numbro/numbro-tests.ts delete mode 100644 numbro/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index e671ef4523..ef4e4f7f85 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -5,6 +5,12 @@ "typingsPackageName": "moment", "sourceRepoURL": "https://github.com/moment/moment", "asOfVersion": "2.13.0" + }, + { + "libraryName": "Numbro", + "typingsPackageName": "numbro", + "sourceRepoURL": "https://github.com/foretagsplatsen/numbro/", + "asOfVersion": "1.9.3" }, { "libraryName": "ng-table", diff --git a/numbro/index.d.ts b/numbro/index.d.ts deleted file mode 100644 index 55234aad81..0000000000 --- a/numbro/index.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Type definitions for Numbro.js -// Project: https://github.com/foretagsplatsen/numbro -// Definitions by: Vincent Bortone -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface NumbroLanguage { - delimiters: { - thousands: string; - decimal: string; - }; - abbreviations: { - thousand: string; - million: string; - billion: string; - trillion: string; - }; - ordinal(num: number): string; - currency: { - symbol: string; - }; -} - -interface Numbro { - (value?: any): Numbro; - version: string; - isNumbro: boolean; - culture(key: string, values?: NumbroLanguage): Numbro; - zeroFormat(format: string): string; - clone(): Numbro; - format(inputString?: string): string; - formatCurrency(inputString?: string): string; - unformat(inputString: string): number; - value(): number; - valueOf(): number; - set (value: any): Numbro; - add(value: any): Numbro; - subtract(value: any): Numbro; - multiply(value: any): Numbro; - divide(value: any): Numbro; - difference(value: any): number; -} - -declare var numbro: Numbro; - -declare module "numbro" { - - export = numbro; - -} diff --git a/numbro/numbro-tests.ts b/numbro/numbro-tests.ts deleted file mode 100644 index 5b5b762353..0000000000 --- a/numbro/numbro-tests.ts +++ /dev/null @@ -1,43 +0,0 @@ - - -var valueFormat: string = numbro(1000).format('0,0'); -// '1,000' - -var valueUnformat: number = numbro().unformat('($10,000.00)'); -// '-10000' - -var value3: Numbro = numbro(1000); -var added: Numbro = value3.add(10); -// 1010 - -var value4: Numbro = numbro(1000); -var formatValue4a: string = value4.format('0,0'); -// '1,000' -var formatValue4b: number = value4.value(); -// 1000 - -var value5: Numbro = numbro(); -value5.set(1000); -var value5Num: number = value5.value(); -// 1000 - -var value6: Numbro = numbro(1000); -var value: number = 100; -var difference = value6.difference(value); -// 900 - -var value7: Numbro = numbro(0); -numbro.zeroFormat('N/A'); -var zeroString: string = value7.format('0.0'); -// 'N/A' - -var a: Numbro = numbro(1000); -var b: Numbro = numbro(a); -var c: Numbro = a.clone(); - -var aVal: number = a.set(2000).value(); -// 2000 -var bVal: number = b.value(); -// 1000 -var cVal: number = c.add(10).value(); -// 1010 diff --git a/numbro/tsconfig.json b/numbro/tsconfig.json deleted file mode 100644 index 4a55ffe0ab..0000000000 --- a/numbro/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "numbro-tests.ts" - ] -} \ No newline at end of file From ec4b986bc8641599b223a79efaebafe196aeb2e8 Mon Sep 17 00:00:00 2001 From: Alexey Svetliakov Date: Tue, 14 Feb 2017 01:49:54 +0100 Subject: [PATCH 004/567] enzyme: return any as state for shallow() and mount() --- enzyme/enzyme-tests.tsx | 14 ++++++++++++++ enzyme/index.d.ts | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/enzyme/enzyme-tests.tsx b/enzyme/enzyme-tests.tsx index 82a8dc9822..c7323766f7 100644 --- a/enzyme/enzyme-tests.tsx +++ b/enzyme/enzyme-tests.tsx @@ -37,6 +37,13 @@ namespace ShallowWrapperTest { elementWrapper: ShallowWrapper, {}>, statelessWrapper: ShallowWrapper; + function test_props_state_inferring() { + let wrapper: ShallowWrapper; + wrapper = shallow(); + wrapper.state().stateProperty; + wrapper.props().stringProp.toUpperCase(); + } + function test_shallow_options() { shallow(, { context: { @@ -337,6 +344,13 @@ namespace ReactWrapperTest { elementWrapper: ReactWrapper, {}>, statelessWrapper: ReactWrapper; + function test_prop_state_inferring() { + let wrapper: ReactWrapper; + wrapper = mount(); + wrapper.state().stateProperty; + wrapper.props().stringProp.toUpperCase(); + } + function test_unmount() { reactWrapper = reactWrapper.unmount(); } diff --git a/enzyme/index.d.ts b/enzyme/index.d.ts index 66c86d1166..184b20ec57 100644 --- a/enzyme/index.d.ts +++ b/enzyme/index.d.ts @@ -541,14 +541,14 @@ export interface MountRendererProps { * @param node * @param [options] */ -export function shallow(node: ReactElement

, options?: ShallowRendererProps): ShallowWrapper; +export function shallow(node: ReactElement

, options?: ShallowRendererProps): ShallowWrapper; /** * Mounts and renders a react component into the document and provides a testing wrapper around it. * @param node * @param [options] */ -export function mount(node: ReactElement

, options?: MountRendererProps): ReactWrapper; +export function mount(node: ReactElement

, options?: MountRendererProps): ReactWrapper; /** * Render react components to static HTML and analyze the resulting HTML structure. From 05031f52cfa8e622af5ce154fe3f5c24e99cd298 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 14 Feb 2017 10:43:10 +0900 Subject: [PATCH 005/567] Remove definitions for redux-persist (shipped with library), update definitions for transformers --- notNeededPackages.json | 8 ++- redux-persist-transform-compress/index.d.ts | 4 +- redux-persist-transform-compress/package.json | 3 +- .../redux-persist-transform-compress-tests.ts | 8 +-- redux-persist-transform-compress/tslint.json | 3 + redux-persist-transform-encrypt/async.d.ts | 3 + redux-persist-transform-encrypt/index.d.ts | 20 ++---- redux-persist-transform-encrypt/package.json | 3 +- .../redux-persist-transform-encrypt-tests.ts | 12 ++-- redux-persist-transform-encrypt/tsconfig.json | 6 +- redux-persist-transform-encrypt/tslint.json | 3 + .../v0.1/index.d.ts | 18 +++++ .../v0.1}/package.json | 0 .../redux-persist-transform-encrypt-tests.ts | 13 ++++ .../v0.1}/tsconfig.json | 4 +- .../v0.1/tslint.json | 3 + redux-persist-transform-filter/index.d.ts | 4 +- redux-persist-transform-filter/package.json | 3 +- .../redux-persist-transform-filter-tests.ts | 8 +-- redux-persist-transform-filter/tsconfig.json | 6 +- redux-persist-transform-filter/tslint.json | 3 + redux-persist/constants.d.ts | 2 - redux-persist/index.d.ts | 66 ------------------- redux-persist/redux-persist-tests.ts | 53 --------------- redux-persist/storages.d.ts | 4 -- 25 files changed, 94 insertions(+), 166 deletions(-) create mode 100644 redux-persist-transform-compress/tslint.json create mode 100644 redux-persist-transform-encrypt/async.d.ts create mode 100644 redux-persist-transform-encrypt/tslint.json create mode 100644 redux-persist-transform-encrypt/v0.1/index.d.ts rename {redux-persist => redux-persist-transform-encrypt/v0.1}/package.json (100%) create mode 100644 redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts rename {redux-persist => redux-persist-transform-encrypt/v0.1}/tsconfig.json (83%) create mode 100644 redux-persist-transform-encrypt/v0.1/tslint.json create mode 100644 redux-persist-transform-filter/tslint.json delete mode 100644 redux-persist/constants.d.ts delete mode 100644 redux-persist/index.d.ts delete mode 100644 redux-persist/redux-persist-tests.ts delete mode 100644 redux-persist/storages.d.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index e671ef4523..5a5e864d72 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -293,6 +293,12 @@ "typingsPackageName": "redux-saga", "sourceRepoURL": "https://github.com/redux-saga/redux-saga", "asOfVersion": "0.10.5" + }, + { + "libraryName": "redux-persist", + "typingsPackageName": "redux-persist", + "sourceRepoURL": "https://github.com/rt2zz/redux-persist", + "asOfVersion": "4.3.1" } ] -} +} \ No newline at end of file diff --git a/redux-persist-transform-compress/index.d.ts b/redux-persist-transform-compress/index.d.ts index 2f8fb7f366..81f472d9ba 100644 --- a/redux-persist-transform-compress/index.d.ts +++ b/redux-persist-transform-compress/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { PersistConfig, PersistTransformer } from "redux-persist"; +import { PersistorConfig, Transform } from "redux-persist"; export = createCompressor; -declare function createCompressor (config?: PersistConfig): PersistTransformer; +declare function createCompressor(config?: PersistorConfig): Transform; diff --git a/redux-persist-transform-compress/package.json b/redux-persist-transform-compress/package.json index 36ce503807..e5b05e9b76 100644 --- a/redux-persist-transform-compress/package.json +++ b/redux-persist-transform-compress/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "redux": "^3.6.0" + "redux": "^3.6.0", + "redux-persist": "^4.3.1" } } diff --git a/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts b/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts index b445171cb9..9c180e664c 100644 --- a/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts +++ b/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts @@ -1,11 +1,11 @@ import { createStore, Reducer, Store } from "redux" -import { createPersistor, Persistor, PersistTransformer } from "redux-persist" +import { createPersistor, Transform } from "redux-persist" import createCompressor = require("redux-persist-transform-compress") -const reducer: Reducer = (state: any, action: any) => ({}) +const reducer: Reducer = (state: any, action: any) => ({ state, action }) -const compressor: PersistTransformer = createCompressor({ whitelist : ["foo"] }) +const compressor: Transform = createCompressor({ whitelist : ["foo"] }) const store: Store = createStore(reducer) -const persistor: Persistor = createPersistor(store, { transforms : [compressor] }) +createPersistor(store, { transforms : [compressor] }) diff --git a/redux-persist-transform-compress/tslint.json b/redux-persist-transform-compress/tslint.json new file mode 100644 index 0000000000..f9e30021f4 --- /dev/null +++ b/redux-persist-transform-compress/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/redux-persist-transform-encrypt/async.d.ts b/redux-persist-transform-encrypt/async.d.ts new file mode 100644 index 0000000000..68bcb6c3b8 --- /dev/null +++ b/redux-persist-transform-encrypt/async.d.ts @@ -0,0 +1,3 @@ +import createAsyncEncryptor from "redux-persist-transform-encrypt"; + +export default createAsyncEncryptor; diff --git a/redux-persist-transform-encrypt/index.d.ts b/redux-persist-transform-encrypt/index.d.ts index 048f02221f..a3d5dc1750 100644 --- a/redux-persist-transform-encrypt/index.d.ts +++ b/redux-persist-transform-encrypt/index.d.ts @@ -1,18 +1,12 @@ -// Type definitions for redux-persist-transform-encrypt 0.1 -// Project: https://github.com/maxdeviant/redux-persist-transform-encrypt#readme +// Type definitions for redux-persist-transform-encrypt 1.0 +// Project: https://github.com/maxdeviant/redux-persist-transform-encrypt // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { PersistTransformer } from "redux-persist"; +import { Transform } from "redux-persist"; -export as namespace ReduxPersistEncryptor; - -export = createEncryptor; - -declare function createEncryptor (config: createEncryptor.EncryptorConfig): PersistTransformer; - -declare namespace createEncryptor { - export interface EncryptorConfig { - secretKey: string; - } +export interface EncryptorConfig { + secretKey: string; } + +export default function createEncryptor(config: EncryptorConfig): Transform; diff --git a/redux-persist-transform-encrypt/package.json b/redux-persist-transform-encrypt/package.json index 36ce503807..e5b05e9b76 100644 --- a/redux-persist-transform-encrypt/package.json +++ b/redux-persist-transform-encrypt/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "redux": "^3.6.0" + "redux": "^3.6.0", + "redux-persist": "^4.3.1" } } diff --git a/redux-persist-transform-encrypt/redux-persist-transform-encrypt-tests.ts b/redux-persist-transform-encrypt/redux-persist-transform-encrypt-tests.ts index b3a70dc776..76dc7985bd 100644 --- a/redux-persist-transform-encrypt/redux-persist-transform-encrypt-tests.ts +++ b/redux-persist-transform-encrypt/redux-persist-transform-encrypt-tests.ts @@ -1,13 +1,15 @@ import { createStore, Reducer, Store } from "redux" -import { createPersistor, Persistor, PersistTransformer } from "redux-persist" +import { createPersistor, Transform } from "redux-persist" import { EncryptorConfig } from "redux-persist-transform-encrypt" -import * as createEncryptor from "redux-persist-transform-encrypt" +import createEncryptor from "redux-persist-transform-encrypt" +import createAsyncEncryptor from "redux-persist-transform-encrypt/async" -const reducer: Reducer = (state: any, action: any) => ({}) +const reducer: Reducer = (state: any, action: any) => ({ state, action }) const config: EncryptorConfig = { secretKey : "foo" } -const encryptor: PersistTransformer = createEncryptor(config) +const encryptor: Transform = createEncryptor(config) +const asyncEncryptor: Transform = createAsyncEncryptor(config) const store: Store = createStore(reducer) -const persistor: Persistor = createPersistor(store, { transforms : [encryptor] }) +createPersistor(store, { transforms : [encryptor, asyncEncryptor] }) diff --git a/redux-persist-transform-encrypt/tsconfig.json b/redux-persist-transform-encrypt/tsconfig.json index b0a989e85a..0537c9d89a 100644 --- a/redux-persist-transform-encrypt/tsconfig.json +++ b/redux-persist-transform-encrypt/tsconfig.json @@ -13,10 +13,12 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "noUnusedParameters": true, + "noUnusedLocals": true }, "files": [ "index.d.ts", "redux-persist-transform-encrypt-tests.ts" ] -} \ No newline at end of file +} diff --git a/redux-persist-transform-encrypt/tslint.json b/redux-persist-transform-encrypt/tslint.json new file mode 100644 index 0000000000..f9e30021f4 --- /dev/null +++ b/redux-persist-transform-encrypt/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/redux-persist-transform-encrypt/v0.1/index.d.ts b/redux-persist-transform-encrypt/v0.1/index.d.ts new file mode 100644 index 0000000000..048f02221f --- /dev/null +++ b/redux-persist-transform-encrypt/v0.1/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for redux-persist-transform-encrypt 0.1 +// Project: https://github.com/maxdeviant/redux-persist-transform-encrypt#readme +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { PersistTransformer } from "redux-persist"; + +export as namespace ReduxPersistEncryptor; + +export = createEncryptor; + +declare function createEncryptor (config: createEncryptor.EncryptorConfig): PersistTransformer; + +declare namespace createEncryptor { + export interface EncryptorConfig { + secretKey: string; + } +} diff --git a/redux-persist/package.json b/redux-persist-transform-encrypt/v0.1/package.json similarity index 100% rename from redux-persist/package.json rename to redux-persist-transform-encrypt/v0.1/package.json diff --git a/redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts b/redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts new file mode 100644 index 0000000000..b3a70dc776 --- /dev/null +++ b/redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts @@ -0,0 +1,13 @@ +import { createStore, Reducer, Store } from "redux" +import { createPersistor, Persistor, PersistTransformer } from "redux-persist" +import { EncryptorConfig } from "redux-persist-transform-encrypt" +import * as createEncryptor from "redux-persist-transform-encrypt" + +const reducer: Reducer = (state: any, action: any) => ({}) + +const config: EncryptorConfig = { secretKey : "foo" } +const encryptor: PersistTransformer = createEncryptor(config) + +const store: Store = createStore(reducer) + +const persistor: Persistor = createPersistor(store, { transforms : [encryptor] }) diff --git a/redux-persist/tsconfig.json b/redux-persist-transform-encrypt/v0.1/tsconfig.json similarity index 83% rename from redux-persist/tsconfig.json rename to redux-persist-transform-encrypt/v0.1/tsconfig.json index 53bbe4f198..b0a989e85a 100644 --- a/redux-persist/tsconfig.json +++ b/redux-persist-transform-encrypt/v0.1/tsconfig.json @@ -17,8 +17,6 @@ }, "files": [ "index.d.ts", - "constants.d.ts", - "storages.d.ts", - "redux-persist-tests.ts" + "redux-persist-transform-encrypt-tests.ts" ] } \ No newline at end of file diff --git a/redux-persist-transform-encrypt/v0.1/tslint.json b/redux-persist-transform-encrypt/v0.1/tslint.json new file mode 100644 index 0000000000..f9e30021f4 --- /dev/null +++ b/redux-persist-transform-encrypt/v0.1/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/redux-persist-transform-filter/index.d.ts b/redux-persist-transform-filter/index.d.ts index 19e7779bbd..9619c07df7 100644 --- a/redux-persist-transform-filter/index.d.ts +++ b/redux-persist-transform-filter/index.d.ts @@ -3,6 +3,6 @@ // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { PersistTransformer } from "redux-persist"; +import { Transform } from "redux-persist"; -export default function createFilter (reducerName: string, inboundPaths?: string[], outboundPaths?: string[]): PersistTransformer; +export default function createFilter(reducerName: string, inboundPaths?: string[], outboundPaths?: string[]): Transform; diff --git a/redux-persist-transform-filter/package.json b/redux-persist-transform-filter/package.json index 36ce503807..e5b05e9b76 100644 --- a/redux-persist-transform-filter/package.json +++ b/redux-persist-transform-filter/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "redux": "^3.6.0" + "redux": "^3.6.0", + "redux-persist": "^4.3.1" } } diff --git a/redux-persist-transform-filter/redux-persist-transform-filter-tests.ts b/redux-persist-transform-filter/redux-persist-transform-filter-tests.ts index a19f7610e4..737e4a70a7 100644 --- a/redux-persist-transform-filter/redux-persist-transform-filter-tests.ts +++ b/redux-persist-transform-filter/redux-persist-transform-filter-tests.ts @@ -1,10 +1,10 @@ import { createStore, Reducer, Store } from "redux" -import { createPersistor, Persistor, PersistTransformer } from "redux-persist" +import { createPersistor, Transform } from "redux-persist" import createFilter from "redux-persist-transform-filter" -const reducer: Reducer = (state: any, action: any) => ({}) +const reducer: Reducer = (state: any, action: any) => ({ state, action }) -const filter: PersistTransformer = createFilter( +const filter: Transform = createFilter( "foo", ["foo.bar"], ["fizz.buzz"] @@ -12,4 +12,4 @@ const filter: PersistTransformer = createFilter( const store: Store = createStore(reducer) -const persistor: Persistor = createPersistor(store, { transforms : [filter] }) +createPersistor(store, { transforms : [filter] }) diff --git a/redux-persist-transform-filter/tsconfig.json b/redux-persist-transform-filter/tsconfig.json index ac08736562..a8f712550c 100644 --- a/redux-persist-transform-filter/tsconfig.json +++ b/redux-persist-transform-filter/tsconfig.json @@ -13,10 +13,12 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "noUnusedParameters": true, + "noUnusedLocals": true }, "files": [ "index.d.ts", "redux-persist-transform-filter-tests.ts" ] -} \ No newline at end of file +} diff --git a/redux-persist-transform-filter/tslint.json b/redux-persist-transform-filter/tslint.json new file mode 100644 index 0000000000..f9e30021f4 --- /dev/null +++ b/redux-persist-transform-filter/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/redux-persist/constants.d.ts b/redux-persist/constants.d.ts deleted file mode 100644 index 93d3249dda..0000000000 --- a/redux-persist/constants.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const KEY_PREFIX: string; -export const REHYDRATE: string; diff --git a/redux-persist/index.d.ts b/redux-persist/index.d.ts deleted file mode 100644 index c8d099d5e6..0000000000 --- a/redux-persist/index.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Type definitions for redux-persist 4.0 -// Project: https://github.com/rt2zz/redux-persist -// Definitions by: Karol Janyst -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import { Action, GenericStoreEnhancer, Store } from "redux"; - -export interface PersistAction extends Action { - payload?: S; - error?: any; -} - -export interface PersistorRehydrateOptions { - serial?: boolean; -} - -export interface Persistor { - purge(keys?: string[]): void; - rehydrate(incoming: A, options?: PersistorRehydrateOptions): A; - pause(): void; - resume(): void; -} - -export type PersistCallback = (err: any, response?: A) => void; - -export interface PersistTransformer { - in(state: any, key: string): any; - out(state: any, key: string): any; -} - -export interface PersistStorage { - setItem(key: string, value: any, callback?: PersistCallback): Promise; - getItem(key: string, callback?: PersistCallback): Promise; - removeItem(key: string, callback?: PersistCallback): Promise; - getAllKeys(callback?: PersistCallback): Promise; - [key: string]: any; -} - -export type PersistStateReconciler = (state: A, inboundState: B, reducedState: C, log?: boolean) => C; - -export interface PersistAutoRehydrateConfig { - stateReconcile?: PersistStateReconciler; -} - -export interface PersistConfig { - whitelist?: string[]; - blacklist?: string[]; - transforms?: PersistTransformer[]; - storage?: PersistStorage; - debounce?: number; - keyPrefix?: string; - serialize?: (data: any) => string; - deserialize?: (data: string) => any; -} - -export function autoRehydrate (config?: PersistAutoRehydrateConfig): GenericStoreEnhancer; - -export function createPersistor (store: Store, config?: PersistConfig): Persistor; - -export function createTransform (inbound: any, outbound: any, config?: PersistConfig): PersistTransformer; - -export function getStoredState(config?: PersistConfig, callback?: PersistCallback): Promise; - -export function persistStore (store: Store, config?: PersistConfig, callback?: PersistCallback): Persistor; - -export function purgeStoredState (config?: PersistConfig, keys?: string[]): Promise; diff --git a/redux-persist/redux-persist-tests.ts b/redux-persist/redux-persist-tests.ts deleted file mode 100644 index 59885a292a..0000000000 --- a/redux-persist/redux-persist-tests.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { createStore, Store, Reducer } from "redux" -import { - autoRehydrate, - createPersistor, - createTransform, - getStoredState, - persistStore, - purgeStoredState, - PersistConfig, - PersistAutoRehydrateConfig, - PersistCallback, - Persistor, - PersistorRehydrateOptions, - PersistTransformer -} from "redux-persist" -import { KEY_PREFIX, REHYDRATE } from "redux-persist/constants" -import { asyncLocalStorage, asyncSessionStorage } from "redux-persist/storages" - -const reducer: Reducer = (state: any, action: any) => ({}) - -const persistCallback: PersistCallback = (err: any, response: any) => {} - -const transform: PersistTransformer = createTransform({}, {}, { whitelist : ["foo"] }) - -const persistConfig: PersistConfig = { - blacklist : ["foo"], - whitelist : ["bar"], - storage : asyncLocalStorage, - transforms : [transform], - debounce : 1000, - keyPrefix : KEY_PREFIX -} - -const rehydrateOptions: PersistorRehydrateOptions = { serial : true } - -const autoRehydrateConfig: PersistAutoRehydrateConfig = { - stateReconcile: (state: any, inboundState: any, reducedState: any, log: boolean) => ({}) -} - -const store: Store = createStore(reducer, autoRehydrate(autoRehydrateConfig)) -const persistor: Persistor = persistStore(store, persistConfig, persistCallback) - -purgeStoredState({ whitelist : ["foo"] }, ["bar"]) - -getStoredState(persistConfig, (err: any, restoredState: any) => { - const store: Store = createStore(reducer, restoredState) - const persistor: Persistor = createPersistor(store, persistConfig) - const secondaryPersistor: Persistor = createPersistor(store, { storage : asyncSessionStorage }) - persistor.pause() - persistor.resume() - persistor.purge(["foo", "bar"]) - persistor.rehydrate(restoredState, rehydrateOptions) -}) diff --git a/redux-persist/storages.d.ts b/redux-persist/storages.d.ts deleted file mode 100644 index b798ed2664..0000000000 --- a/redux-persist/storages.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { PersistStorage } from "redux-persist"; - -export const asyncLocalStorage: PersistStorage; -export const asyncSessionStorage: PersistStorage; From 9f74a96b56fcc20ab52d632a0dfe9be3e3d4a7de Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Thu, 16 Feb 2017 09:15:46 +0900 Subject: [PATCH 006/567] Remove unnecessary definitions for redux-persist-transform-compress, update other redux-persist plugins --- notNeededPackages.json | 6 +++++ redux-persist-transform-compress/index.d.ts | 9 -------- redux-persist-transform-compress/package.json | 6 ----- .../redux-persist-transform-compress-tests.ts | 11 ---------- .../tsconfig.json | 22 ------------------- redux-persist-transform-compress/tslint.json | 3 --- redux-persist-transform-encrypt/package.json | 2 +- redux-persist-transform-filter/package.json | 2 +- 8 files changed, 8 insertions(+), 53 deletions(-) delete mode 100644 redux-persist-transform-compress/index.d.ts delete mode 100644 redux-persist-transform-compress/package.json delete mode 100644 redux-persist-transform-compress/redux-persist-transform-compress-tests.ts delete mode 100644 redux-persist-transform-compress/tsconfig.json delete mode 100644 redux-persist-transform-compress/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 5a5e864d72..07a5acf21c 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -299,6 +299,12 @@ "typingsPackageName": "redux-persist", "sourceRepoURL": "https://github.com/rt2zz/redux-persist", "asOfVersion": "4.3.1" + }, + { + "libraryName": "redux-persist-transform-compress", + "typingsPackageName": "redux-persist-transform-compress", + "sourceRepoURL": "https://github.com/rt2zz/redux-persist-transform-compress", + "asOfVersion": "4.2.0" } ] } \ No newline at end of file diff --git a/redux-persist-transform-compress/index.d.ts b/redux-persist-transform-compress/index.d.ts deleted file mode 100644 index 81f472d9ba..0000000000 --- a/redux-persist-transform-compress/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Type definitions for redux-persist-transform-compress 4.1 -// Project: https://github.com/rt2zz/redux-persist-transform-compress -// Definitions by: Karol Janyst -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import { PersistorConfig, Transform } from "redux-persist"; - -export = createCompressor; -declare function createCompressor(config?: PersistorConfig): Transform; diff --git a/redux-persist-transform-compress/package.json b/redux-persist-transform-compress/package.json deleted file mode 100644 index e5b05e9b76..0000000000 --- a/redux-persist-transform-compress/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "redux": "^3.6.0", - "redux-persist": "^4.3.1" - } -} diff --git a/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts b/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts deleted file mode 100644 index 9c180e664c..0000000000 --- a/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { createStore, Reducer, Store } from "redux" -import { createPersistor, Transform } from "redux-persist" -import createCompressor = require("redux-persist-transform-compress") - -const reducer: Reducer = (state: any, action: any) => ({ state, action }) - -const compressor: Transform = createCompressor({ whitelist : ["foo"] }) - -const store: Store = createStore(reducer) - -createPersistor(store, { transforms : [compressor] }) diff --git a/redux-persist-transform-compress/tsconfig.json b/redux-persist-transform-compress/tsconfig.json deleted file mode 100644 index 5e33f4960f..0000000000 --- a/redux-persist-transform-compress/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "redux-persist-transform-compress-tests.ts" - ] -} \ No newline at end of file diff --git a/redux-persist-transform-compress/tslint.json b/redux-persist-transform-compress/tslint.json deleted file mode 100644 index f9e30021f4..0000000000 --- a/redux-persist-transform-compress/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../tslint.json" -} diff --git a/redux-persist-transform-encrypt/package.json b/redux-persist-transform-encrypt/package.json index e5b05e9b76..e186771ad7 100644 --- a/redux-persist-transform-encrypt/package.json +++ b/redux-persist-transform-encrypt/package.json @@ -1,6 +1,6 @@ { "dependencies": { "redux": "^3.6.0", - "redux-persist": "^4.3.1" + "redux-persist": "^4.4.0" } } diff --git a/redux-persist-transform-filter/package.json b/redux-persist-transform-filter/package.json index e5b05e9b76..e186771ad7 100644 --- a/redux-persist-transform-filter/package.json +++ b/redux-persist-transform-filter/package.json @@ -1,6 +1,6 @@ { "dependencies": { "redux": "^3.6.0", - "redux-persist": "^4.3.1" + "redux-persist": "^4.4.0" } } From b983469a15b61bf259d37d04de304273dcbdc3ef Mon Sep 17 00:00:00 2001 From: sqwk Date: Thu, 16 Feb 2017 10:12:42 +0100 Subject: [PATCH 007/567] Initial Commit --- lowdb/index.d.ts | 536 +++++++++++++++++++++++++++++++++++++++++++ lowdb/lowdb-tests.ts | 12 + lowdb/tsconfig.json | 23 ++ 3 files changed, 571 insertions(+) create mode 100644 lowdb/index.d.ts create mode 100644 lowdb/lowdb-tests.ts create mode 100644 lowdb/tsconfig.json diff --git a/lowdb/index.d.ts b/lowdb/index.d.ts new file mode 100644 index 0000000000..ddd20e89ed --- /dev/null +++ b/lowdb/index.d.ts @@ -0,0 +1,536 @@ +declare module 'lowdb' { + interface PromiseLike { + + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; + } + + interface StringRepresentable { + toString(): string; + } + + interface List { + [index: number]: T; + length: number; + } + + interface Dictionary { + [index: string]: T; + } + + interface DictionaryIterator { + (value: T, key?: string, collection?: Dictionary): TResult; + } + + interface ListIterator { + (value: T, index: number, collection: List): TResult; + } + + interface StringIterator { + (char: string, index?: number, string?: string): TResult; + } + + interface MixinOptions { + chain?: boolean; + } + + interface LoDashWrapper { + + /** + * @see _.has + */ + has(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; + + /** + * @see _.hasIn + */ + hasIn(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source: TSource + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source1: TSource1, + source2: TSource2 + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3 + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4 + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign(): LoDashWrapper; + + /** + * @see _.assign + */ + assign(...otherArgs: any[]): LoDashWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep(): LoDashWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep(): LoDashWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeepWith(customizer: (value: any) => any): LoDashWrapper[]; + + /** + * @see _.cloneDeep + */ + cloneDeepWith(customizer: (value: any) => any): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults(): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults(...sources: {}[]): LoDashWrapper; + + /** + * @see _.get + */ + get(object: Object, + path: string | number | boolean | Array, + defaultValue?: TResult + ): LoDashWrapper; + + /** + * @see _.get + */ + get(path: string | number | boolean | Array, + defaultValue?: TResult + ): LoDashWrapper; + + + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): LoDashWrapper; + + /** + * @see _.mixin + */ + mixin( + options?: MixinOptions + ): LoDashWrapper; + + /** + * @see _.set + */ + set( + path: StringRepresentable | StringRepresentable[], + value: any + ): LoDashWrapper; + + /** + * @see _.set + */ + set( + path: StringRepresentable | StringRepresentable[], + value: V + ): LoDashWrapper; + + /** + * @see _.find + */ + find( + predicate?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.find + */ + find( + predicate?: string, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.find + */ + find( + predicate?: TObject + ): LoDashWrapper; + + /** + * @see _.find + */ + filter( + predicate?: TObject + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate: ListIterator | DictionaryIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate?: StringIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashWrapper; + /** + * @see _.map + */ + map( + iteratee?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashWrapper; + /** + * @see _.map + */ + map( + iteratee?: ListIterator | DictionaryIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.range + */ + range( + end?: number, + step?: number + ): LoDashWrapper; + + /** + * @see _.rangeRight + */ + rangeRight( + end?: number, + step?: number + ): LoDashWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator + ): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(...iteratees: (ListIterator | Object | string)[]): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratees: (ListIterator | string | Object)[]): LoDashWrapper; + + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashWrapper; + + /** + * @see _.size + */ + size(): LoDashWrapper; + + /** + * @see _.take + */ + take(n?: number): LoDashWrapper; + + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult + ): LoDashWrapper; + + /** + * @see _.times + */ + times(): LoDashWrapper; + + /** + * @see _.uniqueId + */ + uniqueId(): LoDashWrapper; + + value(): T; + + pop(): T; + push(...items: T[]): LoDashWrapper; + shift(): T; + sort(compareFn?: (a: T, b: T) => number): LoDashWrapper; + splice(start: number): LoDashWrapper; + splice(start: number, deleteCount: number, ...items: any[]): LoDashWrapper; + unshift(...items: T[]): LoDashWrapper; + } + + interface Storage { + /** + * Reads the database. + * + * @param source The source location. + * @param deserialize The deserialize function to apply. + * @return Returns a promise with the deserialized db object. + */ + read?(source: string, deserialize: any): PromiseLike + /** + * Reads the database. + * + * @param source The source location. + * @param deserialize The deserialize function to apply. + * @return Returns the deserialized db object. + */ + read?(source: string, deserialize: any): Object + /** + * Writes to the database. + * + * @param destination The destination location. + * @param obj The object to write. + * @param serialize The serialize function to apply. + */ + write?(destination: string, obj: any, serialize: any): void + /** + * Writes to the database. + * + * @param destination The destination location. + * @param obj The object to write. + * @param serialize The serialize function to apply. + */ + write?(destination: string, obj: any, serialize: any): PromiseLike + } + + interface Format { + /** + * Writes to the database. + * + * @param obj The object to serialize. + * @return Returns the serialized object string. + */ + serialize(obj: Object): string + /** + * Writes to the database. + * + * @param data The object to deserialize. + * @return Returns the deserialized object. + */ + deserialize(data: string): Object + } + + interface Options { + /** + * The custom "storage" object. + */ + storage?: Storage + /** + * The custom "format" object. + */ + format?: Format + /** + * The flag to automatically persist changes. + */ + writeOnChange?: boolean + } + + export interface Low extends LoDashWrapper, Format { + /** + * Access current database state. + * Returns Returns the database state. + */ + getState(): Object + /** + * Drop or reset database state. + * @param newState New state of the database + */ + setState(newState: Object): void + /** + * Persist database. + * @param source The source location. + */ + write(source: string): void + /** + * Persist database. + * @param source The source location. + */ + write(source: string): PromiseLike + /** + * Read database. + * @param source The source location. + */ + read(source?: string): Object + /** + * Read database. + * @param source The source location. + */ + read(source?: string): PromiseLike + } + +// declare class lowdb { +// new (source?: string, opts?: Options): Low; +// (source?: string, opts?: Options) : Low; +// } + +// declare module "lowdb" { +// export = lowdb; +// } + +} + diff --git a/lowdb/lowdb-tests.ts b/lowdb/lowdb-tests.ts new file mode 100644 index 0000000000..d656c63b62 --- /dev/null +++ b/lowdb/lowdb-tests.ts @@ -0,0 +1,12 @@ +import Lowdb = require('lowdb'); + +Lowdb +let db = new Lowdb(); + +db.defaults({ 'someObject': {}, 'anotherObject': {} }).value(); + +db.get('someObject').set('foo' , 'bar').value(); +db.get('anotherObject').set('foo' , 'bar').value(); +db.set('singleValue', 'foo').value(); + +console.log(db.getState()); diff --git a/lowdb/tsconfig.json b/lowdb/tsconfig.json new file mode 100644 index 0000000000..4a6104842c --- /dev/null +++ b/lowdb/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "lowdb-tests.ts" + ] +} \ No newline at end of file From 7a0e3cf5362f8f546f20d96574a66bb53a2473a5 Mon Sep 17 00:00:00 2001 From: Gilbert Date: Thu, 16 Feb 2017 11:13:03 +0100 Subject: [PATCH 008/567] updated jasmine-expect matchers + assymetric matchers. --- jasmine-expect/index.d.ts | 221 ++++++++++++++++++++++++-------------- 1 file changed, 141 insertions(+), 80 deletions(-) diff --git a/jasmine-expect/index.d.ts b/jasmine-expect/index.d.ts index c2ee7e0ee5..f8dbc54f56 100644 --- a/jasmine-expect/index.d.ts +++ b/jasmine-expect/index.d.ts @@ -1,93 +1,154 @@ -// Type definitions for jasmine-expect 2.0 +// Type definitions for jasmine-expect 3.6.0 // Project: https://github.com/JamieMason/Jasmine-Matchers -// Definitions by: UserPixel +// Definitions by: GeneralCss // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 /// declare namespace jasmine { - interface Matchers { - // These functions are written in the order defined in the src directory of jasmine-matchers - // The type system is used smartly whenever it can provide value (by looking at the code of every matcher) - toBeAfter(otherDate: Date): boolean; // - toBeArray(): boolean; // - toBeArrayOfBooleans(): boolean; // - toBeArrayOfNumbers(): boolean; - toBeArrayOfObjects(): boolean; - toBeArrayOfSize(size: number): boolean; - toBeArrayOfStrings(): boolean; - toBeBefore(otherDate: Date): boolean; // - toBeBoolean(): boolean; - toBeCalculable(): boolean; - toBeDate(): boolean; - toBeEmptyArray(): boolean; - toBeEmptyObject(): boolean; - toBeEmptyString(): boolean; - toBeEvenNumber(): boolean; - toBeFalse(): boolean; - toBeFunction(): boolean; - toBeHtmlString(): boolean; - toBeIso8601(): boolean; - toBeJsonString(): boolean; - toBeLongerThan(other: string): boolean; - toBeNonEmptyArray(): boolean; - toBeNonEmptyObject(): boolean; - toBeNonEmptyString(): boolean; - toBeNumber(): boolean; - toBeObject(): boolean; - toBeOddNumber(): boolean; - toBeSameLengthAs(other: string): boolean; - toBeShorterThan(other: string): boolean; - toBeString(): boolean; - toBeTrue(): boolean; - toBeWhitespace(): boolean; - toBeWholeNumber(): boolean; - toBeWithinRange(floor: number, ceiling: number): boolean; + interface Matchers { + // toBe + toBeArray(): boolean; + toBeArrayOfBooleans(): boolean; + toBeArrayOfNumbers(): boolean; + toBeArrayOfObjects(): boolean; + toBeArrayOfSize(): boolean; + toBeArrayOfStrings(): boolean; + toBeEmptyArray(): boolean; + toBeNonEmptyArray(): boolean; - toEndWith(subString: string): boolean; + // Booleans + toBeBoolean(): boolean; + toBeFalse(): boolean; + toBeTrue(): boolean; - toHaveArray(key: string): boolean; - toHaveArrayOfBooleans(key: string): boolean; - toHaveArrayOfNumbers(key: string): boolean; - toHaveArrayOfObjects(key: string): boolean; - toHaveArrayOfSize(key: string, size?: number): boolean; - toHaveArrayOfStrings(key: string): boolean; - toHaveBoolean(key: string): boolean; - toHaveCalculable(key: string): boolean; - toHaveDate(key: string): boolean; - toHaveDateAfter(key: string, otherDate: Date): boolean; - toHaveDateBefore(key: string, otherDate: Date): boolean; - toHaveEmptyArray(key: string): boolean; - toHaveEmptyObject(key: string): boolean; - toHaveEmptyString(key: string): boolean; - toHaveEvenNumber(key: string): boolean; - toHaveFalse(key: string): boolean; - toHaveHtmlString(key: string): boolean; - toHaveIso8601(key: string): boolean; - toHaveJsonString(key: string): boolean; - toHaveMember(key: string): boolean; - toHaveMethod(key: string): boolean; - toHaveNonEmptyArray(key: string): boolean; - toHaveNonEmptyObject(key: string): boolean; - toHaveNonEmptyString(key: string): boolean; - toHaveNumber(key: string): boolean; - toHaveNumberWithinRange(key: string, floor: number, ceiling: number): boolean; - toHaveObject(key: string): boolean; - toHaveOddNumber(key: string): boolean; - toHaveString(key: string): boolean; - toHaveStringLongerThan(key: string, other: string): boolean; - toHaveStringSameLengthAs(key: string, other: string): boolean; - toHaveStringShorterThan(key: string, other: string): boolean; - toHaveTrue(key: string): boolean; - toHaveWhitespaceString(key: string): boolean; - toHaveWholeNumber(key: string): boolean; + // Dates + toBeAfter(date: Date): boolean + toBeBefore(date: Date): boolean + toBeDate(): boolean; + toBeValidDate(): boolean; - toImplement(api: {}): boolean; + // Functions + toBeFunction(): boolean; + toThrowAnyError(): boolean; + toThrowErrorOfType(constructorName: string): boolean - toStartWith(subString: string): boolean; + // Numbers + toBeCalculable(): boolean; + toBeEvenNumber(): boolean; + toBeGreaterThanOrEqualTo(number: number): boolean; + toBeLessThanOrEqualTo(number: number): boolean; + toBeNear(number: number, epsilon: number): boolean; + toBeNumber(): boolean; + toBeOddNumber(): boolean + toBeWholeNumber(): boolean; + toBeWithinRange(floor: number, ceiling: number): boolean; - toThrowAnyError(): boolean; - toThrowErrorOfType(type: string): boolean; - } + // Strings + toBeEmptyString(): boolean; + toBeHtmlString(): boolean; + toBeIso8601(): boolean; + toBeJsonString(): boolean; + toBeLongerThan(): boolean; + toBeNonEmptyString(): boolean; + toBeSameLengthAs(): boolean; + toBeShorterThan(): boolean; + toBeString(): boolean; + toBeWhitespace(): boolean; + toEndWith(): boolean; + toStartWith(): boolean; + + // Objects + toBeEmptyObject(): boolean; + toBeNonEmptyObject(): boolean; + toBeObject(): boolean; + + // Regular Expression + toBeRegExp(): boolean; + + // Members, Properties, Methods + toHaveArray(memberName: string): boolean; + toHaveArrayOfBooleans(memberName: string): boolean; + toHaveArrayOfNumbers(memberName: string): boolean; + toHaveArrayOfObjects(memberName: string): boolean; + toHaveArrayOfSize(memberName: string, size: number): boolean; + toHaveArrayOfStrings(memberName: string): boolean; + toHaveBoolean(memberName: string): boolean; + toHaveCalculable(memberName: string): boolean; + toHaveDate(memberName: string): boolean; + toHaveDateAfter(memberName: string, date: Date): boolean; + toHaveDateBefore(memberName: string, date: Date): boolean; + toHaveEmptyArray(memberName: string): boolean; + toHaveEmptyObject(memberName: string): boolean; + toHaveEmptyString(memberName: string): boolean; + toHaveEvenNumber(memberName: string): boolean; + toHaveFalse(memberName: string): boolean; + toHaveHtmlString(memberName: string): boolean; + toHaveIso8601(memberName: string): boolean; + toHaveJsonString(memberName: string): boolean; + toHaveMember(memberName: string): boolean; + toHaveMethod(memberName: string): boolean; + toHaveNonEmptyArray(memberName: string): boolean; + toHaveNonEmptyObject(memberName: string): boolean; + toHaveNonEmptyString(memberName: string): boolean; + toHaveNumber(memberName: string): boolean; + toHaveNumberWithinRange(memberName: string, floor: number, ceiling: number): boolean; + toHaveObject(memberName: string): boolean; + toHaveOddNumber(memberName: string): boolean; + toHaveString(memberName: string): boolean; + toHaveStringLongerThan(memberName: string, string: string): boolean; + toHaveStringSameLengthAs(memberName: string, string: string): boolean; + toHaveStringShorterThan(memberName: string, string: string): boolean; + toHaveTrue(memberName: string): boolean; + toHaveUndefined(memberName: string): boolean; + toHaveWhitespaceString(memberName: string): boolean; + toHaveWholeNumber(memberName: string): boolean; + } + + interface AssymetricMatchers { + + // Arrays + arrayOfBooleans(): boolean; + arrayOfNumbers(): boolean; + arrayOfObjects(): boolean; + arrayOfSize(number: number): boolean; + arrayOfStrings(): boolean; + emptyArray(): boolean; + nonEmptyArray(): boolean; + + // Dates + after(date: Date): boolean; + before(date: Date): boolean; + + // Numbers + calculable(): boolean; + evenNumber(): boolean; + greaterThanOrEqualTo(number: number): boolean; + lessThanOrEqualTo(number: number): boolean; + oddNumber(): boolean; + wholeNumber(): boolean; + withinRange(floor: number, ceiling: number): boolean; + + // Strings + endingWith(string: string): boolean; + iso8601(): boolean; + jsonString(): boolean; + longerThan(string: string): boolean; + nonEmptyString(string: string): boolean; + sameLengthAs(string: string): boolean; + shorterThan(string: string): boolean; + startingWith(string: string): boolean; + whitespace(): boolean; + + //Objects + emptyObject(): boolean; + nonEmptyObject(): boolean; + + // Regular expressions + regExp(): boolean; + } } + +declare var any: jasmine.AssymetricMatchers; + From d4f54ea6c1a9d2867081c71254012bc6b0d0b105 Mon Sep 17 00:00:00 2001 From: Gilbert Date: Thu, 16 Feb 2017 11:50:23 +0100 Subject: [PATCH 009/567] fixed failing tests. Did not add any new ones though --- jasmine-expect/index.d.ts | 12 ++++---- jasmine-expect/jasmine-expect-tests.ts | 38 ++------------------------ 2 files changed, 9 insertions(+), 41 deletions(-) diff --git a/jasmine-expect/index.d.ts b/jasmine-expect/index.d.ts index f8dbc54f56..1a37f8fbe7 100644 --- a/jasmine-expect/index.d.ts +++ b/jasmine-expect/index.d.ts @@ -13,7 +13,7 @@ declare namespace jasmine { toBeArrayOfBooleans(): boolean; toBeArrayOfNumbers(): boolean; toBeArrayOfObjects(): boolean; - toBeArrayOfSize(): boolean; + toBeArrayOfSize(size: number): boolean; toBeArrayOfStrings(): boolean; toBeEmptyArray(): boolean; toBeNonEmptyArray(): boolean; @@ -50,14 +50,14 @@ declare namespace jasmine { toBeHtmlString(): boolean; toBeIso8601(): boolean; toBeJsonString(): boolean; - toBeLongerThan(): boolean; + toBeLongerThan(string: string): boolean; toBeNonEmptyString(): boolean; - toBeSameLengthAs(): boolean; - toBeShorterThan(): boolean; + toBeSameLengthAs(string: string): boolean; + toBeShorterThan(string: string): boolean; toBeString(): boolean; toBeWhitespace(): boolean; - toEndWith(): boolean; - toStartWith(): boolean; + toEndWith(string: string): boolean; + toStartWith(string: string): boolean; // Objects toBeEmptyObject(): boolean; diff --git a/jasmine-expect/jasmine-expect-tests.ts b/jasmine-expect/jasmine-expect-tests.ts index 7753cc7381..d01595a171 100644 --- a/jasmine-expect/jasmine-expect-tests.ts +++ b/jasmine-expect/jasmine-expect-tests.ts @@ -873,9 +873,11 @@ describe('toHaveArrayOfSize', function() { describeToHaveArrayX('toHaveArrayOfSize', function() { describe('when number of expected items does not match', function() { it('should deny', function() { - expect({ + var xpToFail = expect; + xpToFail({ memberName: '' }).not.toHaveArrayOfSize('memberName'); + expect({ memberName: ['bar'] }).not.toHaveArrayOfSize('memberName', 0); @@ -1877,40 +1879,6 @@ describe('toHaveWholeNumber', function() { }); }); -describe('toImplement', function() { - describe('when invoked', function() { - describe('when subject IS an Object containing all of the supplied members', function() { - it('should confirm', function() { - expect({ - a: 1, - b: 2 - }).toImplement({ - a: 1, - b: 2 - }); - expect({ - a: 1, - b: 2 - }).toImplement({ - a: 1 - }); - }); - }); - describe('when subject is NOT an Object containing all of the supplied members', function() { - it('should deny', function() { - expect({ - a: 1 - }).not.toImplement({ - c: 3 - }); - expect(null).not.toImplement({ - a: 1 - }); - }); - }); - }); -}); - describe('toStartWith', function() { describe('when invoked', function() { describe('when subject is NOT an undefined or empty string', function() { From 3479affcfe6394800fc3562be7461552c3ed1326 Mon Sep 17 00:00:00 2001 From: Yuya Tanaka Date: Wed, 15 Feb 2017 03:06:14 +0900 Subject: [PATCH 010/567] react: Fix SVGAttributes contains all HTMLAttributes --- react/index.d.ts | 21 +++++++++++++++++++-- react/test/index.ts | 3 +++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/react/index.d.ts b/react/index.d.ts index b2be91bf62..61b282dfc7 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -2203,7 +2203,25 @@ declare namespace React { // - "number | string" // - "string" // - union of string literals - interface SVGAttributes extends HTMLAttributes { + interface SVGAttributes extends DOMAttributes { + // Attributes which also defined in HTMLAttributes + // See comment in SVGDOMPropertyConfig.js + className?: string; + color?: string; + height?: number | string; + id?: string; + lang?: string; + max?: number | string; + media?: string; + method?: string; + min?: number | string; + name?: string; + style?: CSSProperties; + target?: string; + type?: string; + width?: number | string; + + // SVG Specific attributes accentHeight?: number | string; accumulate?: "none" | "sum"; additive?: "replace" | "sum"; @@ -2396,7 +2414,6 @@ declare namespace React { textRendering?: number | string; to?: number | string; transform?: string; - type?: string; u1?: number | string; u2?: number | string; underlinePosition?: number | string; diff --git a/react/test/index.ts b/react/test/index.ts index 4b00e988bf..702f1632c9 100644 --- a/react/test/index.ts +++ b/react/test/index.ts @@ -341,6 +341,9 @@ React.DOM.svg({ xmlns: "http://www.w3.org/2000/svg" }, React.DOM.rect({ + className: 'foobar', + id: 'foo', + color: 'black', x: 22, y: 10, width: 4, From a302f69580ad40511c18a61d5e8bcbdabcf4f16a Mon Sep 17 00:00:00 2001 From: Yuya Tanaka Date: Wed, 15 Feb 2017 04:30:20 +0900 Subject: [PATCH 011/567] react: Add type parameter to SVGProps --- react/index.d.ts | 108 +++++++++++++++++++++++------------------------ 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/react/index.d.ts b/react/index.d.ts index 61b282dfc7..867e066c7e 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -437,7 +437,7 @@ declare namespace React { interface ChangeTargetHTMLProps extends ChangeTargetHTMLAttributes, ClassAttributes { } - interface SVGProps extends SVGAttributes, ClassAttributes { + interface SVGProps extends SVGAttributes, ClassAttributes { } interface DOMAttributes { @@ -2810,60 +2810,60 @@ declare global { wbr: React.HTMLProps; // SVG - svg: React.SVGProps; + svg: React.SVGProps; - circle: React.SVGProps; - clipPath: React.SVGProps; - defs: React.SVGProps; - desc: React.SVGProps; - ellipse: React.SVGProps; - feBlend: React.SVGProps; - feColorMatrix: React.SVGProps; - feComponentTransfer: React.SVGProps; - feComposite: React.SVGProps; - feConvolveMatrix: React.SVGProps; - feDiffuseLighting: React.SVGProps; - feDisplacementMap: React.SVGProps; - feDistantLight: React.SVGProps; - feFlood: React.SVGProps; - feFuncA: React.SVGProps; - feFuncB: React.SVGProps; - feFuncG: React.SVGProps; - feFuncR: React.SVGProps; - feGaussianBlur: React.SVGProps; - feImage: React.SVGProps; - feMerge: React.SVGProps; - feMergeNode: React.SVGProps; - feMorphology: React.SVGProps; - feOffset: React.SVGProps; - fePointLight: React.SVGProps; - feSpecularLighting: React.SVGProps; - feSpotLight: React.SVGProps; - feTile: React.SVGProps; - feTurbulence: React.SVGProps; - filter: React.SVGProps; - foreignObject: React.SVGProps; - g: React.SVGProps; - image: React.SVGProps; - line: React.SVGProps; - linearGradient: React.SVGProps; - marker: React.SVGProps; - mask: React.SVGProps; - metadata: React.SVGProps; - path: React.SVGProps; - pattern: React.SVGProps; - polygon: React.SVGProps; - polyline: React.SVGProps; - radialGradient: React.SVGProps; - rect: React.SVGProps; - stop: React.SVGProps; - switch: React.SVGProps; - symbol: React.SVGProps; - text: React.SVGProps; - textPath: React.SVGProps; - tspan: React.SVGProps; - use: React.SVGProps; - view: React.SVGProps; + circle: React.SVGProps; + clipPath: React.SVGProps; + defs: React.SVGProps; + desc: React.SVGProps; + ellipse: React.SVGProps; + feBlend: React.SVGProps; + feColorMatrix: React.SVGProps; + feComponentTransfer: React.SVGProps; + feComposite: React.SVGProps; + feConvolveMatrix: React.SVGProps; + feDiffuseLighting: React.SVGProps; + feDisplacementMap: React.SVGProps; + feDistantLight: React.SVGProps; + feFlood: React.SVGProps; + feFuncA: React.SVGProps; + feFuncB: React.SVGProps; + feFuncG: React.SVGProps; + feFuncR: React.SVGProps; + feGaussianBlur: React.SVGProps; + feImage: React.SVGProps; + feMerge: React.SVGProps; + feMergeNode: React.SVGProps; + feMorphology: React.SVGProps; + feOffset: React.SVGProps; + fePointLight: React.SVGProps; + feSpecularLighting: React.SVGProps; + feSpotLight: React.SVGProps; + feTile: React.SVGProps; + feTurbulence: React.SVGProps; + filter: React.SVGProps; + foreignObject: React.SVGProps; + g: React.SVGProps; + image: React.SVGProps; + line: React.SVGProps; + linearGradient: React.SVGProps; + marker: React.SVGProps; + mask: React.SVGProps; + metadata: React.SVGProps; + path: React.SVGProps; + pattern: React.SVGProps; + polygon: React.SVGProps; + polyline: React.SVGProps; + radialGradient: React.SVGProps; + rect: React.SVGProps; + stop: React.SVGProps; + switch: React.SVGProps; + symbol: React.SVGProps; + text: React.SVGProps; + textPath: React.SVGProps; + tspan: React.SVGProps; + use: React.SVGProps; + view: React.SVGProps; } } } From a7ffc449a43f2ac89a4ee2a57f625663abbb9ba3 Mon Sep 17 00:00:00 2001 From: morrisjdev Date: Sun, 19 Feb 2017 21:26:34 +0100 Subject: [PATCH 012/567] Added declarations for 'linq4js' --- linq4js/index.d.ts | 286 +++++++++++++++++++++++++++++++++++++++ linq4js/linq4js-tests.ts | 5 + linq4js/tsconfig.json | 22 +++ 3 files changed, 313 insertions(+) create mode 100644 linq4js/index.d.ts create mode 100644 linq4js/linq4js-tests.ts create mode 100644 linq4js/tsconfig.json diff --git a/linq4js/index.d.ts b/linq4js/index.d.ts new file mode 100644 index 0000000000..6b98907453 --- /dev/null +++ b/linq4js/index.d.ts @@ -0,0 +1,286 @@ +// Type definitions for Linq4JS 2.0.3 +// Project: https://github.com/morrisjdev/Linq4JS +// Definitions by: Morris Janatzek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace Linq4JS { + class GeneratedEntity { + _GeneratedId_: number; + Id: number; + } +} +declare namespace Linq4JS { + class Helper { + static ConvertStringFunction: (functionString: string) => any; + static ConvertFunction: (testFunction: any) => T; + static OrderCompareFunction: (valueSelector: (item: T) => any, a: T, b: T, invert: boolean) => number; + } +} +interface Array { + Order: Array; + GroupValue: any; + /** + * Creates a copy of the array + */ + Clone(): Array; + /** + * Gets the index of the first item found by a filter + * @param filter A function (or function-string) that returns a boolean when matching element was found + */ + FindIndex(filter: ((item: T) => boolean) | string): number; + /** + * Gets the index of the last item found by a filter + * @param filter A function (or function-string) that returns a boolean when matching element was found + */ + FindLastIndex(filter: ((item: T) => boolean) | string): number; + /** + * Gets the item with the index + * @param index Item index + */ + Get(index: number): T; + /** + * Executes a method for each item in the array + * @param action A function (or function-string) that gets executed for each element. If it returns false the loop stops. + */ + ForEach(action: ((item: T, index?: number) => boolean | any) | string): Array; + /** + * Updates an object in the array + * @param object The object to update + * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array + */ + Update(object: T, primaryKeySelector?: ((item: T) => any) | string): Array; + /** + * Updates objects in the array + * @param objects The array of objects to update + * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array + */ + UpdateRange(objects: Array, primaryKeySelector?: ((item: T) => any) | string): Array; + /** + * Removes an object from the array + * @param object The object to remove + * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array + */ + Remove(object: T, primaryKeySelector?: ((item: T) => any) | string): Array; + /** + * Removes objects from the array + * @param objects The array of objects to remove + * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array + */ + RemoveRange(objects: Array, primaryKeySelector?: ((item: T) => any) | string): Array; + /** + * Adds an object to the array + * @param object The object to add + * @param generateId Auto-generate a property to identify object in later processes + */ + Add(object: T, generateId?: boolean): Array; + /** + * Adds objects to the array + * @param objects The array of objects to add + */ + AddRange(objects: Array, generateId?: boolean): Array; + /** + * Inserts an entry at a specific position + * @param object The object to insert + * @param index The position to insert + */ + Insert(object: T, index: number): Array; + /** + * Searches for all items in array that match the given filter + * @param filter A function (or function-string) that returns a boolean when matching element was found + */ + Where(filter: ((item: T, index?: number) => boolean) | string): Array; + /** + * Takes items in a specific range + * @param start The start position + * @param length The number of elements to take + */ + Range(start: number, length: number): Array; + /** + * Repeats an object in the array + * @param object The object to repeat + * @param count The count of repeats + */ + Repeat(object: T, count: number): Array; + /** + * Returns the length of the array + * @param filter If set the function returns count of elements matched by the condition + */ + Count(filter?: ((item: T) => boolean) | string): number; + /** + * Tests if all items in the array match the condition + * @param filter A function (or function-string) that returns a boolean when matching element was found + */ + All(filter: ((item: T) => boolean) | string): boolean; + /** + * Tests if any item is in the array + * @param filter If set the function tests if any item in the array matches the condition + */ + Any(filter?: ((item: T) => boolean) | string): boolean; + /** + * Returns the first item of the array - Throws an exception if no item was found + * @param filter If set the function returns the first item that matches the filter + */ + First(filter?: ((item: T) => boolean) | string): T; + /** + * Returns the first item of the array - returns `null` if no suitable item was found + * @param filter If set the function returns the first item that matches the filter + */ + FirstOrDefault(filter?: ((item: T) => boolean) | string): (T | null); + /** + * Returns the last item of the array - Throws an exception if no item was found + * @param filter If set the function returns the last item that matches the filter + */ + Last(filter?: ((item: T) => boolean) | string): T; + /** + * Returns the last item of the array - returns `null` if no suitable item was found + * @param filter If set the function returns the last item that matches the filter + */ + LastOrDefault(filter?: ((item: T) => boolean) | string): (T | null); + /** + * Select the properties for a new array + * @param selector A function (or a function-string) that returns a new object + */ + Select(selector: ((item: T) => any) | string): any[]; + /** + * Limits the number of entries taken + * @param count The count of elements taken + */ + Take(count: number): Array; + /** + * Takes entries as long as a condition is true + * @param condition The condition-function (or function-string) that returns a boolean. All elements until a false gets created are taken + * @param initial A initial-function (or function-string) that gets executed once at the start of the loop + * @param after A function that gets executed after every element-iteration after the condition-function was evaluated + */ + TakeWhile(condition: ((item: T, storage?: any) => boolean) | string, initial?: ((storage: any) => void) | string, after?: ((item: T, storage: any) => void) | string): Array; + /** + * Skips entries + * @param count The count of elements skipped + */ + Skip(count: number): Array; + /** + * Orders array by property or value in ascending direction + * @param valueSelector The selector-function (or function-string) that selects the property for sorting + */ + OrderBy(valueSelector: ((item: T) => any) | string): Array; + /** + * Orders array by additional properties in ascending direction in combination with OrderBy/OrderByDescending + * @param valueSelector The selector-function (or function-string) that selects the property for sorting + */ + ThenBy(valueSelector: ((item: T) => any) | string): Array; + /** + * Orders array by property or value in descending direction + * @param valueSelector The selector-function (or function-string) that selects the property for sorting + */ + OrderByDescending(valueSelector: ((item: T) => any) | string): Array; + /** + * Orders array by additional properties in descending direction in combination with OrderBy/OrderByDescending + * @param valueSelector The selector-function (or function-string) that selects the property for sorting + */ + ThenByDescending(valueSelector: ((item: T) => any) | string): Array; + /** + * Returns the smallest element in array + * @param valueSelector The selector-function (or function-string) that selects the property for comparison + */ + Min(valueSelector?: ((item: T) => any) | string): (T | null); + /** + * Returns the greates element in array + * @param valueSelector The selector-function (or function-string) that selects the property for comparison + */ + Max(valueSelector?: ((item: T) => any) | string): (T | null); + /** + * Groups array by property + * @param selector The selector-function (or function-string) that selects the property for grouping + */ + GroupBy(selector: ((item: T) => any) | string): Array>; + /** + * Moves an item from one index to another + * @param oldIndex The current position of the item + * @param newIndex The new position of the item + */ + Move(oldIndex: number, newIndex: number): Array; + /** + * Makes all values unique + * @param valueSelector A selector-function (or function-string) to select property for comparison and distinction + */ + Distinct(valueSelector?: ((item: T) => any) | string): Array; + /** + * Tests if array contains specific object + * @param object The object to test for + */ + Contains(object: T): boolean; + /** + * Combines two arrays + * @param array The array to combine + */ + Concat(array: Array): Array; + /** + * Combines two arrays but only applies values that are in both arrays + * @param array The array to combine + */ + Intersect(array: Array): Array; + /** + * Joins the entries by a given char + * @param character The character for joining + * @param selector A selector-function (or function-string) to select property for joining + */ + Join(character: string, selector?: ((item: T) => any) | string): string; + /** + * Combines the entries using a custom function + * @param method A function (or function-string) for aggregation + * @param startVal The value to start aggregation + */ + Aggregate(method: ((result: any, item: T) => any) | string, startVal?: any): string; + /** + * Reverses the array + */ + Reverse(): Array; + /** + * Computes the average of the elements + * @param selector A selector-function (or function-string) to select property for average computing + * @param filter If set the function computes the average of elements that match the filter + */ + Average(selector?: ((item: T) => any) | string, filter?: ((item: T) => boolean) | string): number; + /** + * Computes the sum of the elements + * @param selector A selector-function (or function-string) to select property for adding + * @param filter If set the function computes the sum of elements that match the filter + */ + Sum(selector?: ((item: T) => any) | string, filter?: ((item: T) => boolean) | string): number; + /** + * Compares to sequences of objects + * @param array The array to compare + */ + SequenceEqual(array: Array): boolean; + /** + * Combines the entries of two arrays using a custom function + * @param array The array to combine + * @param result The function (or function-string) to combine elements + */ + Zip(array: Array, result: ((first: T, second: X) => any) | string): Array; + /** + * Combines two arrays without duplicates + * @param array The array to combine + */ + Union(array: Array): Array; + /** + * Converts the array to a dictionary + * @param keySelector The selector-function (or function-string) to select property for key + * @param valueSelector A selector-function (or function-string) to select property for value + */ + ToDictionary(keySelector: ((item: T) => any) | string, valueSelector?: ((item: T) => any) | string): any; +} +declare module "linq4js" { + export = Linq4JS; +} +declare namespace Linq4JS { + class OrderEntry { + Direction: OrderDirection; + ValueSelector: (item: any) => any; + constructor(_direction: OrderDirection, _valueSelector: (item: any) => any); + } + enum OrderDirection { + Ascending = 0, + Descending = 1, + } +} diff --git a/linq4js/linq4js-tests.ts b/linq4js/linq4js-tests.ts new file mode 100644 index 0000000000..6d15649c2c --- /dev/null +++ b/linq4js/linq4js-tests.ts @@ -0,0 +1,5 @@ +import * as linq from "linq4js"; + +let array: Array = ["test", "test2", "test3", "test4", "test5"]; + +array.Add("test6").Remove("test3").Insert("test3", 2).Distinct().OrderBy(x => x).OrderByDescending(x => x).Select(x => x.length).Average(); \ No newline at end of file diff --git a/linq4js/tsconfig.json b/linq4js/tsconfig.json new file mode 100644 index 0000000000..fa4dac9326 --- /dev/null +++ b/linq4js/tsconfig.json @@ -0,0 +1,22 @@ +{ + "files": [ + "index.d.ts", + "linq4js-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "strictNullChecks": true, + "alwaysStrict": true, + "target": "es6", + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file From a8a54caf2fa90399a14615348e90d4807e2604ad Mon Sep 17 00:00:00 2001 From: morrisjdev Date: Sun, 19 Feb 2017 22:02:31 +0100 Subject: [PATCH 013/567] fixed lint --- linq4js/index.d.ts | 65 +++++++++++++++++++++------------------------ linq4js/tslint.json | 1 + 2 files changed, 32 insertions(+), 34 deletions(-) create mode 100644 linq4js/tslint.json diff --git a/linq4js/index.d.ts b/linq4js/index.d.ts index 6b98907453..4fe054d5fc 100644 --- a/linq4js/index.d.ts +++ b/linq4js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Linq4JS 2.0.3 +// Type definitions for Linq4JS 2.0 // Project: https://github.com/morrisjdev/Linq4JS // Definitions by: Morris Janatzek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -17,12 +17,12 @@ declare namespace Linq4JS { } } interface Array { - Order: Array; + Order: Linq4JS.OrderEntry[]; GroupValue: any; /** * Creates a copy of the array */ - Clone(): Array; + Clone(): T[]; /** * Gets the index of the first item found by a filter * @param filter A function (or function-string) that returns a boolean when matching element was found @@ -42,65 +42,65 @@ interface Array { * Executes a method for each item in the array * @param action A function (or function-string) that gets executed for each element. If it returns false the loop stops. */ - ForEach(action: ((item: T, index?: number) => boolean | any) | string): Array; + ForEach(action: ((item: T, index?: number) => boolean | any) | string): T[]; /** * Updates an object in the array * @param object The object to update * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array */ - Update(object: T, primaryKeySelector?: ((item: T) => any) | string): Array; + Update(object: T, primaryKeySelector?: ((item: T) => any) | string): T[]; /** * Updates objects in the array * @param objects The array of objects to update * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array */ - UpdateRange(objects: Array, primaryKeySelector?: ((item: T) => any) | string): Array; + UpdateRange(objects: T[], primaryKeySelector?: ((item: T) => any) | string): T[]; /** * Removes an object from the array * @param object The object to remove * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array */ - Remove(object: T, primaryKeySelector?: ((item: T) => any) | string): Array; + Remove(object: T, primaryKeySelector?: ((item: T) => any) | string): T[]; /** * Removes objects from the array * @param objects The array of objects to remove * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array */ - RemoveRange(objects: Array, primaryKeySelector?: ((item: T) => any) | string): Array; + RemoveRange(objects: T[], primaryKeySelector?: ((item: T) => any) | string): T[]; /** * Adds an object to the array * @param object The object to add * @param generateId Auto-generate a property to identify object in later processes */ - Add(object: T, generateId?: boolean): Array; + Add(object: T, generateId?: boolean): T[]; /** * Adds objects to the array * @param objects The array of objects to add */ - AddRange(objects: Array, generateId?: boolean): Array; + AddRange(objects: T[], generateId?: boolean): T[]; /** * Inserts an entry at a specific position * @param object The object to insert * @param index The position to insert */ - Insert(object: T, index: number): Array; + Insert(object: T, index: number): T[]; /** * Searches for all items in array that match the given filter * @param filter A function (or function-string) that returns a boolean when matching element was found */ - Where(filter: ((item: T, index?: number) => boolean) | string): Array; + Where(filter: ((item: T, index?: number) => boolean) | string): T[]; /** * Takes items in a specific range * @param start The start position * @param length The number of elements to take */ - Range(start: number, length: number): Array; + Range(start: number, length: number): T[]; /** * Repeats an object in the array * @param object The object to repeat * @param count The count of repeats */ - Repeat(object: T, count: number): Array; + Repeat(object: T, count: number): T[]; /** * Returns the length of the array * @param filter If set the function returns count of elements matched by the condition @@ -145,39 +145,39 @@ interface Array { * Limits the number of entries taken * @param count The count of elements taken */ - Take(count: number): Array; + Take(count: number): T[]; /** * Takes entries as long as a condition is true * @param condition The condition-function (or function-string) that returns a boolean. All elements until a false gets created are taken * @param initial A initial-function (or function-string) that gets executed once at the start of the loop * @param after A function that gets executed after every element-iteration after the condition-function was evaluated */ - TakeWhile(condition: ((item: T, storage?: any) => boolean) | string, initial?: ((storage: any) => void) | string, after?: ((item: T, storage: any) => void) | string): Array; + TakeWhile(condition: ((item: T, storage?: any) => boolean) | string, initial?: ((storage: any) => void) | string, after?: ((item: T, storage: any) => void) | string): T[]; /** * Skips entries * @param count The count of elements skipped */ - Skip(count: number): Array; + Skip(count: number): T[]; /** * Orders array by property or value in ascending direction * @param valueSelector The selector-function (or function-string) that selects the property for sorting */ - OrderBy(valueSelector: ((item: T) => any) | string): Array; + OrderBy(valueSelector: ((item: T) => any) | string): T[]; /** * Orders array by additional properties in ascending direction in combination with OrderBy/OrderByDescending * @param valueSelector The selector-function (or function-string) that selects the property for sorting */ - ThenBy(valueSelector: ((item: T) => any) | string): Array; + ThenBy(valueSelector: ((item: T) => any) | string): T[]; /** * Orders array by property or value in descending direction * @param valueSelector The selector-function (or function-string) that selects the property for sorting */ - OrderByDescending(valueSelector: ((item: T) => any) | string): Array; + OrderByDescending(valueSelector: ((item: T) => any) | string): T[]; /** * Orders array by additional properties in descending direction in combination with OrderBy/OrderByDescending * @param valueSelector The selector-function (or function-string) that selects the property for sorting */ - ThenByDescending(valueSelector: ((item: T) => any) | string): Array; + ThenByDescending(valueSelector: ((item: T) => any) | string): T[]; /** * Returns the smallest element in array * @param valueSelector The selector-function (or function-string) that selects the property for comparison @@ -192,18 +192,18 @@ interface Array { * Groups array by property * @param selector The selector-function (or function-string) that selects the property for grouping */ - GroupBy(selector: ((item: T) => any) | string): Array>; + GroupBy(selector: ((item: T) => any) | string): T[][]; /** * Moves an item from one index to another * @param oldIndex The current position of the item * @param newIndex The new position of the item */ - Move(oldIndex: number, newIndex: number): Array; + Move(oldIndex: number, newIndex: number): T[]; /** * Makes all values unique * @param valueSelector A selector-function (or function-string) to select property for comparison and distinction */ - Distinct(valueSelector?: ((item: T) => any) | string): Array; + Distinct(valueSelector?: ((item: T) => any) | string): T[]; /** * Tests if array contains specific object * @param object The object to test for @@ -213,12 +213,12 @@ interface Array { * Combines two arrays * @param array The array to combine */ - Concat(array: Array): Array; + Concat(array: T[]): T[]; /** * Combines two arrays but only applies values that are in both arrays * @param array The array to combine */ - Intersect(array: Array): Array; + Intersect(array: T[]): T[]; /** * Joins the entries by a given char * @param character The character for joining @@ -234,7 +234,7 @@ interface Array { /** * Reverses the array */ - Reverse(): Array; + Reverse(): T[]; /** * Computes the average of the elements * @param selector A selector-function (or function-string) to select property for average computing @@ -251,18 +251,18 @@ interface Array { * Compares to sequences of objects * @param array The array to compare */ - SequenceEqual(array: Array): boolean; + SequenceEqual(array: T[]): boolean; /** * Combines the entries of two arrays using a custom function * @param array The array to combine * @param result The function (or function-string) to combine elements */ - Zip(array: Array, result: ((first: T, second: X) => any) | string): Array; + Zip(array: X[], result: ((first: T, second: X) => any) | string): any[]; /** * Combines two arrays without duplicates * @param array The array to combine */ - Union(array: Array): Array; + Union(array: T[]): T[]; /** * Converts the array to a dictionary * @param keySelector The selector-function (or function-string) to select property for key @@ -270,9 +270,6 @@ interface Array { */ ToDictionary(keySelector: ((item: T) => any) | string, valueSelector?: ((item: T) => any) | string): any; } -declare module "linq4js" { - export = Linq4JS; -} declare namespace Linq4JS { class OrderEntry { Direction: OrderDirection; @@ -283,4 +280,4 @@ declare namespace Linq4JS { Ascending = 0, Descending = 1, } -} +} \ No newline at end of file diff --git a/linq4js/tslint.json b/linq4js/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/linq4js/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 0b19c9cf595d7db45f437e035c762addf99f975e Mon Sep 17 00:00:00 2001 From: morrisjdev Date: Sun, 19 Feb 2017 22:03:08 +0100 Subject: [PATCH 014/567] fixed version --- linq4js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linq4js/index.d.ts b/linq4js/index.d.ts index 4fe054d5fc..e108f31a4c 100644 --- a/linq4js/index.d.ts +++ b/linq4js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Linq4JS 2.0 +// Type definitions for Linq4JS 2.1 // Project: https://github.com/morrisjdev/Linq4JS // Definitions by: Morris Janatzek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 36a25dcc742b344e98372f9cff9efadc02f2648c Mon Sep 17 00:00:00 2001 From: morrisjdev Date: Sun, 19 Feb 2017 22:19:41 +0100 Subject: [PATCH 015/567] fixed tsconfig.json --- linq4js/linq4js-tests.ts | 2 +- linq4js/tsconfig.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/linq4js/linq4js-tests.ts b/linq4js/linq4js-tests.ts index 6d15649c2c..9e0bbe7be5 100644 --- a/linq4js/linq4js-tests.ts +++ b/linq4js/linq4js-tests.ts @@ -1,4 +1,4 @@ -import * as linq from "linq4js"; +import "linq4js"; let array: Array = ["test", "test2", "test3", "test4", "test5"]; diff --git a/linq4js/tsconfig.json b/linq4js/tsconfig.json index fa4dac9326..2c6f199057 100644 --- a/linq4js/tsconfig.json +++ b/linq4js/tsconfig.json @@ -16,6 +16,9 @@ "../" ], "types": [], + "lib":[ + "es6" + ], "noEmit": true, "forceConsistentCasingInFileNames": true } From 32b84dfb0bb755753ed03a3cafb809cffac2426b Mon Sep 17 00:00:00 2001 From: morrisjdev Date: Sun, 19 Feb 2017 22:25:18 +0100 Subject: [PATCH 016/567] tsconfig.json fix 2 --- linq4js/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/linq4js/tsconfig.json b/linq4js/tsconfig.json index 2c6f199057..f053fa2e23 100644 --- a/linq4js/tsconfig.json +++ b/linq4js/tsconfig.json @@ -9,7 +9,6 @@ "noImplicitReturns": true, "noImplicitThis": true, "strictNullChecks": true, - "alwaysStrict": true, "target": "es6", "baseUrl": "../", "typeRoots": [ From 525ba9bf9cc9f497b1b5cf19438e26361f672feb Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Mon, 20 Feb 2017 13:58:02 +0900 Subject: [PATCH 017/567] Add missing file --- redux-persist-transform-encrypt/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/redux-persist-transform-encrypt/tsconfig.json b/redux-persist-transform-encrypt/tsconfig.json index 0537c9d89a..e101982e56 100644 --- a/redux-persist-transform-encrypt/tsconfig.json +++ b/redux-persist-transform-encrypt/tsconfig.json @@ -18,6 +18,7 @@ "noUnusedLocals": true }, "files": [ + "async.d.ts", "index.d.ts", "redux-persist-transform-encrypt-tests.ts" ] From d8edccd12a27b614e78d88342edde56379963ee8 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Mon, 20 Feb 2017 03:11:11 +0000 Subject: [PATCH 018/567] Initial commit for v17 of openfin api --- openfin/index.d.ts | 45 +- openfin/openfin-tests.ts | 6 +- openfin/v16/index.d.ts | 1581 ++++++++++++++++++++++++++++++++++ openfin/v16/openfin-tests.ts | 724 ++++++++++++++++ openfin/v16/tsconfig.json | 25 + openfin/v16/tslint.json | 1 + 6 files changed, 2373 insertions(+), 9 deletions(-) create mode 100644 openfin/v16/index.d.ts create mode 100644 openfin/v16/openfin-tests.ts create mode 100644 openfin/v16/tsconfig.json create mode 100644 openfin/v16/tslint.json diff --git a/openfin/index.d.ts b/openfin/index.d.ts index 2c1cfd648e..893a253606 100644 --- a/openfin/index.d.ts +++ b/openfin/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for OpenFin API 16.0 +// Type definitions for OpenFin API 17.0 // Project: https://openfin.co/ // Definitions by: Chris Barker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// based on v6.49.16.16 +// based on v6.49.17.14 // see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean /** @@ -63,7 +63,7 @@ declare namespace fin { */ close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Retrieves an array of wrapped fin.desktop.Windows for each of the applications child windows. + * Retrieves an array of wrapped fin.desktop.Windows for each of the application�s child windows. */ getChildWindows(callback?: (children: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; /** @@ -82,6 +82,10 @@ declare namespace fin { * Retrieves current configuration of application's shortcuts. */ getShortcuts(callback?: (config: ShortCutConfig) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves information about the application. + */ + getInfo(callback?: (info: LaunchInfo) => void, errorCallback?: (reason: string) => void): void; /** * Determines if the application is currently running. */ @@ -95,7 +99,7 @@ declare namespace fin { */ removeEventListener(type: OpenFinApplicationEventType, previouslyRegisteredListener: (event: ApplicationBaseEvent | TrayIconClickedEvent | WindowEvent | WindowAlertRequestedEvent | WindowAuthRequested | WindowNavigationRejectedEvent | WindowEndLoadEvent) => any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Removes the applications icon from the tray. + * Removes the application�s icon from the tray. */ removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -185,10 +189,13 @@ declare namespace fin { */ accelerator?: { devtools?: boolean, - zoom?: boolean + zoom?: boolean, + reload?: boolean, + reloadIgnoreCache?: boolean, }; /** * A flag to always position the window at the top of the window stack. Default: false. + * Updatable */ alwaysOnTop?: boolean; /** @@ -197,10 +204,12 @@ declare namespace fin { autoShow?: boolean; /** * A flag to show the context menu when right-clicking on a window. Gives access to the Developer Console for the Window. Default: true + * Updatable */ contextMenu?: boolean; /** * This defines and applies rounded corners for a frameless window. Default for both width and height: 0. + * Updatable */ cornerRounding?: { width?: number; @@ -232,30 +241,37 @@ declare namespace fin { defaultLeft?: number; /** * A flag to show the frame. Default: true. + * Updatable */ frame?: boolean; /** * A flag to allow a window to be hidden when the close button is clicked.Default: false. + * Updatable */ hideOnClose?: boolean; /** * A URL for the icon to be shown in the window title bar and the taskbar.Default: The parent application's applicationIcon. + * Updatable */ icon?: string; /** * The maximum height of a window.Will default to the OS defined value if set to - 1. Default: -1. + * Updatable */ maxHeight?: number; /** * A flag that lets the window be maximized.Default: true. + * Updatable */ maximizable?: boolean; /** * The maximum width of a window.Will default to the OS defined value if set to - 1. Default: -1. + * Updatable */ maxWidth?: number; /** * The minimum height of a window.Default: 0. + * Updatable */ minHeight?: number; /** @@ -272,14 +288,17 @@ declare namespace fin { name?: string; /** * A flag that specifies how transparent the window will be.This value is clamped between 0.0 and 1.0.Default: 1.0. + * Updatable */ opacity?: number; /** * A flag to drop to allow the user to resize the window.Default: true. + * Updatable */ resizable?: boolean; /** * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. + * Updatable */ resizeRegion?: { /** @@ -989,7 +1008,7 @@ declare namespace fin { bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Closes the window. - * @param {force} Close will be prevented from closing when force is false and close-requested has been subscribed to for applications main window. + * @param {force} Close will be prevented from closing when force is false and �close-requested� has been subscribed to for application�s main window. */ close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1009,7 +1028,7 @@ declare namespace fin { */ enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Flashes the windows frame and taskbar icon until the window is activated. + * Flashes the window�s frame and taskbar icon until the window is activated. */ flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1106,7 +1125,7 @@ declare namespace fin { setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Shows the window if it is hidden. - * @param {force} Show will be prevented from closing when force is false and show-requested has been subscribed to for applications main window. + * @param {force} Show will be prevented from closing when force is false and �show-requested� has been subscribed to for application�s main window. */ show(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1500,6 +1519,16 @@ declare namespace fin { type: "session-changed"; } + interface LaunchInfo { + launchMode: "fin-protocol" + | "fins-protocol" + | "shortcut" + | "command-line" + | "adapter" + | "other" + | string; + } + type OpenFinTweenType = "linear" | "ease-in" | "ease-out" diff --git a/openfin/openfin-tests.ts b/openfin/openfin-tests.ts index 81ac24f937..ae5fe587d3 100644 --- a/openfin/openfin-tests.ts +++ b/openfin/openfin-tests.ts @@ -1,6 +1,6 @@ function test_application() { let application: fin.OpenFinApplication; - // constructor + // constructor application = new fin.desktop.Application({ url: "application.html", uuid: "74BED629-2D8E-4141-8582-73E364BDFA74", @@ -69,6 +69,10 @@ console.log("Start Menu shortcut is enabled: ", config.startMenu); console.log("System Startup shortcut is enabled: ", config.systemStartup); }); + // getInfo + application.getInfo(info => { + console.log(`Launch mode: ${info.launchMode}`); + }); // isRunning application.isRunning(function (running) { console.log("the application is", running ? "running" : "not running"); diff --git a/openfin/v16/index.d.ts b/openfin/v16/index.d.ts new file mode 100644 index 0000000000..2c1cfd648e --- /dev/null +++ b/openfin/v16/index.d.ts @@ -0,0 +1,1581 @@ +// Type definitions for OpenFin API 16.0 +// Project: https://openfin.co/ +// Definitions by: Chris Barker +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// based on v6.49.16.16 +// see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean + +/** + * JavaScript API + * The JavaScript API allows you to create an HTML/JavaScript application that has access to the native windowing environment, can communicate with other applications and has access to sandboxed system-level features. + * + * API Ready + * When using the OpenFin API, it is important to ensure that it has been fully loaded before making any API calls. To verify that the API is in fact ready, be sure to make any API calls either from within the fin.desktop.main() method or explicitly after it has returned. This avoids the situation of trying to access methods that are not yet fully injected. + * + * Overview + * When running within the OpenFin Runtime your web applications have access to the "fin" namespace and all the modules within the API without the need to include additional source files. You can treat the "fin" namespace as you would the "window", "navigator" or "document" objects. + **/ +declare namespace fin { + const desktop: OpenFinDesktop; + + interface OpenFinDesktop { + main(f: () => any): void; + Application: OpenFinApplicationStatic; + ExternalApp: OpenFinExternalApplicationStatic; + InterApplicationBus: OpenFinInterApplicationBus; + Notification: OpenFinNotificationStatic; + System: OpenFinSystem; + Window: OpenFinWindowStatic; + } + + interface OpenFinApplicationStatic { + /** + * Creates a new Application. + * An object representing an application. Allows the developer to create, execute, show/close an application as well as listen to application events. + */ + new (options: ApplicationOptions, callback?: (successObj: { httpResponseCode: number }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinApplication; + /** + * Returns an Application object that represents an existing application. + */ + getCurrent(): OpenFinApplication; + /** + * Returns an Application object that represents an existing application. + */ + wrap(uuid: string): OpenFinApplication; + } + + /** + * Application + * An object representing an application.Allows the developer to create, execute, show / close an application as well as listen to application events. + */ + interface OpenFinApplication { + /** + * Returns an instance of the main Window of the application + */ + getWindow(): OpenFinWindow; + /** + * Registers an event listener on the specified event. + */ + addEventListener(type: OpenFinApplicationEventType, listener: (event: ApplicationBaseEvent | TrayIconClickedEvent | WindowEvent | WindowAlertRequestedEvent | WindowAuthRequested | WindowNavigationRejectedEvent | WindowEndLoadEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Closes the application and any child windows created by the application. + */ + close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of wrapped fin.desktop.Windows for each of the applications child windows. + */ + getChildWindows(callback?: (children: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of active window groups for all of the application's windows. Each group is represented as an array of wrapped fin.desktop.Windows. + */ + getGroups(callback?: (groups: OpenFinWindow[][]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the JSON manifest that was used to create the application. Invokes the error callback if the application was not created from a manifest. + */ + getManifest(callback?: (manifest: any) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves UUID of the application that launches this application. Invokes the error callback if the application was created from a manifest. + */ + getParentUuid(callback?: (uuid: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves current configuration of application's shortcuts. + */ + getShortcuts(callback?: (config: ShortCutConfig) => void, errorCallback?: (reason: string) => void): void; + /** + * Determines if the application is currently running. + */ + isRunning(callback?: (running: boolean) => void, errorCallback?: (reason: string) => void): void; + /** + * Passes in custom data that will be relayed to the RVM + */ + registerCustomData(data: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener(type: OpenFinApplicationEventType, previouslyRegisteredListener: (event: ApplicationBaseEvent | TrayIconClickedEvent | WindowEvent | WindowAlertRequestedEvent | WindowAuthRequested | WindowNavigationRejectedEvent | WindowEndLoadEvent) => any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes the applications icon from the tray. + */ + removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Restarts the application. + */ + restart(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Runs the application. When the application is created, run must be called. + */ + run(callback?: (successObj: SuccessObj) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): void; + /** + * Tells the rvm to relaunch the main application once upon a complete shutdown + */ + scheduleRestart(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets new shortcut configuration for current application. Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest to be able to change shortcut states. + */ + setShortcuts(config: ShortCutConfig, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Adds a customizable icon in the system tray and notifies the application when clicked. + */ + setTrayIcon(iconUrl: string, listener: (clickInfo: TrayIconClickedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Closes the application by terminating its process. + */ + terminate(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Waits for a hanging application. This method can be called in response to an application "not-responding" to allow the application to continue and to generate another "not-responding" message after a certain period of time. + */ + wait(callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface ShortCutConfig { + /** + * application has a shortcut on the desktop + */ + desktop?: boolean; + /** + * application has no shortcut in the start menu + */ + startMenu?: boolean; + /** + * application will be launched on system startup + */ + systemStartup?: boolean; + } + + interface SuccessObj { + httpResponseCode: number; + } + + interface NetworkErrorInfo extends ErrorInfo { + networkErrorCode: number; + } + + interface ErrorInfo { + stack: string; + message: string; + } + + interface ApplicationOptions { + /** + * The name of the application. + */ + name?: string; + /** + * The url to the application. + */ + url?: string; + /** + * The UUID of the application, unique within the set of all other applications running in the OpenFin Runtime. name and uuid must match. + */ + uuid?: string; + /** + * Enable Flash at the application level. Default: false. + */ + plugins?: boolean; + /** + * The options of the main window of the application. + */ + mainWindowOptions?: WindowOptions; + } + + interface WindowOptions { + /** + * Enable keyboard shortcuts for devtools and zoom. Default: false for both. + */ + accelerator?: { + devtools?: boolean, + zoom?: boolean + }; + /** + * A flag to always position the window at the top of the window stack. Default: false. + */ + alwaysOnTop?: boolean; + /** + * A flag to automatically show the Window when it is created. Default: false. + */ + autoShow?: boolean; + /** + * A flag to show the context menu when right-clicking on a window. Gives access to the Developer Console for the Window. Default: true + */ + contextMenu?: boolean; + /** + * This defines and applies rounded corners for a frameless window. Default for both width and height: 0. + */ + cornerRounding?: { + width?: number; + height?: number; + }; + /** + * A field that the user can attach serializable data to to be ferried around with the window options. Default: ''. + */ + customData?: any; + /** + * Specifies that the window will be positioned in the center of the primary monitor when loaded for the first time on a machine. When the window corresponding to that id is loaded again, the position from before the window was closed is used. This option overrides defaultLeft and defaultTop. Default: false. + */ + defaultCentered?: boolean; + /** + * The default height of the window. Specifies the height of the window when loaded for the first time on a machine. When the window corresponding to that id is loaded again, the height is taken to be the last height of the window before it was closed. Default: 500. + */ + defaultHeight?: number; + /** + * The default left position of the window. Specifies the position of the left of the window when loaded for the first time on a machine. When the window corresponding to that id is loaded again, the value of left is taken to be the last value before the window was closed. Default: 100. + */ + defaultWidth?: number; + /** + * The default top position of the window. Specifies the position of the top of the window when loaded for the first time on a machine. When the window corresponding to that id is loaded again, the value of top is taken to be the last value before the window was closed. Default: 100. + */ + defaultTop?: number; + /** + * The default width of the window. Specifies the width of the window when loaded for the first time on a machine. When the window corresponding to that id is loaded again, the width is taken to be the last width of the window before it was closed. Default: 800. + */ + defaultLeft?: number; + /** + * A flag to show the frame. Default: true. + */ + frame?: boolean; + /** + * A flag to allow a window to be hidden when the close button is clicked.Default: false. + */ + hideOnClose?: boolean; + /** + * A URL for the icon to be shown in the window title bar and the taskbar.Default: The parent application's applicationIcon. + */ + icon?: string; + /** + * The maximum height of a window.Will default to the OS defined value if set to - 1. Default: -1. + */ + maxHeight?: number; + /** + * A flag that lets the window be maximized.Default: true. + */ + maximizable?: boolean; + /** + * The maximum width of a window.Will default to the OS defined value if set to - 1. Default: -1. + */ + maxWidth?: number; + /** + * The minimum height of a window.Default: 0. + */ + minHeight?: number; + /** + * A flag that lets the window be minimized.Default: true. + */ + minimizable?: boolean; + /** + * The minimum width of a window.Default: 0. + */ + minWidth?: number; + /** + * The name for the window which must be unique within the context of the invoking Application. + */ + name?: string; + /** + * A flag that specifies how transparent the window will be.This value is clamped between 0.0 and 1.0.Default: 1.0. + */ + opacity?: number; + /** + * A flag to drop to allow the user to resize the window.Default: true. + */ + resizable?: boolean; + /** + * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. + */ + resizeRegion?: { + /** + * The size in pixels (Default: 2), + */ + size?: number; + /** + * The size in pixels of an additional + * square resizable region located at the + * bottom right corner of a + * frameless window. (Default: 4) + */ + bottomRightCorner?: number; + }; + /** + * A flag to show the Window's icon in the taskbar. Default: true. + */ + showTaskbarIcon?: boolean; + /** + * A flag to cache the location of the window or not. Default: true. + */ + saveWindowState?: boolean; + /** + * Specify a taskbar group for the window. Default: app's uuid. + */ + taskbarIconGroup?: string; + /** + * A string that sets the window to be "minimized", "maximized", or "normal" on creation. Default: "normal". + */ + state?: string; + /** + * The URL of the window. Default: "about:blank". + */ + url?: string; + /** + * When set to false, the window will render before the "load" event is fired on the content's window. Caution, when false you will see an initial empty white window. Default: true. + */ + waitForPageLoad?: boolean; + } + + /** + * Clipboard + * Clipboard API allows reading and writting to the clipboard in multiple formats. + */ + interface OpenFinClipboard { + /** + * Reads available formats for the clipboard type + */ + availableFormats(type: string | null, callback?: (formats: string[]) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Reads available formats for the clipboard type + */ + readHtml(type: string | null, callback?: (html: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Read the content of the clipboard as Rtf + */ + readRtf(type: string | null, callback?: (rtf: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Read the content of the clipboard as plain text + */ + readText(type: string | null, callback?: (text: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard + */ + write(data: any, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard as Html + */ + writeHtml(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard as Rtf + */ + writeRtf(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Writes data into the clipboard as plain text + */ + writeText(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + } + + interface OpenFinExternalApplicationStatic { + /** + * Returns an External Application object that represents an existing external application. + */ + wrap(uuid: string): OpenFinExternalApplication; + } + /** + * ExternalApplication + * An object representing an application. Allows the developer to create, execute, show and close an application, as well as listen to application events. + */ + interface OpenFinExternalApplication { + /** + * Registers an event listener on the specified event. + */ + addEventListener(type: OpenFinExternalApplicationEventType, listener: () => void, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener(type: OpenFinExternalApplicationEventType, listener: () => void, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + } + + /** + * InterApplicationBus + * A messaging bus that allows for pub/sub messaging between different applications. + */ + interface OpenFinInterApplicationBus { + /** + * Adds a listener that gets called when applications subscribe to the current application's messages. + */ + addSubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Adds a listener that gets called when applications unsubscribe to the current application's messages. + */ + addUnsubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Removes a previously registered subscribe listener. + */ + removeSubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Removes a previously registered unsubscribe listener. + */ + removeUnsubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; + /** + * Publishes a message to all applications running on OpenFin Runtime that are subscribed to the specified topic. + */ + publish(topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sends a message to a specific application on a specific topic. + */ + send(destinationUuid: string, name: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + send(destinationUuid: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Subscribes to messages from the specified application on the specified topic. If the subscription is for a uuid, [name], topic combination that has already been published to upon subscription you will receive the last 20 missed messages in the order they were published. + */ + subscribe(senderUuid: string, name: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + subscribe(senderUuid: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Unsubscribes to messages from the specified application on the specified topic. + */ + unsubscribe(senderUuid: string, name: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + unsubscribe(senderUuid: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface OpenFinNotificationStatic { + /** + * ctor + */ + new (options: NotificationOptions, callback?: () => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinNotification; + /** + * Gets an instance of the current notification. For use within a notification window to close the window or send a message back to its parent application. + */ + getCurrent(): OpenFinNotification; + } + + /** + * Notification + * Notification represents a window on OpenFin Runtime which is shown briefly to the user on the bottom-right corner of the primary monitor. A notification is typically used to alert the user of some important event which requires his or her attention. Notifications are a child or your application that are controlled by the runtime. + */ + interface OpenFinNotification { + /** + * Closes the notification. + */ + close(callback?: () => void): void; + /** + * Sends a message to the notification. + */ + sendMessage(message: any, callback?: () => void): void; + /** + * Sends a message from the notification to the application that created the notification. The message is handled by the notification's onMessage callback. + */ + sendMessageToApplication(message: any, callback?: () => void): void; + } + + interface NotificationOptions { + /** + * A boolean that will force dismissal even if the mouse is hovering over the notification + */ + ignoreMouseOver?: boolean; + /** + * A message of any primitive or composite-primitive type to be passed to the notification upon creation. + */ + message?: any; + /** + * The timeout for displaying a notification.Can be in milliseconds or "never". + */ + duration?: number | "never"; + /** + * The url of the notification + */ + url?: string; + /** + * A function that is called when a notification is clicked. + */ + onClick?(callback: () => void): void; + /** + * Invoked when the notification is closed via .close() method on the created notification instance or the by the notification itself via fin.desktop.Notification.getCurrent().close(). NOTE: this is not invoked when the notification is dismissed via a swipe. For the swipe dismissal callback see onDismiss + */ + onClose?(callback: () => void): void; + /** + * Invoked when a the notification is dismissed by swiping it off the screen to the right. NOTE: this is no fired on a programmatic close. + */ + onDismiss?(callback: () => void): void; + /** + * A function that is called when an error occurs.The reason for the error is passed as an argument. + */ + onError?(errorCallback: (reason: string, errorObj: NetworkErrorInfo) => void): void; + /** + * The onMessage function will respond to messages sent from notification.sendMessageToApplication.The function is passed the message, which can be of any primitive or composite-primitive type. + */ + onMessage?(callback: (message: any) => void): void; + /** + * A function that is called when a notification is shown. + */ + onShow?(callback: (successObj: SuccessObj) => void): void; + } + + /** + * System + * An object representing the core of OpenFin Runtime. Allows the developer to perform system-level actions, such as accessing logs, viewing processes, clearing the cache and exiting the runtime. + */ + interface OpenFinSystem { + /** + * + */ + Clipboard: OpenFinClipboard; + /** + * Registers an event listener on the specified event. + */ + addEventListener(type: OpenFinSystemEventType, listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Clears cached data containing window state/positions, application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage. + */ + clearCache(options: CacheOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Clears all cached data when OpenFin Runtime exits. + */ + deleteCacheOnExit(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Downloads the given application asset + */ + downloadAsset(assetObj: AppAssetInfo, progressListener?: (progress: { downloadedBytes: number, totalBytes: number }) => void, callback?: (successObj: { path: string }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): void; + /** + * Exits the Runtime. + */ + exit(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data for all applications. + */ + getAllApplications(callback?: (applicationInfoList: ApplicationInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data for all external applications. + */ + getAllExternalApplications(callback?: (applicationInfoList: ApplicationInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of data (name, ids, bounds) for all application windows. + */ + getAllWindows(callback?: (windowInfoList: WindowDetails[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the command line argument string that started OpenFin Runtime. + */ + getCommandLineArguments(callback?: (args: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the configuration object that started the OpenFin Runtime. + */ + getDeviceId(callback?: (uuid: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the value of a given environment variable on the computer on which the runtime is installed. + */ + getEnvironmentVariable(envVar: string, callback?: (variable: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves system information. + */ + getHostSpecs(callback?: (info: HostSpecInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the contents of the log with the specified filename. + */ + getLog(logFileName: string, callback?: (variable: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array containing information for each log file. + */ + getLogList(callback?: (logInfoList: LogInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an object that contains data about the about the monitor setup of the computer that the runtime is running on. + */ + getMonitorInfo(callback?: (monitorInfo: MonitorInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the mouse in virtual screen coordinates (left, top). + */ + getMousePosition(callback?: (mousePosition: VirtualScreenCoordinates) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array of all of the runtime processes that are currently running. Each element in the array is an object containing the uuid and the name of the application to which the process belongs. + */ + getProcessList(callback?: (processInfoList: ProcessInfo[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves the Proxy settings. + */ + getProxySettings(callback?: (proxy: ProxyInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns information about the running RVM in an object. + */ + getRvmInfo(callback?: (rvmInfo: RvmInfo) => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the version of the runtime. The version contains the major, minor, build and revision numbers. + */ + getVersion(callback?: (version: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Runs an executable or batch file. + */ + launchExternalProcess(options: ExternalProcessLaunchInfo, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; + /** + * Writes the passed message into both the log file and the console. + */ + log(level: "debug" | "info" | "warn" | "error", message: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Monitors a running process. + */ + monitorExternalProcess(options: ExternalProcessInfo, callback?: (payload: { uuid: string }) => void, errorCallback?: (reason: string) => void): void; + /** + * Opens the passed URL in the default web browser. + */ + openUrlWithBrowser(url: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * This function call will register a unique id and produce a token. The token can be used to broker an external connection. + */ + registerExternalConnection(uuid: string, callback?: (detail: { + /** + * this will be unique each time + */ + token: string; + /** + * "remote-connection-uuid" + */ + uuid: string; + }) => void, errorCallback?: (reason: string) => void): void; + /** + * Removes the process entry for the passed UUID obtained from a prior call of fin.desktop.System.launchExternalProcess(). + */ + releaseExternalProcess(processUuid: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener(type: OpenFinSystemEventType, listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the Chrome Developer Tools for the specified window. + */ + showDeveloperTools(uuid: string, name: string, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Attempt to close an external process. The process will be terminated if it has not closed after the elapsed timeout in milliseconds. + */ + terminateExternalProcess(processUuid: string, timeout: number, killTree: boolean, callback?: (info: { result: "clean" | "terminated" | "failed" }) => void, errorCallback?: (reason: string) => void): void; + terminateExternalProcess(processUuid: string, timeout: number, callback?: (info: { result: "clean" | "terminated" | "failed" }) => void, errorCallback?: (reason: string) => void): void; + /** + * Update the OpenFin Runtime Proxy settings. + */ + updateProxySettings(type: string, address: string, port: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + + } + + interface CacheOptions { + cache?: boolean; + cookies?: boolean; + localStorage?: boolean; + appcache?: boolean; + userData?: boolean; + } + + interface AppAssetInfo { + src?: string; + alias?: string; + version?: string; + target?: string; + args?: string; + } + + interface ApplicationInfo { + /** + * true when the application is running. + */ + isRunning?: boolean; + /** + * uuid of the application. + */ + uuid?: string; + /** + * uuid of the application that launches this application. + */ + parentUuid?: string; + } + + interface WindowDetails { + uuid?: string; + mainWindow?: WindowInfo; + childWindows?: WindowInfo[]; + } + + interface WindowInfo { + /** + * name of the child window + */ + name?: string; + /** + * top-most coordinate of the child window + */ + top?: number; + /** + * right-most coordinate of the child window + */ + right?: number; + /** + * bottom-most coordinate of the child window + */ + bottom?: number; + /** + * left-most coordinate of the child window + */ + left?: number; + } + + interface HostSpecInfo { + /** + * "x86" for 32-bit or "x86_64" for 64-bit + */ + arch: string; + /** + * Same payload as Node's os.cpus() + */ + cpus: NodeCpuInfo[]; + /** + * + */ + gpu: { + /** + * Graphics card name + */ + name: string; + }; + /** + * Same payload as Node's os.totalmem() + */ + memory: number; + /** + * OS name and version/edition + */ + name: string; + } + + interface NodeCpuInfo { + model: string; + /** + * in MHz + */ + speed: number; + times: { + /** + * The number of milliseconds the CPU has spent in user mode. + */ + user: number; + /** + * The number of milliseconds the CPU has spent in nice mode. + */ + nice: number; + /** + * The number of milliseconds the CPU has spent in sys mode. + */ + sys: number; + /** + * The number of milliseconds the CPU has spent in idle mode. + */ + idle: number; + /** + * The number of milliseconds the CPU has spent in irq mode. + */ + irq: number; + }; + } + + interface LogInfo { + /** + * the filename of the log + */ + name?: string; + /** + * the size of the log in bytes + */ + size?: number; + /** + * the unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)" + */ + date?: string; + } + + interface ProcessInfo { + /** + * the percentage of total CPU usage + */ + cpuUsage?: number; + /** + * the application name + */ + name?: string; + /** + * the current nonpaged pool usage in bytes + */ + nonPagedPoolUsage?: number; + /** + * the number of page faults + */ + pageFaultCount?: number; + /** + * the current paged pool usage in bytes + */ + pagedPoolUsage?: number; + /** + * the total amount of memory in bytes that the memory manager has committed + */ + pagefileUsage?: number; + /** + * the peak nonpaged pool usage in bytes + */ + peakNonPagedPoolUsage?: number; + /** + * the peak paged pool usage in bytes + */ + peakPagedPoolUsage?: number; + /** + * the peak value in bytes of pagefileUsage during the lifetime of this process + */ + peakPagefileUsage?: number; + /** + * the peak working set size in bytes + */ + peakWorkingSetSize?: number; + /** + * the native process identifier + */ + processId?: number; + /** + * the application UUID + */ + uuid?: string; + /** + * the current working set size (both shared and private data) in bytes + */ + workingSetSize?: number; + } + + interface ProxyInfo { + /** + * the configured Proxy Address + */ + proxyAddress?: string; + /** + * the configured Proxy port + */ + proxyPort?: number; + /** + * Proxy Type + */ + type?: string; + } + + interface RvmInfo { + version?: string; + "start-time"?: string; + } + + interface ExternalProcessLaunchInfo { + path?: string; + /** + * Additionally note that the executable found in the zip file specified in appAssets + * will default to the one mentioned by appAssets.target + * If the the path below refers to a specific path it will override this default + */ + alias?: string; + /** + * When using alias; if no arguments are passed then the arguments (if any) + * are taken from the 'app.json' file, from the 'args' parameter + * of the 'appAssets' Object with the relevant 'alias'. + * If 'arguments' is passed as a parameter it takes precedence + * over any 'args' set in the 'app.json'. + */ + arguments?: string; + listener?: (result: { + /** + * "Exited" Or "released" on a call to releaseExternalProcess + */ + topic?: string; + /** + * The mapped UUID which identifies the launched process + */ + uuid?: string; + /* + * Process exit code + */ + exitCode?: number; + }) => void; + certificate?: CertificationInfo; + } + + interface CertificationInfo { + /** + * A hex string with or without spaces + */ + serial?: string; + /** + * An internally tokenized and comma delimited string allowing partial or full checks of the subject fields + */ + subject?: string; + /** + * A hex string with or without spaces + */ + publickey?: string; + /** + * A hex string with or without spaces + */ + thumbprint?: string; + /** + * A boolean indicating that the certificate is trusted and not revoked + */ + trusted?: boolean; + } + + interface ExternalProcessInfo { + pid?: number; + listener?: (result: { + /** + * "Exited" Or "released" on a call to releaseExternalProcess + */ + topic?: string; + /** + * The mapped UUID which identifies the launched process + */ + uuid?: string; + /* + * Process exit code + */ + exitCode?: number; + }) => void; + } + + interface OpenFinWindowStatic { + /** + * Class: Window + * + * new Window(options, callbackopt, errorCallbackopt) + * + * Creates a new OpenFin Window + * + * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. The new window appears in the same process as the parent window. + * @param {any} options - The options of the window + * @param {Function} [callback] - Called if the window creation was successful + * @param {number} [callback.successObj] - httpResponseCode + */ + new (options: WindowOptions, callback?: (successObj: { httpResponseCode: number }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinWindow; + /** + * Returns an instance of the current window. + * @returns {OpenFinWindow} Current window + */ + getCurrent(): OpenFinWindow; + /** + * Returns a Window object that wraps an existing window. + */ + wrap(appUuid: string, windowName: string): OpenFinWindow; + } + + /** + * Window + * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. The new window appears in the same process as the parent window. + */ + interface OpenFinWindow { + /** + * Name of window + */ + name: string; + /** + * Returns the native JavaScript "window" object for the window. This method can only be used by the parent application or the window itself, otherwise it will return undefined. The same Single-Origin-Policy (SOP) rules apply for child windows created by window.open(url) in that the contents of the window object are only accessible if the URL has the same origin as the invoking window. See example below. Also, will not work with fin.desktop.Window objects created with fin.desktop.Window.wrap(). + * @returns {Window} Native window + */ + getNativeWindow(): Window; + /** + * Gets the parent application. + * @returns {OpenFinApplication} Parent application + */ + getParentApplication(): OpenFinApplication; + /** + * Gets the parent window. + */ + getParentWindow(): OpenFinWindow; + /** + * Registers an event listener on the specified event. + */ + addEventListener(type: OpenFinWindowEventType, listener: (event: WindowBaseEvent | WindowAuthRequestedEvent | WindowBoundsEvent | WindowExternalProcessStartedEvent | WindowExternalProcessExited | WindowGroupChangedEvent | WindowHiddenEvent | Window_NavigationRejectedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Performs the specified window transitions + */ + animate(transitions: AnimationTransition, options: AnimationOptions, callback?: (event: any) => void, errorCallback?: (reason: string) => void): void; + /** + * Provides credentials to authentication requests + */ + authenticate(userName: string, password: string, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; + /** + * Removes focus from the window. + */ + blur(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Brings the window to the front of the OpenFin window stack. + */ + bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Closes the window. + * @param {force} Close will be prevented from closing when force is false and close-requested has been subscribed to for applications main window. + */ + close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Prevents a user from changing a window's size/position when using the window's frame. + * 'disabled-frame-bounds-changing' is generated at the start of and during a user move/size operation. + * 'disabled-frame-bounds-changed' is generated after a user move/size operation. + * The events provide the bounds that would have been applied if the frame was enabled. + * 'frame-disabled' is generated when an enabled frame becomes disabled. + */ + disableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Re-enables user changes to a window's size/position when using the window's frame. + * 'disabled-frame-bounds-changing' is generated at the start of and during a user move/size operation. + * 'disabled-frame-bounds-changed' is generated after a user move/size operation. + * The events provide the bounds that would have been applied if the frame was enabled. + * 'frame-enabled' is generated when a disabled frame has becomes enabled. + */ + enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Flashes the windows frame and taskbar icon until the window is activated. + */ + flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Gives focus to the window. + */ + focus(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current bounds (top, left, width, height) of the window. + */ + getBounds(callback?: (bounds: WindowBounds) => void, errorCallback?: (reason: string) => void): void; + /** + * Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned. Please note that calling window is included in the result array. + */ + getGroup(callback?: (group: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current settings of the window. + */ + getOptions(callback?: (options: WindowOptions) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets a base64 encoded PNG snapshot of the window. + */ + getSnapshot(callback?: (base64Snapshot: string) => void, errorCallback?: (reason: string) => void): void; + /** + * Gets the current state ("minimized", "maximized", or "restored") of the window. + */ + getState(callback?: (state: "minimized" | "maximized" | "restored") => void, errorCallback?: (reason: string) => void): void; + /** + * Returns the zoom level of the window. + */ + getZoomLevel(callback?: (level: number) => void, errorCallback?: (reason: string) => void): void; + /** + * Hides the window. + */ + hide(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Determines if the window is currently showing. + */ + isShowing(callback?: (showing: boolean) => void, errorCallback?: (reason: string) => void): void; + /** + * Joins the same window group as the specified window. + */ + joinGroup(target: OpenFinWindow, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Leaves the current window group so that the window can be move independently of those in the group. + */ + leaveGroup(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Maximizes the window. + */ + maximize(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Merges the instance's window group with the same window group as the specified window + */ + mergeGroups(target: OpenFinWindow, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Minimizes the window. + */ + minimize(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Moves the window by a specified amount. + */ + moveBy(deltaLeft: number, deltaTop: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Moves the window to a specified location. + */ + moveTo(left: number, top: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener(type: OpenFinWindowEventType, listener: (event: WindowBaseEvent | WindowAuthRequestedEvent | WindowBoundsEvent | WindowExternalProcessStartedEvent | WindowExternalProcessExited | WindowGroupChangedEvent | WindowHiddenEvent | Window_NavigationRejectedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Resizes the window by a specified amount. + */ + resizeBy(deltaWidth: number, deltaHeight: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Resizes the window by a specified amount. + */ + resizeTo(width: number, height: number, anchor: OpenFinAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Restores the window to its normal state (i.e., unminimized, unmaximized). + */ + restore(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Will bring the window to the front of the entire stack and give it focus. + */ + setAsForeground(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets the window's size and position + */ + setBounds(left: number, top: number, width: number, height: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Sets the zoom level of the window. + */ + setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the window if it is hidden. + * @param {force} Show will be prevented from closing when force is false and show-requested has been subscribed to for applications main window. + */ + show(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Shows the window if it is hidden at the specified location. If the toggle parameter is set to true, the window will alternate between showing and hiding. + */ + showAt(left: number, top: number, force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Stops the taskbar icon from flashing. + */ + stopFlashing(callback?: () => void, errorCallback?: (reason: string) => void): void; + /** + * Updates the window using the passed options + */ + updateOptions(options: WindowOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; + } + + interface ApplicationBaseEvent { + topic: string; + type: OpenFinApplicationEventType; + uuid: string; + } + + interface TrayIconClickedEvent extends ApplicationBaseEvent { + button: number; // 0 for left, 1 for middle, 2 for right + monitorInfo: MonitorInfo; + x: number; // the cursor x coordinate + y: number; // the cursor y coordinate + } + + interface WindowEvent extends ApplicationBaseEvent { + name: string; + } + + interface WindowAlertRequestedEvent extends WindowEvent { + message: string; + url: string; + } + + interface WindowAuthRequested extends WindowEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; + } + + interface WindowNavigationRejectedEvent extends WindowEvent { + sourceName: string; + url: string; + } + + interface WindowEndLoadEvent extends WindowEvent { + documentName: string; + isMain: boolean; + } + + interface MonitorInfoChangedEvent extends MonitorInfo { + topic: "system"; + type: "monitor-info-changed"; + } + + interface MonitorInfo { + nonPrimaryMonitors: MonitorInfoDetail[]; + primaryMonitor: MonitorInfoDetail; + reason: string; + taskbar: { + edge: "left" | "right" | "top" | "bottom", + rect: MontiorCoordinates + }; + topic: "system"; + type: "monitor-info-changed"; + virtualScreen: MontiorCoordinates; + } + + interface MonitorInfoDetail { + availableRect: MontiorCoordinates; + deviceId: string; + displayDeviceActive: boolean; + monitorRect: MontiorCoordinates; + name: string; + } + + interface MontiorCoordinates { + bottom: number; + left: number; + right: number; + top: number; + } + + interface VirtualScreenCoordinates { + left: number; + top: number; + } + + interface SystemBaseEvent { + topic: string; + type: OpenFinSystemEventType; + uuid: string; + } + + interface DesktopIconClickedEvent { + mouse: { + /** + * the left virtual screen coordinate of the mouse + */ + left: number, + /** + * the top virtual screen coordinate of the mouse + */ + top: number + }; + /** + * the number of milliseconds that have elapsed since the system was started, + */ + tickCount: number; + topic: "system"; + type: "desktop-icon-clicked"; + } + + interface IdleStateChangedEvent { + /** + * How long in milliseconds since the user has been idle. + */ + elapsedTime: number; + /** + * true when the user is idle,false when the user has returned; + */ + isIdle: boolean; + topic: "system"; + type: "idle-state-changed"; + } + + interface WindowBaseEvent { + /** + * the name of the window + */ + name: string; + /** + * always window + */ + topic: "window"; + /** + * window event type + */ + type: OpenFinWindowEventType; + /** + * the UUID of the application the window belongs to + */ + uuid: string; + } + + interface WindowAuthRequestedEvent extends WindowBaseEvent { + authInfo: { + host: string; + isProxy: boolean; + port: number; + realm: string; + scheme: string; + }; + } + + interface WindowBoundsEvent extends WindowBaseEvent { + /** + * describes what kind of change occurred. + * 0 means a change in position. + * 1 means a change in size. + * 2 means a change in position and size. + */ + changeType: number; + /** + * true when pending changes have been applied to the window. + */ + deferred: boolean; + /** + * the new height of the window. + */ + height: number; + /** + * the left-most coordinate of the window. + */ + left: number; + /** + * the top-most coordinate of the window. + */ + top: number; + /** + * + */ + type: "bounds-changed" | "bounds-changing" | "disabled-frame-bounds-changed" | "disabled-frame-bounds-changing"; + /** + * the new width of the window. + */ + width: number; + } + + interface WindowExternalProcessStartedEvent extends WindowBaseEvent { + /** + * the process handle uuid + */ + processUuid: string; + type: "external-process-started"; + } + + interface WindowExternalProcessExited extends WindowBaseEvent { + /** + * the process exit code + */ + exitCode: number; + /** + * the process handle uuid + */ + processUuid: string; + type: "external-process-exited"; + } + + interface WindowGroupChangedEvent extends WindowBaseEvent { + /** + * Which group array the window that the event listener was registered on is included in: + * 'source' The window is included in sourceGroup. + * 'target' The window is included in targetGroup. + * 'nothing' The window is not included in sourceGroup nor targetGroup. + */ + memberOf: "source" | "target" | "nothing"; + /** + * The reason this event was triggered. + * 'leave' A window has left the group due to a leave or merge with group. + * 'join' A window has joined the group. + * 'merge' Two groups have been merged together. + * 'disband' There are no other windows in the group. + */ + reason: "leave" | "join" | "merge" | "disband"; + /** + * All the windows in the group the sourceWindow originated from. + */ + sourceGroup: WindowOfGroupInfo[]; + /** + * The UUID of the application the sourceWindow belongs to The source window is the window in which (merge/join/leave)group(s) was called. + */ + sourceWindowAppUuid: string; + /** + * the name of the sourcewindow.The source window is the window in which(merge / join / leave) group(s) was called. + */ + sourceWindowName: string; + /** + * All the windows in the group the targetWindow orginated from + */ + targetGroup: WindowOfGroupInfo[]; + /** + * The UUID of the application the targetWindow belongs to. The target window is the window that was passed into (merge/join) group(s). + */ + targetWindowAppUuid: string; + /** + * The name of the targetWindow. The target window is the window that was passed into (merge/join) group(s). + */ + targetWindowName: string; + type: "group-changed"; + } + + interface WindowOfGroupInfo { + /** + * The UUID of the application this window entry belongs to. + */ + appUuid: string; + /** + * The name of this window entry. + */ + windowName: string; + } + + interface WindowHiddenEvent extends WindowBaseEvent { + /** + * What action prompted the close. + * The reasons are: "hide", "hide-on-close" + */ + reason: "hide" | "hide-on-close"; + type: "hidden"; + } + + interface Window_NavigationRejectedEvent { + name: string; + /** + * source of navigation window name + */ + sourceName: string; + topic: "navigation-rejected"; + /** + * Url that was not reached "http://blocked-content.url" + */ + url: string; + /** + * the UUID of the application the window belongs to. + */ + uuid: string; + } + + interface AnimationTransition { + opacity?: { + /** + * This value is clamped from 0.0 to 1.0 + */ + opacity?: number; + /** + * The total time in milliseconds this transition should take. + */ + duration?: number; + /** + * Treat 'opacity' as absolute or as a delta. Defaults to false. + */ + relative?: boolean; + }; + position?: { + /** + * Defaults to the window's current left position in virtual screen coordinates. + */ + left?: number; + /** + * Defaults to the window's current top position in virtual screen coordinates. + */ + top?: number; + /** + * The total time in milliseconds this transition should take. + */ + duration?: number; + /** + * Treat 'left' and 'top' as absolute or as deltas. Defaults to false. + */ + relative?: boolean; + }; + size?: { + /** + * Optional if height is present. Defaults to the window's current width. + */ + width?: number; + /** + * Optional if width is present. Defaults to the window's current height. + */ + height?: number; + /** + * The total time in milliseconds this transition should take. + */ + duration?: number; + /** + * Treat 'width' and 'height' as absolute or as deltas. Defaults to false. + */ + relative?: boolean; + }; + } + + interface AnimationOptions { + /** + * This option interrupts the current animation. When false it pushes this animation onto the end of the animation queue. + */ + interrupt?: boolean; + /** + * Transition effect. Defaults to 'ease-in-out'. + */ + tween?: OpenFinTweenType; + } + + interface WindowBounds { + /** + * the height of the window. + */ + height?: number; + /** + * left-most coordinate of the window. + */ + left?: number; + /** + * top-most coordinate of the window. + */ + top?: number; + /** + * the width of the window. + */ + width?: number; + } + + interface SessionChangedEvent { + /** + * the action that triggered this event: + */ + reason: "lock" + | "unlock" + | "remote-connect" + | "remote-disconnect" + | "unknown"; + topic: "system"; + type: "session-changed"; + } + + type OpenFinTweenType = "linear" + | "ease-in" + | "ease-out" + | "ease-in-out" + | "ease-in-quad" + | "ease-out-quad" + | "ease-in-out-quad" + | "ease-in-cubic" + | "ease-out-cubic" + | "ease-in-out-cubic" + | "ease-out-bounce" + | "ease-in-back" + | "ease-out-back" + | "ease-in-out-back" + | "ease-in-elastic" + | "ease-out-elastic" + | "ease-in-out-elastic"; + + type OpenFinApplicationEventType = "closed" + | "connected" + | "crashed" + | "initialized" + | "manifest-changed" + | "not-responding" + | "out-of-memory" + | "responding" + | "run-requested" + | "started" + | "tray-icon-clicked" + | "window-alert-requested" + | "window-auth-requested" + | "window-closed" + | "window-created" + | "window-end-load" + | "window-navigation-rejected" + | "window-show-requested" + | "window-start-load"; + + type OpenFinExternalApplicationEventType = "connected" + | "disconnected"; + + type OpenFinSystemEventType = "application-closed" + | "application-crashed" + | "application-created" + | "application-started" + | "desktop-icon-clicked" + | "idle-state-changed" + | "monitor-info-changed" + | "session-changed"; + + type OpenFinWindowEventType = "auth-requested" + | "blurred" + | "bounds-changed" + | "bounds-changing" + | "close-requested" + | "closed" + | "disabled-frame-bounds-changed" + | "disabled-frame-bounds-changing" + | "embedded" + | "external-process-exited" + | "external-process-started" + | "focused" + | "frame-disabled" + | "frame-enabled" + | "group-changed" + | "hidden" + | "initialized" + | "maximized" + | "minimized" + | "navigation-rejected" + | "restored" + | "show-requested" + | "shown"; + + type OpenFinAnchor = "top-left" + | "top-right" + | "bottom-left" + | "bottom-right"; +} \ No newline at end of file diff --git a/openfin/v16/openfin-tests.ts b/openfin/v16/openfin-tests.ts new file mode 100644 index 0000000000..81ac24f937 --- /dev/null +++ b/openfin/v16/openfin-tests.ts @@ -0,0 +1,724 @@ +function test_application() { + let application: fin.OpenFinApplication; + // constructor + application = new fin.desktop.Application({ + url: "application.html", + uuid: "74BED629-2D8E-4141-8582-73E364BDFA74", + name: "Application Name", + plugins: false, + mainWindowOptions: { + defaultHeight: 600, + defaultWidth: 800, + defaultTop: 300, + defaultLeft: 300, + autoShow: true + } + }, function (successObj) { + console.log("Application successfully created, HTTP response code:", successObj); + application.run(); + }, function (error) { + console.log("Error creating application:", error); + }); + // getCurrent + application = fin.desktop.Application.getCurrent(); + // wrap + application = fin.desktop.Application.wrap("454C7F31-A915-4EA2-83F2-CFA655453C52"); + // getWindow + application.getWindow(); + // addEventListener + application.addEventListener("closed", function (event) { + console.log("The application has closed"); + }, function () { + console.log("The registration was successful"); + }, function (reason) { + console.log("failure: " + reason); + }); + // close + application.close(); + // getChildWindows + application.getChildWindows(function (children) { + children.forEach(function (childWindow) { + console.log("Showing child: " + childWindow.name); + childWindow.show(); + }); + }); + // getGroups + application.getGroups(function (allGroups) { + console.log("There are a total of " + allGroups.length + " groups."); + + var groupCounter = 1; + allGroups.forEach(function (windowGroup) { + console.log("Group " + groupCounter + " contains " + + windowGroup.length + " windows."); + ++groupCounter; + }); + }); + // getManifest + application.getManifest(function (manifest) { + console.log("Application manifest:"); + console.log(manifest); + }); + // getParentUuid + application.getParentUuid(function (parentUuid) { + console.log("UUID of parent application:"); + console.log(parentUuid); + }); + // getShortcuts + application.getShortcuts(function (config) { + console.log("Desktop shortcut is enabled: ", config.desktop); + console.log("Start Menu shortcut is enabled: ", config.startMenu); + console.log("System Startup shortcut is enabled: ", config.systemStartup); + }); + // isRunning + application.isRunning(function (running) { + console.log("the application is", running ? "running" : "not running"); + }); + // registerCustomData + application.registerCustomData({ + someData: "this is custom" + }, function () { + console.log("You will not read this."); + }, function (err) { + console.log("failure:", err); + }); + // removeEventListener + let previousCallback = function (event: fin.WindowEvent) { }; + application.removeEventListener("closed", previousCallback, function () { + console.log("The unregistration was successful"); + }, function (err) { + console.log("failure:", err); + }); + // removeTrayIcon + application.removeTrayIcon(function () { + console.log("Removed the tray icon."); + }, function (err) { + console.log("failure:", err); + }); + // restart + application.restart(function () { + console.log("You will not read this."); + }, function (err) { + console.log("failure:", err); + }); + // schedule restart + application.scheduleRestart(function () { + console.log("You will not read this."); + }, function (err) { + console.log("failure:", err); + }); + // setShortcuts + application.setShortcuts({ + desktop: true, + startMenu: false, + systemStartup: true + }, function () { + console.log("Successfully set new shortcut states"); + }, function (error) { + console.log("Failed to set new shortcut states. Error: ", error); + }); + // setTrayIcon + application.setTrayIcon("https://developer.openf.in/download/openfin.png", function (clickInfo) { + console.log("The mouse has clicked at (" + clickInfo.x + "," + clickInfo.y + ")"); + }); + // terminate + application.terminate(); + // wait + application.addEventListener("not-responding", function () { + console.log("waiting for hung application"); + application.wait(); + }); +} + +function test_external_application() { + let externalApp: fin.OpenFinExternalApplication; + // wrap + externalApp = fin.desktop.ExternalApp.wrap('my-uuid'); + // addEventListener + externalApp.addEventListener('connected', () => { + console.log('external app connected'); + }, () => { + console.log('The registration was successful'); + }, (reason, err) => { + console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`); + }); + // removeEventListener + let previousCallback = function () { }; + externalApp.removeEventListener('connected', previousCallback, () => { + console.log('The unregistration was successful'); + }, (reason, err) => { + console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`); + }); +} + +function test_inter_application_bus() { + // addSubscribeListener + fin.desktop.InterApplicationBus.addSubscribeListener(function (uuid, topic, name) { + console.log("The application " + uuid + " has subscribed to " + topic); + }); + // addUnsubscribeListener + fin.desktop.InterApplicationBus.addUnsubscribeListener(function (uuid, topic, name) { + console.log("The application " + uuid + " has unsubscribed to " + topic); + }); + // removeSubscribeListener + let aRegisteredListener = function (uuid: string, topic: string, name: string) { }; + fin.desktop.InterApplicationBus.removeSubscribeListener(aRegisteredListener); + // removeUnsubscribeListener + fin.desktop.InterApplicationBus.removeUnsubscribeListener(aRegisteredListener); + // publish + fin.desktop.InterApplicationBus.publish("a topic", { + field1: "value1", + field2: "value2" + }); + // send + fin.desktop.InterApplicationBus.send("an application's uuid", "a topic", { + field1: "value1", + field2: "value2" + }); + // subscribe + fin.desktop.InterApplicationBus.subscribe("*", "a topic", function (message, uuid, name) { + console.log("The application " + uuid + " sent this message: " + message); + }); + // unsubscribe + let aRegisteredMessageListener = function (message: any, senderUuid: string) { + console.log(message, senderUuid); + }; + fin.desktop.InterApplicationBus.unsubscribe("*", "a topic", aRegisteredMessageListener); +} + +function test_notification() { + let notification: fin.OpenFinNotification; + // getCurrent + notification = fin.desktop.Notification.getCurrent(); + // close + notification.close(); + // sendMessage + notification = new fin.desktop.Notification({ + duration: 10, + url: "http://localhost:5000/Account/Register", + message: "Hello", + onShow: () => { }, + //onClose: () => { }, + onDismiss: () => { }, + //onClick: () => { }, + onMessage: () => { }, + onError: () => { } + }); + // sendMessageToApplication + notification.sendMessageToApplication("some message"); +} + +function test_system() { + // addEventListener + fin.desktop.System.addEventListener('monitor-info-changed', function (event) { + console.log("The monitor information has changed to: ", event); + }, function () { + console.log("The registration was successful"); + }, function (err) { + console.log("failure: " + err); + }); + // clearCache + fin.desktop.System.clearCache({ + cache: true, + cookies: true, + localStorage: true, + appcache: true, + userData: true + }); + // deleteCacheOnExit + fin.desktop.System.deleteCacheOnExit(function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // downloadAsset + let dirAppAsset = { + 'src': 'http://local:8000/dir.zip', + 'alias': 'dirApp', + 'version': '1.23.24', + 'target': 'dir.bat', + 'args': '' + }; + fin.desktop.System.downloadAsset(dirAppAsset, progress => { + let downloadedPercent = Math.floor((progress.downloadedBytes / progress.totalBytes) * 100); + console.log(`Downloaded ${downloadedPercent}%`); + }, p => { + console.log(`Downlod complete, can be found on ${p.path}`); + //lets launch our application asset. + //launchDirApp(); + }, (reason, err) => { + console.log(reason, err); + }); + // exit + fin.desktop.System.exit(function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // getAllApplications + fin.desktop.System.getAllApplications(function (applicationInfoList) { + applicationInfoList.forEach(function (applicationInfo) { + console.log("Showing information for application with uuid: " + + applicationInfo.uuid); + console.log("isRunning: ", applicationInfo.isRunning); + }); + }); + // getAllExternalApplications + fin.desktop.System.getAllExternalApplications(externalAppsInfoList => { + externalAppsInfoList.forEach(appInfo => { + console.log(`External app connected to the runtime with UUID ${appInfo.uuid}`); + }); + }); + // getAllWindows + fin.desktop.System.getAllWindows(function (windowInfoList) { + windowInfoList.forEach(function (windowInfo) { + console.log("Showing information for application with uuid: ", windowInfo.uuid); + console.log("Main window: ", windowInfo.mainWindow); + console.log("Child windows: ", windowInfo.childWindows); + }); + }); + // getCommandLineArguments + fin.desktop.System.getCommandLineArguments(function (args) { + console.log("The command line arguments are " + args); + }); + // getDeviceId + fin.desktop.System.getDeviceId(function (id) { + console.log("The id of the device is: " + id); + }); + // getEnvironmentVariable + fin.desktop.System.getEnvironmentVariable("APPDATA", function (variable) { + console.log("this is the APPDATA value", variable); + }); + // getHostSpecs + fin.desktop.System.getHostSpecs(function (info) { + console.log(info); + }, function (error) { + console.log('There was an error:', error); + }); + // getLog + fin.desktop.System.getLog('debug-2015-01-08-22-27-53.log', function (log) { + console.log(log); + }); + // getLogList + fin.desktop.System.getLogList(function (logList) { + logList.forEach(function (logInfo) { + console.log("The filename of the log is " + + logInfo.name + ", the size is " + + logInfo.size + ", and the date of creation is " + + logInfo.date); + }); + }); + // getMonitorInfo + fin.desktop.System.getMonitorInfo(function (monitorInfo) { + console.log("This object contains information about all monitors: ", monitorInfo); + }); + // getMousePosition + fin.desktop.System.getMousePosition(function (mousePosition) { + console.log("The mouse is located at left: " + mousePosition.left + ", top: " + mousePosition.top); + }); + // getProcessList + fin.desktop.System.getProcessList(function (list) { + list.forEach(function (process) { + console.log("UUID: " + process.uuid + ", Application Name: " + process.name); + }); + }); + // getProxySettings + fin.desktop.System.getProxySettings(function (proxy) { + console.log(proxy); + }); + // getRvmInfo + fin.desktop.System.getRvmInfo(function (rvmInfoObject) { + console.log("RVM version:", rvmInfoObject.version); + console.log("RVM has been running since:", rvmInfoObject["start-time"]); + }, function (err) { + console.log("Failed to get rvm info, error message:", err); + }); + // getVersion + fin.desktop.System.getVersion(function (version) { + console.log("The version is " + version); + }); + // launchExternalProcess + fin.desktop.System.launchExternalProcess({ + path: "notepad", + arguments: "", + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // + fin.desktop.System.launchExternalProcess({ + //Additionally note that the executable found in the zip file specified in appAssets + //will default to the one mentioned by appAssets.target + //If the the path below refers to a specific path it will override this default + alias: "myApp", + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // + fin.desktop.System.launchExternalProcess({ + alias: "myApp", + arguments: "e f g", + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // + fin.desktop.System.launchExternalProcess({ + path: "C:\Users\ExampleUser\AppData\Local\OpenFin\OpenFinRVM.exe", + arguments: "--version", + certificate: { + trusted: true, + subject: 'O=OpenFin INC., L=New York, S=NY, C=US', + thumbprint: '‎3c a5 28 19 83 05 fe 69 88 e6 8f 4b 3a af c5 c5 1b 07 80 5b' + }, + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // log + fin.desktop.System.log("info", "An example log message", function () { + console.log("message successfully logged"); + }, function (err) { + console.log(err); + }); + // monitorExternalProcess + fin.desktop.System.monitorExternalProcess({ + pid: 2508, + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log("The process is now being monitored: ", payload.uuid); + }, function (error) { + console.log("Error:", error); + }); + // openUrlWithBrowser + fin.desktop.System.openUrlWithBrowser("https://developer.openf.in/", function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // registerExternalConnection + fin.desktop.System.registerExternalConnection("remote-connection-uuid", function () { + console.log(arguments); + }); + // releaseExternalProcess + fin.desktop.System.launchExternalProcess({ + path: "notepad", + arguments: "", + listener: function (result) { + console.log("The exit code", result.exitCode); + } + }, function (result) { + console.log("Result UUID is " + result.uuid); + + //release it. + fin.desktop.System.releaseExternalProcess(result.uuid, function () { + console.log("Process has been unmapped!"); + }, function (reason) { + console.log("failure: " + reason); + }); + }); + // removeEventListener + let aRegisteredListener = (event: fin.SystemBaseEvent) => { }; + fin.desktop.System.removeEventListener("monitor-info-changed", aRegisteredListener, function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // showDeveloperTools + fin.desktop.System.showDeveloperTools("uuid", "name", function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // terminateExternalProcess + fin.desktop.System.launchExternalProcess({ + // notepad is in the system’s PATH + path: "notepad", + arguments: "", + listener: function (result) { + console.log("The exit code", result.exitCode); + } + }, function (result) { + console.log("Result UUID is " + result.uuid); + + // Attempt to close the process. Terminate after 4 seconds if it + // has not done so. + fin.desktop.System.terminateExternalProcess(result.uuid, 4000, function (info) { + console.log("Termination result " + info.result); + }, function (reason) { + console.log("failure: " + reason); + }); + }); + // updateProxySettings + fin.desktop.System.updateProxySettings("type", "proxyAddress", 8080, function () { + console.log('success'); + }, function (err) { + console.log(err); + }); +} + +function test_system_clipboard() { + // availableFormats + fin.desktop.System.Clipboard.availableFormats(null, formats => { + formats.forEach(format => console.log(`The format ${format} is available to read`)); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // readHtml + fin.desktop.System.Clipboard.readHtml(null, html => { + console.log(`This is the html from the clipboard: ${html}`); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // readRtf + fin.desktop.System.Clipboard.readRtf(null, rtf => { + console.log(`This is the rtf from the clipboard: ${rtf}`); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // readText + fin.desktop.System.Clipboard.readText(null, text => { + console.log(`This is the text from the clipboard: ${text}`); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // write + fin.desktop.System.Clipboard.write({ + text: 'Hello Text!', + html: '

Hello Html

', + rtf: 'Hello Rtf' + }, null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // writeHtml + fin.desktop.System.Clipboard.writeHtml('

Hello World

', null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // writeRtf + fin.desktop.System.Clipboard.writeRtf('Hello World!', null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); + // writeText + fin.desktop.System.Clipboard.writeText('Hello World', null, () => { + console.log('Success!!'); + }, (reason, err) => { + console.log(`Error while reading the clipboard Message: ${err.message}, Stack: ${err.stack}`); + }); +} + +function test_window() { + let finWindow: fin.OpenFinWindow; + // constructor + finWindow = new fin.desktop.Window({ + name: "childWindow", + url: "child.html", + defaultWidth: 320, + defaultHeight: 320, + defaultTop: 10, + defaultLeft: 300, + frame: false, + resizable: false, + state: "normal" + }, function () { + var _win = finWindow.getNativeWindow(); + _win.addEventListener("DOMContentLoaded", function () { finWindow.show(); }); + }, function (error) { + console.log("Error creating window:", error); + }); + // getCurrent + finWindow = fin.desktop.Window.getCurrent(); + // getNativeWindow + let nativeWindow: Window; + nativeWindow = finWindow.getNativeWindow(); + // getParentApplication + let parentApp: fin.OpenFinApplication; + parentApp = finWindow.getParentApplication(); + // getParentWindow + let parentFinWindow: fin.OpenFinWindow; + parentFinWindow = finWindow.getParentWindow(); + // wrap + finWindow = fin.desktop.Window.wrap("uuid", "name"); + // addEventListener + finWindow.addEventListener("bounds-changed", function (event) { + console.log("The window has been moved or resized"); + }, function () { + console.log("The registration was successful"); + }, function (reason) { + console.log("failure:" + reason); + }); + // animate + finWindow.animate({ + opacity: { + opacity: 0.15, + duration: 1000 + }, + position: { + left: 10, + top: 10, + duration: 3000 + } + }, { + interrupt: false + }, function (evt) { + // Callback will only fire after both "opacity" and "position" have finished animating. + }); + // authenticate + finWindow.addEventListener('auth-requested', evt => { + finWindow.authenticate('userName', 'P@assw0rd', () => { }, (reason, err) => { + console.log("failure:", err); + }); + }); + // blur + finWindow.blur(); + // bringToFront + finWindow.bringToFront(); + // close + finWindow.close(); + // disableFrame + finWindow.disableFrame(); + // enableFrame + finWindow.enableFrame(); + // flash + finWindow.flash(); + // focus + finWindow.focus(); + // getBounds + finWindow.getBounds(function (bounds) { + console.log("top: " + bounds.top + + "left: " + bounds.left + + "height: " + bounds.height + + "width: " + bounds.width); + }); + // getOptions + finWindow.getOptions(function (options) { + console.log(options); + }); + // getSnapshot + finWindow.getSnapshot(function (base64Snapshot) { + console.log("data:image/png;base64," + base64Snapshot); + }); + // getState + finWindow.getState(function (state) { + console.log("state: " + state); + }); + // getZoomLevel + finWindow.getZoomLevel(function (level) { + console.log("zoom level: " + level); + }, function (error) { + console.log('error:', error); + }); + // hide + finWindow.hide(); + // isShowing + finWindow.isShowing(function (showing) { + console.log("the window is " + (showing ? "showing" : "hidden")); + }); + // joinGroup + let secondWindow = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "secondWindow", + autoShow: true + }, function () { + // When mainWindow moves or is moved, secondWindow moves by the same amount + secondWindow.joinGroup(finWindow); + }); + // leaveGroup + secondWindow = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "secondWindow", + autoShow: true + }, function () { + // When finWindow moves or is moved, secondWindow moves by the same amount + secondWindow.joinGroup(finWindow, function () { + //once we are in the group, lets leave it. + secondWindow.leaveGroup(); + }); + }); + // maximize + finWindow.maximize(); + // mergeGroups + { + let finWindowOne = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowOne", + autoShow: true + }); + let finWindowTwo = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowTwo", + autoShow: true + }); + let finWindowThree = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowThree", + autoShow: true + }); + let finWindowFour = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowFour", + autoShow: true + }); + // When finWindowOne moves or is moved, finWindowTwo moves by the same amount + finWindowOne.joinGroup(finWindowTwo); + // When finWindowThree moves or is moved, finWindowFour moves by the same amount + finWindowThree.joinGroup(finWindowFour); + // finWindowOne, finWindowTwo, finWindowThree, and finWindowFour now move together in the same group + finWindowOne.mergeGroups(finWindowThree); + } + // minimize + finWindow.minimize(); + // moveBy + finWindow.moveBy(10, 10); + // moveTo + finWindow.moveTo(100, 200); + // removeEventListener + let aRegisteredListener = (event: fin.WindowBaseEvent) => { }; + finWindow.removeEventListener("bounds-changed", aRegisteredListener); + // resizeBy + finWindow.resizeBy(10, 10, "top-right"); + // resizeTo + finWindow.resizeTo(10, 10, "top-right"); + // restore + finWindow.restore(); + // setAsForeground + finWindow.setAsForeground(); + // setBounds + finWindow.setBounds(100, 200, 400, 400); + // setZoomLevel + finWindow.setZoomLevel(10); + // show + finWindow.show(); + // showAt + finWindow.showAt(10, 10, false); + // stopFlashing + finWindow.stopFlashing(); + // updateOptions + finWindow.updateOptions({ + frame: false, + maxWidth: 500 + }); +} \ No newline at end of file diff --git a/openfin/v16/tsconfig.json b/openfin/v16/tsconfig.json new file mode 100644 index 0000000000..24629d90e4 --- /dev/null +++ b/openfin/v16/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "openfin": [ + "openfin/v16" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "openfin-tests.ts" + ] +} diff --git a/openfin/v16/tslint.json b/openfin/v16/tslint.json new file mode 100644 index 0000000000..af53769b6b --- /dev/null +++ b/openfin/v16/tslint.json @@ -0,0 +1 @@ +{ "extends": "../../tslint.json" } From f36d20dcd0aa4f92c02cbdea3638083cfd2a58e2 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Tue, 21 Feb 2017 00:14:41 +0000 Subject: [PATCH 019/567] Fixed tslint and test issue that showed up on travis --- openfin/index.d.ts | 12 ++++++------ openfin/v16/tsconfig.json | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/openfin/index.d.ts b/openfin/index.d.ts index 893a253606..f0803864ae 100644 --- a/openfin/index.d.ts +++ b/openfin/index.d.ts @@ -307,8 +307,8 @@ declare namespace fin { size?: number; /** * The size in pixels of an additional - * square resizable region located at the - * bottom right corner of a + * square resizable region located at the + * bottom right corner of a * frameless window. (Default: 4) */ bottomRightCorner?: number; @@ -941,11 +941,11 @@ declare namespace fin { interface OpenFinWindowStatic { /** * Class: Window - * + * * new Window(options, callbackopt, errorCallbackopt) - * + * * Creates a new OpenFin Window - * + * * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. The new window appears in the same process as the parent window. * @param {any} options - The options of the window * @param {Function} [callback] - Called if the window creation was successful @@ -982,7 +982,7 @@ declare namespace fin { * @returns {OpenFinApplication} Parent application */ getParentApplication(): OpenFinApplication; - /** + /** * Gets the parent window. */ getParentWindow(): OpenFinWindow; diff --git a/openfin/v16/tsconfig.json b/openfin/v16/tsconfig.json index 24629d90e4..88e1dbe7fa 100644 --- a/openfin/v16/tsconfig.json +++ b/openfin/v16/tsconfig.json @@ -1,7 +1,10 @@ { "compilerOptions": { "module": "commonjs", - "target": "es6", + "lib": [ + "es6", + "dom" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, From a4ba9a452279b77f8c28d2506093f8956db94740 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Tue, 21 Feb 2017 00:24:31 +0000 Subject: [PATCH 020/567] And fixed one more --- openfin/v16/index.d.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/openfin/v16/index.d.ts b/openfin/v16/index.d.ts index 2c1cfd648e..0b9f3e16ac 100644 --- a/openfin/v16/index.d.ts +++ b/openfin/v16/index.d.ts @@ -63,7 +63,7 @@ declare namespace fin { */ close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Retrieves an array of wrapped fin.desktop.Windows for each of the applications child windows. + * Retrieves an array of wrapped fin.desktop.Windows for each of the application�s child windows. */ getChildWindows(callback?: (children: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; /** @@ -95,7 +95,7 @@ declare namespace fin { */ removeEventListener(type: OpenFinApplicationEventType, previouslyRegisteredListener: (event: ApplicationBaseEvent | TrayIconClickedEvent | WindowEvent | WindowAlertRequestedEvent | WindowAuthRequested | WindowNavigationRejectedEvent | WindowEndLoadEvent) => any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Removes the applications icon from the tray. + * Removes the application�s icon from the tray. */ removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -288,8 +288,8 @@ declare namespace fin { size?: number; /** * The size in pixels of an additional - * square resizable region located at the - * bottom right corner of a + * square resizable region located at the + * bottom right corner of a * frameless window. (Default: 4) */ bottomRightCorner?: number; @@ -922,11 +922,11 @@ declare namespace fin { interface OpenFinWindowStatic { /** * Class: Window - * + * * new Window(options, callbackopt, errorCallbackopt) - * + * * Creates a new OpenFin Window - * + * * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. The new window appears in the same process as the parent window. * @param {any} options - The options of the window * @param {Function} [callback] - Called if the window creation was successful @@ -963,7 +963,7 @@ declare namespace fin { * @returns {OpenFinApplication} Parent application */ getParentApplication(): OpenFinApplication; - /** + /** * Gets the parent window. */ getParentWindow(): OpenFinWindow; @@ -989,7 +989,7 @@ declare namespace fin { bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Closes the window. - * @param {force} Close will be prevented from closing when force is false and close-requested has been subscribed to for applications main window. + * @param {force} Close will be prevented from closing when force is false and �close-requested� has been subscribed to for application�s main window. */ close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1009,7 +1009,7 @@ declare namespace fin { */ enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Flashes the windows frame and taskbar icon until the window is activated. + * Flashes the window�s frame and taskbar icon until the window is activated. */ flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1106,7 +1106,7 @@ declare namespace fin { setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Shows the window if it is hidden. - * @param {force} Show will be prevented from closing when force is false and show-requested has been subscribed to for applications main window. + * @param {force} Show will be prevented from closing when force is false and �show-requested� has been subscribed to for application�s main window. */ show(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** From 700d3a139d81fb5e7f694aeca54569df37ff0fc6 Mon Sep 17 00:00:00 2001 From: Sean Nolan Date: Wed, 22 Feb 2017 13:11:41 +1300 Subject: [PATCH 021/567] Updated bacbone.marionette to support marionette 3.1.0 Updated tinymce --- backbone.marionette/index.d.ts | 334 ++++++++++----------------------- tinymce/index.d.ts | 172 +++++++++++++++-- 2 files changed, 256 insertions(+), 250 deletions(-) diff --git a/backbone.marionette/index.d.ts b/backbone.marionette/index.d.ts index edaab2c2d6..c9705c53c1 100644 --- a/backbone.marionette/index.d.ts +++ b/backbone.marionette/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Backbone from 'backbone'; +import * as Radio from '../backbone.radio'; export as namespace Marionette; export = Marionette; @@ -22,8 +23,6 @@ declare module 'backbone' { findByIndex(index: number): TView; findByCid(cid: string): TView; remove(view: TView): void; - call(method: any): void; - apply(method: any, args?: any[]): void; //mixins from Collection (copied from Backbone's Collection declaration) @@ -180,6 +179,27 @@ declare namespace Marionette { * backbone conventions and utilities like initialize and Backbone.Events. */ class Object extends Backbone.Events { + + /** + * Defines the Radio channel that will be used for the requests and/or events + */ + channelName: string; + + /** + * Returns a Radio.Channel instance using 'channelName' + */ + getChannel(): Backbone.Radio.Channel; + + /** + * Defines an events hash with the events to be listened and its respective handlers + */ + radioEvents: any; + + /** + * Defines an events hash with the requests to be replied and its respective handlers + */ + radioRequests: any; + /** * Initialize is called immediately after the Object has been instantiated, * and is invoked with the same arguments that the constructor received. @@ -772,12 +792,37 @@ declare namespace Marionette { triggerMethod(name: string, ...args: any[]): any; /** - * Called on the view instance when the view has been rendered and - * displayed. This event can be used to react to when a view has been - * shown via a region. A common use case for the onShow method is to - * use it to add children views. + * Item views will serialize a model or collection, by default, by calling + * .toJSON on either the model or collection. If both a model and + * collection are attached to an item view, the model will be used as the + * data source. The results of the data serialization will be passed to + * the template that is rendered. + * + * If you need custom serialization for your data, you can provide a serializeData + * method on your view. It must return a valid JSON object, as if you had + * called .toJSON on a model or collection. */ - onShow(): void; + serializeData(): any; + + /** + * Renders the view. It is unwise to override the render method of any + * Marionette view. Instead, you should use the onBeforeRender and + * onRender callbacks to layer in additional functionality to the + * rendering of your view. + */ + render(): any; + + /** + * Triggered before an ItemView is rendered. + */ + onBeforeRender(): void; + + /** + * Triggered after the view has been rendered. You can implement this in + * your view to provide custom code for dealing with the view's el after + * it has been rendered. + */ + onRender(): void; /** * Triggered just after the view has been destroyed. @@ -814,49 +859,65 @@ declare namespace Marionette { isDestroyed: boolean; supportsRenderLifecycle: boolean; supportsDestroyLifecycle: boolean; - } - - /** - * An ItemView is a view that represents a single item. That item may be - * a Backbone.Model or may be a Backbone.Collection. Whichever it is though, - * it will be treated as a single item. - */ - class ItemView extends View { - - constructor(options?: Backbone.ViewOptions); /** - * Item views will serialize a model or collection, by default, by calling - * .toJSON on either the model or collection. If both a model and - * collection are attached to an item view, the model will be used as the - * data source. The results of the data serialization will be passed to - * the template that is rendered. - * - * If you need custom serialization for your data, you can provide a serializeData - * method on your view. It must return a valid JSON object, as if you had - * called .toJSON on a model or collection. + * If you have the need to replace the Region with a region class of your + * own implementation, you can specify an alternate class to use with this + * property. */ - serializeData(): any; + regionClass: any; /** - * Renders the view. It is unwise to override the render method of any - * Marionette view. Instead, you should use the onBeforeRender and - * onRender callbacks to layer in additional functionality to the - * rendering of your view. - */ - render(): ItemView; + * Regions hash or a method returning the regions hash that maps + * regions/selectors to methods on your View. + **/ + regions(): any; + + /** Adds a region to the layout view. */ + addRegion(name: string, definition: any): Region; /** - * Triggered before an ItemView is rendered. + * Add multiple regions as a {name: definition, name2: def2} object literal. */ - onBeforeRender(): void; + addRegions(regions: any): any; + + /** Returns a region from the layout view */ + getRegion(name: string): Region; /** - * Triggered after the view has been rendered. You can implement this in - * your view to provide custom code for dealing with the view's el after - * it has been rendered. + * Removes the region with the specified name. + * @param name the name of the region to remove. */ - onRender(): void; + removeRegion(name: string): Region; + + /** Enable easy overriding of the default `RegionManager` + * for customized region interactions and business specific + * view logic for better control over single regions. + */ + getRegionManager(): RegionManager; + + /** + * Show a view into the region specified by `regionName`. + */ + showChildView(regionName: string, view: any, options?: RegionShowOptions): void; + + /** + * Get the current view that is shown in the region specified by + * `regionName`. + */ + getChildView(regionName: string): Backbone.View; + + /** + * Returns all regions from the layout view. The results contains an + * Object hash that has `string`s as keys and `Region`s as values. + */ + getRegions(): {[key: string]: Region}; + + /** + * You can customize the event prefix for events that are forwarded through + * the layout view with this property. + */ + childViewEventPrefix: string; } @@ -928,12 +989,12 @@ declare namespace Marionette { childViewEventPrefix: string; /** - * You can specify a childEvents hash or method which allows you to - * capture all bubbling childEvents without having to manually set bindings. + * You can specify a childViewEvents hash or method which allows you to + * capture all bubbling childViewEvents without having to manually set bindings. * The keys of the hash can either be a function or a string that is the * name of a method on the collection view. */ - childEvents: any; + childViewEvents: any; /** * When a collection has no children, and you need to render a view other than @@ -1034,37 +1095,9 @@ declare namespace Marionette { */ attachHtml(collectionView: CollectionView, childView: TView, index: number): void; - /** - * The value returned by this method is the ChildView class that will be - * instantiated when a Model needs to be initially rendered. This method - * also gives you the ability to customize per Model ChildViews. - */ - getChildView(item: M): new (...args:any[]) => TView; - - /** - * If you need the emptyView's class chosen dynamically, specify - * getEmptyView. - */ - getEmptyView(): any; - /** Serialize a collection by serializing each of its models. */ serializeCollection(): any; - /** - * Attaches the content of a given view. - * This method can be overridden to optimize rendering, - * or to render in a non standard way. - * - * For example, using `innerHTML` instead of `$el.html` - * - * @example - * attachElContent: function(html) { - * this.el.innerHTML = html; - * return this; - * } - */ - attachElContent(html: string): ItemView; - /** * Reorder DOM after sorting. When your element's rendering * do not use their index, you can pass reorderOnSort: true @@ -1132,165 +1165,6 @@ declare namespace Marionette { onRemoveChild(childView: TView): void; } - /** - * A CompositeView extends from CollectionView to be used as a composite view - * for scenarios where it should represent both a branch and leaf in a tree - * structure, or for scenarios where a collection needs to be rendered within - * a wrapper template. - */ - class CompositeView> extends CollectionView { - - constructor(options?: CollectionViewOptions); - - /** - * Each childView will be rendered using the childView's template. The - * CompositeView's template is rendered and the childView's templates are - * added to this. - */ - childView: new (...args:any[]) => TView; - - /** - * By default the composite view uses the same attachHtml method that the - * collection view provides. This means the view will call jQuery's - * .append to move the HTML contents from the child view instance in to - * the collection view's el. - * This is typically not very useful as a composite view will usually render - * a container DOM element in which the child views should be placed. - * This can be either a string or a function returning a string. - */ - childViewContainer: any; - - /** - * Renders the view. - */ - render(): CompositeView; - - /** - * Invoked before the model has been rendered - */ - onBeforeRenderTemplate(): void; - - /** - * Invoked after the model has been rendered. - */ - onRenderTemplate(): void; - - /** - * Invoked before the collection of models is rendered - */ - onBeforeRenderCollection(): void; - - /** - * Invoked after the collection of models has been rendered - */ - onRenderCollection(): void; - } - - interface LayoutViewOptions extends Backbone.ViewOptions { - /** - * The LayoutView takes an additional parameter where you can pass the regions as option on creation. - */ - regions?:any; - - /** - * This option removes the layoutView from the DOM before destroying the - * children preventing repaints as each option is removed. However, it - * makes it difficult to do close animations for a child view (false by - * default) - */ - destroyImmediate?: boolean; - } - - /** - * A LayoutView is a hybrid of an ItemView and a collection of Region objects. - * They are ideal for rendering application layouts with multiple sub-regions - * managed by specified region managers. - * A layoutView can also act as a composite-view to aggregate multiple views - * and sub-application areas of the screen allowing applications to attach - * multiple region managers to dynamically rendered HTML. - * You can create complex views by nesting layoutView managers within Regions. - */ - class LayoutView extends ItemView { - /** - * If you have the need to replace the Region with a region class of your - * own implementation, you can specify an alternate class to use with this - * property. - */ - regionClass: any; - - /** - * Constructor. - * A hash that can contain a regions hash that allows you to specify regions per - * LayoutView instance. - */ - constructor(options?: LayoutViewOptions); - - /** - * Handle destroying regions, and then destroy the view itself. - */ - destroy(): LayoutView; - - /** - * Regions hash or a method returning the regions hash that maps - * regions/selectors to methods on your View. - **/ - regions(): any; - - /** Adds a region to the layout view. */ - addRegion(name: string, definition: any): Region; - - /** - * Add multiple regions as a {name: definition, name2: def2} object literal. - */ - addRegions(regions: any): any; - - /** Returns a region from the layout view */ - getRegion(name: string): Region; - - /** - * Renders the view. It will use the existing region objects the first - * time it is called. Subsequent calls will destroy the views that the - * regions are showing and then reset the `el` for the regions to the - * newly rendered DOM elements. - */ - render(): LayoutView; - - /** - * Removes the region with the specified name. - * @param name the name of the region to remove. - */ - removeRegion(name: string): Region; - - /** Enable easy overriding of the default `RegionManager` - * for customized region interactions and business specific - * view logic for better control over single regions. - */ - getRegionManager(): RegionManager; - - /** - * Show a view into the region specified by `regionName`. - */ - showChildView(regionName: string, view: any, options?: RegionShowOptions): void; - - /** - * Get the current view that is shown in the region specified by - * `regionName`. - */ - getChildView(regionName: string): Backbone.View; - - /** - * Returns all regions from the layout view. The results contains an - * Object hash that has `string`s as keys and `Region`s as values. - */ - getRegions(): {[key: string]: Region}; - - /** - * You can customize the event prefix for events that are forwarded through - * the layout view with this property. - */ - childViewEventPrefix: string; - } - interface AppRouterOptions extends Backbone.RouterOptions { /** * The appRoutes. @@ -1437,7 +1311,7 @@ declare namespace Marionette { options: any; - /** + /** * Behaviors can have their own ui hash, which will be mixed into the ui * hash of its associated View instance. ui elements defined on either the * Behavior or the View will be made available within events and triggers. diff --git a/tinymce/index.d.ts b/tinymce/index.d.ts index f760671a8e..e382910026 100644 --- a/tinymce/index.d.ts +++ b/tinymce/index.d.ts @@ -7,37 +7,169 @@ declare namespace TinyMCE { export interface Observable { - off: (name?: string, callback?: () => void) => any; - on: (name: string, callback: () => void) => any; - fire: (name: string, args?: any, bubble?: boolean) => Event; + off(name?: string, callback?: void): any; + on(name: string, callback: () => void): any; + fire(name: string, args?: any, bubble?: boolean): Event; } export interface Editor extends Observable { - destroy: (automatic: boolean) => void; - remove: () => void; - hide: () => void; - show: () => void; - getContent: (args?: any) => string; - setContent: (content: string, args?: any) => string; - focus: (skip_focus?: boolean) => void; + $: any; + iframeElement: string; + selection: Selection; undoManager: UndoManager; - settings: any; - getDoc: () => Document; - editorUpload: any; + formatter: Formatter; + shortcuts: Shortcuts; + dom: DOMUtils; + notificationManager: NotificationManager; + focus(): void; + getContent(args?: Object): string; + isDirty(): boolean; + insertContent(content: string, args?: any): any; + setContent(content: string, args?: any): any; + reset(): any; + execCommand(command: string, ui?: boolean, value?: any, args?: any): boolean; + remove(): any; + destroy(state?: boolean): void; + getElement(): Element; + getDoc(): Document; + queryCommandSupported(cmd: string): boolean; + getBody(): Element; + setDirty(dirty: boolean): void; + on(eventName: String, handler: Function): void; + addShortcut(pattern: string, desc: string, cmdFunc: string, scope?: any ): boolean; + addButton(name: string, settings: any): void; + addMenuItem(name: string, settings: any): void; + menuItems: any; + initialized: boolean; + } + + export interface Formatter { + remove(name: string): any; + apply(name: string): any; + toggle(name: string): any; + match(name: string, vars?: Object, node?: Node): boolean; + matchAll(names: [string], vars?: Object): [string]; } export interface UndoManager { - undo: () => any; - clear: () => void; - hasUndo: () => boolean; + transact(callback: Function): any; + undo(): any; + redo(): any; + hasRedo(): boolean; + hasUndo(): boolean; + } + + export interface DOMUtils { + DOM: any; + getParent(n: Node, s: string): Node; + setStyle(n: any, na: string, v: string): void; + select(pattern: string, scope ?: Element): Array; + getAttrib(elm: string, name: string, defaultVal ?: string): string; + isEmpty(elements: Object): boolean; + } + + export interface NotificationManager { + getNotifications(): any[]; + open(args: any): any; + close(): any; + } + + export interface Shortcuts { + addShortcut(pattern: string, desc: string, cmdFunc: string, scope?: any): boolean; + remove(pattern: string): boolean; + } + + export interface Collection { + + } + + export interface Container { + add(items: any): Collection; + items(): Collection; + } + + export interface Tooltip { + + } + + export interface Control { + renderTo(node?: Node): void; + innerHtml(html: string): Control; + $el: any; + show(): void; + hide(): void; + visible(state ?: boolean): boolean; + disabled(state: boolean): boolean; + active(state: boolean): boolean; + on(name: string, callback: Function): Control; + parent(parent ?: any): Control; + settings: any; + text(text: string): void; + tooltip(): Tooltip; + } + + export interface Moveable { + moveRel(elm: Node, rel: string): Control; + } + + export interface FloatPanel extends Control, Moveable { + + } + + export interface Menu extends FloatPanel, Control, Container { + + } + + export interface Factory { + create(settings: any): Control; + } + + export interface Tools { + grep(array: any, f: Function): any; + each(o: Object, cb: Function, s?: Object): void; + } + + export interface UI { + Factory: Factory; + Control: Control; + FloatPanel: FloatPanel; + } + + export interface util { + Tools: Tools; + } + + export interface Selection { + getContent(args?: Object): string; + getNode(): any; + getRng(): Range; + collapse(toStart?: boolean): any; + select(node: any, body: boolean): any; + getStart(): any; + getEnd(real ?: boolean): void; + selectorChanged(selector: string, handler: any): void; + getSel(): any; + } + + export interface FocusManager { + isEditorUIElement(elm: Node): boolean; + } + + export interface UI { + Factory: Factory; + Control: Control; + FloatPanel: FloatPanel; } export interface Static extends Observable { - init: (settings: any) => void; - execCommand: (c: string, u: boolean, v: string) => boolean; + init(settings: any): void; + execCommand(c: string, u: boolean, v: string): boolean; activeEditor: Editor; - get: (id: string) => Editor; - triggerSave: () => void; + FocusManager: FocusManager; + get(id: string): Editor; + triggerSave(): void; + ui: UI; + util: util; } } From 44b4d01af14305b1a18f274bb50ef2816ee73754 Mon Sep 17 00:00:00 2001 From: Sean Nolan Date: Wed, 22 Feb 2017 13:16:51 +1300 Subject: [PATCH 022/567] Remove parent relationship --- backbone.marionette/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backbone.marionette/index.d.ts b/backbone.marionette/index.d.ts index c9705c53c1..9fdfd70594 100644 --- a/backbone.marionette/index.d.ts +++ b/backbone.marionette/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Backbone from 'backbone'; -import * as Radio from '../backbone.radio'; +import * as Radio from 'backbone.radio'; export as namespace Marionette; export = Marionette; From d701bd4a5b05fdb23eb2c23800464bee4885df30 Mon Sep 17 00:00:00 2001 From: Sean Nolan Date: Wed, 22 Feb 2017 14:25:02 +1300 Subject: [PATCH 023/567] Fixed build errors --- .../backbone.marionette-tests.ts | 8 ++--- backbone.marionette/index.d.ts | 2 +- tinymce/index.d.ts | 30 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/backbone.marionette/backbone.marionette-tests.ts b/backbone.marionette/backbone.marionette-tests.ts index b5eb9d07c6..2c1f5b68bd 100644 --- a/backbone.marionette/backbone.marionette-tests.ts +++ b/backbone.marionette/backbone.marionette-tests.ts @@ -66,11 +66,11 @@ namespace MarionetteTests { let regions: {[key: string]: Marionette.Region} = this.layoutView.getRegions(); let prefix: string = this.layoutView.childViewEventPrefix; let region: Marionette.Region = this.layoutView.removeRegion('main'); - let layout: Marionette.LayoutView = this.layoutView.destroy(); + let layout: Marionette.View = this.layoutView.destroy(); } } - class AppLayoutView extends Marionette.LayoutView { + class AppLayoutView extends Marionette.View { constructor() { super({ el: 'body' }); } @@ -111,7 +111,7 @@ namespace MarionetteTests { } - class MyView extends Marionette.ItemView { + class MyView extends Marionette.View { behaviors: any; constructor(model: MyModel) { @@ -189,7 +189,7 @@ namespace MarionetteTests { constructor() { super(); this.childView = MyView; - this.childEvents = { + this.childViewEvents = { render: function () { console.log("a childView has been rendered"); } diff --git a/backbone.marionette/index.d.ts b/backbone.marionette/index.d.ts index 9fdfd70594..d24f9d64f9 100644 --- a/backbone.marionette/index.d.ts +++ b/backbone.marionette/index.d.ts @@ -770,7 +770,7 @@ declare namespace Marionette { /** * View implements a destroy method, which is called by the region managers automatically. As part of the implementation. */ - destroy(...args: any[]): void; + destroy(...args: any[]): View; /** * In several cases you need to access ui elements inside the view to diff --git a/tinymce/index.d.ts b/tinymce/index.d.ts index e382910026..b393c1c20e 100644 --- a/tinymce/index.d.ts +++ b/tinymce/index.d.ts @@ -7,8 +7,8 @@ declare namespace TinyMCE { export interface Observable { - off(name?: string, callback?: void): any; - on(name: string, callback: () => void): any; + off(name?: string, callback?: void): void; + on(name: string, callback: () => void): void; fire(name: string, args?: any, bubble?: boolean): Event; } @@ -22,7 +22,7 @@ declare namespace TinyMCE { dom: DOMUtils; notificationManager: NotificationManager; focus(): void; - getContent(args?: Object): string; + getContent(args?: any): string; isDirty(): boolean; insertContent(content: string, args?: any): any; setContent(content: string, args?: any): any; @@ -35,7 +35,7 @@ declare namespace TinyMCE { queryCommandSupported(cmd: string): boolean; getBody(): Element; setDirty(dirty: boolean): void; - on(eventName: String, handler: Function): void; + on(eventName: string, handler: () => void): void; addShortcut(pattern: string, desc: string, cmdFunc: string, scope?: any ): boolean; addButton(name: string, settings: any): void; addMenuItem(name: string, settings: any): void; @@ -47,12 +47,12 @@ declare namespace TinyMCE { remove(name: string): any; apply(name: string): any; toggle(name: string): any; - match(name: string, vars?: Object, node?: Node): boolean; - matchAll(names: [string], vars?: Object): [string]; + match(name: string, vars?: any, node?: Node): boolean; + matchAll(names: [string], vars?: any): [string]; } export interface UndoManager { - transact(callback: Function): any; + transact(callback: () => void): any; undo(): any; redo(): any; hasRedo(): boolean; @@ -63,9 +63,9 @@ declare namespace TinyMCE { DOM: any; getParent(n: Node, s: string): Node; setStyle(n: any, na: string, v: string): void; - select(pattern: string, scope ?: Element): Array; + select(pattern: string, scope ?: Element): Element[]; getAttrib(elm: string, name: string, defaultVal ?: string): string; - isEmpty(elements: Object): boolean; + isEmpty(elements: any): boolean; } export interface NotificationManager { @@ -80,7 +80,7 @@ declare namespace TinyMCE { } export interface Collection { - + active():Collection; } export interface Container { @@ -89,7 +89,7 @@ declare namespace TinyMCE { } export interface Tooltip { - + repaint(): void; } export interface Control { @@ -101,7 +101,7 @@ declare namespace TinyMCE { visible(state ?: boolean): boolean; disabled(state: boolean): boolean; active(state: boolean): boolean; - on(name: string, callback: Function): Control; + on(name: string, callback: () => void): Control; parent(parent ?: any): Control; settings: any; text(text: string): void; @@ -125,8 +125,8 @@ declare namespace TinyMCE { } export interface Tools { - grep(array: any, f: Function): any; - each(o: Object, cb: Function, s?: Object): void; + grep(array: any, f: () => void): any; + each(o: Object, cb: () => void, s?: any): void; } export interface UI { @@ -140,7 +140,7 @@ declare namespace TinyMCE { } export interface Selection { - getContent(args?: Object): string; + getContent(args?: any): string; getNode(): any; getRng(): Range; collapse(toStart?: boolean): any; From 648d85936ee669957e5d214e00a5cde7c2a3bf88 Mon Sep 17 00:00:00 2001 From: Sean Nolan Date: Wed, 22 Feb 2017 14:30:33 +1300 Subject: [PATCH 024/567] Fixed build errors --- tinymce/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tinymce/index.d.ts b/tinymce/index.d.ts index b393c1c20e..e6a9374ab4 100644 --- a/tinymce/index.d.ts +++ b/tinymce/index.d.ts @@ -7,7 +7,7 @@ declare namespace TinyMCE { export interface Observable { - off(name?: string, callback?: void): void; + off(name?: string, callback ?: () => void): void; on(name: string, callback: () => void): void; fire(name: string, args?: any, bubble?: boolean): Event; } @@ -80,7 +80,7 @@ declare namespace TinyMCE { } export interface Collection { - active():Collection; + active(): Collection; } export interface Container { @@ -126,7 +126,7 @@ declare namespace TinyMCE { export interface Tools { grep(array: any, f: () => void): any; - each(o: Object, cb: () => void, s?: any): void; + each(o: any, cb: () => void, s?: any): void; } export interface UI { From 89e6daabefd894b3fe28a23f1aecb9df4bfc49c5 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Wed, 22 Feb 2017 15:29:23 +0900 Subject: [PATCH 025/567] Fix tsconfig for old module, update dependancy version --- redux-persist-transform-encrypt/package.json | 2 +- redux-persist-transform-encrypt/v0.1/tsconfig.json | 6 +++--- redux-persist-transform-filter/package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/redux-persist-transform-encrypt/package.json b/redux-persist-transform-encrypt/package.json index e186771ad7..058a03ac99 100644 --- a/redux-persist-transform-encrypt/package.json +++ b/redux-persist-transform-encrypt/package.json @@ -1,6 +1,6 @@ { "dependencies": { "redux": "^3.6.0", - "redux-persist": "^4.4.0" + "redux-persist": "^4.4.1" } } diff --git a/redux-persist-transform-encrypt/v0.1/tsconfig.json b/redux-persist-transform-encrypt/v0.1/tsconfig.json index b0a989e85a..dcabb54253 100644 --- a/redux-persist-transform-encrypt/v0.1/tsconfig.json +++ b/redux-persist-transform-encrypt/v0.1/tsconfig.json @@ -7,9 +7,9 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "baseUrl": "../", + "baseUrl": "../../", "typeRoots": [ - "../" + "../../" ], "types": [], "noEmit": true, @@ -19,4 +19,4 @@ "index.d.ts", "redux-persist-transform-encrypt-tests.ts" ] -} \ No newline at end of file +} diff --git a/redux-persist-transform-filter/package.json b/redux-persist-transform-filter/package.json index e186771ad7..058a03ac99 100644 --- a/redux-persist-transform-filter/package.json +++ b/redux-persist-transform-filter/package.json @@ -1,6 +1,6 @@ { "dependencies": { "redux": "^3.6.0", - "redux-persist": "^4.4.0" + "redux-persist": "^4.4.1" } } From e2f0f5b1458f39860ea8bb2f3a1c9e870eef41e0 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Wed, 22 Feb 2017 15:36:29 +0900 Subject: [PATCH 026/567] Add missing path mapping to redux-persist-transform-encrypt --- redux-persist-transform-encrypt/v0.1/tsconfig.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redux-persist-transform-encrypt/v0.1/tsconfig.json b/redux-persist-transform-encrypt/v0.1/tsconfig.json index dcabb54253..aefe08ae89 100644 --- a/redux-persist-transform-encrypt/v0.1/tsconfig.json +++ b/redux-persist-transform-encrypt/v0.1/tsconfig.json @@ -10,7 +10,10 @@ "baseUrl": "../../", "typeRoots": [ "../../" - ], + ]. + "paths": { + "redux-persist-transform-encrypt": ["redux-persist-transform-encrypt/v0.1"] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true From 49cd3906e630ff5634a2ceda4ec949f834c7b82b Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Wed, 22 Feb 2017 15:44:09 +0900 Subject: [PATCH 027/567] Fix typo --- redux-persist-transform-encrypt/v0.1/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redux-persist-transform-encrypt/v0.1/tsconfig.json b/redux-persist-transform-encrypt/v0.1/tsconfig.json index aefe08ae89..99c5ba41bc 100644 --- a/redux-persist-transform-encrypt/v0.1/tsconfig.json +++ b/redux-persist-transform-encrypt/v0.1/tsconfig.json @@ -10,7 +10,7 @@ "baseUrl": "../../", "typeRoots": [ "../../" - ]. + ], "paths": { "redux-persist-transform-encrypt": ["redux-persist-transform-encrypt/v0.1"] }, From 9d913b0229ffc45ac544433d89a4373bcf934e46 Mon Sep 17 00:00:00 2001 From: morrisjdev Date: Wed, 22 Feb 2017 19:05:16 +0100 Subject: [PATCH 028/567] small changes in function definition --- linq4js/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/linq4js/index.d.ts b/linq4js/index.d.ts index e108f31a4c..e6b9084ea3 100644 --- a/linq4js/index.d.ts +++ b/linq4js/index.d.ts @@ -11,9 +11,9 @@ declare namespace Linq4JS { } declare namespace Linq4JS { class Helper { - static ConvertStringFunction: (functionString: string) => any; - static ConvertFunction: (testFunction: any) => T; - static OrderCompareFunction: (valueSelector: (item: T) => any, a: T, b: T, invert: boolean) => number; + private static ConvertStringFunction(functionString); + static ConvertFunction(testFunction: string | T): T; + static OrderCompareFunction(valueSelector: (item: T) => any, a: T, b: T, invert: boolean): number; } } interface Array { @@ -148,7 +148,7 @@ interface Array { Take(count: number): T[]; /** * Takes entries as long as a condition is true - * @param condition The condition-function (or function-string) that returns a boolean. All elements until a false gets created are taken + * @param condition The condition-function (or function-string) that returns a boolean. All elements until a false gets thrown are taken * @param initial A initial-function (or function-string) that gets executed once at the start of the loop * @param after A function that gets executed after every element-iteration after the condition-function was evaluated */ @@ -280,4 +280,4 @@ declare namespace Linq4JS { Ascending = 0, Descending = 1, } -} \ No newline at end of file +} From a256a3c1065d73bbdba5280e1a795d5e417d7a66 Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Wed, 22 Feb 2017 21:02:51 +0200 Subject: [PATCH 029/567] lodash types compatibility with TypeScript 2.2 TypeScript 2.2 changed the built-in type of WeakMap to use the new object type in its generic subtype. Updated compat for target es5 and mark file as requiring TS2.2 --- lodash/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash/index.d.ts b/lodash/index.d.ts index 00de563bbb..70b086188c 100644 --- a/lodash/index.d.ts +++ b/lodash/index.d.ts @@ -2,7 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.2 /** ### 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) @@ -19446,5 +19446,5 @@ declare global { interface Set { } interface Map { } interface WeakSet { } - interface WeakMap { } + interface WeakMap { } } From 5ac5d244171439468b176efe5948319a557bf779 Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Wed, 22 Feb 2017 21:25:51 +0200 Subject: [PATCH 030/567] Correct type of WeakMap's key in tests Keys should be an object. see: http://www.ecma-international.org/ecma-262/6.0/#sec-weakmap-objects --- lodash/lodash-tests.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 7d4105df70..588794fab4 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7446,10 +7446,12 @@ namespace TestIsUndefined { // _.isWeakMap namespace TestIsWeakMap { { - let value: number|WeakMap; + interface Obj { a: string }; - if (_.isWeakMap(value)) { - let result: WeakMap = value; + let value: number|WeakMap; + + if (_.isWeakMap(value)) { + let result: WeakMap = value; } else { let result: number = value; From bdf48eb3a1fb7896b83e80a81863b74e0aec4ecb Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Wed, 22 Feb 2017 21:26:49 +0200 Subject: [PATCH 031/567] Adapt isWeakMap as well --- lodash/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lodash/index.d.ts b/lodash/index.d.ts index 70b086188c..d5453f4b91 100644 --- a/lodash/index.d.ts +++ b/lodash/index.d.ts @@ -12701,7 +12701,7 @@ declare namespace _ { * @param value The value to check. * @returns Returns true if value is correctly classified, else false. */ - isWeakMap(value?: any): value is WeakMap; + isWeakMap(value?: any): value is WeakMap; } interface LoDashImplicitWrapperBase { From e650a40fac972b3412a7e402f40146b13b691fd1 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Thu, 23 Feb 2017 12:14:22 +0100 Subject: [PATCH 032/567] Add definitions for fetch-jsonp (https://github.com/camsong/fetch-jsonp) --- fetch-jsonp/fetch-jsonp-tests.ts | 48 ++++++++++++++++++++++++++++++++ fetch-jsonp/index.d.ts | 15 ++++++++++ fetch-jsonp/tsconfig.json | 19 +++++++++++++ fetch-jsonp/tslint.json | 1 + 4 files changed, 83 insertions(+) create mode 100644 fetch-jsonp/fetch-jsonp-tests.ts create mode 100644 fetch-jsonp/index.d.ts create mode 100644 fetch-jsonp/tsconfig.json create mode 100644 fetch-jsonp/tslint.json diff --git a/fetch-jsonp/fetch-jsonp-tests.ts b/fetch-jsonp/fetch-jsonp-tests.ts new file mode 100644 index 0000000000..058f47e70c --- /dev/null +++ b/fetch-jsonp/fetch-jsonp-tests.ts @@ -0,0 +1,48 @@ +import * as fetchJsonp from 'fetch-jsonp'; + +/* Taken from https://github.com/camsong/fetch-jsonp/blob/v1.0.2/README.md */ + +fetchJsonp('/users.jsonp') + .then(function(response) { + return response.json() + }).then(function(json) { + console.log('parsed json', json) + }).catch(function(ex) { + console.log('parsing failed', ex) + }) + +fetchJsonp('/users.jsonp', { + jsonpCallback: 'custom_callback' + }) + .then(function(response) { + return response.json() + }).then(function(json) { + console.log('parsed json', json) + }).catch(function(ex) { + console.log('parsing failed', ex) + }) + +fetchJsonp('/users.jsonp', { + timeout: 3000, + jsonpCallback: 'custom_callback' + }) + .then(function(response) { + return response.json() + }).then(function(json) { + console.log('parsed json', json) + }).catch(function(ex) { + console.log('parsing failed', ex) + }) + +// Taken from https://github.com/camsong/fetch-jsonp/blob/v1.0.2/examples/index.html +var result = fetchJsonp('http://www.flickr.com/services/feeds/photos_public.gne?format=json', { + jsonpCallback: 'jsoncallback', + timeout: 3000 +}) +result.then(function(response) { + return response.json() +}).then(function(json) { + document.body.innerHTML = JSON.stringify(json); +})['catch'](function(ex) { + document.body.innerHTML = 'failed:' + ex; +}) diff --git a/fetch-jsonp/index.d.ts b/fetch-jsonp/index.d.ts new file mode 100644 index 0000000000..99867cdda2 --- /dev/null +++ b/fetch-jsonp/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for fetch-jsonp 1.0 +// Project: https://github.com/camsong/fetch-jsonp +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace fetchJsonp { + interface Options { + timeout?: number; + jsonpCallback?: string; + } +} + +declare function fetchJsonp(url: RequestInfo, options?: fetchJsonp.Options): Promise; + +export = fetchJsonp; diff --git a/fetch-jsonp/tsconfig.json b/fetch-jsonp/tsconfig.json new file mode 100644 index 0000000000..0aaee7fbf4 --- /dev/null +++ b/fetch-jsonp/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "lib": ["es6", "dom"], + "noUnusedLocals": true, + "noUnusedParameters": true, + "strictNullChecks": true, + "noImplicitAny": true, + "noImplicitThis": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true + }, + "files": [ + "index.d.ts", + "fetch-jsonp-tests.ts" + ] +} diff --git a/fetch-jsonp/tslint.json b/fetch-jsonp/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/fetch-jsonp/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From b33b361bba6c18b4ce91b1f825bab4198c5be528 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Thu, 23 Feb 2017 12:41:41 +0100 Subject: [PATCH 033/567] Add "module": "commonjs" --- fetch-jsonp/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/fetch-jsonp/tsconfig.json b/fetch-jsonp/tsconfig.json index 0aaee7fbf4..05c3f994ed 100644 --- a/fetch-jsonp/tsconfig.json +++ b/fetch-jsonp/tsconfig.json @@ -3,6 +3,7 @@ "baseUrl": "../", "typeRoots": ["../"], "types": [], + "module": "commonjs", "lib": ["es6", "dom"], "noUnusedLocals": true, "noUnusedParameters": true, From df8b672c7a12c28d0cc05401529de547ec607be9 Mon Sep 17 00:00:00 2001 From: Lukas Zech Date: Thu, 23 Feb 2017 12:16:04 +0100 Subject: [PATCH 034/567] Use Partial keyword for objectContaining --- jasmine/index.d.ts | 6 +++--- jasmine/jasmine-tests.ts | 13 +++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/jasmine/index.d.ts b/jasmine/index.d.ts index e18361dec4..146ab55ad4 100644 --- a/jasmine/index.d.ts +++ b/jasmine/index.d.ts @@ -49,7 +49,7 @@ declare namespace jasmine { function any(aclass: any): Any; function anything(): Any; function arrayContaining(sample: any[]): ArrayContaining; - function objectContaining(sample: any): ObjectContaining; + function objectContaining(sample: Partial): ObjectContaining; function createSpy(name: string, originalFn?: Function): Spy; function createSpyObj(baseName: string, methodNames: any[]): any; function createSpyObj(baseName: string, methodNames: any[]): T; @@ -82,8 +82,8 @@ declare namespace jasmine { jasmineToString(): string; } - interface ObjectContaining { - new (sample: any): any; + interface ObjectContaining { + new (sample: Partial): T; jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean; jasmineToString(): string; diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index 4632eb8b4c..13d80af9db 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -663,7 +663,12 @@ describe("jasmine.any", function () { }); describe("jasmine.objectContaining", function () { - var foo: any; + interface fooType { + a:number; + b:number; + bar:string; + } + var foo: fooType; beforeEach(function () { foo = { @@ -674,11 +679,11 @@ describe("jasmine.objectContaining", function () { }); it("matches objects with the expect key/value pairs", function () { - expect(foo).toEqual(jasmine.objectContaining({ + expect(foo).toEqual(jasmine.objectContaining({ bar: "baz" })); - expect(foo).not.toEqual(jasmine.objectContaining({ - c: 37 + expect(foo).not.toEqual(jasmine.objectContaining({ + a: 37 })); }); From d1a477c46afe174d349d007c1021332d8cfce73c Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Thu, 23 Feb 2017 13:29:09 +0100 Subject: [PATCH 035/567] =?UTF-8?q?Add=20=E2=80=9CTypeScript=20Version:=20?= =?UTF-8?q?2.2=E2=80=9D=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fetch-jsonp/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/fetch-jsonp/index.d.ts b/fetch-jsonp/index.d.ts index 99867cdda2..e37094254e 100644 --- a/fetch-jsonp/index.d.ts +++ b/fetch-jsonp/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/camsong/fetch-jsonp // Definitions by: Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 declare namespace fetchJsonp { interface Options { From fe7183b55a5d6ee28b005a5816b6641d05b0dd12 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Thu, 23 Feb 2017 13:57:11 +0100 Subject: [PATCH 036/567] Re-indent a bit + missing ; + missing spaces --- gapi/index.d.ts | 96 ++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/gapi/index.d.ts b/gapi/index.d.ts index 28d5c990bc..3a4a78ca21 100644 --- a/gapi/index.d.ts +++ b/gapi/index.d.ts @@ -38,7 +38,7 @@ declare namespace gapi { /** * Pragmatically initialize gapi class member. */ - export function load(object: string, fn: any) : any; + export function load(object: string, fn: any): any; } @@ -155,37 +155,37 @@ declare namespace gapi.client { } /** - * Loads the client library interface to a particular API. If a callback is not provided, a promise is returned. - * @param name The name of the API to load. - * @param version The version of the API to load. - * @return promise The promise that get's resolved after the request is finished. - */ - export function load(name: string, version: string): Promise + * Loads the client library interface to a particular API. If a callback is not provided, a promise is returned. + * @param name The name of the API to load. + * @param version The version of the API to load. + * @return promise The promise that get's resolved after the request is finished. + */ + export function load(name: string, version: string): Promise; /** - * Loads the client library interface to a particular API. The new API interface will be in the form gapi.client.api.collection.method. - * @param name The name of the API to load. - * @param version The version of the API to load - * @param callback the function that is called once the API interface is loaded - * @param url optional, the url of your app - if using Google's APIs, don't set it - */ + * Loads the client library interface to a particular API. The new API interface will be in the form gapi.client.api.collection.method. + * @param name The name of the API to load. + * @param version The version of the API to load + * @param callback the function that is called once the API interface is loaded + * @param url optional, the url of your app - if using Google's APIs, don't set it + */ export function load(name: string, version: string, callback: () => any, url?: string): void; /** - * Creates a HTTP request for making RESTful requests. - * An object encapsulating the various arguments for this method. - */ + * Creates a HTTP request for making RESTful requests. + * An object encapsulating the various arguments for this method. + */ export function request(args: RequestOptions): HttpRequest; /** - * Creates an RPC Request directly. The method name and version identify the method to be executed and the RPC params are provided upon RPC creation. - * @param method The method to be executed. - * @param version The version of the API which defines the method to be executed. Defaults to v1 - * @param rpcParams A key-value pair of the params to supply to this RPC - */ + * Creates an RPC Request directly. The method name and version identify the method to be executed and the RPC params are provided upon RPC creation. + * @param method The method to be executed. + * @param version The version of the API which defines the method to be executed. Defaults to v1 + * @param rpcParams A key-value pair of the params to supply to this RPC + */ export function rpcRequest(method: string, version?: string, rpcParams?: any): RpcRequest; /** - * Sets the API key for the application. - * @param apiKey The API key to set - */ + * Sets the API key for the application. + * @param apiKey The API key to set + */ export function setApiKey(apiKey: string): void; /** @@ -210,24 +210,24 @@ declare namespace gapi.client { status: number; statusText: string; } - ) => any):void; - /** + ) => any): void; + /** * HttpRequest supports promises. */ - then(success:(response:{ - result:T; - body:string; + then(success: (response: { + result: T; + body: string; headers?: any[]; status?: number; - statusText?: string - })=>void, - failure:(response:{ - result:T; - body:string; + statusText?: string; + }) => void, + failure: (response: { + result: T; + body: string; headers?: any[]; status?: number; - statusText?: string - })=>void): void; + statusText?: string; + }) => void): void; } /** * Represents an HTTP Batch operation. Individual HTTP requests are added with the add method and the batch is executed using execute. @@ -244,16 +244,16 @@ declare namespace gapi.client { */ id: string; callback: ( - /** - * is the response for this request only. Its format is defined by the API method being called. - */ - individualResponse: any, - /** - * is the raw batch ID-response map as a string. It contains all responses to all requests in the batch. - */ - rawBatchResponse: any - ) => any - }):void; + /** + * is the response for this request only. Its format is defined by the API method being called. + */ + individualResponse: any, + /** + * is the raw batch ID-response map as a string. It contains all responses to all requests in the batch. + */ + rawBatchResponse: any + ) => any + }): void; /** * Executes all requests in the batch. The supplied callback is executed on success or failure. * @param callback The callback to execute when the batch returns. @@ -267,7 +267,7 @@ declare namespace gapi.client { * is the same response, but as an unparsed JSON-string. */ rawBatchResponse: string - ) => any):void; + ) => any): void; } /** @@ -288,7 +288,7 @@ declare namespace gapi.client { * is the same as jsonResp, except it is a raw string that has not been parsed. It is typically used when the response is not JSON. */ rawResp: string - ) => void ):void; + ) => void): void; } } From 318a5c5896c5dbee368d546f904ded23b759d2c6 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Thu, 23 Feb 2017 14:01:24 +0100 Subject: [PATCH 037/567] Better gapi.load --- gapi/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gapi/index.d.ts b/gapi/index.d.ts index 3a4a78ca21..84da600e7b 100644 --- a/gapi/index.d.ts +++ b/gapi/index.d.ts @@ -38,7 +38,7 @@ declare namespace gapi { /** * Pragmatically initialize gapi class member. */ - export function load(object: string, fn: any): any; + export function load(apiName: string, callback: () => void): void; } From ea45419314f1dd5be0b5b7c30c495b4203cc098c Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Thu, 23 Feb 2017 16:01:54 +0100 Subject: [PATCH 038/567] add qlik-visualizationextensions as typescript definition Signed-off-by: Konrad Mattheis --- qlik-visualizationextensions/index.d.ts | 2417 +++++++++++++++++ .../qlik-visualizationextensions-tests.ts | 3 + qlik-visualizationextensions/tsconfig.json | 23 + qlik-visualizationextensions/tslint.json | 7 + 4 files changed, 2450 insertions(+) create mode 100644 qlik-visualizationextensions/index.d.ts create mode 100644 qlik-visualizationextensions/qlik-visualizationextensions-tests.ts create mode 100644 qlik-visualizationextensions/tsconfig.json create mode 100644 qlik-visualizationextensions/tslint.json diff --git a/qlik-visualizationextensions/index.d.ts b/qlik-visualizationextensions/index.d.ts new file mode 100644 index 0000000000..8a9c145969 --- /dev/null +++ b/qlik-visualizationextensions/index.d.ts @@ -0,0 +1,2417 @@ +// Type definitions for qlik-visualizationextensions +// Project: http://help.qlik.com/en-US/sense-developer/3.2/Subsystems/Extensions/Content/extensions-introduction.htm +// Definitions by: Konrad Mattheis +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace BackendAPI { + type StateType = "L" | "S" | "O" | "D" | "A" | "X" | "XS" | "XL"; + type SortIndicatorType = "N" | "A" | "D"; + type DimensionType = "D" | "N" | "T"; + type GroupingType = "N" | "H" | "C"; + type FieldAttributesType = "U" | "A" | "I" | "R" | "F" | "M" | "D" | "T" | "TS" | "IV"; + type PatchType = "Add" | "Remove" | "Replace"; + + interface ICharRange { + /** + * Position of the first search occurrence + * Integer + */ + qCharPos: number; + + /** + * Number of occurrences found + * Integer + */ + qCharCount: number; + } + + interface INxHighlightRanges { + /** + * Ranges of highlighted values + * Array of CharRange + */ + qRanges: ICharRange[]; + } + + interface INxSimpleValue { + /** + * Text related to the attribute expression value. + * This property is optional. No text is returned if the attribute expression value is a numeric. + * String + */ + qText: string; + + /** + * Numeric value of the attribute expression. + * This property is set to NaN (Not a Number) if the attribute expression value is not a numeric. + * Numerical values are not returned as text. + * Double precision floating point + */ + qNum: number; + } + + interface INxAttributeExpressionValues { + /** + * List of attribute expressions values. + * Array of NxSimpleValue + */ + qValues: INxSimpleValue[]; + } + + interface INxSimpleDimValue { + /** + * Text related to the attribute expression value. + * This property is optional. No text is returned if the attribute expression value is a numeric. + * String + */ + qText: string; + + /** + * Element number. + * Integer + */ + qElemNo: number; + } + + interface INxAttributeDimValues { + /** + * List of values. + * Array of NxSimpleDimValue + */ + qValues: INxSimpleDimValue[]; + } + + interface INxCell { + /** + * Some text. + * This parameter is optional. + */ + qText?: string; + + /** + * A value. + * This parameter is optional. + */ + qNum?: number; + + /** + * Rank number of the value, starting from 0. + * If the element number is a negative number, it means that the returned value is not an element number. + * You can get the following negative values: + * # -1: the cell is a Total cell. It shows a total. + * # -2: the cell is collapsed. Applies to pivot tables. + * # -3: the cell belongs to the group Others. + * # -4: the cell is empty. Applies to pivot tables. + */ + qElemNumber: number; + + /** + * State of the value. + * The default state for a measure is L. + * L for Locked + * S for Selected + * O for Optional + * D for Deselected + * A for Alternative + * X for eXcluded + * XS for eXcluded Selected + * XL for eXcluded Locked + */ + qState: StateType; + + /** + * Is set to true, if qText and qNum are empty. + * This parameter is optional. The default value is false. + */ + qIsEmpty: boolean; + + /** + * Is set to true if a total is displayed in the cell. + * This parameter is optional. The default value is false. + * Not applicable to list objects. + */ + qIsTotalCell: boolean; + + /** + * Is set to true if the cell belongs to the group Others. + * Dimension values can be set as Others depending on what has been defined in OtherTotalSpecProp. + * This parameter is optional. The default value is false. + * Not applicable to list objects. + */ + qIsOtherCell: boolean; + + /** + * Frequency of the value. + * This parameter is optional. + */ + qFrequency: string; + + /** + * Search hits. + * The search hits are highlighted. + * This parameter is optional. + */ + qHighlightRanges: INxHighlightRanges; + + /** + * Attribute expression values. + */ + qAttrExps: INxAttributeExpressionValues; + + /** + * Is set to true if the value is Null. + */ + qIsNull: boolean; + + /** + * Attribute dimensions values. + */ + qAttrDims: INxAttributeDimValues; + } + + interface INxPage { + /** + * Position from the left. + * Corresponds to the first column. + */ + qLeft: number; + + /** + * Position from the top. + * Corresponds to the first row. + */ + qTop: number; + + /** + * Number of columns in the page. The indexing of the columns may vary depending on whether the cells are expanded or not (parameter qAlwaysFullyExpanded in HyperCubeDef). + */ + qWidth: number; + + /** + * Number of rows or elements in the page. The indexing of the rows may vary depending on whether the cells are expanded or not (parameter qAlwaysFullyExpanded in HyperCubeDef). + */ + qHeight: number; + } + + interface INxAttrDimInfo { + /** + * Cardinality of the attribute expression. + * Integer + */ + qCardinal: number; + + /** + * Number of rows. + * Size + */ + qSize: number; + + /** + * The title for the attribute dimension. + * String + */ + qFallbackTitle: string; + + /** + * The Locked value of the dimension. + * Boolean + */ + qLocked: boolean; + + /** + * Validation error. + * REF(NxValidationError) + */ + //?Type = REF(NxValidationError)? + qError: INxValidationError; + } + + interface INxDimensionInfo { + /** + * Corresponds to the label of the dimension that is selected. + * If the label is not defined then the field name is used. + * String + */ + qFallbackTitle: string; + + /** + * Length of the longest value in the field. + * Integer + */ + qApprMaxGlyphCount: number; + + /** + * Number of distinct field values. + * Integer + */ + qCardinal: number; + + /** + * Is set to true if the field is locked. + * Boolean + */ + qLocked: boolean; + + /** + * Sort indicator. + * This parameter is optional. + * The default value is no sorting. + * One of: + * # N for no sorting + * # A for sorting ascending + * # D for sorting descending + */ + qSortIndicator: SortIndicatorType; + + /** + * Array of dimension labels. + * Contains the labels of all dimensions in a hierarchy group (for example the labels of all dimensions in a drill down group). + * Array of String + */ + qGroupFallbackTitles: string[]; + + /** + * Index of the dimension that is currently in use. + * qGroupPos is set to 0 if there are no hierarchical groups (drill-down groups) or cycle groups. + * Integer + */ + qGroupPos: number; + + /** + * Number of values in a particular state. + * NxStateCounts + */ + qStateCounts: INxStateCounts; + + /** + * Gives information on a field. For example, it can return the type of the field. + * Examples: key, text, ASCII + * Array of String + */ + qTags: string[]; + + /** + * This parameter is optional. + * Gives information on the error. + * Null or NxValidationError + */ + qError: INxValidationError; + + /** + * Binary format of the field. + * One of: + * # D for discrete (String) + * # N for numeric (Double) + * # T for Time (Timestamp) + */ + qDimensionType: DimensionType; + + /** + * If set to true, it inverts the sort criteria in the field. + * Boolean + */ + qReverseSort: boolean; + + /** + * Defines the grouping. + * One of: + * # N for no grouping + * # H for drill-down + * # C for cyclic + */ + qGrouping: GroupingType; + + /** + * If set to true, it means that the field is a semantic. + * Boolean + */ + qIsSemantic: boolean; + + /** + * Format of the field. + * This parameter is optional. + * FieldAttributes + */ + qNumFormat: FieldAttributesType; + + /** + * This parameter is set to true if qNumFormat is set to U (unknown). The engine guesses the type of the field based on the field's definition. + * Boolean + */ + qIsAutoFormat: boolean; + + /** + * Array of field names. + * Array of String + */ + qGroupFieldDefs: string[]; + + /** + * Array of attribute expressions. + * Array of NxAttrExprInfo + */ + qAttrExprInfo: INxAttrExprInfo; + + /** + * Minimum value. + * Double + */ + qMin: number; + + /** + * Maximum value. + * Double + */ + qMax: number; + + /** + * Is continuous axis used. + * Boolean + */ + qContinuousAxes: boolean; + + /** + * Is a cyclic dimension used. + * Boolean + */ + qIsCyclic: boolean; + + /** + * Is derived field is used as a dimension. + * Boolean + */ + qDerivedField: boolean; + + /** + * Array of attribute dimensions. + * Array of NxAttrDimInfo + */ + qAttrDimInfo: INxAttrDimInfo; + } + + interface INxAttrExprInfo { + /** + * Minimum value. + */ + qMin: number; + + /** + * Maximum value. + */ + qMax: number; + + /** + * Is continuous axis used. + */ + qContinuousAxes: boolean; + + /** + * Is a cyclic dimension used. + */ + qIsCyclic: boolean; + + /** + * Corresponds to the label of the dimension that is selected. + */ + qFallbackTitle: string; + } + + interface INxStateCounts { + /** + * Number of values in locked state. + * Integer + */ + qLocked: number; + + /** + * Number of values in selected state. + * Integer + */ + qSelected: number; + + /** + * Number of values in optional state. + * Integer + */ + qOption: number; + + /** + * Number of values in deselected state. + * Integer + */ + qDeselected: number; + + /** + * Number of values in alternative state. + * Integer + */ + qAlternative: number; + + /** + * Number of values in excluded state + * Integer + */ + qExcluded: number; + + /** + * Number of values in selected excluded state. + * Integer + */ + qSelectedExcluded: number; + + /** + * Number of values in locked excluded state. + * Integer + */ + qLockedExcluded: number; + } + + interface INxValidationError { + /** + * Error code. + * This parameter is always displayed in case of error. + * Integer + */ + qErrorCode: number; + + /** + * Context related to the error, from the user app domain. + * It can be the identifier of an object, a field name, a table name. + * This parameter is optional. + * String + */ + qContext: string; + + /** + * Internal information from the server. + * This parameter is optional. + * String + */ + qExtendedMessage: string; + } + + interface IFieldAttributes { + /** + * Type of the field. + * Default is U. + * One of: + * # U for UNKNOWN type. + * # A for ASCII; Numeric fields values contain only standard ASCII characters. + * # I for INTEGER; Numeric fields values are shown as integer numbers. + * # R for REAL; Numeric fields values are shown as real numbers. + * # F for FIX; Numeric fields values are shown as numbers with a fix number of decimals. + * # M for MONEY; Numeric fields values are shown as in the money format. + * # D for DATE; Numeric fields values are shown as dates. + * # T for TIME; Numeric fields values are shown as times. + * # TS TIMESTAMP; Numeric fields values are shown as time stamps. + * # IV for INTERVAL; Numeric fields values are shown as intervals. + */ + qType: FieldAttributesType; + + /** + * Number of decimals. + * Default is 10. + * Integer between 0 and 15. + */ + qnDec: number; + + /** + * Defines whether or not a thousands separator must be used. + * Default is 0. + * One of: 0 for false | 1 for true + */ + qUseThou: boolean; + + /** + * Defines the format pattern that applies to qText. + * Is used in connection to the type of the field (parameter qType). + * For more information, see Struct FieldAttributes. + * Example: YYYY-MM-DD for a date + */ + qFmt: string; + + /** + * Defines the decimal separator. + * Example: . + */ + qDec: string; + + /** + * Defines the thousand separator (if any). + * Is used if qUseThou is set to 1. + * Example: , + */ + qThou: string; + + /** + * Array + */ + qSAFEARRAY: any[]; + } + + interface INxMeasureInfo { + /** + * Corresponds to the label of the measure. If the label is not defined then the measure name is used. + * String + */ + qFallbackTitle: string; + + /** + * Length of the longest value in the field. + * Integer + */ + qApprMaxGlyphCount: number; + + /** + * Number of distinct field values. + * Integer + */ + qCardinal: number; + + /** + * Sort indicator. This parameter is optional. The default value is no sorting. + */ + qSortIndicator: SortIndicatorType; + + /** + * Format of the field. This parameter is optional. + * One of: N for no sorting, A for sorting ascending, D for sorting descending + */ + qNumFormat: IFieldAttributes; + + /** + * This parameter is set to true if qNumFormat is set to U (unknown). The engine guesses the type of the field based on the field's expression. + */ + qIsAutoFormat: boolean; + + /** + * Lowest value in the range. + */ + qMin: number; + + /** + * Highest value in the range. + */ + qMax: number; + + /** + * This parameter is optional. Gives information on the error. + */ + qError: INxValidationError; + + /** + * If set to true, it inverts the sort criteria in the field. + */ + qReverseSort: boolean; + + /** + * List of attribute expressions. + */ + qAttrExprInfo: INxAttrExprInfo[]; + + /** + * List of attribute dimensions. + */ + qAttrDimInfo: INxMeasureInfo[]; + } + + interface IRange { + /** + * Lowest value in the range + * Double + */ + qMin: number; + + /** + * Highest value in the range + * Double + */ + qMax: number; + + /** + * If set to true, the range includes the lowest value in the range of selections (Equals to ). [bn(50500)] + * Example: The range is [1,10]. If qMinInclEq is set to true it means that 1 is included in the range of selections. + */ + qMinInclEq: boolean; + + /** + * If set to true, the range includes the highest value in the range of selections (Equals to ). [bn(50500)] + * Example: The range is [1,10]. If qMinInclEq is set to true it means that 10 is included in the range of selections. + */ + qMaxInclEq: boolean; + } + + interface INxPatch { + /** + * Operation to perform. + * One of: + * # Add + * # Remove + * # Replace + */ + qOp: PatchType; + + /** + * Path to the property to add, remove or replace. + * String + */ + qPath: string; + + /** + * This parameter is not used in a remove operation. + * Corresponds to the value of the property to add or to the new value of the property to update. + * Examples: "false", "2", "\"New title\"" + * String + */ + qValue: string; + } + + interface IBackend { + /** + * Aborts the result of a search in a list object. Clears the existing search and returns the object to the state it was in prior to the search started. + */ + abortSearch(): void; + + /** + * Accepts the result of a search in a list object and the search result is selected in the field. + * @param {boolean} toggleMode - If true, toggle state for selected values + */ + acceptSearch(toggleMode: boolean): void; + + /** + * Updates the properties for this object. + * @param {array} qPatches - Array of patches. Each path contains: + * #qOp: Add/Remove/Replace + * #qPath: Path to property + * #qValue: The new value in string format. Strings need to be surrounded by \". + * @param {boolean} qSoftPatch - Set to True if properties should be soft, that is not persisted. + * @return {Promise} - A promise of a Qlik engine reply. + */ + applyPatches(qPatches: any[], qSoftPatch: boolean): ng.IPromise; + + /** + * Clears unconfirmed selections for this object. + */ + clearSelections(): void; + + /** + * Clears all soft patches that has previously been applied for this object using the applyPatches method. + * @return {Promise} - A promise of a Qlik engine reply. + */ + clearSoftPatches(): ng.IPromise; + + /** + * Collapse the left dimensions of a pivot table. Only works for hypercubes with qMode = P which are not always fully expanded. + * @param {number} qRow - Row index. + * @param {number} qCol - Column index. + * @param {boolean} [qAll] - Optional. If set to true, qRow and qCol are ignored and all cells are collapsed. + * @return {Promise} - A promise of a Qlik engine reply. + */ + collapseLeft(qRow: number, qCol: number, qAll?: boolean): ng.IPromise; + + /** + * Collapse the top dimensions of a pivot table. Only works for hypercubes with qMode = P which are not always fully expanded. + * @param {number} qRow - Row index. + * @param {number} qCol - Column index. + * @param {boolean} [qAll] - Optional. If set to true, qRow and qCol are ignored and all cells are collapsed. + * @return {Promise} - A promise of a Qlik engine reply. + */ + collapseTop(qRow: number, qCol: number, qAll?: boolean): ng.IPromise; + + /** + * Loops through data rows for this object. Only rows that are available client side will be used. + * @param {function} callback - Function to call for each row. + * Parameters are row number and row data as an array of NxCell objects. + * The loop is terminated if the function returns false. + * @return {NxCell[]} - An array of NxCell. + */ + eachDataRow(callback: any): INxCell[]; + + /** + * Expands the left dimensions of a pivot table. Only works for hypercubes with qMode = P which are not always fully expanded. + * @param {number} qRow - Row index. + * @param {number} qCol - Column index. + * @param {boolean} [qAll] - Optional. If set to true, qRow and qCol are ignored and all cells are collapsed. + * @return {Promise} - A promise of a Qlik engine reply. + */ + expandLeft(qRow: number, qCol: number, qAll?: boolean): ng.IPromise; + + /** + * Expands the top dimensions of a pivot table. Only works for hypercubes with qMode = P which are not always fully expanded. + * @param {number} qRow - Row index. + * @param {number} qCol - Column index. + * @param {boolean} [qAll] - Optional. If set to true, qRow and qCol are ignored and all cells are collapsed. + * @return {Promise} - A promise of a Qlik engine reply. + */ + expandTop(qRow: number, qCol: number, qAll?: boolean): ng.IPromise; + + /** + * Geta data from Qlik engine for this object. + * @param {array} qPages - An array of NxPage objects. + * @return {Promise} - A promise of qDataPages. + */ + getData(qPages: INxPage[]): ng.IPromise; + + /** + * Gets a data row for this object. + * @param {number} rownum - The row number. + * @return {NxCell} - A row of NxCell or null if the row is not available client side and need to be fetched with getData method. + */ + getDataRow(rownum: number): INxCell; + + /** + * Gets qDimensionInfo for this object. + * @return {NxDimensionInfo[]} - An array of qDimensionInfo objects. + */ + getDimensionInfos(): INxDimensionInfo[]; + + /** + * Gets qMeasureInfo for this object. + * @return {NxMeasureInfo} - An array of qMeasureInfo objects. + */ + getMeasureInfos(): INxMeasureInfo; + + /** + * Gets pivot data from the Qlik engine for this object. Only works for hypercubes with qMode = P. + * @param {array} qPages - An array of request page objects. + * @return {Promise} - A promise of pivot data pages. + */ + getPivotData(qPages: INxPage[]): ng.IPromise; + + /** + * Get properties for this object. + * @return {Promise} - A promise of object properties. + */ + getProperties(): ng.IPromise; + + /** + * Get reduced data from the Qlik engine for this object. This method is intended for preserving the shape of the data, not for viewing the actual data points. + * @param {array} qPages - An array of request page objects. + * @param {number} qZoomFactor - Zoom factor. + * If set to -1, the Qlik engine decides of the zoom factor. + * If qReductionMode is D1 or S, the zoom factor is 2ⁿ. If the zoom factor is 5, the data are reduced by a factor 32. + * If qReductionMode is C, the zoom factor defines the number of centroids. + * @param {string} qReductionMode - Reduction mode.Can be: + * # N for no data reduction. + * # D1 to reduce a bar chart or line chart. The profile of the chart is reduced whatever the number of dimensions in the chart. + * # S to reduce the resolution of a scatter plot. + * # C to reduce the data of a scatter plot chart. + * # ST to reduce the data of a stacked pivot table. + * @return {Promise} - A promise of reduced data pages. + */ + getReducedData(qPages: INxPage[], qZoomFactor: number, qReductionMode: string): ng.IPromise; + + /** + * Get total number of data rows for this object. + * @return {Number} - A number. + */ + getRowCount(): number; + + /** + * Get stacked data from the Qlik engine for this object. Only works for hypercubes with qMode = S. + * @param {array} qPages - An array of request page objects. + * @param {number} qMaxNbrCells - Maximum number of cells at outer level. + * @return {Promise} - A promise of stack data pages. + */ + getStackedData(qPages: INxPage[], qMaxNbrCells: number): ng.IPromise; + + /** + * Find out if there are unconfirmed selections for this object. + * @return {boolean} - True if there are unconfirmed selections. + */ + hasSelections(): boolean; + + /** + * Save this object. + * @return {Promise} - A promise. In case of success, it returns "undefined". In case of failure it returns the error. + */ + save(): ng.IPromise; + + /** + * Search for a term in a list object. Results in an updated layout, containing only matching records. + * @param {string} term - Term to search for. + */ + search(term: string): void; + + /** + * Select values in this object using ranges. + * @param {array} qRanges - Array of ranges to select. + * @param {boolean} qOrMode - If true only one of the measures needs to be in range. + */ + selectRange(qRanges: IRange[], qOrMode: boolean): void; + + /** + * Select values in this object with a Qlik engine call which triggers a repaint of the object. + * @param {number} qDimNo - Dimension number. 0 = first dimension. + * @param {array} qValues - Array of values (qElemNumber in the matrix from the Qlik engine) to select or deselect. + * @param {boolean} qToggleMode - If true, values in the field are selected in addition to any previously selected items. + * If false, values in the field are selected while previously selected items are deselected. + */ + selectValues(qDimNo: number, qValues: any[], qToggleMode: boolean): void; + + /** + * Set properties for this object. + * @param {object} props - The properties to set. + * @return {Promise} - A promise of a Qlik engine reply. + */ + setProperties(props: any): ng.IPromise; + } +} + +declare namespace RootAPI { + interface IAppConfig { + /** + * Optional Qlik host. + */ + host?: string; + + /** + * Port number. + */ + port: string | number; + + /** + * Optional. Qlik virtual proxy. "/" if no proxy. + */ + prefix?: string; + + /** + * Optional. Use SSL. + */ + isSecure?: boolean; + + /** + * Optional. Open app without loading data. Introduced in version 1.1. + */ + openWithoutData?: boolean; + + /** + * Optional. Unique identity for the session. If omitted, the session will be shared. + */ + identity?: string; + } + + interface IGlobalConfig { + /** + * Qlik Sense host + */ + host: string; + + /** + * Port number + */ + port: string; + + /** + * Qlik Sense virtual proxy. / if no virtual proxy + */ + prefix: string; + + /** + * Use SSL + */ + isSecure: boolean; + + /** + * Unique identity for the session. If omitted, the session will be shared. + */ + identity: string; + } + + interface IRoot { + /** + * Calls the Qlik Sense repository. + * @param {string} path - Path to the Qlik Sense repository. + * Refer to Qlik Sense repository documentation for the available paths. + * @param {string} [method] - Optional. HTTP method. Default is GET. + * @param {string} [body] - Optional. Body of the post. + * @return {Promise} - A promise of a Qlik engine reply. + */ + callRepository(path: string, method?: string, body?: string): ng.IPromise; + + /** currApp + * Gets a reference to the current app. Use the currApp method in an extension to get a reference to the app currently displayed. + * @param {object} [reference] - Optional. Reference to extension object. Introduced in version 1.1. + * @return {IApp} - An App JavaScript object with app methods. + */ + currApp(object?: any): AppAPI.IApp; + + /** + * Gets a list of Qlik Sense apps that you potentially can connect to and registers a callback to receive the data. + * The getAppList method opens a WebSocket, gets the app list, and then closes the WebSocket. + * @param {function} callback - Callback method. + * @param {object} [config] - Optional. Additional configuration parameters: + * Name | Type | Descr | Name + * host | String | Optional. Qlik host. | host + * port | String or integer | Port number. | port + * prefix | String | Optional. Qlik virtual proxy. "/" if no proxy. | prefix + * isSecure | Boolean | Optional. Use SSL. | isSecure + * openWithoutData | Boolean | Optional. Open app without loading data. Introduced in version 1.1. | openWithoutData + * identity | String | Optional. Unique identity for the session. If omitted, the session will be shared. | identity + */ + getAppList(callback: any, config?: any): void; + + /** + * Gets a list of extensions installed for Qlik Sense. The reply contains all extensions, that is widget libraries, visualization extensions and mashups. + * @param {function} [callback] - Optional. Callback method. + * @return {Promise} - A promise of a Qlik engine reply. + */ + getExtensionList(callback?: any): ng.IPromise; + + /** + * Opens a WebSocekt connection to the Qlik engine for global methods. + * @param {object} [config] - Optional. Parameters: + * Name | Type | Description + * host | String | Qlik Sense host + * port | String | Port number + * prefix | String | Qlik Sense virtual proxy. / if no virtual proxy + * isSecure | Boolean | Use SSL + * identity | String | Unique identity for the session. If omitted, the session will be shared. + * @return {ANY} - A global JavaScript object with global methods. + */ + getGlobal(config: any): any; + + /** Opens a Qlik Sense app. You can open multiple apps. + * Most other methods are defined on the app. Returns: App JavaScript object with app methods. + * @param {string} appId The app id. + * @param {object} [config] Optional. Additional configuration parameters: + * Name | Type | Descr + * host | String | Optional. Qlik host. + * port | String or Integer | Port number. + * prefix | String | Optional. Qlik virtual proxy. "/" if no proxy. + * isSecure | Boolean | Optional. Use SSL. + * openWithoutData | Boolean | Optional. Open app without loading data. Introduced in version 1.1. + * identity | String | Optional. Unique identity for the session. If omitted, the session will be shared. + * Parameter updated in version 2.2. + * @return {any} - App JavaScript object with app methods. + */ + openApp(appId: string, config?: any): any; + + /** + * Registers an extension for use in this mashup. The extension is not installed on the Qlik Sense server and only available in the session where it is created. + * As long as a JavaScript module is created in the correct format, it can be sent to the registerExtension function. + * @param {string} id - Set the ID of the visualization extension. + * @param {object} impl - Set the extension implementation. + * @param {object} [metadata] - Optional. Extension meta-data, same format as the QEXT file. Default: {"type":"visualization"} + */ + registerExtension(id: string, impl: any, metadata?: any): void; + + /** + * Sends a resize event to all Qlik Sense objects. + * @param {string} [ID] - Object id. Optional: if no ID resize event will be sent to all objects. + */ + resize(ID?: string): void; + + /** + * Sets a specific language for the Qlik Sense session. + * Language should be defined before the app is opened meaning the setLanguage method should be called before the openApp method is called. + * @param {string} lang - Language code. Can be: + * # German: short: de long: de-DE + * # English: short: en long: en-US + * # Spanish: short: es long: es-ES + * # French: short: fr long: fr-FR + * # Italian: short: it long: it-IT + * # Japanese: short: ja long: ja-JP + * # Korean: (introduced in version 3.0) short: ko long: ko-KR + * # Dutch: short: nl long: nl-NL + * # Polish: (introduced in version 3.0) short: pl long: pl-PL + * # Brazilian Portuguese: short: pt long: pt-BR + * # Russian: short: ru long: ru-RU + * # Swedish: short: sv long: sv-SE + * # Turkish: (introduced in version 3.0) short: tr long: tr-TR + * # Simplified Chinese: short: Do not use! long: zh-CN + * # Traditional Chinese: (introduced in version 3.0) short: Do not use! long: zh-TW + */ + setLanguage(lang: string): void; + + /** + * Registers a callback for error handling. Standard Qlik Sense error handling is used if this method is not called. + * @param {function} onError - Error handling function + * @param {function} [onWarning] - Optional. Warning handling function. Introduced in version 2.1. + */ + setOnError(onError: any, onWarning?: any): void; + + /** + * Create a QTable object that wraps data in your extension and provides an object oriented interface. + * @param {object} ext - Extension or angular scope for the extension. + * @param {string} [path] - Optional. Path to the hypercube. Default: qHyperCube + * @return {QTable} - A QTable object that holds data and options for the table. + */ + table(ext: any, path?: string): TableAPI.IQTable; + + navigation: NavigationAPI.INavigation; + } +} + +declare namespace AppAPI { + interface IApp { + /** + * Adds an alternate state in the app. Multiple states within a Qlik Sense app can be created and applied to specific objects within the app. Objects in a given state are not affected by user selection in the other states. + * @param {string} qStateName - Mandatory. Alternate state name. + * @return {Promise} - A promise of a Qlik engine reply. + */ + addAlternateState(qStateName: string): ng.IPromise; + + /** + * Steps back in the list of selections. + * @return {Promise} - A promise of a Qlik engine reply. + */ + back(): ng.IPromise; + + /** + * Clears all selections in all fields of the current Qlik Sense app. + * @param {boolean} [lockedAlso] - Optional. Alternate state name. Default: false Introduced in version 2.1. + * @param {string} [state] - Optional. Alternate state name. Default: $ Introduced in version 2.1. + * @return {Promise} - A promise of a Qlik engine reply. + */ + clearAll(lockedAlso?: boolean, state?: string): ng.IPromise; + + /** + * Closes a Qlik Sense app. Also closes the WebSocket and clears out client side data. + */ + close(): void; + + /** + * Defines a hypercube and registers a callback to receive the data. + * @param {object} qHyperCubeDef - Cube definition. + * @param {function} [callback] - Optional. Callback method. Parameter will contain a qHyperCube. + * @return {Promise} - A promise of an object model. + */ + createCube(qHyperCubeDef: any, callback?: any): ng.IPromise; + + /** + * Creates a generic object and registers a callback to receive the data. The generic object can contain the following: + * # qHyperCubeDef + * # qListObjectDef + * # qStringExpression + * # qValueExpression + * The callback method will be called whenever the selection state changes in a way that affects the generic object. The parameter will be the evaluated version of the definition. + * @param {object} [def] - Optional. Generic object definition + * @param {function} [callback] - Optional. Callback method. + * @return {Promise} - A promise of an object model. + */ + createGenericObject(def?: any, callback?: any): ng.IPromise; + + /** + * Defines a list of field values and registers a callback to receive the data. + * @param {object} qListObjectDef - List definition. + * @param {function} [callback] - Optional. Callback method. Parameter will contain a qListObject. + * @return {Promise} - A promise of an object model. + */ + createList(qListObjectDef: any, callback?: any): ng.IPromise; + + /** + * Defines a hypercube for a table and is the entry point to the Table API. It creates a table object that wraps the hypercube. + * @param {Array.} dimensions - Dimensions to use. + * Should, for each entry, be a field name or a NxDimension structure. + * @param {Array.} measures - Measures to use. + * Should, for each entry, be an expression or a NxMeasure structure. + * @param {object} [options] - Optional. Options to set. + * @return {QTable} - A table object of type QTable, which is initially empty but that eventually will contain data. The table object will be updated when selection state changes. + */ + createTable(dimensions: string[] | any[], measures: string[] | any[], options?: any): TableAPI.IQTable; + + /** + * Destroys a Qlik Sense session object created with the createGenericObject method or any of createCube, createList or getList methods. + * Calling this method removes the object from the Qlik engine, no more updates are sent to the client and all methods on the object are invalid. + * @param {string} id - Session object id. + * @return {Promise} - A promise of a Qlik engine reply. + */ + destroySessionObject(id: string): ng.IPromise; + + /** + * Reloads the data in a Qlik Sense app. + * @param {string} [qMode] - Optional. Error handling mode: + * # 0 = default mode. + * # 1 = attempt recovery on all errors. + * # 2 = fail on all errors. + * @param {boolean} [qPartial] - Optional. Set to true for partial reload. + * @param {boolean} [qDebug] - Optional. Set to true if debug breakpoints are honored. Execution of the script will be in debug mode. + * @return {Promise} - A promise of a Qlik engine reply. + */ + doReload(qMode?: string, qPartial?: boolean, qDebug?: boolean): ng.IPromise; + + /** + * Saves a Qlik Sense app, including all objects and data in the data model. + * @param {string} [qFileName] - Optional. File name of the file to save. + * @return {Promise} - A promise of a Qlik engine reply. + */ + doSave(qFileName?: string): ng.IPromise; + + /** + * Gets a field reference with methods that can be used to manipulate the field. + * @param {string} [field] - Optional. Name of the field. + * @param {string} [state] - Optional. Alternate state name. Default is $. + * @return {QField} - A QField object with methods and properties that can be used to manipulate the field. + */ + field(field?: string, state?: string): FieldAPI.IQField; + + /** + * Step forward in list of selections. + * @return {Promise} - A promise of a Qlik engine reply. + */ + forward(): ng.IPromise; + + /** + * Gets a layout for this Qlik Sense app and registers a callback to receive the data. Returns the dynamic properties (if any) in addition to the fixed properties. + * @param {function} [callback] - Optional. Callback method. + * @return {Promise} - A promise of a Qlik engine reply. + */ + getAppLayout(callback?: any): ng.IPromise; + + /** + * Gets a list of sheets and visualizations and registers a callback to receive the data. + * @param {string} [field] - Optional. Type of object. One of: + * # sheet + * # masterobject + * Default is sheet. + * @param {function} [callback] - Optional. Callback method. + */ + getAppObjectList(type?: string, callback?: any): void; + + /** + * Gets properties for a generic object, the children of the generic object and the bookmarks and/or embedded snapshots of the generic object. + * @param {string} id - Object id. + * @return {Promise} - A promise of an object model. + */ + getFullPropertyTree(id: string): ng.IPromise; + + /** + * Gets a list of internal Qlik Sense objects and registers a callback to receive the data. + * @param {string} type - Type of object: + * # FieldList + * # MeasureList + * # DimensionList + * # BookmarkList + * # SelectionObject + * # SnapshotList (Introduced in version 1.1) + * # MediaList (Introduced in version 1.1) + * # Sheet (Introduced in version 1.1) + * # MasterObject (Introduced in version 1.1) + * # VariableList (Introduced in version 2.0) + * # story (Introduced in version 2.1) + * @param {function} [callback] - Optional. Registers a callback that is executed every time data is returned. + * @return {Promise} - A promise of an object model. + */ + getList(type: string, callback?: any): ng.IPromise; + + /** + * Retrieves a Qlik Sense object from the Qlik Sense application and inserts it into a HTML element. The object fills the HTML object, so you can size and position the element to determine how large the Qlik Sense object will be. + * If you supply only one parameter, you get the model without displaying the object. + * @param {string} id - Object id or 'CurrentSelections' if used for Selections bar. + * @param {Element | string} [elem] - Optional. HTML element. + * Since version 1.1 it is also possible to define a string of the HTML element id. + * @param {object} [options] - Optional. + * Name | Type | Description + * noInteraction | Boolean | Set to true if you want to disable interaction, including selections, in the visualization. Introduced in version 1.1 and updated in version 3.0. + * noSelections | Boolean | Set to true if you want to disable selections in the visualization. Introduced in version 3.0. + * @return {Promise} - A promise of an object model. + */ + getObject(id: string, elem?: any | string, options?: any): ng.IPromise; + + /** + * Gets properties for a Qlik Sense object. + * @param {string} id - Object id. + * @return {Promise} - A promise of an object model. + */ + getObjectProperties(id: string): ng.IPromise; + + /** + * Inserts a Qlik Sense snapshot into a HTML element. The snapshot fills the HTML object so you can size and position the element to determine how large the Qlik Sense object will be. + * If you only supply one parameter, you will just get the model without displaying the object. + * @param {string} id - Snapshot ID. + * @param {element | string} [elem] - Optional. HTML element or string with HTML element id. + * @return {Promise} - A promise of an object model. + */ + getSnapshot(id: string, elem?: any | string): ng.IPromise; + + /** + * Locks all selections. + * @param {string} [state=$] - Optional. Alternate state name. + * Default: $ + * Introduced in version 2.1. + * @return {Promise} - A promise of a Qlik engine reply. + */ + lockAll(state?: string): ng.IPromise; + + /** + * Removes an alternate state in the app. + * @param {string} qStateName - Alternate state name. + * @return {Promise} - A promise of a Qlik engine reply. + */ + removeAlternateState(qStateName: string): ng.IPromise; + + /** + * Searches for one or more terms in the values of a Qlik Sense app. + * @param {array} qTerms - Terms to search for. + * @param {object} qPage - Properties: + * Name | Type | Description + * qOffset | Number | Position from the top, starting from 0. + * qCount | Number | Number of search results to return. + * qMaxNbrFieldMatches | Number | Maximum number of matching values to return per search result. + * @param {object} qOptions - Properties + * Name | Type | Description + * qSearchFields | Array | List of search fields. + * qContext | | Search context. Can be one of: + * # Cleared: In this mode, the first step is to clear any current selections in the app. The second step is to search for one or more terms in the values of the app. + * # LockedFieldsOnly: In this mode, the search applies only to the values associated with the selections made in locked fields, ignoring selections in any unlocked field. If no locked fields, the behavior is identical to the Cleared context. You cannot make any new selections in a locked field. You can get search hits for the associated values of a locked field but you cannot get the search hits for the non associative values. + * # CurrentSelections: In this mode, the current selections are kept (if any). Search for one or more terms in the values of the app. New selections are made on top of the current selections. If no selections were made before the search, this mode is identical to the Cleared context. + * | | Default value is LockedFieldsOnly. + * @param {function} [callback] - Optional. Callback method. + * @return {Promise} - A promise of a Qlik engine reply. + */ + searchAssociations(qTerms: any[], qPage: any, qOptions: any, callback?: any): ng.IPromise; + + /** + * Searches for one or more terms in the values of a Qlik Sense app. + * @param {array} qTerms - Terms to search for. + * @param {object} qPage - Properties: + * Name | Type | Description + * qOffset | Number | Position from the top, starting from 0. + * qCount | Number | Number of search results to return. + * qGroupOptions | Array | This parameter is optional. Options of the search groups. If this property is not set, all values are returned. + * qGroupItemOptions | Array | This parameter is optional. Options of the search group items. If this property is not set, all values are returned. + * qOptions | Object | Optional. Search options. Properties: + * Name | Type | Description + * qSearchFields | Array | List of search fields. + * qContext | | Search context. Can be one of: + * # Cleared: In this mode, the first step is to clear any current selections in the app. The second step is to search for one or more terms in the values of the app. + * # LockedFieldsOnly: In this mode, the search applies only to the values associated with the selections made in locked fields, ignoring selections in any unlocked field. If no locked fields, the behavior is identical to the Cleared context. You cannot make any new selections in a locked field. You can get search hits for the associated values of a locked field but you cannot get the search hits for the non associative values. + * # CurrentSelections: In this mode, the current selections are kept (if any). Search for one or more terms in the values of the app. New selections are made on top of the current selections. If no selections were made before the search, this mode is identical to the Cleared context. + * | | Default value is LockedFieldsOnly. + * @param {function} [callback] - Optional. Callback method. + * @return {Promise} - A promise of a Qlik engine reply. + */ + searchResults(qTerms: any[], qPage: any, qOptions?: any, callback?: any): ng.IPromise; + + /** + * Returns suggestions of words from the values entered in the search. Acts as a helper for the searchAssociations method. + * @param {array} qTerms - Terms to search for. + * @param {object} [qOptions] - Optional. Search options. Properties: + * Name | Type | Description + * qSearchFields | Array | List of search fields. + * @param {function} [callback] - Optional. Callback method. + * @return {Promise} - A promise of a Qlik engine reply. + */ + searchSuggest(qTerms: any[], qOptions?: any, callback?: any): ng.IPromise; + + /** + * Makes a selection based on searchAssociation results. + * @param {number} qMatchIx - Index to search result. + * @param {array} qTerms - Values to select. + * @param {object} qOptions - Values to select. + * @param {array} [qTerms] - Optional. Parameter sent to the Qlik engine containing information about the search fields and the search context. + * @param {object} [qSoftLock] - Optional. This parameter was deprecated in version 2.0 and is ignored in newer versions. Use the qOtions.qContext parameter instead. + * @return {Promise} - A promise of a Qlik engine reply. + */ + selectAssociations(qMatchIx: number, qTerms: any[], qOptions?: any, qSoftLock?: any): ng.IPromise; + + /** + * Creates a QSelectionState object that encapsulates the selection state. Entry point to the Selection API. + * @param {string} [state] - Optional. Sets the state. Default is $. + */ + selectionState(state?: string): SelectionStateAPI.IQSelectionState; + + /** + * Unlocks all selections that has previously been locked. + * @param {string} [state] - Optional. Alternate state name. Default: $ Introduced in version 2.1. + */ + unlockAll(state?: string): ng.IPromise; + } +} + +declare namespace BookmarkAPI { + interface IBookmark { + /** + * Applies a bookmark. + * @param {string} id - Bookmark id. + * @return {Promise} - A promise of a Qlik engine reply. + */ + apply(id: string): ng.IPromise; + + /** + * Creates a bookmark based on the current selection. + * @param {string} title - Bookmark title. + * @param {string} description - Bookmark description. + * @param {string} [sheetId] - Optional. Bookmark sheet id. Introduced in version 2.2. + * @return {Promise} - A promise of a Qlik engine reply. + */ + create(title: string, description: string, sheetId?: string): ng.IPromise; + + /** + * Removes a bookmark. + * @param {string} id - Bookmark id. + * @return {Promise} - A promise of a Qlik engine reply. + */ + remove(id: string): ng.IPromise; + } +} + +declare namespace FieldAPI { + interface IQField { + /** + * Clears a field selection. + * @return {Promise} - A promise. + */ + clear(): ng.IPromise; + + /** + * Clears all fields except the selected one. + * @param {boolean} [softlock] - Optional. If true, locked selections can be overridden. + * @return {Promise} - A promise. + */ + clearOther(softlock?: boolean): ng.IPromise; + + /** + * Gets field data. The values are available as QFieldValue in array field.rows and will updated when the selection state changes. Notification OnData will be triggered after each update. + * @param {boolean} [options] - Optional. Properties: + * Name | Type | Description + * rows | Number | Number of rows to fetch. Default: 200. + * frequencyMode | String | Can be one of: + * # V=Absolute + * # P=Percent + * # R=Relative + * # N=No frequency + * | | Default: V. + * @return {IQField} - The field object. + */ + getData(options?: boolean): IQField; + + /** + * Gets more data for your field. Notification OnData is triggered when complete. + * @return {IQField} - The field object. + */ + getMoreData(): IQField; + + /** + * Locks a field selection. + * @return {Promise} - A promise. + */ + lock(): ng.IPromise; + + /** + * Selects field values using indexes. + * @param {number[]} Array - Array of index values to select + * @param {boolean} [toggle] - Optional. If true, toggle selected state. + * @param {boolean} [softlock] - Optional. If true, locked selections can be overridden. + * @return {Promise} - A promise. + */ + select(Array: number[], toggle?: boolean, softlock?: boolean): ng.IPromise; + + /** + * Selects all values in a field. + * @param {boolean} [softlock] - Optional. If true, locked selections can be overridden. + * @return {Promise} - A promise. + */ + selectAll(softlock?: boolean): ng.IPromise; + + /** + * Selects alternative values in a field. + * @param {boolean} [softlock] - Optional. If true, locked selections can be overridden. + * @return {Promise} - A promise. + */ + selectAlternative(softlock?: boolean): ng.IPromise; + + /** + * Selects excluded values in a field. + * @param {boolean} [softlock] - Optional. If true, locked selections can be overridden. + * @return {Promise} - A promise. + */ + selectExcluded(softlock?: boolean): ng.IPromise; + + /** + * Selects matching field values. + * @param {string} match - Match string. + * @param {boolean} [softlock] - Optional. If true, locked selections can be overridden. + * @return {Promise} - A promise. + */ + selectMatch(match: string, softlock?: boolean): ng.IPromise; + + /** + * Selects possible values in a field. + * @param {boolean} [softlock] - Optional. If true, locked selections can be overridden. + * @return {Promise} - A promise. + */ + selectPossible(softlock?: boolean): ng.IPromise; + + /** + * Selects specific values in a field. + * @param {array} array - Array of qFieldValues to select. A simplified syntax with strings or numbers also works since version 1.1. + * For a numeric field you need to provide the numeric value. + * @param {boolean} [toggle] - Optional. If true, toggle selected state. + * @param {boolean} [softlock] - Optional. If true, locked selections can be overridden. + * @return {Promise} - A promise. + */ + selectValues(array: IQFieldValue[], toggle?: boolean, softlock?: boolean): ng.IPromise; + + /** + * Toggles a field selection. + * @param {string} match - Match string. + * @param {boolean} [softlock] - Optional. If true, locked selections can be overridden. + * @return {Promise} - A promise. + */ + toggleSelect(match: string, softlock?: boolean): ng.IPromise; + + /** + * Unlocks field selections. + * @return {Promise} - A promise. + */ + unlock(): ng.IPromise; + + /** + * Field values. You need to call getData() method to make this available. Introduced in 2.1. + */ + rows: IQFieldValue[]; + + /** + * Optional. Number of different values. Only after getData() call. Introduced in 2.1. + */ + rowCount: number; + + /** + * Optional. Object with number of values in different states. Only after getData() call. Introduced in 2.1. + */ + qStateCounts: any; + } + + interface IQFieldValue { + /** + * Cell value formatted as set up in properties. + */ + qText: string; + + /** + * Cell value index. + */ + qElemNumber: number; + + /** + * Cell state. + */ + qState: any; + + /** + * Optional. Cell numeric value, if cell is numeric. + */ + qNum?: number; + + /** + * Optional. Frequency, if calculated by the Qlik engine. + */ + qFrequency?: string; + + /** + * Selects a field value. + * @param {boolean} [toggle] - Optional. If true, toggle selected state. + * @param {boolean} [softlock] - Optional. If true, locked selections can be overridden. + * @return {Promise} - A promise. + */ + select(toggle?: boolean, softlock?: boolean): ng.IPromise; + } +} + +declare namespace GlobalAPI { + interface IGlobal { + /** + * Cancels an ongoing reload. The reload of the app is stopped. + * @return {Promise} - A promise of a Qlik engine reply. + */ + cancelReload(): ng.IPromise; + + /** + * Gets a list of Qlik Sense apps that you potentially can connect to and registers a callback to receive the data. + * Calling the getAppList method opens a WebSocket, gets the app list, and then keeps the WebSocket open for you to make other calls as well. + * @param {Function} callback - Callback method. + */ + getAppList(callback: any): void; + + /** + * Gets information (user directory and user id) about the authenticated user. + * @param {Function} [callback] - Optional. Callback method. + * @return {Promise} - A promise of a Qlik engine reply. + */ + getAuthenticatedUser(callback?: any): ng.IPromise; + + /** + * Gets information about progress of doReload and doSave calls. + * @param {Number} qRequestId - Request id from doReload call or 0. + * Complete information is returned if the identifier of the request is specified. + * If qRequestId = 0, less information is returned. + * @param {Function} [callback] - Optional. Callback method. + * @return {Promise} - A promise of a Qlik engine reply. + */ + getProgress(qRequestId: number, callback?: any): ng.IPromise; + + /** + * Gets the product version. + * @param {Function} [callback] - Optional. Callback method. + * @return {Promise} - A promise of a Qlik engine reply. + */ + getProductVersion(callback?: any): ng.IPromise; + + /** + * Gets the Qlik product name. + * @param {Function} [callback] - Optional. Callback method. + * @return {Promise} - A promise of a Qlik engine reply. + */ + getQTProduct(callback?: any): ng.IPromise; + + /** + * Gets the Qlik Sense version number. + * @param {Function} [callback] - Optional. Callback method. + * @return {Promise} - A promise. + */ + getQvVersion(callback?: any): ng.IPromise; + + /** + * Gets information if the user is working in personal mode (returns true if Qlik Sense Desktop is used) or not (returns false if Qlik Sense Desktop is not used). + * @param {Function} [callback] - Optional. Callback method. + * @return {Promise} - A promise of a Qlik engine reply. + */ + isPersonalMode(callback?: any): ng.IPromise; + } +} + +declare namespace NavigationAPI { + type NavigationModeType = "ANALYSIS" | "EDIT"; + type NavigationErrorType = "NOSUCHSHEET" | "NOCURRENTSHEET" | "NOSUCHSTORY"; + + /** + * The navigation result object. + */ + interface NavigationResult { + /** + * Returns true if successful. + */ + success: boolean; + + /** + * The new sheet ID. + */ + sheetId: string; + + /** + * The new story ID. + */ + storyId: string; + + /** + * The new mode. + */ + mode: string; + + /** + * Error code. Can be: NOSUCHSHEET | NOCURRENTSHEET | NOSUCHSTORY + */ + error: NavigationErrorType; + + /** + * Error message, for example 'No current sheet'. + */ + errorMsg: string; + } + + /** Navigation API for Qlik Sense. The Navigation API allows you to navigate + * within a Qlik Sense app, and is meant to be used in visualization extensions + * and will not work in Mashup scenarios. + */ + interface INavigation { + /** + * Used for analysis mode. + */ + edit: "edit"; + + /** + * Used for edit mode. + */ + analysis: "analysis"; + + /** + * Gets the current sheet ID. + * @return {NavigationResult} - A navigation result object. + */ + getCurrentSheetId(): NavigationResult; + + /** + * Gets the current mode. + * @return {string} - The current mode as a string. + */ + getMode(): string; + + /** + * Navigate to a given sheet in the current app. The method will return before the actual navigation takes place. + * @param {string} sheetId - Set the sheet ID to navigate to. + * @return {NavigationResult} - A navigation result object. + */ + gotoSheet(sheetId: string): NavigationResult; + + /** + * Navigate to a given story in the current app. The method will return before the actual navigation takes place. + * @param {string} storyId - Set the story ID to navigate to. + * @return {NavigationResult} - A navigation result object. + */ + gotoStory(storyId: string): NavigationResult; + + /** + * Checks if a given mode is allowed. + * @param {NavigationModeType} mode - Can be one of the strings: edit | analysis + * or one of the constants: qlik.navigation.EDIT | qlik.navigation.ANALYSIS + * @return {boolean} - A Boolean value (true or false). + */ + isModeAllowed(mode: NavigationModeType): boolean; + + /** + * Go to the next sheet in the current app. It will do nothing if you do not have sheets in the current context. + * The method will return before the actual navigation takes place. + * @return {NavigationResult} - A navigation result object. + */ + nextSheet(): NavigationResult; + + /** + * Jumps to the previous sheet in the current app. It will do nothing if you do not have sheets in the current context. + * The method will return before the actual navigation takes place + * @return {NavigationResult} - A navigation result object. + */ + prevSheet(): NavigationResult; + + /** + * Sets the current working mode of Qlik Sense. + * @param {string | constant} mode - Can be one of the strings: edit | analysis + * or one of the constants: qlik.navigation.EDIT | qlik.navigation.ANALYSIS + * @return {NavigationResult} - A navigation result object. + */ + setMode(mode: string): NavigationResult; + + /** + * Switches the working mode of Qlik Sense. + * @param {NavigationModeType} mode - Can be one of the strings: edit | analysis + * or one of the constants: qlik.navigation.EDIT | qlik.navigation.ANALYSIS + * @return {NavigationResult} - A navigation result object. + */ + switchMode(mode: NavigationModeType): NavigationResult; + } +} + +declare namespace SelectionStateAPI { + interface IQFieldSelections { + /** + * Selection state for a field. + */ + fieldName: string; + + /** + * Sort index. Starting from 0. + */ + qSortIndex: number; + + /** + * Reference to the field. + */ + field: FieldAPI.IQField; + + /** + * Defines if the field is locked. + */ + locked: boolean; + + /** + * Defines if the field is numeric. + */ + isNumeric: boolean; + + /** + * Total number of values in the field. + */ + totalCount: number; + + /** + * Number of selected values. + */ + selectedCount: number; + + /** + * Number of values that will be listed. + */ + qSelectionThreshold: number; + + /** + * Object with number of values in different states. + */ + qStateCounts: any; + + /** + * Concatenated string of selected values if number of values are less than the threshold, or if the string is of format "7 of 123". + */ + qSelected: string; + + /** + * Array with maximum of qSelectionThreshold values that are selected. For each value, the text plus the selection mode (NORMAL/AND/NOT) + */ + selectedValues: number[]; + + /** + * Array with maximum of qSelectionThreshold values that are not selected. For each value, the text plus the selection mode (NORMAL/AND/NOT) + */ + notSelectedValues: number[]; + } + + interface IQSelectionState { + /** + * State name. $ for default state. + */ + stateName: string; + + /** + * Selections + */ + selections: IQFieldSelections; + + /** + * Number of back steps available. + */ + backCount: number; + + /** + * Number of forward steps available. OnData notification will be triggered after each update. + */ + forwardCount: number; + + /** + * Cleara all selections in this state. + * @param {boolean} lockedAlso - Use to also clear locked fields. + * @return {Promise} - A promise of a Qlik engine reply. + */ + clearAll(lockedAlso: boolean): ng.IPromise; + + /** + * Locks all selections in this state. + * @return {Promise} - A promise of a Qlik engine reply. + */ + lockAll(): ng.IPromise; + + /** + * Unlocks all selections in this state. + * @return {Promise} - A promise of a Qlik engine reply. + */ + unlockAll(): ng.IPromise; + } +} + +declare namespace TableAPI { + interface IQTable { + /** + * Data rows. + */ + rows: IQRow[]; + + /** + * Header information. + */ + headers: IQHeader[]; + + /** + * Total information for measures. + */ + totals: IQMeasureCell[]; + + /** + * Total number of rows for the qHyperCube, including rows not fetched from the server. + */ + rowCount: number; + + /** + * Total number of columns for the qHyperCube. + */ + colCount: number; + + /** + * Exports data of the underlying hypercube in OOXML or CSV format. + * @param {object} [options] - Optional. Properties: + * Name | Type | Description + * format | String | Data format. Can be one of: + * # OOXML: open XML, default + * # CSV_C: comma separated CSV + * # CSV_T: tab separated CSV + * filename | String | Name of the exported file after download from browser. This parameter is optional and only used in desktop. + * state | String | Can be: + * # A: all values + * # P: possible values (default) + * download | Boolean | Automatically start download of file (with window.open). + * @param {Function} [callback] - Optional. Callback function returning the link to the exported file. + */ + exportData(options?: any, callback?: any): void; + + /** + * Gets the column number for a given field name. + * @param {string} fld - Field name. + * @return {number} - Column number, starting with zero. Undefined if no column with that name exists. + */ + getColByName(fld: string): number; + + /** + * Gets more data for your qHyperCube. + */ + getMoreData(): any; + } + + interface IQHeader { + /** + * Column title. + */ + qFallbackTitle: string; + + /** + * Can be: + * # A: ascending + * # D: descending + */ + qSortIndicator: string; + + /** + * True indicates if this is the first column for sorting. + */ + isOrderedBy: boolean; + + /** + * True indicates if the sort order is reversed for this column. + */ + qReverseSort: boolean; + + /** + * Column number. + */ + col: number; + + /** + * Optional. Number of different values. Only used for dimensions. + */ + qCardinal?: number; + + /** + * Optional. Object with number of values in different states. Only used for dimensions. + */ + qStateCounts?: any; + + /** + * Optional. Field object with methods to manipulate the underlying field. Only used for dimensions. + */ + field?: any; + + /** + * Optional. Minimum value. Only used for measures. + */ + qMin?: number; + + /** + * Optional. Maximum value. Only used for measures. + */ + qMax?: number; + + /** + * Optional. Error code for this column. Only if column has an error. Introduced in version 2.2. + */ + errorCode?: number; + + /** + * Error message for this column. Only if column has an error. Introduced in version 2.2. + */ + errorMessage: number; + + /** + * Sets this column to be the first in the sort order. + */ + orderBy(): void; + + /** + * Reverses the sort order for this column. + */ + reverseOrder(): void; + + /** + * Select a range in this measure. + * @param {number} min - Sets the minimum value of the range. + * @param {number} max - Sets the maximum value of the range. + * @param {boolean} [inclMin] - Optional. Set to true to include minimum value. + * @param {boolean} [inclMax] - Optional. Set to true to include maximum value. + * @return {Promise} - A promise. + */ + selectRange(min: number, max: number, inclMin?: boolean, inclMax?: boolean): ng.IPromise; + } + + interface IQRow { + /** + * Dimension cells. + */ + dimensions: IQDimensionCell[]; + + /** + * Measure cells. + */ + measures: IQMeasureCell[]; + + /** + * All cells, in the order they are defined in the properties. + */ + cells: any[]; + } + + interface IQDimensionCell extends IQMeasureCell { + /** + * Cell value index. + */ + qElemNumber: number; + + /** + * Cell state. + */ + qState: string; + + /** + * Selects the value in this cell. + */ + select(): void; + } + + interface IQMeasureCell { + /** + * Cell value formatted as set up in properties. + */ + qText: string; + + /** + * Optional. Cell numeric value, if cell is numeric. + */ + qNum?: number; + + /** + * Gets the value of this cell as a percentage of the total. Might be more than 100% if this is an average. + */ + getPercent(): number; + + /** + * Gets the value of this cell as a percentage of the maximum. + */ + getPercentOfMax(): number; + } +} + +declare namespace VariableAPI { + interface IVariable { + /** + * Creates a variable. + * @param {string | object} qProp - Variable name or properties. Properties: + * Name | Type | Description + * qInfo.qId | String | Optional. Variable id. If the selected ID is already in use, a new ID is automatically set by the engine. + * qName | String | Variable name. The name must be unique. + * qComment | String | Optional. Comment related to the variable. + * qDefinition | String | Optional. Variable definition. + * qNumberPresentation | Object | Optional. Defines the format of the value. + * qIncludeInBookmark | Boolean | Optional. Set to true to update the variable when applying a bookmark. The variable value will be persisted in the bookmark. + * @return {Promise} - Returns a promise of a variable model. + */ + create(qProp: string | any): ng.IPromise; + + /** + * Creates a session variable, that is a temporary variable which is not persisted and needs to be recreated for each new session. + * @param {object} qProp - Variable properties: + * Name | Type | Description + * qInfo.qId | String | Optional. Variable id. + * qName | String | Variable name. + * qComment | String | Optional. Comment. + * qDefinition | String | Optional. Variable definition. + * qNumberPresentation | Object | Optional. + * qIncludeInBookmark | Boolean | Optional. Include in bookmark flag. + * @return {Promise} - A promise of a variable model. + */ + createSessionVariable(qProp: any): ng.IPromise; + + /** + * Gets a variable by id. + * @param {string} qId - Variable id. + * @return {Promise} - A promise of a variable model. + */ + get(qId: string): ng.IPromise; + + /** + * Gets a variable by name. + * @param {string} qName - Variable name. + * @return {Promise} - A promise of a variable model. + */ + getByName(qName: string): ng.IPromise; + + /** + * Gets variable content. + * @param {string} name - Variable name. + * @param {Function} callback - Callback to receive the content. + * @return {Promise} - A promise of a Qlik engine reply. + */ + getContent(name: string, callback: any): ng.IPromise; + + /** + * Sets the content of a variable. + * @param {string} name - Variable name. + * @param {string} content - Variable content. + * @return {Promise} - A promise of a Qlik engine reply. + */ + setContent(name: string, content: string): ng.IPromise; + + /** + * Sets a numeric value as a variable. + * @param {string} qName - Variable name. + * @param {Number} qVal - Variable value. + * @return {Promise} - A promise of a Qlik engine reply. + */ + setNumValue(qName: string, qVal: number): ng.IPromise; + + /** + * Sets variable string value. + * @param {string} qName - Variable name. + * @param {string} qVal - Variable value. + * @return {Promise} - A promise of a Qlik engine reply. + */ + setStringValue(qName: string, qVal: string): ng.IPromise; + } +} + +declare namespace VisualizationAPI { + type VisualizationType = "barchart" | "combochart" | "gauge" | "kpi" | "linechart" | "piechart" | "pivot-table" | + "scatterplot" | "table" | "treemap" | "extension"; + + interface IVisualization { + /** + * Create a new visualization on the fly based on a session object and will not be persisted in the app. + * @param {VisualizationType} type - Visualization type. Can be: + * # barchart + * # combochart + * # gauge + * # kpi + * # linechart + * # piechart + * # pivot-table + * # scatterplot + * # table + * # treemap + * # extension + * @param {array} [cols] - Optional. Column definitions, dimensions and measures. Each entry can be of the following structures: + * # String + * # NxDimension + * # NxMeasure + * If the NxDimension or the NxMeasure refer to a library dimension or a library measure, you also need to add qType : "measure" or "dimension". + * @param {object} [options] - Optional. Options to set. + * @return {Promise} - A promise of a QVisualization. + */ + create(type: VisualizationType, cols?: any[], options?: any): ng.IPromise; + + /** + * Gets an existing visualization. + * @param {string} id - Id for an existing visualization. + * @return {Promise} - A promise of a QVisualization. + */ + get(id: string): ng.IPromise; + } + + interface IQVisualization { + /** + * Table object for this visualization. Only for visualizations built on a hypercube. + */ + table: TableAPI.IQTable; + + /** + * Closes a visualization and releases the session object. + * @return {Promise} - A promise. + */ + close(): ng.IPromise; + + /** + * Tells the visualization it has been resized and should re-paint. + */ + resize(): void; + + /** + * Sets options for a visualization. + * @param {object} options - Options to set (using applyPatches). + */ + setOptions(options?: any): void; + + /** + * Shows the visualization in an HTML element. + * @param {Element | string} [element] - Optional. HTML element or HTML element ID. + * @param {object} [options] - Optional. + * Name | Type | Description + * noInteraction | Boolean | Set to true if you want to disable all interaction, including selections, in the visualization. + * noSelections | Boolean | Set to true if you want to disable selections in the visualization. + * | | Parameter introduced in version 3.0. + */ + show(element?: any | string, options?: any): void; + } +} + +declare namespace ExtensionAPI { + + + interface IExtensionModel { + + } + + interface IExtensionComponent { + model: IExtensionModel; + } + + interface IExtensionScope extends ng.IScope { + component: IExtensionComponent; + } + + + //ExtensionAPI + type SelectionModeType = "CONFIRM" | "QUICK"; + + interface IInitialProperties { + qHyperCubeDef?: any; //IHyperCubeDef; + qListObjectDef?: any; //IListObjectDef; + fixed?: boolean; + width?: number; + percent?: boolean; + selectionMode?: SelectionModeType; + } + + interface ISupport { + snapshot?: boolean; + export?: boolean; + exportData?: boolean; + } + + interface IExtension { + definition?: IDefinition; + paint?: ($element: HTMLElement, layout?: any) => void; + initialProperties?: IInitialProperties; + template?: string; + controller?: any; + support?: ISupport; + } + + interface ISupport { + snapshot?: boolean; // | () => boolean; + export?: boolean; // | () => boolean; + canTakeSnapshot?: boolean; + } + + interface IInitialProperties { + // qHyperCubeDef: IVisualizationHyperCubeDef; + // qListObjectDef: IVis + + //[""]: + } + + //#region IDefinition + type ExpressionType = "always" | "optional" | ""; + + type func = () => T; + type valueOrfunc = T | func; + + //#region Controls + interface ICustomControlOption { + value: string; + label: string; + } + + interface ICustomControl { + type: string; + label: string; + ref: string; + } + + interface ICustomString extends ICustomControl { + defaultValue: string; + expression: ExpressionType; + show: valueOrfunc; + maxlength: number; + } + + interface ICustomNumber extends ICustomControl { + defaultValue: number; + min: number; + max: number; + } + + interface ICustomInteger extends ICustomNumber { + } + + interface ICustomArray extends ICustomControl { + itemTitleRef: string; + addTranslation: string; + allowAdd: boolean; + allowMove: boolean; + allowRemove: boolean; + } + + interface ICustomButton extends ICustomControl { + label: string; + component: "button"; + action: valueOrfunc; + } + + interface ICustomButtonGroup extends ICustomControl { + component: "buttongroup"; + defaultValue: string; + options: valueOrfunc; + } + + interface ICustomCheckBox extends ICustomControl { + component: "checkbox"; + defaultValue: boolean; + } + + interface ICustomColorPicker extends ICustomControl { + component: "color-picker"; + defaultValue: number; + } + + interface ICustomDropDownList extends ICustomControl { + component: "dropdown"; + defaultValue: string; + options: valueOrfunc; + } + + interface ICustomLink { + type: string; + component: "link"; + label: string; + url: string; + } + + interface ICustomMedia extends ICustomControl { + component: "media"; + layoutRef: string; + } + + interface ICustomRadioButton extends ICustomControl { + component: "radiobuttons"; + defaultValue: string; + options: valueOrfunc; + } + + interface ICustomSlider extends ICustomControl { + component: "slider"; + defaultValue: number; + min: number; + max: number; + step: number; + } + + interface ICustomRangeSlider extends ICustomControl { + component: "slider"; + defaultValue: number[]; + min: number; + max: number; + step: number; + } + + interface ICustomSwitch { + component: "switch"; + defaultValue: boolean; + options: valueOrfunc; + } + + interface ICustomText { + type: "text"; + component: "text"; + label: string; + } + + interface ICustomTextArea extends ICustomControl { + component: "textarea"; + rows: number; + maxlength: number; + defaultValue: string; + show: valueOrfunc; + } + //#endregion + + interface IDefinition { + type: "items"; + component: "accordion"; + items: IItems; + } + + interface IItems { + dimentions?: IDimensions; + measures?: IMeasures; + appearance?: IAppearance; + sorting?: ISorting; + AddOns?: IAddOns; + [other: string]: any; + } + + interface IAddOns { + uses: "addons"; + } + + interface ISorting { + uses: "sorting"; + } + + interface IDimensions { + uses: "dimensions"; + min?: number; + max?: number; + } + + interface IAppearance { + uses: "settings"; + min?: number; + max?: number; + items: any; + } + + //?Das selbe wie Appearance? + interface ISettings { + uses: "settings"; + min?: number; + max?: number; + } + + interface IMeasures { + uses: "measures"; + min?: number; + max?: number; + } + + //#endregion +} + +declare module "qlik" { + var e: RootAPI.IRoot; export = e; +} + +interface IQVAngular { + /** + * Register a new directive with the compiler. + * + * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) + * @param directiveFactory An injectable directive factory function. + */ + directive(name: string, directiveFactory: ng.Injectable): void; + directive(object: { [directiveName: string]: ng.Injectable }): void; + + filter(name: string, filterFactoryFunction: ng.Injectable): void; + filter(object: { [name: string]: ng.Injectable }): void; + + /** + * Register a service constructor, which will be invoked with new to create the service instance. This is short for registering a service where its provider's $get property is a factory function that returns an instance instantiated by the injector from the service constructor function. + * + * @param name The name of the instance. + * @param serviceConstructor An injectable class (constructor function) that will be instantiated. + * @return Returns the constructed singleton of the service class/function. + */ + service(name: string, serviceConstructor: ng.Injectable): T; + service(object: { [name: string]: ng.Injectable }): T; + + //provider(name: string, serviceProviderFactory: ng.IServiceProviderFactory): void; + //provider(name: string, serviceProviderConstructor: ng.IServiceProviderClass): void; +} + +declare module "qvangular" { + var e: IQVAngular; export = e; +} \ No newline at end of file diff --git a/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts b/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts new file mode 100644 index 0000000000..032b755b34 --- /dev/null +++ b/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts @@ -0,0 +1,3 @@ +import * as qlik from "qlik"; + +const t = qlik.currApp(); \ No newline at end of file diff --git a/qlik-visualizationextensions/tsconfig.json b/qlik-visualizationextensions/tsconfig.json new file mode 100644 index 0000000000..47e4903e2e --- /dev/null +++ b/qlik-visualizationextensions/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "amd", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "qlik-visualizationextensions-tests.ts" + ] +} \ No newline at end of file diff --git a/qlik-visualizationextensions/tslint.json b/qlik-visualizationextensions/tslint.json new file mode 100644 index 0000000000..965a36a968 --- /dev/null +++ b/qlik-visualizationextensions/tslint.json @@ -0,0 +1,7 @@ +{ "extends": "../tslint.json", + "rules": { + "forbidden-types": false, + "no-empty-interface": false, + "interface-name": false + } +} \ No newline at end of file From 47134067acfda2acc7230e44d1c2b7ba9c6ef85b Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Thu, 23 Feb 2017 16:08:25 +0100 Subject: [PATCH 039/567] fixes BOM & module to run npm test Signed-off-by: Konrad Mattheis --- qlik-visualizationextensions/index.d.ts | 4 ++-- .../qlik-visualizationextensions-tests.ts | 2 +- qlik-visualizationextensions/tsconfig.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qlik-visualizationextensions/index.d.ts b/qlik-visualizationextensions/index.d.ts index 8a9c145969..c7eb32273c 100644 --- a/qlik-visualizationextensions/index.d.ts +++ b/qlik-visualizationextensions/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for qlik-visualizationextensions +// Type definitions for qlik-visualizationextensions 3.2 // Project: http://help.qlik.com/en-US/sense-developer/3.2/Subsystems/Extensions/Content/extensions-introduction.htm // Definitions by: Konrad Mattheis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -791,7 +791,7 @@ declare namespace BackendAPI { * @param {array} qPages - An array of request page objects. * @param {number} qZoomFactor - Zoom factor. * If set to -1, the Qlik engine decides of the zoom factor. - * If qReductionMode is D1 or S, the zoom factor is 2ⁿ. If the zoom factor is 5, the data are reduced by a factor 32. + * If qReductionMode is D1 or S, the zoom factor is 2n. If the zoom factor is 5, the data are reduced by a factor 32. * If qReductionMode is C, the zoom factor defines the number of centroids. * @param {string} qReductionMode - Reduction mode.Can be: * # N for no data reduction. diff --git a/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts b/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts index 032b755b34..2e1d738198 100644 --- a/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts +++ b/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts @@ -1,3 +1,3 @@ -import * as qlik from "qlik"; +import qlik=require("qlik"); const t = qlik.currApp(); \ No newline at end of file diff --git a/qlik-visualizationextensions/tsconfig.json b/qlik-visualizationextensions/tsconfig.json index 47e4903e2e..f4a5bc132a 100644 --- a/qlik-visualizationextensions/tsconfig.json +++ b/qlik-visualizationextensions/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "module": "amd", + "module": "commonjs", "lib": [ "es6", "dom" From 6305a2105a763fbd859d63c2131a6e8ba249d98d Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Fri, 24 Feb 2017 08:58:26 +0900 Subject: [PATCH 040/567] Delete typings for minor version --- .../v0.1/index.d.ts | 18 ------------- .../v0.1/package.json | 5 ---- .../redux-persist-transform-encrypt-tests.ts | 13 ---------- .../v0.1/tsconfig.json | 25 ------------------- .../v0.1/tslint.json | 3 --- 5 files changed, 64 deletions(-) delete mode 100644 redux-persist-transform-encrypt/v0.1/index.d.ts delete mode 100644 redux-persist-transform-encrypt/v0.1/package.json delete mode 100644 redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts delete mode 100644 redux-persist-transform-encrypt/v0.1/tsconfig.json delete mode 100644 redux-persist-transform-encrypt/v0.1/tslint.json diff --git a/redux-persist-transform-encrypt/v0.1/index.d.ts b/redux-persist-transform-encrypt/v0.1/index.d.ts deleted file mode 100644 index 048f02221f..0000000000 --- a/redux-persist-transform-encrypt/v0.1/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Type definitions for redux-persist-transform-encrypt 0.1 -// Project: https://github.com/maxdeviant/redux-persist-transform-encrypt#readme -// Definitions by: Karol Janyst -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import { PersistTransformer } from "redux-persist"; - -export as namespace ReduxPersistEncryptor; - -export = createEncryptor; - -declare function createEncryptor (config: createEncryptor.EncryptorConfig): PersistTransformer; - -declare namespace createEncryptor { - export interface EncryptorConfig { - secretKey: string; - } -} diff --git a/redux-persist-transform-encrypt/v0.1/package.json b/redux-persist-transform-encrypt/v0.1/package.json deleted file mode 100644 index 36ce503807..0000000000 --- a/redux-persist-transform-encrypt/v0.1/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "redux": "^3.6.0" - } -} diff --git a/redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts b/redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts deleted file mode 100644 index b3a70dc776..0000000000 --- a/redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { createStore, Reducer, Store } from "redux" -import { createPersistor, Persistor, PersistTransformer } from "redux-persist" -import { EncryptorConfig } from "redux-persist-transform-encrypt" -import * as createEncryptor from "redux-persist-transform-encrypt" - -const reducer: Reducer = (state: any, action: any) => ({}) - -const config: EncryptorConfig = { secretKey : "foo" } -const encryptor: PersistTransformer = createEncryptor(config) - -const store: Store = createStore(reducer) - -const persistor: Persistor = createPersistor(store, { transforms : [encryptor] }) diff --git a/redux-persist-transform-encrypt/v0.1/tsconfig.json b/redux-persist-transform-encrypt/v0.1/tsconfig.json deleted file mode 100644 index 99c5ba41bc..0000000000 --- a/redux-persist-transform-encrypt/v0.1/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "redux-persist-transform-encrypt": ["redux-persist-transform-encrypt/v0.1"] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "redux-persist-transform-encrypt-tests.ts" - ] -} diff --git a/redux-persist-transform-encrypt/v0.1/tslint.json b/redux-persist-transform-encrypt/v0.1/tslint.json deleted file mode 100644 index f9e30021f4..0000000000 --- a/redux-persist-transform-encrypt/v0.1/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../tslint.json" -} From 28be3862f5ad801e7e8c23ab6052bc5bdf4d926e Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 24 Feb 2017 01:15:16 +0100 Subject: [PATCH 041/567] Basic definitions for Google+ API (gapi.plus) --- gapi.plus/gapi.plus-tests.ts | 10 ++++ gapi.plus/index.d.ts | 111 +++++++++++++++++++++++++++++++++++ gapi.plus/tsconfig.json | 18 ++++++ 3 files changed, 139 insertions(+) create mode 100644 gapi.plus/gapi.plus-tests.ts create mode 100644 gapi.plus/index.d.ts create mode 100644 gapi.plus/tsconfig.json diff --git a/gapi.plus/gapi.plus-tests.ts b/gapi.plus/gapi.plus-tests.ts new file mode 100644 index 0000000000..12368dd63c --- /dev/null +++ b/gapi.plus/gapi.plus-tests.ts @@ -0,0 +1,10 @@ +/* Example taken from https://developers.google.com/+/web/people/ */ + +gapi.client.load('plus','v1', function(){ + var request = gapi.client.plus.people.get({ + 'userId': 'me' + }); + request.execute(function(resp) { + console.log('Retrieved profile for:' + resp.displayName); + }); +}); diff --git a/gapi.plus/index.d.ts b/gapi.plus/index.d.ts new file mode 100644 index 0000000000..3e24b79ce1 --- /dev/null +++ b/gapi.plus/index.d.ts @@ -0,0 +1,111 @@ +// Type definitions for Google+ Platform API 1.0 +// Project: https://developers.google.com/+/web/people/ +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +// See Google+ REST API Reference https://developers.google.com/+/web/api/rest/latest/ +declare namespace gapi.client.plus { + export namespace people { + + interface GetParameters { + userId: string; + } + function get(parameters: GetParameters): HttpRequest; + + interface SearchParameters { + query: string; + language?: string; + maxResults?: number; + pageToken?: string; + } + function search(parameters: SearchParameters): HttpRequest; + + // Search response + interface PeopleFeed { + kind: 'plus#peopleFeed'; + etag: string; + selfLink: string; + title: string; + nextPageToken: string; + totalItems: number; + items: Person[]; + } + + interface Person { + kind: 'plus#person'; + etag: string; + nickname: string; + occupation: string; + skills: string; + birthday: string; + gender: string; + emails: { + value: string; + type: string; + }[]; + urls: { + value: string; + type: string; + label: string; + }[]; + objectType: string; + id: string; + displayName: string; + name: { + formatted: string; + familyName: string; + givenName: string; + middleName: string; + honorificPrefix: string; + honorificSuffix: string; + }; + tagline: string; + braggingRights: string; + aboutMe: string; + relationshipStatus: string; + url: string; + image: { + url: string; + }; + organizations: { + name: string; + department: string; + title: string; + type: string; + startDate: string; + endDate: string; + location: string; + description: string; + primary: boolean; + }[]; + placesLived: { + value: string; + primary: boolean; + }[]; + isPlusUser: boolean; + language: string; + ageRange: { + min: number; + max: number; + }; + plusOneCount: number; + circledByCount: number; + verified: boolean; + cover: { + layout: string; + coverPhoto: { + url: string; + height: number; + width: number; + }; + coverInfo: { + topImageOffset: number; + leftImageOffset: number; + } + }; + domain: string; + } + } +} diff --git a/gapi.plus/tsconfig.json b/gapi.plus/tsconfig.json new file mode 100644 index 0000000000..1fc2401de1 --- /dev/null +++ b/gapi.plus/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "module": "commonjs", + "lib": ["es6", "dom"], + "strictNullChecks": true, + "noImplicitAny": true, + "noImplicitThis": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true + }, + "files": [ + "index.d.ts", + "gapi.plus-tests.ts" + ] +} From 9e80f1e890b49247de1b9fd37b6d5c68f8fc52b3 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 24 Feb 2017 01:17:28 +0100 Subject: [PATCH 042/567] Add definitions for Google People API (gapi.people) --- gapi.people/gapi.people-tests.ts | 99 +++++++++++++ gapi.people/index.d.ts | 246 +++++++++++++++++++++++++++++++ gapi.people/tsconfig.json | 18 +++ 3 files changed, 363 insertions(+) create mode 100644 gapi.people/gapi.people-tests.ts create mode 100644 gapi.people/index.d.ts create mode 100644 gapi.people/tsconfig.json diff --git a/gapi.people/gapi.people-tests.ts b/gapi.people/gapi.people-tests.ts new file mode 100644 index 0000000000..65b6339765 --- /dev/null +++ b/gapi.people/gapi.people-tests.ts @@ -0,0 +1,99 @@ +/* Example taken from Google People API JavaScript Quickstart https://developers.google.com/people/quickstart/js */ + +{ + // Your Client ID can be retrieved from your project in the Google + // Developer Console, https://console.developers.google.com + var CLIENT_ID = ''; + + var SCOPES = ["https://www.googleapis.com/auth/contacts.readonly"]; + + /** + * Check if current user has authorized this application. + */ + function checkAuth() { + gapi.auth.authorize( + { + 'client_id': CLIENT_ID, + 'scope': SCOPES.join(' '), + 'immediate': true + }, handleAuthResult); + } + + /** + * Handle response from authorization server. + * + * @param {Object} authResult Authorization result. + */ + function handleAuthResult(authResult: GoogleApiOAuth2TokenObject) { + var authorizeDiv = document.getElementById('authorize-div')!; + if (authResult && !authResult.error) { + // Hide auth UI, then load client library. + authorizeDiv.style.display = 'none'; + loadPeopleApi(); + } else { + // Show auth UI, allowing the user to initiate authorization by + // clicking authorize button. + authorizeDiv.style.display = 'inline'; + } + } + + /** + * Initiate auth flow in response to user clicking authorize button. + * + * @param {Event} event Button click event. + */ + function handleAuthClick(event: MouseEvent) { + gapi.auth.authorize( + {client_id: CLIENT_ID, scope: SCOPES, immediate: false}, + handleAuthResult); + return false; + } + + /** + * Load Google People client library. List names if available + * of 10 connections. + */ + function loadPeopleApi() { + gapi.client.load('https://people.googleapis.com/$discovery/rest', 'v1', listConnectionNames); + } + + /** + * Print the display name if available for 10 connections. + */ + function listConnectionNames() { + var request = gapi.client.people.people.connections.list({ + 'resourceName': 'people/me', + 'pageSize': 10, + }); + + request.execute(function(resp) { + var connections = resp.connections; + appendPre('Connections:'); + + if (connections.length > 0) { + for (var i = 0; i < connections.length; i++) { + var person = connections[i]; + if (person.names && person.names.length > 0) { + appendPre(person.names[0].displayName) + } else { + appendPre("No display name found for connection."); + } + } + } else { + appendPre('No upcoming events found.'); + } + }); + } + + /** + * Append a pre element to the body containing the given message + * as its text node. + * + * @param {string} message Text to be placed in pre element. + */ + function appendPre(message: string) { + var pre = document.getElementById('output')!; + var textContent = document.createTextNode(message + '\n'); + pre.appendChild(textContent); + } +} diff --git a/gapi.people/index.d.ts b/gapi.people/index.d.ts new file mode 100644 index 0000000000..86bf930beb --- /dev/null +++ b/gapi.people/index.d.ts @@ -0,0 +1,246 @@ +// Type definitions for Google People API 1.0 +// Project: https://developers.google.com/people/ +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace gapi.client.people { + export namespace people { + + interface GetParameters { + resourceName: string; + + // Query parameters + requestMask?: RequestMask; + } + + function get(parameters: GetParameters): HttpRequest; + + interface GetBatchGetParameters { + // Query parameters + resourcesName?: string; + requestMask?: RequestMask; + } + + function getBatchGet(parameters: GetBatchGetParameters): HttpRequest; + + interface BatchGetResponse { + responses: PersonResponse[]; + } + + interface PersonResponse { + httpStatusCode: number; + person: Person; + requestedResourceName: string; + } + + namespace connections { + function list(parameters: ListParameters): HttpRequest; + + type SortOrder = 'LAST_MODIFIED_ASCENDING' | 'FIRST_NAME_ASCENDING' | 'LAST_NAME_ASCENDING'; + + interface ListParameters { + resourceName: string; + + // Query parameters + pageToken?: string; + pageSize?: number; + sortOrder?: SortOrder; + syncToken?: string; + requestMask?: RequestMask; + } + + interface Response { + connections: Person[]; + nextPageToken: string; + nextSyncToken: string; + } + } + } + + interface RequestMask { + includeField: string; + } + + type SourceType = 'SOURCE_TYPE_UNSPECIFIED' | 'ACCOUNT' | 'PROFILE' | 'DOMAIN_PROFILE' | 'CONTACT'; + + interface Source { + type: SourceType; + id: string; + etag: string; + resourceName: string; + } + + type ObjectType = 'OBJECT_TYPE_UNSPECIFIED' | 'PERSON' | 'PAGE'; + + interface PersonMetadata { + sources: Source[]; + previousResourceNames: string[]; + linkedPeopleResourceNames: string[]; + deleted: boolean; + objectType: ObjectType; + } + + interface FieldMetadata { + primary: boolean; + verified: boolean; + source: Source; + } + + interface Locale { + metadata: FieldMetadata; + value: string; + } + + interface Name { + metadata: FieldMetadata; + displayName: string; + displayNameLastFirst: string; + familyName: string; + givenName: string; + middleName: string; + honorificPrefix: string; + honorificSuffix: string; + phoneticFullName: string; + phoneticFamilyName: string; + phoneticGivenName: string; + phoneticMiddleName: string; + phoneticHonorificPrefix: string; + phoneticHonorificSuffix: string; + } + + type NicknameType = 'DEFAULT' | 'MAIDEN_NAME' | 'INITIALS' | 'GPLUS' | 'OTHER_NAME'; + + interface Nickname { + metadata: FieldMetadata; + value: string; + type: NicknameType; + } + + interface CoverPhoto { + } + + interface Photo { + } + + interface Gender { + } + + interface AgeRange { + } + + interface Birthday { + } + + interface Event { + } + + interface Address { + metadata: FieldMetadata; + formattedValue: string; + type: string; + formattedType: string; + poBox: string; + streetAddress: string; + extendedAddress: string; + city: string; + region: string; + postalCode: string; + country: string; + countryCode: string; + } + + interface Residence { + metadata: FieldMetadata; + value: string; + current: boolean; + } + + interface EmailAddress { + metadata: FieldMetadata; + value: string; + type: string; + formattedType: string; + displayName: string; + } + + interface PhoneNumber { + metadata: FieldMetadata; + value: string; + canonicalForm: string; + type: string; + formattedType: string; + } + + interface ImClient { + } + + interface Tagline { + } + + interface Biography { + } + + interface Url { + } + + interface Organization { + } + + interface Occupation { + } + + interface Interest { + } + + interface Skill { + } + + interface BraggingRights { + } + + interface Relation { + } + + interface RelationshipInterest { + } + + interface RelationshipStatus { + } + + interface Membership { + } + + interface Person { + resourceName: string; + etag: string; + metadata: PersonMetadata; + locales: Locale[]; + names: Name[]; + nicknames?: Nickname[]; + coverPhotos: CoverPhoto[]; + photos?: Photo[]; + genders?: Gender[]; + ageRange?: AgeRange; + birthdays?: Birthday[]; + events?: Event[]; + addresses?: Address[]; + residences?: Residence[]; + emailAddresses?: EmailAddress[]; + phoneNumbers?: PhoneNumber[]; + imClients?: ImClient[]; + taglines?: Tagline[]; + biographies?: Biography[]; + urls?: Url[]; + organizations?: Organization[]; + occupations?: Occupation[]; + interests?: Interest[]; + skills?: Skill[]; + BraggingRights?: BraggingRights[]; + relations?: Relation[]; + relationshipInterests?: RelationshipInterest[]; + relationshipStatuses?: RelationshipStatus[]; + memberships?: Membership[]; + } +} diff --git a/gapi.people/tsconfig.json b/gapi.people/tsconfig.json new file mode 100644 index 0000000000..93fcfc59b6 --- /dev/null +++ b/gapi.people/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "module": "commonjs", + "lib": ["es6", "dom"], + "strictNullChecks": true, + "noImplicitAny": true, + "noImplicitThis": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true + }, + "files": [ + "index.d.ts", + "gapi.people-tests.ts" + ] +} From fc9bff794033c7509144dd53f28cba8fe8748796 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 24 Feb 2017 01:18:59 +0100 Subject: [PATCH 043/567] Add tests for gapi Includes various fixes due to the tests --- gapi/gapi-tests.ts | 97 ++++++++++++++++++++++++++++++++++++++++++++++ gapi/index.d.ts | 86 ++++++++++++++++++++++++++++++---------- gapi/tsconfig.json | 10 +++-- 3 files changed, 168 insertions(+), 25 deletions(-) create mode 100644 gapi/gapi-tests.ts diff --git a/gapi/gapi-tests.ts b/gapi/gapi-tests.ts new file mode 100644 index 0000000000..b16cade6bb --- /dev/null +++ b/gapi/gapi-tests.ts @@ -0,0 +1,97 @@ +/// +/// + +/* Examples taken from https://developers.google.com/api-client-library/javascript/start/start-js */ + +{ + function start1() { + // 2. Initialize the JavaScript client library. + gapi.client.init({ + 'apiKey': 'YOUR_API_KEY', + 'discoveryDocs': ['https://people.googleapis.com/$discovery/rest'], + // clientId and scope are optional if auth is not required. + 'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com', + 'scope': 'profile', + }).then(function() { + // 3. Initialize and make the API request. + return gapi.client.people.people.get({ + resourceName: 'people/me' + }); + }).then(function(response) { + console.log(response.result); + }, function(reason) { + console.log('Error: ' + reason.result.error.message); + }); + }; + // 1. Load the JavaScript client library. + gapi.load('client', start1); +} + +{ + function start2() { + // 2. Initialize the JavaScript client library. + gapi.client.init({ + 'apiKey': 'YOUR_API_KEY', + // clientId and scope are optional if auth is not required. + 'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com', + 'scope': 'profile', + }).then(function() { + // 3. Initialize and make the API request. + return gapi.client.request({ + 'path': 'https://people.googleapis.com/v1/people/me', + }) + }).then(function(response) { + console.log(response.result); + }, function(reason) { + console.log('Error: ' + reason.result.error.message); + }); + }; + // 1. Load the JavaScript client library. + gapi.load('client', start2); +} + + +/* Examples taken from https://developers.google.com/api-client-library/javascript/features/promises */ + +gapi.client.request({'path': '/plus/v1/people', 'params': {'query': 'John'}}).then(function(response) { + // Handle response +}, function(reason) { + // Handle error +}); + +gapi.client.load('plus', 'v1').then(function() { + gapi.client.plus.people.search({'query': ''}).then(response => { }); +}); + +var personFetcher = { + results: [], + + // Why this: any? Check https://github.com/Microsoft/TypeScript/issues/10835 + + fetch: function(this: any, name: string) { + gapi.client.request({path: '/plus/v1/people', params:{query: name}}).then(function(this: any, response) { + this.results.push(response.result); + }, function(reason) { + console.error(name, 'was not fetched:', reason.result.error.message); + }, this); + } +}; +personFetcher.fetch('John'); + +gapi.client.request({ + 'path': 'plus/v1/people', + 'params': {'query': name} +}).execute(function(resp, rawResp) { + processResponse(resp); +}); + +gapi.client.request({ + 'path': 'plus/v1/people', + 'params': {'query': name} +}).then(function(resp) { + processResponse(resp.result); +}); + +function processResponse(response: any) { + // Stub +} diff --git a/gapi/index.d.ts b/gapi/index.d.ts index 84da600e7b..8f8e621fa3 100644 --- a/gapi/index.d.ts +++ b/gapi/index.d.ts @@ -1,8 +1,8 @@ -// Type definitions for Google API Client +// Type definitions for Google API Client 0.0 // Project: https://code.google.com/p/google-api-javascript-client/ // Definitions by: Frank M // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +// TypeScript Version: 2.1 /** * The OAuth 2.0 token object represents the OAuth 2.0 token and any associated data. @@ -102,7 +102,7 @@ declare namespace gapi.auth { /** * A function in the global namespace, which is called when the sign-in button is rendered and also called after a sign-in flow completes. */ - callback?: Function; + callback?: () => void; /** * If true, all previously granted scopes remain granted in each incremental request, for incremental authorization. The default value true is correct for most use cases; use false only if employing delegated auth, where you pass the bearer token to a less-trusted component with lower programmatic authority. */ @@ -127,6 +127,30 @@ declare namespace gapi.auth { } declare namespace gapi.client { + /** + * Initializes the JavaScript client with API key, OAuth client ID, scope, and API discovery document(s). + * If OAuth client ID and scope are provided, this function will load the gapi.auth2 module to perform OAuth. + * The gapi.client.init function can be run multiple times, such as to set up more APIs, to change API key, or initialize OAuth lazily. + */ + export function init(args: { + /** + * The API Key to use. + */ + apiKey?: string; + /** + * An array of discovery doc URLs or discovery doc JSON objects. + */ + discoveryDocs?: string[]; + /** + * The app's client ID, found and created in the Google Developers Console. + */ + clientId?: string; + /** + * The scopes to request, as a space-delimited string. + */ + scope?: string + }): Promise; + interface RequestOptions { /** * The URL to handle the request @@ -188,10 +212,46 @@ declare namespace gapi.client { */ export function setApiKey(apiKey: string): void; + interface HttpRequestFulfilled { + result: T; + body: string; + headers?: any[]; + status?: number; + statusText?: string; + } + + interface HttpRequestRejected { + result: { + error: { + message: string; + } + }; + body: string; + headers?: any[]; + status?: number; + statusText?: string; + } + + /** + * HttpRequest supports promises. + * See Google API Client JavaScript Using Promises https://developers.google.com/api-client-library/javascript/features/promises + * + * TODO This should be updated when TypeScript 2.3 is released + * See https://github.com/Microsoft/TypeScript/issues/12409 + * See https://github.com/Microsoft/TypeScript/blob/65da012527937a3074c62655d60ee08fee809f7f/lib/lib.es5.d.ts#L1339 + */ + class HttpRequestPromise { + then( + opt_onFulfilled?: ((response: HttpRequestFulfilled) => void) | null, + opt_onRejected?: ((reason: HttpRequestRejected) => void) | null, + opt_context?: any + ): Promise; + } + /** * An object encapsulating an HTTP request. This object is not instantiated directly, rather it is returned by gapi.client.request. */ - export class HttpRequest { + export class HttpRequest extends HttpRequestPromise { /** * Executes the request and runs the supplied callback on response. * @param callback The callback function which executes when the request succeeds or fails. @@ -211,24 +271,8 @@ declare namespace gapi.client { statusText: string; } ) => any): void; - /** - * HttpRequest supports promises. - */ - then(success: (response: { - result: T; - body: string; - headers?: any[]; - status?: number; - statusText?: string; - }) => void, - failure: (response: { - result: T; - body: string; - headers?: any[]; - status?: number; - statusText?: string; - }) => void): void; } + /** * Represents an HTTP Batch operation. Individual HTTP requests are added with the add method and the batch is executed using execute. */ diff --git a/gapi/tsconfig.json b/gapi/tsconfig.json index 27e01ecd7b..22f5738c1a 100644 --- a/gapi/tsconfig.json +++ b/gapi/tsconfig.json @@ -2,11 +2,12 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -16,6 +17,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "gapi-tests.ts" ] -} \ No newline at end of file +} From 966f6241c6c5471138737e047b95bd404c87b8c8 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 24 Feb 2017 01:19:43 +0100 Subject: [PATCH 044/567] gapi.auth2 small fixes --- gapi.auth2/gapi.auth2-tests.ts | 12 ++++++------ gapi.auth2/index.d.ts | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gapi.auth2/gapi.auth2-tests.ts b/gapi.auth2/gapi.auth2-tests.ts index 621ca6f056..362a60c904 100644 --- a/gapi.auth2/gapi.auth2-tests.ts +++ b/gapi.auth2/gapi.auth2-tests.ts @@ -1,6 +1,6 @@ -function test_init(){ +function test_init() { var auth = gapi.auth2.init({ client_id: 'my-id', cookie_policy: 'single_host_origin', @@ -9,7 +9,7 @@ function test_init(){ }); } -function test_getAuthInstance(){ +function test_getAuthInstance() { gapi.auth2.init({ client_id: 'my-id', cookie_policy: 'single_host_origin', @@ -19,14 +19,14 @@ function test_getAuthInstance(){ var auth = gapi.auth2.getAuthInstance(); } -function test_signIn(){ +function test_signIn() { gapi.auth2.getAuthInstance().signIn({ scope: 'email profile', prompt: 'content' }); } -function test_signInOptionsBuild(){ +function test_signInOptionsBuild() { var options = new gapi.auth2.SigninOptionsBuilder(); options.setAppPackageName('com.example.app'); options.setFetchBasicProfile(true); @@ -35,13 +35,13 @@ function test_signInOptionsBuild(){ gapi.auth2.getAuthInstance().signIn(options); } -function test_getAuthResponse(){ +function test_getAuthResponse() { var user = gapi.auth2.getAuthInstance().currentUser.get(); var authResponse = user.getAuthResponse(); var authResponseWithAuth = user.getAuthResponse(true); } -function test_render(){ +function test_render() { var success = (googleUser: gapi.auth2.GoogleUser): void => { console.log(googleUser); }; diff --git a/gapi.auth2/index.d.ts b/gapi.auth2/index.d.ts index 6146a87e28..402da68699 100644 --- a/gapi.auth2/index.d.ts +++ b/gapi.auth2/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Google Sign-In API +// Type definitions for Google Sign-In API 0.0 // Project: https://developers.google.com/identity/sign-in/web/ // Definitions by: Derek Lawless // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -21,7 +21,7 @@ declare namespace gapi.auth2 { * Calls the onInit function when the GoogleAuth object is fully initialized, or calls the onFailure function if * initialization fails. */ - then(onInit: () => any, onFailure: (reason: string) => any): any; + then(onInit: () => any, onFailure?: (reason: string) => any): any; /** * Signs in the user with the options specified to gapi.auth2.init(). @@ -58,7 +58,7 @@ declare namespace gapi.auth2 { onsuccess: (googleUser: GoogleUser) => any, onfailure: (reason: string) => any): any; } - export interface IsSignedIn{ + export interface IsSignedIn { /** * Returns whether the current user is currently signed in. */ From 2b11d2ab76a29a2dfec9972eec486d9754ec0ede Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 24 Feb 2017 01:20:07 +0100 Subject: [PATCH 045/567] More tests for gapi.auth2 --- gapi.auth2/gapi.auth2-tests.ts | 86 +++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/gapi.auth2/gapi.auth2-tests.ts b/gapi.auth2/gapi.auth2-tests.ts index 362a60c904..1d389d59e9 100644 --- a/gapi.auth2/gapi.auth2-tests.ts +++ b/gapi.auth2/gapi.auth2-tests.ts @@ -1,4 +1,4 @@ - +/// function test_init() { var auth = gapi.auth2.init({ @@ -59,3 +59,87 @@ function test_render() { onfailure: failure }); } + +/* Example taken from https://developers.google.com/identity/sign-in/web/ */ +function onSignIn(googleUser: gapi.auth2.GoogleUser) { + // Useful data for your client-side scripts: + var profile = googleUser.getBasicProfile(); + console.log("ID: " + profile.getId()); // Don't send this directly to your server! + console.log('Full Name: ' + profile.getName()); + console.log('Given Name: ' + profile.getGivenName()); + console.log('Family Name: ' + profile.getFamilyName()); + console.log("Image URL: " + profile.getImageUrl()); + console.log("Email: " + profile.getEmail()); + + // The ID token you need to pass to your backend: + var id_token = googleUser.getAuthResponse().id_token; + console.log("ID Token: " + id_token); +}; + + +/* Example taken from https://github.com/google/google-api-javascript-client/blob/master/samples/authSample.html */ + +// Enter an API key from the Google API Console: +// https://console.developers.google.com/apis/credentials +var apiKey = 'YOUR_API_KEY'; +// Enter the API Discovery Docs that describes the APIs you want to +// access. In this example, we are accessing the People API, so we load +// Discovery Doc found here: https://developers.google.com/people/api/rest/ +var discoveryDocs = ["https://people.googleapis.com/$discovery/rest?version=v1"]; +// Enter a client ID for a web application from the Google API Console: +// https://console.developers.google.com/apis/credentials?project=_ +// In your API Console project, add a JavaScript origin that corresponds +// to the domain where you will be running the script. +var clientId = 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com'; +// Enter one or more authorization scopes. Refer to the documentation for +// the API or https://developers.google.com/people/v1/how-tos/authorizing +// for details. +var scopes = 'profile'; +var authorizeButton = document.getElementById('authorize-button'); +var signoutButton = document.getElementById('signout-button'); +function handleClientLoad() { + // Load the API client and auth2 library + gapi.load('client:auth2', initClient); +} +function initClient() { + gapi.client.init({ + apiKey: apiKey, + discoveryDocs: discoveryDocs, + clientId: clientId, + scope: scopes + }).then(function () { + // Listen for sign-in state changes. + gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus); + // Handle the initial sign-in state. + updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get()); + authorizeButton.onclick = handleAuthClick; + signoutButton.onclick = handleSignoutClick; + }); +} +function updateSigninStatus(isSignedIn: boolean) { + if (isSignedIn) { + authorizeButton.style.display = 'none'; + signoutButton.style.display = 'block'; + makeApiCall(); + } else { + authorizeButton.style.display = 'block'; + signoutButton.style.display = 'none'; + } +} +function handleAuthClick(event: MouseEvent) { + gapi.auth2.getAuthInstance().signIn(); +} +function handleSignoutClick(event: MouseEvent) { + gapi.auth2.getAuthInstance().signOut(); +} +// Load the API and make an API call. Display the results on the screen. +function makeApiCall() { + gapi.client.people.people.get({ + resourceName: 'people/me' + }).then(function(resp) { + var p = document.createElement('p'); + var name = resp.result.names[0].givenName; + p.appendChild(document.createTextNode('Hello, '+name+'!')); + document.getElementById('content').appendChild(p); + }); +} From 77af13e3b476ff344e90063a6787483bffa562ef Mon Sep 17 00:00:00 2001 From: Stefan Dobrev Date: Fri, 24 Feb 2017 11:04:40 +0200 Subject: [PATCH 046/567] [react-native] SubViewRenderer can return null SubViewRenderer could potentially return `null` along with JSX element. --- react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-native/index.d.ts b/react-native/index.d.ts index 2f95939db6..60556d3d09 100644 --- a/react-native/index.d.ts +++ b/react-native/index.d.ts @@ -7635,7 +7635,7 @@ declare module "react" { onNavigateBack?(): void; } - type SubViewRenderer = (subViewProps: SubViewProps) => JSX.Element; + type SubViewRenderer = (subViewProps: SubViewProps) => JSX.Element | null; export interface NavigationHeaderProps extends NavigationSceneRendererProps { onNavigateBack?(): void, From 1dfe4c5dada036e164d2114a1cf3ebbb71224bf0 Mon Sep 17 00:00:00 2001 From: Jan Alonzo Date: Sat, 25 Feb 2017 15:55:05 +1100 Subject: [PATCH 047/567] Remove localforage and point to upstream typings instead --- localforage/index.d.ts | 115 ------------------------------ localforage/localforage-tests.ts | 117 ------------------------------- localforage/package.json | 5 ++ localforage/tsconfig.json | 23 ------ notNeededPackages.json | 8 ++- 5 files changed, 12 insertions(+), 256 deletions(-) delete mode 100644 localforage/index.d.ts delete mode 100644 localforage/localforage-tests.ts create mode 100644 localforage/package.json delete mode 100644 localforage/tsconfig.json diff --git a/localforage/index.d.ts b/localforage/index.d.ts deleted file mode 100644 index d0194ec60f..0000000000 --- a/localforage/index.d.ts +++ /dev/null @@ -1,115 +0,0 @@ -// Type definitions for Mozilla's localForage -// Project: https://github.com/mozilla/localforage -// Definitions by: yuichi david pichsenmeister -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface LocalForageOptions { - driver?: string | LocalForageDriver | LocalForageDriver[]; - - name?: string; - - size?: number; - - storeName?: string; - - version?: number; - - description?: string; -} - -interface LocalForageDbMethods { - getItem(key: string): Promise; - getItem(key: string, callback: (err: any, value: T) => void): void; - - setItem(key: string, value: T): Promise; - setItem(key: string, value: T, callback: (err: any, value: T) => void): void; - - removeItem(key: string): Promise; - removeItem(key: string, callback: (err: any) => void): void; - - clear(): Promise; - clear(callback: (err: any) => void): void; - - length(): Promise; - length(callback: (err: any, numberOfKeys: number) => void): void; - - key(keyIndex: number): Promise; - key(keyIndex: number, callback: (err: any, key: string) => void): void; - - keys(): Promise; - keys(callback: (err: any, keys: string[]) => void): void; - - iterate(iteratee: (value: any, key: string, iterationNumber: number) => any): Promise; - iterate(iteratee: (value: any, key: string, iterationNumber: number) => any, - callback: (err: any, result: any) => void): void; -} - -interface LocalForageDriverSupportFunc { - (): Promise; -} - -interface LocalForageDriver extends LocalForageDbMethods { - _driver: string; - - _initStorage(options: LocalForageOptions): void; - - _support?: boolean | LocalForageDriverSupportFunc; -} - -interface LocalForageSerializer { - serialize(value: T | ArrayBuffer | Blob, callback: (value: string, error: any) => void): void; - - deserialize(value: string): T | ArrayBuffer | Blob; - - stringToBuffer(serializedString: string): ArrayBuffer; - - bufferToString(buffer: ArrayBuffer): string; -} - -interface LocalForage extends LocalForageDbMethods { - LOCALSTORAGE: string; - WEBSQL: string; - INDEXEDDB: string; - - /** - * Set and persist localForage options. This must be called before any other calls to localForage are made, but can be called after localForage is loaded. - * If you set any config values with this method they will persist after driver changes, so you can call config() then setDriver() - * @param {LocalForageOptions} options? - */ - config(options: LocalForageOptions): boolean; - - /** - * Create a new instance of localForage to point to a different store. - * All the configuration options used by config are supported. - * @param {LocalForageOptions} options - */ - createInstance(options: LocalForageOptions): LocalForage; - - driver(): string; - /** - * Force usage of a particular driver or drivers, if available. - * @param {string} driver - */ - setDriver(driver: string | string[]): Promise; - setDriver(driver: string | string[], callback: () => void, errorCallback: (error: any) => void): void; - defineDriver(driver: LocalForageDriver): Promise; - defineDriver(driver: LocalForageDriver, callback: () => void, errorCallback: (error: any) => void): void; - /** - * Return a particular driver - * @param {string} driver - */ - getDriver(driver: string): Promise; - - getSerializer(): Promise; - getSerializer(callback: (serializer: LocalForageSerializer) => void): void; - - supports(driverName: string): boolean; - - ready(callback: () => void): void; - ready(): Promise; -} - -declare module "localforage" { - let localforage: LocalForage; - export = localforage; -} diff --git a/localforage/localforage-tests.ts b/localforage/localforage-tests.ts deleted file mode 100644 index e3edeba2d0..0000000000 --- a/localforage/localforage-tests.ts +++ /dev/null @@ -1,117 +0,0 @@ - - -declare let localForage: LocalForage; - -namespace LocalForageTest { - localForage.clear((err: any) => { - let newError: any = err; - }); - - localForage.iterate((str: string, key: string, num: number) => { - let newStr: string = str; - let newKey: string = key; - let newNum: number = num; - }); - - localForage.length((err: any, num: number) => { - let newError: any = err; - let newNumber: number = num; - }); - - localForage.length().then((num: number) => { - var newNumber: number = num; - }); - - localForage.key(0, (err: any, value: string) => { - let newError: any = err; - let newValue: string = value; - }); - - localForage.keys((err: any, keys: Array) => { - let newError: any = err; - let newArray: Array = keys; - }); - - localForage.keys().then((keys: Array) => { - var newArray: Array = keys; - }); - - localForage.getItem("key",(err: any, str: string) => { - let newError: any = err; - let newStr: string = str - }); - - localForage.getItem("key").then((str: string) => { - let newStr: string = str; - }); - - localForage.setItem("key", "value",(err: any, str: string) => { - let newError: any = err; - let newStr: string = str - }); - - localForage.setItem("key", "value").then((str: string) => { - let newStr: string = str; - }); - - localForage.removeItem("key",(err: any) => { - let newError: any = err; - }); - - localForage.removeItem("key").then(() => { - }); - - localForage.getDriver("CustomDriver").then((result: LocalForageDriver) => { - var driver: LocalForageDriver = result; - // we need to use a variable for proper type guards before TS 2.0 - var _support = driver._support; - if (typeof _support === "function") { - // _support = _support.bind(driver); - _support().then((result: boolean) => { - let doesSupport: boolean = result; - }); - } else if (typeof _support === "boolean") { - let doesSupport: boolean = _support; - } - }); - - { - let config: boolean; - - config = localForage.config({ - name: "testyo", - driver: localForage.LOCALSTORAGE - }); - } - - { - let store: LocalForage; - - store = localForage.createInstance({ - name: "da instance", - driver: localForage.LOCALSTORAGE - }); - } - - { - let testSerializer: LocalForageSerializer; - - localForage.getSerializer() - .then((serializer: LocalForageSerializer) => { - testSerializer = serializer; - }); - - localForage.getSerializer((serializer: LocalForageSerializer) => { - testSerializer = serializer; - }); - } - - { - let store: LocalForage; - - store.ready() - .then(() => {}); - - store.ready(() => {}); - } -} \ No newline at end of file diff --git a/localforage/package.json b/localforage/package.json new file mode 100644 index 0000000000..29f45814b2 --- /dev/null +++ b/localforage/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "localforage": ">=1.5.0" + } +} diff --git a/localforage/tsconfig.json b/localforage/tsconfig.json deleted file mode 100644 index 1e3cbf9e63..0000000000 --- a/localforage/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "localforage-tests.ts" - ] -} \ No newline at end of file diff --git a/notNeededPackages.json b/notNeededPackages.json index 0cd56b96d1..bcdf36987a 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -305,6 +305,12 @@ "typingsPackageName": "gaea-model", "sourceRepoURL": "https://github.com/ascoders/gaea-model", "asOfVersion": "0.0.0" + }, + { + "libraryName": "localforage", + "typingsPackageName": "localforage", + "sourceRepoURL": "https://github.com/localForage/localForage", + "asOfVersion": "0.0.34" } ] -} +} \ No newline at end of file From a8059edc7aab2c3ac955fb6049209c102fd3db86 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sat, 25 Feb 2017 12:55:26 -0500 Subject: [PATCH 048/567] placeId => placeid As per https://developers.google.com/places/web-service/details --- googlemaps/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemaps/index.d.ts b/googlemaps/index.d.ts index 06eba68a94..d4d0935717 100644 --- a/googlemaps/index.d.ts +++ b/googlemaps/index.d.ts @@ -2258,7 +2258,7 @@ declare namespace google.maps { } export interface PlaceDetailsRequest { - placeId: string; + placeid: string; } export interface PlaceGeometry { From 01ad861c95798ff83d7f5a05eefafd8bace185ac Mon Sep 17 00:00:00 2001 From: Diogo Sant'Ana Date: Sat, 25 Feb 2017 21:46:31 -0300 Subject: [PATCH 049/567] Update chart.js Chart constructor from v2.4.0 Version 2.4.0 new Chart constructor signature https://github.com/chartjs/Chart.js/commit/4a5b5a0e7eba85ca44f658375cb0c78e6af93e5c --- chart.js/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chart.js/index.d.ts b/chart.js/index.d.ts index 08781f4463..d21fc3ec80 100644 --- a/chart.js/index.d.ts +++ b/chart.js/index.d.ts @@ -5,7 +5,10 @@ declare class Chart { static readonly Chart: typeof Chart; - constructor(context: CanvasRenderingContext2D | HTMLCanvasElement, options: Chart.ChartConfiguration); + constructor( + context: string | JQuery | CanvasRenderingContext2D | HTMLCanvasElement | string[] | CanvasRenderingContext2D[] | HTMLCanvasElement[], + options: Chart.ChartConfiguration + ); config: Chart.ChartConfiguration; data: Chart.ChartData; destroy: () => {}; From 279fcd17bcf56d08b1dfa423cf62381f5a1bf8f5 Mon Sep 17 00:00:00 2001 From: Diogo Sant'Ana Date: Sat, 25 Feb 2017 22:00:25 -0300 Subject: [PATCH 050/567] Added jquery import declaration --- chart.js/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chart.js/index.d.ts b/chart.js/index.d.ts index d21fc3ec80..c103ab40ec 100644 --- a/chart.js/index.d.ts +++ b/chart.js/index.d.ts @@ -3,6 +3,8 @@ // Definitions by: Alberto Nuti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + declare class Chart { static readonly Chart: typeof Chart; constructor( From e45de33a3f658465e6c96a6b686eea9afc49757e Mon Sep 17 00:00:00 2001 From: Lukas Zech Date: Thu, 23 Feb 2017 15:32:05 +0100 Subject: [PATCH 051/567] Add generic parameter to Matchers --- jasmine/index.d.ts | 55 ++++-- jasmine/jasmine-tests.ts | 391 ++++++++++++++++++++------------------- 2 files changed, 233 insertions(+), 213 deletions(-) diff --git a/jasmine/index.d.ts b/jasmine/index.d.ts index 146ab55ad4..78fea75ec2 100644 --- a/jasmine/index.d.ts +++ b/jasmine/index.d.ts @@ -24,8 +24,9 @@ declare function afterEach(action: (done: DoneFn) => void, timeout?: number): vo declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void; declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void; -declare function expect(spy: Function): jasmine.Matchers; -declare function expect(actual: any): jasmine.Matchers; +declare function expect>(actual: ArrayLike): jasmine.ArrayLikeMatchers; +declare function expect(actual: T): jasmine.Matchers; +declare function expect(spy: Function): jasmine.Matchers; declare function fail(e?: any): void; /** Action method that should be called when the async work is complete */ @@ -43,23 +44,33 @@ declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, t declare function waits(timeout?: number): void; declare namespace jasmine { + type Expected = T | ObjectContaining | Any | Spy; var clock: () => Clock; function any(aclass: any): Any; + function anything(): Any; + function arrayContaining(sample: any[]): ArrayContaining; function objectContaining(sample: Partial): ObjectContaining; function createSpy(name: string, originalFn?: Function): Spy; + function createSpyObj(baseName: string, methodNames: any[]): any; function createSpyObj(baseName: string, methodNames: any[]): T; + function pp(value: any): string; + function getEnv(): Env; + function addCustomEqualityTester(equalityTester: CustomEqualityTester): void; + function addMatchers(matchers: CustomMatcherFactories): void; + function stringMatching(str: string): Any; function stringMatching(str: RegExp): Any; - function formatErrorMsg(domain: string, usage: string) : (msg: string) => string + + function formatErrorMsg(domain: string, usage: string): (msg: string) => string interface Any { @@ -83,7 +94,7 @@ declare namespace jasmine { } interface ObjectContaining { - new (sample: Partial): T; + new (sample: Partial): Partial; jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean; jasmineToString(): string; @@ -150,7 +161,7 @@ declare namespace jasmine { currentSpec: Spec; - matchersClass: Matchers; + matchersClass: Matchers; version(): any; versionString(): string; @@ -224,12 +235,12 @@ declare namespace jasmine { passed(): boolean; } - interface MessageResult extends Result { + interface MessageResult extends Result { values: any; trace: Trace; } - interface ExpectationResult extends Result { + interface ExpectationResult extends Result { matcherName: string; passed(): boolean; expected: any; @@ -242,12 +253,13 @@ declare namespace jasmine { new (options: {random: boolean, seed: string}): any; random: boolean; seed: string; - sort(items: T[]) : T[]; + sort(items: T[]): T[]; } namespace errors { class ExpectationFailed extends Error { constructor(); + stack: any; } } @@ -255,7 +267,7 @@ declare namespace jasmine { interface TreeProcessor { new (attrs: any): any; execute: (done: Function) => void; - processTree() : any; + processTree(): any; } interface Trace { @@ -301,18 +313,18 @@ declare namespace jasmine { results(): NestedResults; } - interface Matchers { + interface Matchers { - new (env: Env, actual: any, spec: Env, isNot?: boolean): any; + new (env: Env, actual: T, spec: Env, isNot?: boolean): any; env: Env; - actual: any; + actual: T; spec: Env; isNot?: boolean; message(): any; - toBe(expected: any, expectationFailOutput?: any): boolean; - toEqual(expected: any, expectationFailOutput?: any): boolean; + toBe(expected: Expected, expectationFailOutput?: any): boolean; + toEqual(expected: Expected, expectationFailOutput?: any): boolean; toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean; toBeDefined(expectationFailOutput?: any): boolean; toBeUndefined(expectationFailOutput?: any): boolean; @@ -332,11 +344,18 @@ declare namespace jasmine { toThrow(expected?: any): boolean; toThrowError(message?: string | RegExp): boolean; toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean; - not: Matchers; + not: Matchers; Any: Any; } + interface ArrayLikeMatchers> extends Matchers { + toBe(expected: Expected>, expectationFailOutput?: any): boolean; + toEqual(expected: Expected>, expectationFailOutput?: any): boolean; + toContain(expected: T, expectationFailOutput?: any): boolean; + not: ArrayLikeMatchers; + } + interface Reporter { reportRunnerStarting(runner: Runner): void; reportRunnerResults(runner: Runner): void; @@ -433,7 +452,7 @@ declare namespace jasmine { spies_: Spy[]; results_: NestedResults; - matchersClass: Matchers; + matchersClass: Matchers; getFullName(): string; results(): NestedResults; @@ -446,7 +465,7 @@ declare namespace jasmine { waits(timeout: number): Spec; waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec; fail(e?: any): void; - getMatchersClass_(): Matchers; + getMatchersClass_(): Matchers; addMatchers(matchersPrototype: CustomMatcherFactories): void; finishCallback(): void; finish(onComplete?: () => void): void; @@ -494,7 +513,7 @@ declare namespace jasmine { identity: string; and: SpyAnd; calls: Calls; - mostRecentCall: { args: any[]; }; + mostRecentCall: {args: any[];}; argsForCall: any[]; } diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index 13d80af9db..f841a613c5 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -1,34 +1,34 @@ // tests based on http://jasmine.github.io/2.2/introduction.html -describe("A suite", function () { - it("contains spec with an expectation", function () { +describe("A suite", function() { + it("contains spec with an expectation", function() { expect(true).toBe(true); }); }); -describe("A suite is just a function", function () { +describe("A suite is just a function", function() { var a: boolean; - it("and so is a spec", function () { + it("and so is a spec", function() { a = true; expect(a).toBe(true); }); }); -describe("The 'toBe' matcher compares with ===", function () { +describe("The 'toBe' matcher compares with ===", function() { - it("and has a positive case", function () { + it("and has a positive case", function() { expect(true).toBe(true); }); - it("and can have a negative case", function () { + it("and can have a negative case", function() { expect(false).not.toBe(true); }); }); -describe("Included matchers:", function () { +describe("Included matchers:", function() { - it("The 'toBe' matcher compares with ===", function () { + it("The 'toBe' matcher compares with ===", function() { var a = 12; var b = a; @@ -36,14 +36,14 @@ describe("Included matchers:", function () { expect(a).not.toBe(null); }); - describe("The 'toEqual' matcher", function () { + describe("The 'toEqual' matcher", function() { - it("works for simple literals and variables", function () { + it("works for simple literals and variables", function() { var a = 12; expect(a).toEqual(12); }); - it("should work for objects", function () { + it("should work for objects", function() { var foo = { a: 12, b: 34 @@ -56,7 +56,7 @@ describe("Included matchers:", function () { }); }); - it("The 'toMatch' matcher is for regular expressions", function () { + it("The 'toMatch' matcher is for regular expressions", function() { var message = "foo bar baz"; expect(message).toMatch(/bar/); @@ -64,7 +64,7 @@ describe("Included matchers:", function () { expect(message).not.toMatch(/quux/); }); - it("The 'toBeDefined' matcher compares against `undefined`", function () { + it("The 'toBeDefined' matcher compares against `undefined`", function() { var a = { foo: "foo" }; @@ -73,16 +73,16 @@ describe("Included matchers:", function () { expect((a).bar).not.toBeDefined(); }); - it("The `toBeUndefined` matcher compares against `undefined`", function () { + it("The `toBeUndefined` matcher compares against `undefined`", function() { var a = { foo: "foo" }; expect(a.foo).not.toBeUndefined(); - expect((a).bar).toBeUndefined(); + expect((a as any).bar).toBeUndefined(); }); - it("The 'toBeNull' matcher compares against null", function () { + it("The 'toBeNull' matcher compares against null", function() { var a: string = null; var foo = "foo"; @@ -91,28 +91,28 @@ describe("Included matchers:", function () { expect(foo).not.toBeNull(); }); - it("The 'toBeTruthy' matcher is for boolean casting testing", function () { + it("The 'toBeTruthy' matcher is for boolean casting testing", function() { var a: string, foo = "foo"; expect(foo).toBeTruthy(); expect(a).not.toBeTruthy(); }); - it("The 'toBeFalsy' matcher is for boolean casting testing", function () { + it("The 'toBeFalsy' matcher is for boolean casting testing", function() { var a: string, foo = "foo"; expect(a).toBeFalsy(); expect(foo).not.toBeFalsy(); }); - it("The 'toContain' matcher is for finding an item in an Array", function () { + it("The 'toContain' matcher is for finding an item in an Array", function() { var a = ["foo", "bar", "baz"]; - expect(a).toContain("bar"); + expect(a).toContain('foo'); expect(a).not.toContain("quux"); }); - it("The 'toBeLessThan' matcher is for mathematical comparisons", function () { + it("The 'toBeLessThan' matcher is for mathematical comparisons", function() { var pi = 3.1415926, e = 2.78; @@ -120,7 +120,7 @@ describe("Included matchers:", function () { expect(pi).not.toBeLessThan(e); }); - it("The 'toBeGreaterThan' is for mathematical comparisons", function () { + it("The 'toBeGreaterThan' is for mathematical comparisons", function() { var pi = 3.1415926, e = 2.78; @@ -128,7 +128,7 @@ describe("Included matchers:", function () { expect(e).not.toBeGreaterThan(pi); }); - it("The 'toBeCloseTo' matcher is for precision math comparison", function () { + it("The 'toBeCloseTo' matcher is for precision math comparison", function() { var pi = 3.1415926, e = 2.78; @@ -136,11 +136,11 @@ describe("Included matchers:", function () { expect(pi).toBeCloseTo(e, 0); }); - it("The 'toThrow' matcher is for testing if a function throws an exception", function () { - var foo = function () { + it("The 'toThrow' matcher is for testing if a function throws an exception", function() { + var foo = function() { return 1 + 2; }; - var bar = function () { + var bar = function() { var a: any = undefined; return a + 1; }; @@ -161,15 +161,15 @@ describe("Included matchers:", function () { }); }); -describe("A spec", function () { - it("is just a function, so it can contain any code", function () { +describe("A spec", function() { + it("is just a function, so it can contain any code", function() { var foo = 0; foo += 1; expect(foo).toEqual(1); }); - it("can have more than one expectation", function () { + it("can have more than one expectation", function() { var foo = 0; foo += 1; @@ -178,94 +178,94 @@ describe("A spec", function () { }); }); -describe("A spec (with setup and tear-down)", function () { +describe("A spec (with setup and tear-down)", function() { var foo: number; - beforeEach(function () { + beforeEach(function() { foo = 0; foo += 1; }); - afterEach(function () { + afterEach(function() { foo = 0; }); - it("is just a function, so it can contain any code", function () { + it("is just a function, so it can contain any code", function() { expect(foo).toEqual(1); }); - it("can have more than one expectation", function () { + it("can have more than one expectation", function() { expect(foo).toEqual(1); expect(true).toEqual(true); }); }); -describe("A spec", function () { +describe("A spec", function() { var foo: number; - beforeEach(function () { + beforeEach(function() { foo = 0; foo += 1; }); - afterEach(function () { + afterEach(function() { foo = 0; }); - it("is just a function, so it can contain any code", function () { + it("is just a function, so it can contain any code", function() { expect(foo).toEqual(1); }); - it("can have more than one expectation", function () { + it("can have more than one expectation", function() { expect(foo).toEqual(1); expect(true).toEqual(true); }); - describe("nested inside a second describe", function () { + describe("nested inside a second describe", function() { var bar: number; - beforeEach(function () { + beforeEach(function() { bar = 1; }); - it("can reference both scopes as needed", function () { + it("can reference both scopes as needed", function() { expect(foo).toEqual(bar); }); }); }); -xdescribe("A spec", function () { +xdescribe("A spec", function() { var foo: number; - beforeEach(function () { + beforeEach(function() { foo = 0; foo += 1; }); - it("is just a function, so it can contain any code", function () { + it("is just a function, so it can contain any code", function() { expect(foo).toEqual(1); }); }); -describe("Pending specs", function () { +describe("Pending specs", function() { - xit("can be declared 'xit'", function () { + xit("can be declared 'xit'", function() { expect(true).toBe(false); }); it("can be declared with 'it' but without a function"); - it("can be declared by calling 'pending' in the spec body", function () { + it("can be declared by calling 'pending' in the spec body", function() { expect(true).toBe(false); pending(); // without reason pending('this is why it is pending'); }); }); -describe("A spy", function () { +describe("A spy", function() { var foo: any, bar: any = null; - beforeEach(function () { + beforeEach(function() { foo = { setBar: function (value: any) { bar = value; @@ -278,29 +278,29 @@ describe("A spy", function () { foo.setBar(456, 'another param'); }); - it("tracks that the spy was called", function () { + it("tracks that the spy was called", function() { expect(foo.setBar).toHaveBeenCalled(); }); - it("tracks all the arguments of its calls", function () { + it("tracks all the arguments of its calls", function() { expect(foo.setBar).toHaveBeenCalledWith(123); expect(foo.setBar).toHaveBeenCalledWith(456, 'another param'); }); - it("stops all execution on a function", function () { + it("stops all execution on a function", function() { expect(bar).toBeNull(); }); }); -describe("A spy, when configured to call through", function () { +describe("A spy, when configured to call through", function() { var foo: any, bar: any, fetchedBar: any; - beforeEach(function () { + beforeEach(function() { foo = { setBar: function (value: any) { bar = value; }, - getBar: function () { + getBar: function() { return bar; } }; @@ -311,28 +311,28 @@ describe("A spy, when configured to call through", function () { fetchedBar = foo.getBar(); }); - it("tracks that the spy was called", function () { + it("tracks that the spy was called", function() { expect(foo.getBar).toHaveBeenCalled(); }); - it("should not effect other functions", function () { + it("should not effect other functions", function() { expect(bar).toEqual(123); }); - it("when called returns the requested value", function () { + it("when called returns the requested value", function() { expect(fetchedBar).toEqual(123); }); }); -describe("A spy, when configured to fake a return value", function () { +describe("A spy, when configured to fake a return value", function() { var foo: any, bar: any, fetchedBar: any; - beforeEach(function () { + beforeEach(function() { foo = { setBar: function (value: any) { bar = value; }, - getBar: function () { + getBar: function() { return bar; } }; @@ -343,15 +343,15 @@ describe("A spy, when configured to fake a return value", function () { fetchedBar = foo.getBar(); }); - it("tracks that the spy was called", function () { + it("tracks that the spy was called", function() { expect(foo.getBar).toHaveBeenCalled(); }); - it("should not effect other functions", function () { + it("should not effect other functions", function() { expect(bar).toEqual(123); }); - it("when called returns the requested value", function () { + it("when called returns the requested value", function() { expect(fetchedBar).toEqual(745); }); }); @@ -361,7 +361,7 @@ describe("A spy, when configured to fake a series of return values", function() beforeEach(function() { foo = { - setBar: function(value: any) { + setBar: function (value: any) { bar = value; }, getBar: function() { @@ -390,20 +390,20 @@ describe("A spy, when configured to fake a series of return values", function() }); }); -describe("A spy, when configured with an alternate implementation", function () { +describe("A spy, when configured with an alternate implementation", function() { var foo: any, bar: any, fetchedBar: any; - beforeEach(function () { + beforeEach(function() { foo = { setBar: function (value: any) { bar = value; }, - getBar: function () { + getBar: function() { return bar; } }; - spyOn(foo, "getBar").and.callFake(function () { + spyOn(foo, "getBar").and.callFake(function() { return 1001; }); @@ -411,23 +411,23 @@ describe("A spy, when configured with an alternate implementation", function () fetchedBar = foo.getBar(); }); - it("tracks that the spy was called", function () { + it("tracks that the spy was called", function() { expect(foo.getBar).toHaveBeenCalled(); }); - it("should not effect other functions", function () { + it("should not effect other functions", function() { expect(bar).toEqual(123); }); - it("when called returns the requested value", function () { + it("when called returns the requested value", function() { expect(fetchedBar).toEqual(1001); }); }); -describe("A spy, when configured to throw a value", function () { +describe("A spy, when configured to throw a value", function() { var foo: any, bar: any; - beforeEach(function () { + beforeEach(function() { foo = { setBar: function (value: any) { bar = value; @@ -437,55 +437,55 @@ describe("A spy, when configured to throw a value", function () { spyOn(foo, "setBar").and.throwError("quux"); }); - it("throws the value", function () { - expect(function () { + it("throws the value", function() { + expect(function() { foo.setBar(123) - }).toThrowError("quux"); + }).toThrowError("quux"); }); }); -describe("A spy, when configured with multiple actions", function () { +describe("A spy, when configured with multiple actions", function() { var foo: any, bar: any, fetchedBar: any; - beforeEach(function () { + beforeEach(function() { foo = { setBar: function (value: any) { bar = value; }, - getBar: function () { + getBar: function() { return bar; } }; spyOn(foo, 'getBar').and.callThrough().and.callFake(() => { - this.fakeCalled = true; + this.fakeCalled = true; }); foo.setBar(123); fetchedBar = foo.getBar(); }); - it("tracks that the spy was called", function () { + it("tracks that the spy was called", function() { expect(foo.getBar).toHaveBeenCalled(); }); - it("should not effect other functions", function () { + it("should not effect other functions", function() { expect(bar).toEqual(123); }); - it("when called returns the requested value", function () { + it("when called returns the requested value", function() { expect(fetchedBar).toEqual(123); }); - it("should have called the fake implementation", function () { + it("should have called the fake implementation", function() { expect(this.fakeCalled).toEqual(true); }); }); -describe("A spy", function () { +describe("A spy", function() { var foo: any, bar: any = null; - beforeEach(function () { + beforeEach(function() { foo = { setBar: function (value: any) { bar = value; @@ -495,7 +495,7 @@ describe("A spy", function () { spyOn(foo, 'setBar').and.callThrough(); }); - it("can call through and then stub in the same spec", function () { + it("can call through and then stub in the same spec", function() { foo.setBar(123); expect(bar).toEqual(123); @@ -507,10 +507,10 @@ describe("A spy", function () { }); }); -describe("A spy", function () { +describe("A spy", function() { var foo: any, bar: any = null; - beforeEach(function () { + beforeEach(function() { foo = { setBar: function (value: any) { bar = value; @@ -520,7 +520,7 @@ describe("A spy", function () { spyOn(foo, 'setBar'); }); - it("tracks if it was called at all", function () { + it("tracks if it was called at all", function() { expect(foo.setBar.calls.any()).toEqual(false); foo.setBar(); @@ -528,7 +528,7 @@ describe("A spy", function () { expect(foo.setBar.calls.any()).toEqual(true); }); - it("tracks the number of times it was called", function () { + it("tracks the number of times it was called", function() { expect(foo.setBar.calls.count()).toEqual(0); foo.setBar(); @@ -537,7 +537,7 @@ describe("A spy", function () { expect(foo.setBar.calls.count()).toEqual(2); }); - it("tracks the arguments of each call", function () { + it("tracks the arguments of each call", function() { foo.setBar(123); foo.setBar(456, "baz"); @@ -545,34 +545,34 @@ describe("A spy", function () { expect(foo.setBar.calls.argsFor(1)).toEqual([456, "baz"]); }); - it("tracks the arguments of all calls", function () { + it("tracks the arguments of all calls", function() { foo.setBar(123); foo.setBar(456, "baz"); expect(foo.setBar.calls.allArgs()).toEqual([[123], [456, "baz"]]); }); - it("can provide the context and arguments to all calls", function () { + it("can provide the context and arguments to all calls", function() { foo.setBar(123); expect(foo.setBar.calls.all()).toEqual([{ object: foo, args: [123], returnValue: undefined }]); }); - it("has a shortcut to the most recent call", function () { + it("has a shortcut to the most recent call", function() { foo.setBar(123); foo.setBar(456, "baz"); expect(foo.setBar.calls.mostRecent()).toEqual({ object: foo, args: [456, "baz"], returnValue: undefined }); }); - it("has a shortcut to the first call", function () { + it("has a shortcut to the first call", function() { foo.setBar(123); foo.setBar(456, "baz"); expect(foo.setBar.calls.first()).toEqual({ object: foo, args: [123], returnValue: undefined }); }); - it("can be reset", function () { + it("can be reset", function() { foo.setBar(123); foo.setBar(456, "baz"); @@ -584,40 +584,40 @@ describe("A spy", function () { }); }); -describe("A spy, when created manually", function () { +describe("A spy, when created manually", function() { var whatAmI: any; - beforeEach(function () { + beforeEach(function() { whatAmI = jasmine.createSpy('whatAmI'); whatAmI("I", "am", "a", "spy"); }); - it("is named, which helps in error reporting", function () { + it("is named, which helps in error reporting", function() { expect(whatAmI.and.identity()).toEqual('whatAmI'); }); - it("tracks that the spy was called", function () { + it("tracks that the spy was called", function() { expect(whatAmI).toHaveBeenCalled(); }); - it("tracks its number of calls", function () { + it("tracks its number of calls", function() { expect(whatAmI.calls.count()).toEqual(1); }); - it("tracks all the arguments of its calls", function () { + it("tracks all the arguments of its calls", function() { expect(whatAmI).toHaveBeenCalledWith("I", "am", "a", "spy"); }); - it("allows access to the most recent call", function () { + it("allows access to the most recent call", function() { expect(whatAmI.calls.mostRecent().args[0]).toEqual("I"); }); }); -describe("Multiple spies, when created manually", function () { +describe("Multiple spies, when created manually", function() { var tape: any; - beforeEach(function () { + beforeEach(function() { tape = jasmine.createSpyObj('tape', ['play', 'pause', 'stop', 'rewind']); tape.play(); @@ -625,35 +625,35 @@ describe("Multiple spies, when created manually", function () { tape.rewind(0); }); - it("creates spies for each requested function", function () { + it("creates spies for each requested function", function() { expect(tape.play).toBeDefined(); expect(tape.pause).toBeDefined(); expect(tape.stop).toBeDefined(); expect(tape.rewind).toBeDefined(); }); - it("tracks that the spies were called", function () { + it("tracks that the spies were called", function() { expect(tape.play).toHaveBeenCalled(); expect(tape.pause).toHaveBeenCalled(); expect(tape.rewind).toHaveBeenCalled(); expect(tape.stop).not.toHaveBeenCalled(); }); - it("tracks all the arguments of its calls", function () { + it("tracks all the arguments of its calls", function() { expect(tape.rewind).toHaveBeenCalledWith(0); }); }); -describe("jasmine.any", function () { - it("matches any value", function () { +describe("jasmine.any", function() { + it("matches any value", function() { expect({}).toEqual(jasmine.any(Object)); expect(12).toEqual(jasmine.any(Number)); }); - describe("when used with a spy", function () { - it("is useful for comparing arguments", function () { + describe("when used with a spy", function() { + it("is useful for comparing arguments", function() { var foo = jasmine.createSpy('foo'); - foo(12, function () { + foo(12, function() { return true; }); @@ -662,15 +662,15 @@ describe("jasmine.any", function () { }); }); -describe("jasmine.objectContaining", function () { +describe("jasmine.objectContaining", function() { interface fooType { - a:number; - b:number; - bar:string; + a: number; + b: number; + bar: string; } var foo: fooType; - beforeEach(function () { + beforeEach(function() { foo = { a: 1, b: 2, @@ -678,17 +678,18 @@ describe("jasmine.objectContaining", function () { }; }); - it("matches objects with the expect key/value pairs", function () { + it("matches objects with the expect key/value pairs", function() { expect(foo).toEqual(jasmine.objectContaining({ - bar: "baz" + bar: '' })); - expect(foo).not.toEqual(jasmine.objectContaining({ + + expect(foo).not.toEqual(jasmine.objectContaining({ a: 37 })); }); - describe("when used with a spy", function () { - it("is useful for comparing arguments", function () { + describe("when used with a spy", function() { + it("is useful for comparing arguments", function() { var callback = jasmine.createSpy('callback'); callback({ @@ -706,43 +707,43 @@ describe("jasmine.objectContaining", function () { }); describe("jasmine.arrayContaining", function() { - var foo: any; + var foo: any; - beforeEach(function() { - foo = [1, 2, 3, 4]; - }); + beforeEach(function() { + foo = [1, 2, 3, 4]; + }); - it("matches arrays with some of the values", function() { - expect(foo).toEqual(jasmine.arrayContaining([3, 1])); - expect(foo).not.toEqual(jasmine.arrayContaining([6])); - }); + it("matches arrays with some of the values", function() { + expect(foo).toEqual(jasmine.arrayContaining([3, 1])); + expect(foo).not.toEqual(jasmine.arrayContaining([6])); + }); - describe("when used with a spy", function() { - it("is useful when comparing arguments", function() { - var callback = jasmine.createSpy('callback'); + describe("when used with a spy", function() { + it("is useful when comparing arguments", function() { + var callback = jasmine.createSpy('callback'); - callback([1, 2, 3, 4]); + callback([1, 2, 3, 4]); - expect(callback).toHaveBeenCalledWith(jasmine.arrayContaining([4, 2, 3])); - expect(callback).not.toHaveBeenCalledWith(jasmine.arrayContaining([5, 2])); + expect(callback).toHaveBeenCalledWith(jasmine.arrayContaining([4, 2, 3])); + expect(callback).not.toHaveBeenCalledWith(jasmine.arrayContaining([5, 2])); + }); }); - }); }); -describe("Manually ticking the Jasmine Clock", function () { +describe("Manually ticking the Jasmine Clock", function() { var timerCallback: any; - beforeEach(function () { + beforeEach(function() { timerCallback = jasmine.createSpy("timerCallback"); jasmine.clock().install(); }); - afterEach(function () { + afterEach(function() { jasmine.clock().uninstall(); }); - it("causes a timeout to be called synchronously", function () { - setTimeout(function () { + it("causes a timeout to be called synchronously", function() { + setTimeout(function() { timerCallback(); }, 100); @@ -753,8 +754,8 @@ describe("Manually ticking the Jasmine Clock", function () { expect(timerCallback).toHaveBeenCalled(); }); - it("causes an interval to be called synchronously", function () { - setInterval(function () { + it("causes an interval to be called synchronously", function() { + setInterval(function() { timerCallback(); }, 100); @@ -770,7 +771,7 @@ describe("Manually ticking the Jasmine Clock", function () { expect(timerCallback.calls.count()).toEqual(2); }); - describe("Mocking the Date object", function(){ + describe("Mocking the Date object", function() { it("mocks the Date object and sets it to a given time", function() { var baseTime = new Date(2013, 9, 23); @@ -782,10 +783,10 @@ describe("Manually ticking the Jasmine Clock", function () { }); }); -describe("Asynchronous specs", function () { +describe("Asynchronous specs", function() { var value: number; beforeEach(function (done: DoneFn) { - setTimeout(function () { + setTimeout(function() { value = 0; done(); }, 1); @@ -798,42 +799,42 @@ describe("Asynchronous specs", function () { }); describe("long asynchronous specs", function() { - beforeEach(function(done: DoneFn) { - done(); + beforeEach(function (done: DoneFn) { + done(); }, 1000); - it("takes a long time", function(done: DoneFn) { - setTimeout(function() { - done(); - }, 9000); + it("takes a long time", function (done: DoneFn) { + setTimeout(function() { + done(); + }, 9000); }, 10000); - afterEach(function(done: DoneFn) { - done(); + afterEach(function (done: DoneFn) { + done(); }, 1000); }); }); -describe("Fail", function () { +describe("Fail", function() { - it("should fail test when called without arguments", function () { - fail(); - }); + it("should fail test when called without arguments", function() { + fail(); + }); - it("should fail test when called with a fail message", function () { - fail("The test failed"); - }); + it("should fail test when called with a fail message", function() { + fail("The test failed"); + }); - it("should fail test when called an error", function () { - fail(new Error("The test failed with this error")); - }); + it("should fail test when called an error", function() { + fail(new Error("The test failed with this error")); + }); }); // test based on http://jasmine.github.io/2.2/custom_equality.html describe("custom equality", function() { - var myCustomEquality: jasmine.CustomEqualityTester = function(first: any, second: any): boolean { + var myCustomEquality: jasmine.CustomEqualityTester = function (first: any, second: any): boolean { if (typeof first == "string" && typeof second == "string") { return first[0] == second[1]; } @@ -886,29 +887,29 @@ var customMatchers: jasmine.CustomMatcherFactories = { // } // } declare namespace jasmine { - interface Matchers { - toBeGoofy(expected?: any): boolean; + interface Matchers { + toBeGoofy(expected?: jasmine.Expected): boolean; } } -describe("Custom matcher: 'toBeGoofy'", function () { - beforeEach(function () { +describe("Custom matcher: 'toBeGoofy'", function() { + beforeEach(function() { jasmine.addMatchers(customMatchers); }); - it("is available on an expectation", function () { + it("is available on an expectation", function() { expect({ hyuk: 'gawrsh' }).toBeGoofy(); }); - it("can take an 'expected' parameter", function () { + it("can take an 'expected' parameter", function() { expect({ hyuk: 'gawrsh is fun' - }).toBeGoofy(' is fun'); + }).toBeGoofy({ hyuk: ' is fun' }); }); - it("can be negated", function () { + it("can be negated", function() { expect({ hyuk: 'this is fun' }).not.toBeGoofy(); @@ -917,7 +918,7 @@ describe("Custom matcher: 'toBeGoofy'", function () { // test based on http://jasmine.github.io/2.5/custom_reporter.html var myReporter: jasmine.CustomReporter = { - jasmineStarted: function (suiteInfo: jasmine.SuiteInfo ) { + jasmineStarted: function (suiteInfo: jasmine.SuiteInfo) { console.log("Running suite with " + suiteInfo.totalSpecsDefined); }, @@ -948,7 +949,7 @@ var myReporter: jasmine.CustomReporter = { } }, - jasmineDone: function(runDetails: jasmine.RunDetails) { + jasmineDone: function (runDetails: jasmine.RunDetails) { console.log('Finished suite'); console.log('Random:', runDetails.order.random); } @@ -957,20 +958,20 @@ var myReporter: jasmine.CustomReporter = { jasmine.getEnv().addReporter(myReporter); describe("Randomize Tests", function() { - it("should allow randomization of the order of tests", function() { - expect(function() { - var env = jasmine.getEnv(); - return env.randomizeTests(true); - }).not.toThrow(); - }); + it("should allow randomization of the order of tests", function() { + expect(function() { + var env = jasmine.getEnv(); + return env.randomizeTests(true); + }).not.toThrow(); + }); - it("should allow a seed to be passed in for randomization", function() { - expect(function() { - var env = jasmine.getEnv(); - env.randomizeTests(true); - return env.seed(1234); - }).not.toThrow(); - }); + it("should allow a seed to be passed in for randomization", function() { + expect(function() { + var env = jasmine.getEnv(); + env.randomizeTests(true); + return env.seed(1234); + }).not.toThrow(); + }); }); (() => { @@ -986,7 +987,7 @@ describe("Randomize Tests", function() { }; var currentWindowOnload = window.onload; - window.onload = function () { + window.onload = function() { if (currentWindowOnload) { (currentWindowOnload)(null); } From 5d864d9772c27269b06f0ecccc2cd88e98af9428 Mon Sep 17 00:00:00 2001 From: Lukas Zech Date: Sun, 26 Feb 2017 12:29:39 +0100 Subject: [PATCH 052/567] Fix linter errors --- jasmine/index.d.ts | 34 ++-- jasmine/jasmine-tests.ts | 386 ++++++++++++++++++------------------ jasmine/v1/jasmine-tests.ts | 22 +- 3 files changed, 219 insertions(+), 223 deletions(-) diff --git a/jasmine/index.d.ts b/jasmine/index.d.ts index 78fea75ec2..03c1e30c78 100644 --- a/jasmine/index.d.ts +++ b/jasmine/index.d.ts @@ -70,7 +70,7 @@ declare namespace jasmine { function stringMatching(str: string): Any; function stringMatching(str: RegExp): Any; - function formatErrorMsg(domain: string, usage: string): (msg: string) => string + function formatErrorMsg(domain: string, usage: string): (msg: string) => string; interface Any { @@ -124,18 +124,14 @@ declare namespace jasmine { withMock(func: () => void): void; } - interface CustomEqualityTester { - (first: any, second: any): boolean; - } + type CustomEqualityTester = (first: any, second: any) => boolean; interface CustomMatcher { compare(actual: T, expected: T): CustomMatcherResult; compare(actual: any, expected: any): CustomMatcherResult; } - interface CustomMatcherFactory { - (util: MatchersUtil, customEqualityTesters: Array): CustomMatcher; - } + type CustomMatcherFactory = (util: MatchersUtil, customEqualityTesters: CustomEqualityTester[]) => CustomMatcher; interface CustomMatcherFactories { [index: string]: CustomMatcherFactory; @@ -147,9 +143,9 @@ declare namespace jasmine { } interface MatchersUtil { - equals(a: any, b: any, customTesters?: Array): boolean; - contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean; - buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string; + equals(a: any, b: any, customTesters?: CustomEqualityTester[]): boolean; + contains(haystack: ArrayLike | string, needle: any, customTesters?: CustomEqualityTester[]): boolean; + buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: any[]): string; } interface Env { @@ -390,18 +386,18 @@ declare namespace jasmine { } interface CustomReporterResult { - description: string, - failedExpectations?: FailedExpectation[], - fullName: string, + description: string; + failedExpectations?: FailedExpectation[]; + fullName: string; id: string; - passedExpectations?: PassedExpectation[], + passedExpectations?: PassedExpectation[]; pendingReason?: string; status?: string; } interface RunDetails { failedExpectations: ExpectationResult[]; - order: jasmine.Order + order: jasmine.Order; } interface CustomReporter { @@ -431,9 +427,7 @@ declare namespace jasmine { results(): NestedResults; } - interface SpecFunction { - (spec?: Spec): void; - } + type SpecFunction = (spec?: Spec) => void; interface SuiteOrSpec { id: number; @@ -513,7 +507,7 @@ declare namespace jasmine { identity: string; and: SpyAnd; calls: Calls; - mostRecentCall: {args: any[];}; + mostRecentCall: {args: any[]; }; argsForCall: any[]; } @@ -574,7 +568,7 @@ declare namespace jasmine { finished: boolean; result: any; messages: any; - runDetails: RunDetails + runDetails: RunDetails; new (): any; diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index f841a613c5..e80060510b 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -1,34 +1,34 @@ // tests based on http://jasmine.github.io/2.2/introduction.html -describe("A suite", function() { - it("contains spec with an expectation", function() { +describe("A suite", () => { + it("contains spec with an expectation", () => { expect(true).toBe(true); }); }); -describe("A suite is just a function", function() { +describe("A suite is just a function", () => { var a: boolean; - it("and so is a spec", function() { + it("and so is a spec", () => { a = true; expect(a).toBe(true); }); }); -describe("The 'toBe' matcher compares with ===", function() { +describe("The 'toBe' matcher compares with ===", () => { - it("and has a positive case", function() { + it("and has a positive case", () => { expect(true).toBe(true); }); - it("and can have a negative case", function() { + it("and can have a negative case", () => { expect(false).not.toBe(true); }); }); -describe("Included matchers:", function() { +describe("Included matchers:", () => { - it("The 'toBe' matcher compares with ===", function() { + it("The 'toBe' matcher compares with ===", () => { var a = 12; var b = a; @@ -36,14 +36,14 @@ describe("Included matchers:", function() { expect(a).not.toBe(null); }); - describe("The 'toEqual' matcher", function() { + describe("The 'toEqual' matcher", () => { - it("works for simple literals and variables", function() { + it("works for simple literals and variables", () => { var a = 12; expect(a).toEqual(12); }); - it("should work for objects", function() { + it("should work for objects", () => { var foo = { a: 12, b: 34 @@ -56,7 +56,7 @@ describe("Included matchers:", function() { }); }); - it("The 'toMatch' matcher is for regular expressions", function() { + it("The 'toMatch' matcher is for regular expressions", () => { var message = "foo bar baz"; expect(message).toMatch(/bar/); @@ -64,16 +64,16 @@ describe("Included matchers:", function() { expect(message).not.toMatch(/quux/); }); - it("The 'toBeDefined' matcher compares against `undefined`", function() { + it("The 'toBeDefined' matcher compares against `undefined`", () => { var a = { foo: "foo" }; expect(a.foo).toBeDefined(); - expect((a).bar).not.toBeDefined(); + expect((a as any).bar).not.toBeDefined(); }); - it("The `toBeUndefined` matcher compares against `undefined`", function() { + it("The `toBeUndefined` matcher compares against `undefined`", () => { var a = { foo: "foo" }; @@ -82,7 +82,7 @@ describe("Included matchers:", function() { expect((a as any).bar).toBeUndefined(); }); - it("The 'toBeNull' matcher compares against null", function() { + it("The 'toBeNull' matcher compares against null", () => { var a: string = null; var foo = "foo"; @@ -91,28 +91,28 @@ describe("Included matchers:", function() { expect(foo).not.toBeNull(); }); - it("The 'toBeTruthy' matcher is for boolean casting testing", function() { + it("The 'toBeTruthy' matcher is for boolean casting testing", () => { var a: string, foo = "foo"; expect(foo).toBeTruthy(); expect(a).not.toBeTruthy(); }); - it("The 'toBeFalsy' matcher is for boolean casting testing", function() { + it("The 'toBeFalsy' matcher is for boolean casting testing", () => { var a: string, foo = "foo"; expect(a).toBeFalsy(); expect(foo).not.toBeFalsy(); }); - it("The 'toContain' matcher is for finding an item in an Array", function() { + it("The 'toContain' matcher is for finding an item in an Array", () => { var a = ["foo", "bar", "baz"]; expect(a).toContain('foo'); expect(a).not.toContain("quux"); }); - it("The 'toBeLessThan' matcher is for mathematical comparisons", function() { + it("The 'toBeLessThan' matcher is for mathematical comparisons", () => { var pi = 3.1415926, e = 2.78; @@ -120,7 +120,7 @@ describe("Included matchers:", function() { expect(pi).not.toBeLessThan(e); }); - it("The 'toBeGreaterThan' is for mathematical comparisons", function() { + it("The 'toBeGreaterThan' is for mathematical comparisons", () => { var pi = 3.1415926, e = 2.78; @@ -128,7 +128,7 @@ describe("Included matchers:", function() { expect(e).not.toBeGreaterThan(pi); }); - it("The 'toBeCloseTo' matcher is for precision math comparison", function() { + it("The 'toBeCloseTo' matcher is for precision math comparison", () => { var pi = 3.1415926, e = 2.78; @@ -136,12 +136,12 @@ describe("Included matchers:", function() { expect(pi).toBeCloseTo(e, 0); }); - it("The 'toThrow' matcher is for testing if a function throws an exception", function() { - var foo = function() { + it("The 'toThrow' matcher is for testing if a function throws an exception", () => { + var foo = () => { return 1 + 2; }; - var bar = function() { - var a: any = undefined; + var bar = () => { + var a: any; return a + 1; }; @@ -149,8 +149,8 @@ describe("Included matchers:", function() { expect(bar).toThrow(); }); - it("The 'toThrowError' matcher is for testing a specific thrown exception", function() { - var foo = function() { + it("The 'toThrowError' matcher is for testing a specific thrown exception", () => { + var foo = () => { throw new TypeError("foo bar baz"); }; @@ -161,15 +161,15 @@ describe("Included matchers:", function() { }); }); -describe("A spec", function() { - it("is just a function, so it can contain any code", function() { +describe("A spec", () => { + it("is just a function, so it can contain any code", () => { var foo = 0; foo += 1; expect(foo).toEqual(1); }); - it("can have more than one expectation", function() { + it("can have more than one expectation", () => { var foo = 0; foo += 1; @@ -178,96 +178,96 @@ describe("A spec", function() { }); }); -describe("A spec (with setup and tear-down)", function() { +describe("A spec (with setup and tear-down)", () => { var foo: number; - beforeEach(function() { + beforeEach(() => { foo = 0; foo += 1; }); - afterEach(function() { + afterEach(() => { foo = 0; }); - it("is just a function, so it can contain any code", function() { + it("is just a function, so it can contain any code", () => { expect(foo).toEqual(1); }); - it("can have more than one expectation", function() { + it("can have more than one expectation", () => { expect(foo).toEqual(1); expect(true).toEqual(true); }); }); -describe("A spec", function() { +describe("A spec", () => { var foo: number; - beforeEach(function() { + beforeEach(() => { foo = 0; foo += 1; }); - afterEach(function() { + afterEach(() => { foo = 0; }); - it("is just a function, so it can contain any code", function() { + it("is just a function, so it can contain any code", () => { expect(foo).toEqual(1); }); - it("can have more than one expectation", function() { + it("can have more than one expectation", () => { expect(foo).toEqual(1); expect(true).toEqual(true); }); - describe("nested inside a second describe", function() { + describe("nested inside a second describe", () => { var bar: number; - beforeEach(function() { + beforeEach(() => { bar = 1; }); - it("can reference both scopes as needed", function() { + it("can reference both scopes as needed", () => { expect(foo).toEqual(bar); }); }); }); -xdescribe("A spec", function() { +xdescribe("A spec", () => { var foo: number; - beforeEach(function() { + beforeEach(() => { foo = 0; foo += 1; }); - it("is just a function, so it can contain any code", function() { + it("is just a function, so it can contain any code", () => { expect(foo).toEqual(1); }); }); -describe("Pending specs", function() { +describe("Pending specs", () => { - xit("can be declared 'xit'", function() { + xit("can be declared 'xit'", () => { expect(true).toBe(false); }); it("can be declared with 'it' but without a function"); - it("can be declared by calling 'pending' in the spec body", function() { + it("can be declared by calling 'pending' in the spec body", () => { expect(true).toBe(false); pending(); // without reason pending('this is why it is pending'); }); }); -describe("A spy", function() { +describe("A spy", () => { var foo: any, bar: any = null; - beforeEach(function() { + beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; } }; @@ -278,29 +278,29 @@ describe("A spy", function() { foo.setBar(456, 'another param'); }); - it("tracks that the spy was called", function() { + it("tracks that the spy was called", () => { expect(foo.setBar).toHaveBeenCalled(); }); - it("tracks all the arguments of its calls", function() { + it("tracks all the arguments of its calls", () => { expect(foo.setBar).toHaveBeenCalledWith(123); expect(foo.setBar).toHaveBeenCalledWith(456, 'another param'); }); - it("stops all execution on a function", function() { + it("stops all execution on a function", () => { expect(bar).toBeNull(); }); }); -describe("A spy, when configured to call through", function() { +describe("A spy, when configured to call through", () => { var foo: any, bar: any, fetchedBar: any; - beforeEach(function() { + beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; }, - getBar: function() { + getBar: () => { return bar; } }; @@ -311,28 +311,28 @@ describe("A spy, when configured to call through", function() { fetchedBar = foo.getBar(); }); - it("tracks that the spy was called", function() { + it("tracks that the spy was called", () => { expect(foo.getBar).toHaveBeenCalled(); }); - it("should not effect other functions", function() { + it("should not effect other functions", () => { expect(bar).toEqual(123); }); - it("when called returns the requested value", function() { + it("when called returns the requested value", () => { expect(fetchedBar).toEqual(123); }); }); -describe("A spy, when configured to fake a return value", function() { +describe("A spy, when configured to fake a return value", () => { var foo: any, bar: any, fetchedBar: any; - beforeEach(function() { + beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; }, - getBar: function() { + getBar: () => { return bar; } }; @@ -343,28 +343,28 @@ describe("A spy, when configured to fake a return value", function() { fetchedBar = foo.getBar(); }); - it("tracks that the spy was called", function() { + it("tracks that the spy was called", () => { expect(foo.getBar).toHaveBeenCalled(); }); - it("should not effect other functions", function() { + it("should not effect other functions", () => { expect(bar).toEqual(123); }); - it("when called returns the requested value", function() { + it("when called returns the requested value", () => { expect(fetchedBar).toEqual(745); }); }); -describe("A spy, when configured to fake a series of return values", function() { +describe("A spy, when configured to fake a series of return values", () => { var foo: any, bar: any; - beforeEach(function() { + beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; }, - getBar: function() { + getBar: () => { return bar; } }; @@ -374,36 +374,36 @@ describe("A spy, when configured to fake a series of return values", function() foo.setBar(123); }); - it("tracks that the spy was called", function() { + it("tracks that the spy was called", () => { foo.getBar(123); expect(foo.getBar).toHaveBeenCalled(); }); - it("should not affect other functions", function() { + it("should not affect other functions", () => { expect(bar).toEqual(123); }); - it("when called multiple times returns the requested values in order", function() { + it("when called multiple times returns the requested values in order", () => { expect(foo.getBar()).toEqual("fetched first"); expect(foo.getBar()).toEqual("fetched second"); expect(foo.getBar()).toBeUndefined(); }); }); -describe("A spy, when configured with an alternate implementation", function() { +describe("A spy, when configured with an alternate implementation", () => { var foo: any, bar: any, fetchedBar: any; - beforeEach(function() { + beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; }, - getBar: function() { + getBar: () => { return bar; } }; - spyOn(foo, "getBar").and.callFake(function() { + spyOn(foo, "getBar").and.callFake(() => { return 1001; }); @@ -411,25 +411,25 @@ describe("A spy, when configured with an alternate implementation", function() { fetchedBar = foo.getBar(); }); - it("tracks that the spy was called", function() { + it("tracks that the spy was called", () => { expect(foo.getBar).toHaveBeenCalled(); }); - it("should not effect other functions", function() { + it("should not effect other functions", () => { expect(bar).toEqual(123); }); - it("when called returns the requested value", function() { + it("when called returns the requested value", () => { expect(fetchedBar).toEqual(1001); }); }); -describe("A spy, when configured to throw a value", function() { +describe("A spy, when configured to throw a value", () => { var foo: any, bar: any; - beforeEach(function() { + beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; } }; @@ -437,22 +437,22 @@ describe("A spy, when configured to throw a value", function() { spyOn(foo, "setBar").and.throwError("quux"); }); - it("throws the value", function() { - expect(function() { - foo.setBar(123) + it("throws the value", () => { + expect(() => { + foo.setBar(123); }).toThrowError("quux"); }); }); -describe("A spy, when configured with multiple actions", function() { +describe("A spy, when configured with multiple actions", () => { var foo: any, bar: any, fetchedBar: any; - beforeEach(function() { + beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; }, - getBar: function() { + getBar: () => { return bar; } }; @@ -465,29 +465,29 @@ describe("A spy, when configured with multiple actions", function() { fetchedBar = foo.getBar(); }); - it("tracks that the spy was called", function() { + it("tracks that the spy was called", () => { expect(foo.getBar).toHaveBeenCalled(); }); - it("should not effect other functions", function() { + it("should not effect other functions", () => { expect(bar).toEqual(123); }); - it("when called returns the requested value", function() { + it("when called returns the requested value", () => { expect(fetchedBar).toEqual(123); }); - it("should have called the fake implementation", function() { + it("should have called the fake implementation", () => { expect(this.fakeCalled).toEqual(true); }); }); -describe("A spy", function() { +describe("A spy", () => { var foo: any, bar: any = null; - beforeEach(function() { + beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; } }; @@ -495,7 +495,7 @@ describe("A spy", function() { spyOn(foo, 'setBar').and.callThrough(); }); - it("can call through and then stub in the same spec", function() { + it("can call through and then stub in the same spec", () => { foo.setBar(123); expect(bar).toEqual(123); @@ -507,12 +507,12 @@ describe("A spy", function() { }); }); -describe("A spy", function() { +describe("A spy", () => { var foo: any, bar: any = null; - beforeEach(function() { + beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; } }; @@ -520,7 +520,7 @@ describe("A spy", function() { spyOn(foo, 'setBar'); }); - it("tracks if it was called at all", function() { + it("tracks if it was called at all", () => { expect(foo.setBar.calls.any()).toEqual(false); foo.setBar(); @@ -528,7 +528,7 @@ describe("A spy", function() { expect(foo.setBar.calls.any()).toEqual(true); }); - it("tracks the number of times it was called", function() { + it("tracks the number of times it was called", () => { expect(foo.setBar.calls.count()).toEqual(0); foo.setBar(); @@ -537,7 +537,7 @@ describe("A spy", function() { expect(foo.setBar.calls.count()).toEqual(2); }); - it("tracks the arguments of each call", function() { + it("tracks the arguments of each call", () => { foo.setBar(123); foo.setBar(456, "baz"); @@ -545,34 +545,34 @@ describe("A spy", function() { expect(foo.setBar.calls.argsFor(1)).toEqual([456, "baz"]); }); - it("tracks the arguments of all calls", function() { + it("tracks the arguments of all calls", () => { foo.setBar(123); foo.setBar(456, "baz"); expect(foo.setBar.calls.allArgs()).toEqual([[123], [456, "baz"]]); }); - it("can provide the context and arguments to all calls", function() { + it("can provide the context and arguments to all calls", () => { foo.setBar(123); expect(foo.setBar.calls.all()).toEqual([{ object: foo, args: [123], returnValue: undefined }]); }); - it("has a shortcut to the most recent call", function() { + it("has a shortcut to the most recent call", () => { foo.setBar(123); foo.setBar(456, "baz"); expect(foo.setBar.calls.mostRecent()).toEqual({ object: foo, args: [456, "baz"], returnValue: undefined }); }); - it("has a shortcut to the first call", function() { + it("has a shortcut to the first call", () => { foo.setBar(123); foo.setBar(456, "baz"); expect(foo.setBar.calls.first()).toEqual({ object: foo, args: [123], returnValue: undefined }); }); - it("can be reset", function() { + it("can be reset", () => { foo.setBar(123); foo.setBar(456, "baz"); @@ -584,40 +584,40 @@ describe("A spy", function() { }); }); -describe("A spy, when created manually", function() { +describe("A spy, when created manually", () => { var whatAmI: any; - beforeEach(function() { + beforeEach(() => { whatAmI = jasmine.createSpy('whatAmI'); whatAmI("I", "am", "a", "spy"); }); - it("is named, which helps in error reporting", function() { + it("is named, which helps in error reporting", () => { expect(whatAmI.and.identity()).toEqual('whatAmI'); }); - it("tracks that the spy was called", function() { + it("tracks that the spy was called", () => { expect(whatAmI).toHaveBeenCalled(); }); - it("tracks its number of calls", function() { + it("tracks its number of calls", () => { expect(whatAmI.calls.count()).toEqual(1); }); - it("tracks all the arguments of its calls", function() { + it("tracks all the arguments of its calls", () => { expect(whatAmI).toHaveBeenCalledWith("I", "am", "a", "spy"); }); - it("allows access to the most recent call", function() { + it("allows access to the most recent call", () => { expect(whatAmI.calls.mostRecent().args[0]).toEqual("I"); }); }); -describe("Multiple spies, when created manually", function() { +describe("Multiple spies, when created manually", () => { var tape: any; - beforeEach(function() { + beforeEach(() => { tape = jasmine.createSpyObj('tape', ['play', 'pause', 'stop', 'rewind']); tape.play(); @@ -625,35 +625,35 @@ describe("Multiple spies, when created manually", function() { tape.rewind(0); }); - it("creates spies for each requested function", function() { + it("creates spies for each requested function", () => { expect(tape.play).toBeDefined(); expect(tape.pause).toBeDefined(); expect(tape.stop).toBeDefined(); expect(tape.rewind).toBeDefined(); }); - it("tracks that the spies were called", function() { + it("tracks that the spies were called", () => { expect(tape.play).toHaveBeenCalled(); expect(tape.pause).toHaveBeenCalled(); expect(tape.rewind).toHaveBeenCalled(); expect(tape.stop).not.toHaveBeenCalled(); }); - it("tracks all the arguments of its calls", function() { + it("tracks all the arguments of its calls", () => { expect(tape.rewind).toHaveBeenCalledWith(0); }); }); -describe("jasmine.any", function() { - it("matches any value", function() { +describe("jasmine.any", () => { + it("matches any value", () => { expect({}).toEqual(jasmine.any(Object)); expect(12).toEqual(jasmine.any(Number)); }); - describe("when used with a spy", function() { - it("is useful for comparing arguments", function() { + describe("when used with a spy", () => { + it("is useful for comparing arguments", () => { var foo = jasmine.createSpy('foo'); - foo(12, function() { + foo(12, () => { return true; }); @@ -662,7 +662,7 @@ describe("jasmine.any", function() { }); }); -describe("jasmine.objectContaining", function() { +describe("jasmine.objectContaining", () => { interface fooType { a: number; b: number; @@ -670,7 +670,7 @@ describe("jasmine.objectContaining", function() { } var foo: fooType; - beforeEach(function() { + beforeEach(() => { foo = { a: 1, b: 2, @@ -678,7 +678,7 @@ describe("jasmine.objectContaining", function() { }; }); - it("matches objects with the expect key/value pairs", function() { + it("matches objects with the expect key/value pairs", () => { expect(foo).toEqual(jasmine.objectContaining({ bar: '' })); @@ -688,8 +688,8 @@ describe("jasmine.objectContaining", function() { })); }); - describe("when used with a spy", function() { - it("is useful for comparing arguments", function() { + describe("when used with a spy", () => { + it("is useful for comparing arguments", () => { var callback = jasmine.createSpy('callback'); callback({ @@ -706,20 +706,20 @@ describe("jasmine.objectContaining", function() { }); }); -describe("jasmine.arrayContaining", function() { +describe("jasmine.arrayContaining", () => { var foo: any; - beforeEach(function() { + beforeEach(() => { foo = [1, 2, 3, 4]; }); - it("matches arrays with some of the values", function() { + it("matches arrays with some of the values", () => { expect(foo).toEqual(jasmine.arrayContaining([3, 1])); expect(foo).not.toEqual(jasmine.arrayContaining([6])); }); - describe("when used with a spy", function() { - it("is useful when comparing arguments", function() { + describe("when used with a spy", () => { + it("is useful when comparing arguments", () => { var callback = jasmine.createSpy('callback'); callback([1, 2, 3, 4]); @@ -730,20 +730,20 @@ describe("jasmine.arrayContaining", function() { }); }); -describe("Manually ticking the Jasmine Clock", function() { +describe("Manually ticking the Jasmine Clock", () => { var timerCallback: any; - beforeEach(function() { + beforeEach(() => { timerCallback = jasmine.createSpy("timerCallback"); jasmine.clock().install(); }); - afterEach(function() { + afterEach(() => { jasmine.clock().uninstall(); }); - it("causes a timeout to be called synchronously", function() { - setTimeout(function() { + it("causes a timeout to be called synchronously", () => { + setTimeout(() => { timerCallback(); }, 100); @@ -754,8 +754,8 @@ describe("Manually ticking the Jasmine Clock", function() { expect(timerCallback).toHaveBeenCalled(); }); - it("causes an interval to be called synchronously", function() { - setInterval(function() { + it("causes an interval to be called synchronously", () => { + setInterval(() => { timerCallback(); }, 100); @@ -771,8 +771,8 @@ describe("Manually ticking the Jasmine Clock", function() { expect(timerCallback.calls.count()).toEqual(2); }); - describe("Mocking the Date object", function() { - it("mocks the Date object and sets it to a given time", function() { + describe("Mocking the Date object", () => { + it("mocks the Date object and sets it to a given time", () => { var baseTime = new Date(2013, 9, 23); jasmine.clock().mockDate(baseTime); @@ -783,82 +783,82 @@ describe("Manually ticking the Jasmine Clock", function() { }); }); -describe("Asynchronous specs", function() { +describe("Asynchronous specs", () => { var value: number; - beforeEach(function (done: DoneFn) { - setTimeout(function() { + beforeEach((done: DoneFn) => { + setTimeout(() => { value = 0; done(); }, 1); }); - it("should support async execution of test preparation and expectations", function (done: DoneFn) { + it("should support async execution of test preparation and expectations", (done: DoneFn) => { value++; expect(value).toBeGreaterThan(0); done(); }); - describe("long asynchronous specs", function() { - beforeEach(function (done: DoneFn) { + describe("long asynchronous specs", () => { + beforeEach((done: DoneFn) => { done(); }, 1000); - it("takes a long time", function (done: DoneFn) { - setTimeout(function() { + it("takes a long time", (done: DoneFn) => { + setTimeout(() => { done(); }, 9000); }, 10000); - afterEach(function (done: DoneFn) { + afterEach((done: DoneFn) => { done(); }, 1000); }); }); -describe("Fail", function() { +describe("Fail", () => { - it("should fail test when called without arguments", function() { + it("should fail test when called without arguments", () => { fail(); }); - it("should fail test when called with a fail message", function() { + it("should fail test when called with a fail message", () => { fail("The test failed"); }); - it("should fail test when called an error", function() { + it("should fail test when called an error", () => { fail(new Error("The test failed with this error")); }); }); // test based on http://jasmine.github.io/2.2/custom_equality.html -describe("custom equality", function() { - var myCustomEquality: jasmine.CustomEqualityTester = function (first: any, second: any): boolean { - if (typeof first == "string" && typeof second == "string") { - return first[0] == second[1]; +describe("custom equality", () => { + var myCustomEquality: jasmine.CustomEqualityTester = function(first: any, second: any): boolean { + if (typeof first === "string" && typeof second === "string") { + return first[0] === second[1]; } }; - beforeEach(function() { + beforeEach(() => { jasmine.addCustomEqualityTester(myCustomEquality); }); - it("should be custom equal", function() { + it("should be custom equal", () => { expect("abc").toEqual("aaa"); }); - it("should be custom not equal", function() { + it("should be custom not equal", () => { expect("abc").not.toEqual("abc"); }); }); // test based on http://jasmine.github.io/2.2/custom_matcher.html var customMatchers: jasmine.CustomMatcherFactories = { - toBeGoofy: function (util: jasmine.MatchersUtil, customEqualityTesters: Array) { + toBeGoofy: (util: jasmine.MatchersUtil, customEqualityTesters: jasmine.CustomEqualityTester[]) => { return { - compare: function (actual: any, expected: any): jasmine.CustomMatcherResult { + compare: (actual: any, expected: any): jasmine.CustomMatcherResult => { if (expected === undefined) { expected = ''; } @@ -892,24 +892,24 @@ declare namespace jasmine { } } -describe("Custom matcher: 'toBeGoofy'", function() { - beforeEach(function() { +describe("Custom matcher: 'toBeGoofy'", () => { + beforeEach(() => { jasmine.addMatchers(customMatchers); }); - it("is available on an expectation", function() { + it("is available on an expectation", () => { expect({ hyuk: 'gawrsh' }).toBeGoofy(); }); - it("can take an 'expected' parameter", function() { + it("can take an 'expected' parameter", () => { expect({ hyuk: 'gawrsh is fun' }).toBeGoofy({ hyuk: ' is fun' }); }); - it("can be negated", function() { + it("can be negated", () => { expect({ hyuk: 'this is fun' }).not.toBeGoofy(); @@ -918,20 +918,21 @@ describe("Custom matcher: 'toBeGoofy'", function() { // test based on http://jasmine.github.io/2.5/custom_reporter.html var myReporter: jasmine.CustomReporter = { - jasmineStarted: function (suiteInfo: jasmine.SuiteInfo) { + jasmineStarted: (suiteInfo: jasmine.SuiteInfo) => { console.log("Running suite with " + suiteInfo.totalSpecsDefined); }, - suiteStarted: function (result: jasmine.CustomReporterResult) { + suiteStarted: (result: jasmine.CustomReporterResult) => { console.log("Suite started: " + result.description + " whose full description is: " + result.fullName); }, - specStarted: function (result: jasmine.CustomReporterResult) { + specStarted: (result: jasmine.CustomReporterResult) => { console.log("Spec started: " + result.description + " whose full description is: " + result.fullName); }, - specDone: function (result: jasmine.CustomReporterResult) { + specDone: (result: jasmine.CustomReporterResult) => { console.log("Spec: " + result.description + " was " + result.status); + //tslint:disable-next-line:prefer-for-of for (var i = 0; i < result.failedExpectations.length; i++) { console.log("Failure: " + result.failedExpectations[i].message); console.log("Actual: " + result.failedExpectations[i].actual); @@ -941,15 +942,16 @@ var myReporter: jasmine.CustomReporter = { console.log(result.passedExpectations.length); }, - suiteDone: function (result: jasmine.CustomReporterResult) { + suiteDone: (result: jasmine.CustomReporterResult) => { console.log('Suite: ' + result.description + ' was ' + result.status); + //tslint:disable-next-line:prefer-for-of for (var i = 0; i < result.failedExpectations.length; i++) { console.log('AfterAll ' + result.failedExpectations[i].message); console.log(result.failedExpectations[i].stack); } }, - jasmineDone: function (runDetails: jasmine.RunDetails) { + jasmineDone: (runDetails: jasmine.RunDetails) => { console.log('Finished suite'); console.log('Random:', runDetails.order.random); } @@ -957,16 +959,16 @@ var myReporter: jasmine.CustomReporter = { jasmine.getEnv().addReporter(myReporter); -describe("Randomize Tests", function() { - it("should allow randomization of the order of tests", function() { - expect(function() { +describe("Randomize Tests", () => { + it("should allow randomization of the order of tests", () => { + expect(() => { var env = jasmine.getEnv(); return env.randomizeTests(true); }).not.toThrow(); }); - it("should allow a seed to be passed in for randomization", function() { - expect(function() { + it("should allow a seed to be passed in for randomization", () => { + expect(() => { var env = jasmine.getEnv(); env.randomizeTests(true); return env.seed(1234); @@ -982,14 +984,14 @@ describe("Randomize Tests", function() { env.addReporter(htmlReporter); var specFilter = new jasmine.HtmlSpecFilter(); - env.specFilter = function (spec) { + env.specFilter = (spec) => { return specFilter.matches(spec.getFullName()); }; var currentWindowOnload = window.onload; - window.onload = function() { + window.onload = () => { if (currentWindowOnload) { - (currentWindowOnload)(null); + (currentWindowOnload as any)(null); } htmlReporter.initialize(); env.execute(); diff --git a/jasmine/v1/jasmine-tests.ts b/jasmine/v1/jasmine-tests.ts index 9177679f8a..c47fc84007 100644 --- a/jasmine/v1/jasmine-tests.ts +++ b/jasmine/v1/jasmine-tests.ts @@ -60,7 +60,7 @@ describe("Included matchers:", () => { foo: 'foo' }; expect(a.foo).toBeDefined(); - expect((a).bar).not.toBeDefined(); + expect((a as any).bar).not.toBeDefined(); }); it("The `toBeUndefined` matcher compares against `undefined`", () => { @@ -68,7 +68,7 @@ describe("Included matchers:", () => { foo: 'foo' }; expect(a.foo).not.toBeUndefined(); - expect((a).bar).toBeUndefined(); + expect((a as any).bar).toBeUndefined(); }); it("The 'toBeNull' matcher compares against null", () => { @@ -202,7 +202,7 @@ describe("A spy", () => { var foo: any, bar: any = null; beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; } }; @@ -235,7 +235,7 @@ describe("A spy, when configured to call through", () => { var foo: any, bar: any, fetchedBar: any; beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; }, getBar: () => { @@ -261,7 +261,7 @@ describe("A spy, when faking a return value", () => { var foo: any, bar: any, fetchedBar: any; beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; }, getBar: () => { @@ -287,7 +287,7 @@ describe("A spy, when faking a return value", () => { var foo: any, bar: any, fetchedBar: any; beforeEach(() => { foo = { - setBar: function (value: any) { + setBar: (value: any) => { bar = value; }, getBar: () => { @@ -319,7 +319,7 @@ describe("A spy, when created manually", () => { whatAmI("I", "am", "a", "spy"); }); it("is named, which helps in error reporting", () => { - expect(whatAmI.identity).toEqual('whatAmI') + expect(whatAmI.identity).toEqual('whatAmI'); }); it("tracks that the spy was called", () => { expect(whatAmI).toHaveBeenCalled(); @@ -369,7 +369,7 @@ describe("jasmine.any", () => { it("is useful for comparing arguments", () => { var foo = jasmine.createSpy('foo'); foo(12, () => { - return true + return true; }); expect(foo).toHaveBeenCalledWith(jasmine.any(Number), jasmine.any(Function)); }); @@ -430,7 +430,7 @@ describe("Asynchronous specs", () => { jasmineEnv.updateInterval = 250; var htmlReporter = new jasmine.HtmlReporter(); jasmineEnv.addReporter(htmlReporter); - jasmineEnv.specFilter = function (spec) { + jasmineEnv.specFilter = (spec) => { return htmlReporter.specFilter(spec); }; var currentWindowOnload = (arg: any) => window.onload(arg); @@ -439,11 +439,11 @@ describe("Asynchronous specs", () => { currentWindowOnload(null); } - (document.querySelector('.version')).innerHTML = jasmineEnv.versionString(); + (document.querySelector('.version') as HTMLElement).innerHTML = jasmineEnv.versionString(); execJasmine(); }; function execJasmine() { jasmineEnv.execute(); } -})(); \ No newline at end of file +})(); From ba29010d1438767c5db5e73d716447178d85f0f3 Mon Sep 17 00:00:00 2001 From: Lukas Zech Date: Sun, 26 Feb 2017 13:17:07 +0100 Subject: [PATCH 053/567] Fix other jasmine packages --- jasmine-es6-promise-matchers/index.d.ts | 2 +- jasmine-expect/index.d.ts | 2 +- jasmine-jquery/index.d.ts | 6 +++--- jasmine-jquery/jasmine-jquery-tests.ts | 4 ++-- jasmine-matchers/index.d.ts | 2 +- jasmine-promise-matchers/index.d.ts | 2 +- jasmine/v1/index.d.ts | 16 ++++++++-------- jasminewd2/index.d.ts | 17 ++++++++++++----- 8 files changed, 29 insertions(+), 22 deletions(-) diff --git a/jasmine-es6-promise-matchers/index.d.ts b/jasmine-es6-promise-matchers/index.d.ts index 89e3146c2c..7d61d4d660 100644 --- a/jasmine-es6-promise-matchers/index.d.ts +++ b/jasmine-es6-promise-matchers/index.d.ts @@ -13,7 +13,7 @@ declare namespace JasminePromiseMatchers { declare namespace jasmine { - interface Matchers { + interface Matchers { /** * Verifies that a Promise is (or has been) rejected. */ diff --git a/jasmine-expect/index.d.ts b/jasmine-expect/index.d.ts index c2ee7e0ee5..25a21d49d5 100644 --- a/jasmine-expect/index.d.ts +++ b/jasmine-expect/index.d.ts @@ -7,7 +7,7 @@ /// declare namespace jasmine { - interface Matchers { + interface Matchers { // These functions are written in the order defined in the src directory of jasmine-matchers // The type system is used smartly whenever it can provide value (by looking at the code of every matcher) toBeAfter(otherDate: Date): boolean; // diff --git a/jasmine-jquery/index.d.ts b/jasmine-jquery/index.d.ts index fb91e0c37b..ebc14cee75 100644 --- a/jasmine-jquery/index.d.ts +++ b/jasmine-jquery/index.d.ts @@ -81,7 +81,7 @@ declare namespace jasmine { proxyCallTo_(methodName: string, passedArguments: any): any; } - interface Matchers { + interface Matchers { /** * Check if DOM element has class. * @@ -232,7 +232,7 @@ declare namespace jasmine { * */ toHaveData(key : string, expectedValue : string): boolean; - toBe(selector: JQuery): boolean; + toBe(selector: T): boolean; /** * Check if DOM element is matched by the given selector. @@ -241,7 +241,7 @@ declare namespace jasmine { * // returns true * expect($('
')).toContain('some-class') */ - toContain(selector: JQuery): boolean; + toContain(selector: T): boolean; /** * Check if DOM element exists inside the given parent element. diff --git a/jasmine-jquery/jasmine-jquery-tests.ts b/jasmine-jquery/jasmine-jquery-tests.ts index 67b349d45e..9d51a3775b 100644 --- a/jasmine-jquery/jasmine-jquery-tests.ts +++ b/jasmine-jquery/jasmine-jquery-tests.ts @@ -4,8 +4,8 @@ describe("Jasmine jQuery extension", () => { it("Adds jQuery matchers", () => { - expect($('
')).toBe('div'); - expect($('
')).toBe('div#some-id'); + expect($('
')).toBe($('div')); + expect($('
')).toBe($('div#some-id')); expect($('')).toBeChecked(); expect($('
')).toBeHidden(); expect($('
')).toHaveCss({ display: "none", margin: "10px" }); diff --git a/jasmine-matchers/index.d.ts b/jasmine-matchers/index.d.ts index ac44d25c1c..d4cad3b77c 100644 --- a/jasmine-matchers/index.d.ts +++ b/jasmine-matchers/index.d.ts @@ -23,7 +23,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI /// declare namespace jasmine { - interface Matchers { + interface Matchers { //toBe toBeArray(): boolean; diff --git a/jasmine-promise-matchers/index.d.ts b/jasmine-promise-matchers/index.d.ts index c511019b62..ffe4f65142 100644 --- a/jasmine-promise-matchers/index.d.ts +++ b/jasmine-promise-matchers/index.d.ts @@ -10,7 +10,7 @@ declare function installPromiseMatchers(): void; declare namespace jasmine { - interface Matchers { + interface Matchers { /** * Verifies that a Promise is (or has been) rejected. */ diff --git a/jasmine/v1/index.d.ts b/jasmine/v1/index.d.ts index 5cbb2a9f83..3f51240f63 100644 --- a/jasmine/v1/index.d.ts +++ b/jasmine/v1/index.d.ts @@ -16,9 +16,9 @@ declare function xit(expectation: string, assertion: () => void): void; declare function beforeEach(action: () => void): void; declare function afterEach(action: () => void): void; -declare function expect(spy: Function): jasmine.Matchers; -//declare function expect(spy: jasmine.Spy): jasmine.Matchers; -declare function expect(actual: any): jasmine.Matchers; +declare function expect(spy: Function): jasmine.Matchers; +//declare function expect(spy: jasmine.Spy): jasmine.Matchers; +declare function expect(actual: any): jasmine.Matchers; declare function spyOn(object: any, method: string): jasmine.Spy; @@ -91,7 +91,7 @@ declare namespace jasmine { currentSpec: Spec; - matchersClass: Matchers; + matchersClass: Matchers; version(): any; versionString(): string; @@ -204,7 +204,7 @@ declare namespace jasmine { results(): NestedResults; } - interface Matchers { + interface Matchers { new (env: Env, actual: any, spec: Env, isNot?: boolean): any; @@ -232,7 +232,7 @@ declare namespace jasmine { toContainHtml(expected: string): boolean; toContainText(expected: string): boolean; toThrow(expected?: any): boolean; - not: Matchers; + not: Matchers; Any: Any; } @@ -287,7 +287,7 @@ declare namespace jasmine { spies_: Spy[]; results_: NestedResults; - matchersClass: Matchers; + matchersClass: Matchers; getFullName(): string; results(): NestedResults; @@ -299,7 +299,7 @@ declare namespace jasmine { waits(timeout: number): Spec; waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec; fail(e?: any): void; - getMatchersClass_(): Matchers; + getMatchersClass_(): Matchers; addMatchers(matchersPrototype: any): void; finishCallback(): void; finish(onComplete?: () => void): void; diff --git a/jasminewd2/index.d.ts b/jasminewd2/index.d.ts index 9d8ecde76e..a4122c6639 100644 --- a/jasminewd2/index.d.ts +++ b/jasminewd2/index.d.ts @@ -17,10 +17,10 @@ declare function afterAll(action: () => Promise, timeout?: number): void; declare namespace jasmine { // The global `Promise` type is too strict and kinda wrong interface Promise { - then(onFulfill?: (value: T) => U | Promise, onReject?: (error: any) => U | Promise): Promise; + then(onFulfill?: (value: T) => U | Promise, onReject?: (error: any) => U | Promise): Promise; } - interface Matchers { + interface Matchers { toBe(expected: any, expectationFailOutput?: any): Promise; toEqual(expected: any, expectationFailOutput?: any): Promise; toMatch(expected: string | RegExp | Promise, expectationFailOutput?: any): Promise; @@ -44,6 +44,13 @@ declare namespace jasmine { toThrowError(expected?: new (...args: any[]) => Error | Promise Error>, message?: string | RegExp | Promise): Promise; } + interface ArrayLikeMatchers> extends Matchers { + toBe(expected: Expected>, expectationFailOutput?: any): Promise; + toEqual(expected: Expected>, expectationFailOutput?: any): Promise; + toContain(expected: T, expectationFailOutput?: any): Promise; + not: ArrayLikeMatchers; + } + function addMatchers(matchers: AsyncCustomMatcherFactories): void; interface Env { @@ -59,12 +66,12 @@ declare namespace jasmine { } interface AsyncCustomMatcherFactory { - (util: MatchersUtil, customEqualityTesters: CustomEqualityTester[]): AsyncCustomMatcher; + (util: MatchersUtil, customEqualityTesters: CustomEqualityTester[]): AsyncCustomMatcher; } interface AsyncCustomMatcher { - compare(actual: T, expected: T): AsyncCustomMatcherResult; - compare(actual: any, expected: any): AsyncCustomMatcherResult; + compare(actual: T, expected: T): AsyncCustomMatcherResult; + compare(actual: any, expected: any): AsyncCustomMatcherResult; } interface AsyncCustomMatcherResult { From d2267ead2004bf3e87d769808ab51532fc5db132 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Mon, 27 Feb 2017 18:00:08 +0100 Subject: [PATCH 054/567] Fix fetch-mock with TypeScript version 2.2 --- fetch-mock/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch-mock/index.d.ts b/fetch-mock/index.d.ts index 4d69096845..bda708ee55 100644 --- a/fetch-mock/index.d.ts +++ b/fetch-mock/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/wheresrhys/fetch-mock // Definitions by: Alexey Svetliakov , Tamir Duberstein , Risto Keravuori // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +// TypeScript Version: 2.2 type MockRequest = Request | RequestInit; From 0238bbea2cf64071e9ef7c616085450febc56246 Mon Sep 17 00:00:00 2001 From: fatsu Date: Mon, 27 Feb 2017 21:48:54 +0100 Subject: [PATCH 055/567] - path should be (string | number)[] - some currying problems with path related functions --- ramda/index.d.ts | 32 +++++++++++++------------- ramda/ramda-tests.ts | 53 +++++++++++++++++++++++++++++++++----------- 2 files changed, 56 insertions(+), 29 deletions(-) diff --git a/ramda/index.d.ts b/ramda/index.d.ts index 114ba38d6d..44d4c33304 100644 --- a/ramda/index.d.ts +++ b/ramda/index.d.ts @@ -8,6 +8,8 @@ declare var R: R.Static; declare namespace R { type Ord = number | string | boolean; + type Path = number | string; + interface ListIterator { (value: T, index: number, list: T[]): TResult; } @@ -221,9 +223,9 @@ declare namespace R { * Makes a shallow clone of an object, setting or overriding the nodes required to create the given path, and * placing the specific value at the tail end of that path. */ - assocPath(path: string[], val: T, obj: U): U; - assocPath(path: string[]): (val: T, obj: U) => U; - assocPath(path: string[], val: T): (obj: U) => U; + assocPath(path: Path[], val: T, obj: U): U; + assocPath(path: Path[], val: T): (obj: U) => U; + assocPath(path: Path[]): CurriedFunction2; /** * Wraps a function of any arity (including nullary) in a function that accepts exactly 2 @@ -439,8 +441,8 @@ declare namespace R { /** * Makes a shallow clone of an object, omitting the property at the given path. */ - dissocPath(path: string[], obj: any): T; - dissocPath(path: string[]): (obj: any) => T; + dissocPath(path: Path[], obj: any): T; + dissocPath(path: Path[]): (obj: any) => T; /** * Divides two numbers. Equivalent to a / b. @@ -838,7 +840,7 @@ declare namespace R { * Returns a lens whose focus is the specified path. * See also view, set, over. */ - lensPath(path: string[]): Lens; + lensPath(path: Path[]): Lens; /** * lensProp creates a lens that will focus on property k of the source object. @@ -1129,26 +1131,24 @@ declare namespace R { /** * Retrieve the value at a given path. */ - path(path: string[], obj: any): T; - path(path: string[]): (obj: any) => T; + path(path: Path[], obj: any): T; + path(path: Path[]): (obj: any) => T; /** * Determines whether a nested path on an object has a specific value, * in `R.equals` terms. Most likely used to filter a list. */ - pathEq(path: string[], val: any, obj: any): boolean; - pathEq(path: string[], val: any): (obj: any) => boolean; - pathEq(path: string[]): (val: any, obj: any) => boolean; - pathEq(path: string[]): (val: any) => (obj: any) => boolean; + pathEq(path: Path[], val: any, obj: any): boolean; + pathEq(path: Path[], val: any): (obj: any) => boolean; + pathEq(path: Path[]): CurriedFunction2; /** * If the given, non-null object has a value at the given path, returns the value at that path. * Otherwise returns the provided default value. */ - pathOr(d: T, p: string[], obj: any): T|any; - pathOr(d: T, p: string[]): (obj: any) => T|any; - pathOr(d: T): (p: string[], obj: any) => T|any; - + pathOr(d: T, p: Path[], obj: any): T|any; + pathOr(d: T, p: Path[]): (obj: any) => T|any; + pathOr(d: T): CurriedFunction2; /** * Returns a partial copy of an object containing only the keys specified. If the key does not exist, the diff --git a/ramda/ramda-tests.ts b/ramda/ramda-tests.ts index e42ae16c63..13aeb222f7 100644 --- a/ramda/ramda-tests.ts +++ b/ramda/ramda-tests.ts @@ -491,6 +491,14 @@ R.times(i, 5); R.findLastIndex((x: number) => x === 1, [1, 2, 3]); } () => { + const testPath = ['x', 0, 'y']; + const testObj = {x: [{y: 2, z: 3}, {y: 4, z: 5}]}; + + R.pathEq(testPath, 2, testObj); // => true + R.pathEq(testPath, 2)(testObj); // => true + R.pathEq(testPath)(2)(testObj); // => true + R.pathEq(testPath)(2, testObj); // => true + var user1 = { address: { zipCode: 90210 } }; var user2 = { address: { zipCode: 55555 } }; var user3 = { name: 'Bob' }; @@ -1028,9 +1036,13 @@ type Pair = KeyValuePair } () => { - const a = R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} - const b = R.assocPath(['a', 'b', 'c'])(42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} - const c = R.assocPath(['a', 'b', 'c'], 42)({a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} + const testPath = ['x', 0, 'y']; + const testObj = {x: [{y: 2, z: 3}, {y: 4, z: 5}]}; + + R.assocPath(testPath, 42, testObj); //=> {x: [{y: 42, z: 3}, {y: 4, z: 5}]} + R.assocPath(testPath, 42)(testObj); //=> {x: [{y: 42, z: 3}, {y: 4, z: 5}]} + R.assocPath(testPath)(42)(testObj); //=> {x: [{y: 42, z: 3}, {y: 4, z: 5}]} + R.assocPath(testPath)(42, testObj); //=> {x: [{y: 42, z: 3}, {y: 4, z: 5}]} } () => { @@ -1038,6 +1050,12 @@ type Pair = KeyValuePair // optionally specify return type const a2 = R.dissocPath<{a :{ b: number}}>(['a', 'b', 'c'], {a: {b: {c: 42}}}); //=> {a: {b: {}}} const a3 = R.dissocPath(['a', 'b', 'c'])({a: {b: {c: 42}}}); //=> {a: {b: {}}} + + const testPath = ['x', 0, 'y']; + const testObj = {x: [{y: 2, z: 3}, {y: 4, z: 5}]}; + + R.dissocPath(testPath, testObj); //=> {x: [{z: 3}, {y: 4, z: 5}]} + R.dissocPath(testPath)(testObj); //=> {x: [{z: 3}, {y: 4, z: 5}]} } () => { @@ -1163,11 +1181,12 @@ class Rectangle { } () => { - const xyLens = R.lensPath(['x', 'y']); + const xyLens = R.lensPath(['x', 0, 'y']); + const testObj = {x: [{y: 2, z: 3}, {y: 4, z: 5}]}; - R.view(xyLens, {x: {y: 2, z: 3}}); //=> 2 - R.set(xyLens, 4, {x: {y: 2, z: 3}}); //=> {x: {y: 4, z: 3}} - R.over(xyLens, R.negate, {x: {y: 2, z: 3}}); //=> {x: {y: -2, z: 3}} + R.view(xyLens, testObj); //=> 2 + R.set(xyLens, 4, testObj); //=> {x: [{y: 4, z: 3}, {y: 4, z: 5}]} + R.over(xyLens, R.negate, testObj); //=> {x: [{y: -2, z: 3}, {y: 4, z: 5}]} } () => { @@ -1242,10 +1261,15 @@ class Rectangle { } () => { - const a1 = R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); //=> 2 - const a2 = R.pathOr('N/A', ['a', 'b'])({a: {b: 2}}); //=> 2 - const a3 = R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); //=> "N/A" - const a4 = R.pathOr({c:2})(['a', 'b'], {c: {b: 2}}); //=> "N/A" + const orValue = 'N/A'; + const testPath = ['x', 0, 'y']; + const testObj = {x: [{y: 2, z: 3}, {y: 4, z: 5}]}; + + R.pathOr(orValue, testPath, testObj); //=> 2 + R.pathOr(orValue, testPath)(testObj); //=> 2 + R.pathOr(orValue)(testPath)(testObj); //=> 2 + R.pathOr(orValue)(testPath, testObj); //=> 2 + R.pathOr(orValue, testPath, {c: {b: 2}}); //=> "N/A" } () => { @@ -1586,8 +1610,11 @@ matchPhrases(['foo', 'bar', 'baz']); } () => { - R.path(['a', 'b'], {a: {b: 2}}); //=> 2 - R.path(['a', 'b'])({a: {b: 2}}); //=> 2 + const testPath = ['x', 0, 'y']; + const testObj = {x: [{y: 2, z: 3}, {y: 4, z: 5}]}; + + R.path(testPath, testObj); //=> 2 + R.path(testPath)(testObj); //=> 2 } () => { From 4fa3d7fda8444f7d880aa31f0ef82ed1e7fab92d Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 24 Feb 2017 01:20:39 +0100 Subject: [PATCH 056/567] Add definitions for Google Calendar API (gapi.calendar) --- gapi.calendar/gapi.calendar-tests.ts | 152 ++++++ gapi.calendar/index.d.ts | 675 +++++++++++++++++++++++++++ gapi.calendar/tsconfig.json | 18 + 3 files changed, 845 insertions(+) create mode 100644 gapi.calendar/gapi.calendar-tests.ts create mode 100644 gapi.calendar/index.d.ts create mode 100644 gapi.calendar/tsconfig.json diff --git a/gapi.calendar/gapi.calendar-tests.ts b/gapi.calendar/gapi.calendar-tests.ts new file mode 100644 index 0000000000..de335c6a15 --- /dev/null +++ b/gapi.calendar/gapi.calendar-tests.ts @@ -0,0 +1,152 @@ +/* Example taken from Google Calendar API JavaScript Quickstart https://developers.google.com/google-apps/calendar/quickstart/js */ + +{ + // Your Client ID can be retrieved from your project in the Google + // Developer Console, https://console.developers.google.com + var CLIENT_ID = ''; + + var SCOPES = ["https://www.googleapis.com/auth/calendar.readonly"]; + + /** + * Check if current user has authorized this application. + */ + function checkAuth() { + gapi.auth.authorize( + { + 'client_id': CLIENT_ID, + 'scope': SCOPES.join(' '), + 'immediate': true + }, handleAuthResult); + } + + /** + * Handle response from authorization server. + * + * @param {Object} authResult Authorization result. + */ + function handleAuthResult(authResult: GoogleApiOAuth2TokenObject) { + var authorizeDiv = document.getElementById('authorize-div')!; + if (authResult && !authResult.error) { + // Hide auth UI, then load client library. + authorizeDiv.style.display = 'none'; + loadCalendarApi(); + } else { + // Show auth UI, allowing the user to initiate authorization by + // clicking authorize button. + authorizeDiv.style.display = 'inline'; + } + } + + /** + * Initiate auth flow in response to user clicking authorize button. + * + * @param {Event} event Button click event. + */ + function handleAuthClick(event: MouseEvent) { + gapi.auth.authorize( + {client_id: CLIENT_ID, scope: SCOPES, immediate: false}, + handleAuthResult); + return false; + } + + /** + * Load Google Calendar client library. List upcoming events + * once client library is loaded. + */ + function loadCalendarApi() { + gapi.client.load('calendar', 'v3', listUpcomingEvents); + } + + /** + * Print the summary and start datetime/date of the next ten events in + * the authorized user's calendar. If no events are found an + * appropriate message is printed. + */ + function listUpcomingEvents() { + var request = gapi.client.calendar.events.list({ + 'calendarId': 'primary', + 'timeMin': (new Date()).toISOString(), + 'showDeleted': false, + 'singleEvents': true, + 'maxResults': 10, + 'orderBy': 'startTime' + }); + + request.execute(function(resp) { + var events = resp.items; + appendPre('Upcoming events:'); + + if (events.length > 0) { + for (let i = 0; i < events.length; i++) { + var event = events[i]; + var when = event.start.dateTime; + if (!when) { + when = event.start.date; + } + appendPre(event.summary + ' (' + when + ')') + } + } else { + appendPre('No upcoming events found.'); + } + + }); + } + + /** + * Append a pre element to the body containing the given message + * as its text node. + * + * @param {string} message Text to be placed in pre element. + */ + function appendPre(message: string) { + var pre = document.getElementById('output')!; + var textContent = document.createTextNode(message + '\n'); + pre.appendChild(textContent); + } +} + +/* Example taken from https://developers.google.com/google-apps/calendar/v3/reference/events/insert#examples */ + +{ + // Refer to the JavaScript quickstart on how to setup the environment: + // https://developers.google.com/google-apps/calendar/quickstart/js + // Change the scope to 'https://www.googleapis.com/auth/calendar' and delete any + // stored credentials. + + const event = { + 'summary': 'Google I/O 2015', + 'location': '800 Howard St., San Francisco, CA 94103', + 'description': 'A chance to hear more about Google\'s developer products.', + 'start': { + 'dateTime': '2015-05-28T09:00:00-07:00', + 'timeZone': 'America/Los_Angeles' + }, + 'end': { + 'dateTime': '2015-05-28T17:00:00-07:00', + 'timeZone': 'America/Los_Angeles' + }, + 'recurrence': [ + 'RRULE:FREQ=DAILY;COUNT=2' + ], + 'attendees': [ + {'email': 'lpage@example.com'}, + {'email': 'sbrin@example.com'} + ], + 'reminders': { + 'useDefault': false, + 'overrides': [ + {'method': 'email', 'minutes': 24 * 60}, + {'method': 'popup', 'minutes': 10} + ] + } + }; + + var request = gapi.client.calendar.events.insert({ + 'calendarId': 'primary', + 'resource': event + }); + + request.execute(function(event) { + appendPre('Event created: ' + event.htmlLink); + }); +} diff --git a/gapi.calendar/index.d.ts b/gapi.calendar/index.d.ts new file mode 100644 index 0000000000..bd0e3b0d17 --- /dev/null +++ b/gapi.calendar/index.d.ts @@ -0,0 +1,675 @@ +// Type definitions for Google Calendar API 3.0 +// Project: https://developers.google.com/google-apps/calendar/ +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace gapi.client.calendar { + export class freebusy { + static query(parameters: FreeBusyQueryParameters): HttpRequest; + } + + interface FreeBusyQueryParameters { + timeMin: datetime; + timeMax: datetime; + timeZone?: string; + groupExpansionMax?: integer; + calendarExpansionMax?: integer; + items: {id: string}[]; + } + + interface FreeBusy { + kind: 'calendar#freeBusy'; + timeMin: datetime; + timeMax: datetime; + groups: { + (key: string): { + errors?: { + domain: string; + reason: string; + }[]; + calendars: string[]; + } + }; + calendars: { + (key: string): { + errors?: { + domain: string; + reason: string; + }[]; + busy: { + start: datetime; + end: datetime; + }[]; + } + }; + } + + export class acl { + static insert(parameters: AclInsertParameters): HttpRequest; + static get(parameters: AclGetParameters): HttpRequest; + static update(parameters: AclUpdateParameters): HttpRequest; + static delete(parameters: AclDeleteParameters): HttpRequest; + } + + // The type of the scope. Possible values are: + type ScopeType = + // The public scope. This is the default value. + // Note: The permissions granted to the "default", or public, scope apply to any user, authenticated or not. + 'default' | + // Limits the scope to a single user. + 'user' | + // Limits the scope to a group. + 'group' | + // Limits the scope to a domain. + 'domain'; + + interface Acl { + kind: 'calendar#aclRule'; + etag: etag; + id: string; + scope: { + type: ScopeType; + value: string; + }; + role: AccessRole; + } + + interface AclInsertParameters { + calendarId: string; + + // Acl resource + role: AccessRole; + scope: { + type: ScopeType; + value?: string; + }; + } + + interface AclGetParameters { + calendarId: string; + ruleId: string; + } + + interface AclUpdateParameters extends AclInsertParameters { + ruleId: string; + } + + interface AclDeleteParameters extends AclGetParameters { + } + + export class calendarList { + static list(parameters?: CalendarListListParameters): HttpRequest; + static insert(parameters: CalendarListInsertParameters): HttpRequest; + } + + type AccessRoleWithoutNone = + // The user has read access to free/busy information. + 'freeBusyReader' | + // The user has read access to the calendar. Private events will appear to users with reader access, but event details will be hidden. + 'reader' | + // The user has read and write access to the calendar. Private events will appear to users with writer access, and event details will be visible. + 'writer' | + // The user has ownership of the calendar. This role has all of the permissions of the writer role with the additional ability to see and manipulate ACLs. + 'owner'; + + // The user's access role for this calendar. Read-only. Possible values are: + type AccessRole = + // The user has no access. + 'none' | + AccessRoleWithoutNone; + + interface CalendarListListParameters { + maxResults?: integer; + // The minimum access role for the user in the returned entries. Optional. The default is no restriction. Acceptable values are: + minAccessRole?: AccessRoleWithoutNone; + pageToken?: string; + showDeleted?: boolean; + showHidden?: boolean; + syncToken?: string; + } + + interface CalendarListInsertParameters { + // Parameters + // Optional query parameters + colorRgbFormat?: boolean; + + // CalendarList resource + resource: CalendarListInput; + } + + interface CalendarListInput { + // Required Properties + id: string; + + // Optional Properties + backgroundColor?: string; + colorId?: string; + defaultReminders?: { + method: ReminderMethod; + minutes: integer; + }[]; + foregroundColor?: string; + hidden?: boolean; + notificationSettings?: { + notifications: { + type: NotificationType; + method: string; + }[]; + }; + selected?: boolean; + summaryOverride?: string; + } + + interface CalendarList { + kind: 'calendar#calendarList'; + etag: etag; + + /** + * Token used to access the next page of this result. + * Omitted if no further results are available, in which case nextSyncToken is provided. + */ + nextPageToken?: string; + + /** + * Token used at a later point in time to retrieve only the entries that have changed since this result was returned. + * Omitted if further results are available, in which case nextPageToken is provided. + */ + nextSyncToken?: string; + + items: CalendarListEntry[]; + } + + // The type of notification. Possible values are: + type NotificationType = + // Notification sent when a new event is put on the calendar. + 'eventCreation' | + // Notification sent when an event is changed. + 'eventChange' | + // Notification sent when an event is cancelled. + 'eventCancellation' | + // Notification sent when an event is changed. + 'eventResponse' | + // An agenda with the events of the day (sent out in the morning). + 'agenda'; + + interface CalendarListEntry { + kind: 'calendar#calendarListEntry'; + etag: etag; + id: string; + summary: string; + description?: string; + location?: string; + timeZone?: string; + summaryOverride?: string; + colorId?: string; + backgroundColor?: string; + foregroundColor?: string; + hidden?: boolean; + selected?: boolean; + // The effective access role that the authenticated user has on the calendar. Read-only. + accessRole: AccessRoleWithoutNone; + defaultReminders: { + method: ReminderMethod; + minutes: integer; + }[]; + notificationSettings?: { + notifications: { + type: NotificationType; + method: string; + }[]; + }; + primary?: boolean; + deleted?: boolean; + } + + export class calendars { + static insert(parameters: CalendarsInsertParameters): HttpRequest; + static update(parameters: CalendarsUpdateParameters): HttpRequest; + static delete(parameters: CalendarsDeleteParameters): HttpRequest; + } + + interface CalendarsUpdateParameters { + calendarId: string; + + // Calendars resource + // Optional Properties + description?: string; + location?: string; + summary?: string; + timeZone?: string; + } + + interface CalendarsInsertParameters { + // Calendars resource + // Required Properties + summary: string; + + description?: string; + location?: string; + timeZone?: string; + } + + interface CalendarsDeleteParameters { + calendarId: string; + } + + interface Calendar { + kind: 'calendar#calendar'; + etag: etag; + id: string; + summary: string; + description?: string; + location?: string; + timeZone?: string; + } + + export class events { + static list(parameters: EventsListParameters): HttpRequest; + static insert(parameters: EventsInsertParameters): HttpRequest; + static update(parameters: EventsUpdateParameters): HttpRequest; + static get(parameters: EventsGetParameters): HttpRequest; + } + + interface EventsGetParameters { + calendarId: string; + eventId: string; + + alwaysIncludeEmail?: boolean; + maxAttendees?: integer; + timeZone?: string; + } + + interface EventsInsertParameters { + calendarId: string; + + maxAttendees?: integer; + sendNotifications?: boolean; + supportsAttachments?: boolean; + + // Event resource + resource: EventInput; + } + + interface EventsUpdateParameters { + calendarId: string; + eventId: string; + + alwaysIncludeEmail?: boolean; + maxAttendees?: integer; + sendNotifications?: boolean; + supportsAttachments?: boolean; + + // Event resource + resource: EventInput; + } + + interface EventInput { + // Required Properties + attachments?: { + fileUrl: string; + }[]; + attendees?: { + email: string; + displayName?: string; + optional?: boolean; + responseStatus?: AttendeeResponseStatus; + comment?: string; + additionalGuests?: integer; + }[]; + end: { + date?: date; + dateTime?: datetime; + timeZone?: string + }; + reminders?: { + overrides: { + method: string; + minutes: integer; + }[]; + useDefault: boolean; + }; + start: { + date?: date; + dateTime?: datetime; + timeZone: string; + }; + + // Optional Properties + anyoneCanAddSelf?: boolean; + colorId?: string; + description?: string; + extendedProperties?: { + private: { + (key: string): string + }; + shared: { + (key: string): string + } + }; + gadget?: { + display?: GadgetDisplayMode; + height: integer; + iconLink: string; + link: string; + preferences: { + (key: string): string + } + title: string; + type: string; + width: integer; + }; + guestsCanInviteOthers?: boolean; + guestsCanSeeOtherGuests?: boolean; + id?: string; + location?: string; + originalStartTime?: { + date: date; + dateTime: datetime; + timeZone: string + }; + recurrence?: string[]; + sequence?: integer; + source?: { + url: string; + title: string + }; + status?: EventStatus; + summary?: string; + transparency?: EventTransparency; + visibility?: EventVisibility; + } + + // The order of the events returned in the result. Optional. The default is an unspecified, stable order. + // Acceptable values are: + type EventsOrder = + // Order by the start date/time (ascending). This is only available when querying single events (i.e. the parameter singleEvents is True) + 'startTime' | + // Order by last modification time (ascending). + 'updated'; + + // Token obtained from the nextSyncToken field returned on the last page of results from the previous list request. + // It makes the result of this list request contain only entries that have changed since then. + // All events deleted since the previous list request will always be in the result set and it is not allowed to set showDeleted to False. + // There are several query parameters that cannot be specified together with nextSyncToken to ensure consistency of the client state. + // These are: + type SyncToken = + 'iCalUID' | + 'orderBy' | + 'privateExtendedProperty' | + 'q' | + 'sharedExtendedProperty' | + 'timeMin' | + 'timeMax' | + 'updatedMin'; + + interface EventsListParameters { + calendarId: string; + alwaysIncludeEmail?: boolean; + iCalUID?: string; + maxAttendees?: integer; + maxResults?: integer; + orderBy?: EventsOrder; + pageToken?: string; + privateExtendedProperty?: string; + q?: string; + sharedExtendedProperty?: string; + showDeleted?: boolean; + showHiddenInvitations?: boolean; + singleEvents?: boolean; + syncToken?: SyncToken; + timeMax?: datetime; + timeMin?: datetime; + timeZone?: string; + updatedMin?: datetime; + } + + interface Events { + kind: 'calendar#events'; + etag: etag; + summary: string; + description: string; + updated: datetime; + timeZone: string; + // The user's access role for this calendar. Read-only. Possible values are: + accessRole: AccessRole; + defaultReminders: { + method: ReminderMethod; + minutes: integer; + }[]; + nextPageToken?: string; + nextSyncToken?: string; + items: Event[]; + } + + type etag = string; + type datetime = string; + type date = string; + type integer = number; + + // The attendee's response status. Possible values are: + type AttendeeResponseStatus = + // The attendee has not responded to the invitation. + 'needsAction' | + // The attendee has declined the invitation. + 'declined' | + // The attendee has tentatively accepted the invitation. + 'tentative' | + // The attendee has accepted the invitation. + 'accepted'; + + // The gadget's display mode. Optional. Possible values are: + type GadgetDisplayMode = + // The gadget displays next to the event's title in the calendar view. + 'icon' | + // The gadget displays when the event is clicked. + 'chip'; + + // The method used by this reminder. Possible values are: + type ReminderMethod = + // Reminders are sent via email. + 'email' | + // Reminders are sent via SMS. These are only available for Google Apps for Work, Education, and Government customers. Requests to set SMS reminders for other account types are ignored. + 'sms' | + // Reminders are sent via a UI popup. + 'popup'; + + // Status of the event. Optional. Possible values are: + type EventStatus = + // The event is confirmed. This is the default status. + 'confirmed' | + // The event is tentatively confirmed. + 'tentative' | + // The event is cancelled. + 'cancelled'; + + // Whether the event blocks time on the calendar. Optional. Possible values are: + type EventTransparency = + // The event blocks time on the calendar. This is the default value. + 'opaque' | + // The event does not block time on the calendar. + 'transparent'; + + // Visibility of the event. Optional. Possible values are: + type EventVisibility = + // Uses the default visibility for events on the calendar. This is the default value. + 'default' | + // The event is public and event details are visible to all readers of the calendar. + 'public' | + // The event is private and only event attendees may view event details. + 'private' | + // The event is private. This value is provided for compatibility reasons. + 'confidential'; + + class Event { + kind: 'calendar#event'; + etag: etag; + id: string; + status?: EventStatus; + htmlLink: string; + created: datetime; + updated: datetime; + summary: string; + description: string; + location?: string; + colorId?: string; + + // The creator of the event. Read-only. + creator: { + // The creator's Profile ID, if available. + id?: string; + + // The creator's email address, if available. + email?: string; + + // The creator's name, if available. + displayName?: string; + + // Whether the creator corresponds to the calendar on which this copy of the event appears. Read-only. The default is False. + self?: boolean; + }; + + // The organizer of the event. + organizer: { + // The organizer's Profile ID, if available. + id?: string; + + // The organizer's email address, if available. + email?: string; + + // The organizer's name, if available. + displayName?: string; + + // Whether the organizer corresponds to the calendar on which this copy of the event appears. Read-only. The default is False. + self?: boolean; + }; + + // The (inclusive) start time of the event. For a recurring event, this is the start time of the first instance. + start: { + // The date, in the format "yyyy-mm-dd", if this is an all-day event. + date?: date; + + // The time, as a combined date-time value (formatted according to RFC3339). + // A time zone offset is required unless a time zone is explicitly specified in timeZone. + dateTime?: datetime; + + // The time zone in which the time is specified. (Formatted as an IANA Time Zone Database name, e.g. "Europe/Zurich".) + // For recurring events this field is required and specifies the time zone in which the recurrence is expanded. + // For single events this field is optional and indicates a custom time zone for the event start/end. + timeZone?: string; + }; + + // The (exclusive) end time of the event. For a recurring event, this is the end time of the first instance. + end: { + // The date, in the format "yyyy-mm-dd", if this is an all-day event. + date?: date; + + // The time, as a combined date-time value (formatted according to RFC3339). + // A time zone offset is required unless a time zone is explicitly specified in timeZone. + dateTime?: datetime; + + // The time zone in which the time is specified. (Formatted as an IANA Time Zone Database name, e.g. "Europe/Zurich".) + // For recurring events this field is required and specifies the time zone in which the recurrence is expanded. + // For single events this field is optional and indicates a custom time zone for the event start/end. + timeZone?: string; + }; + + // Whether the end time is actually unspecified. An end time is still provided for compatibility reasons, even if this attribute is set to True. + // The default is False. + endTimeUnspecified?: boolean; + + recurrence: string[]; + + // For an instance of a recurring event, this is the id of the recurring event to which this instance belongs. Immutable. + recurringEventId?: string; + + // Whether the organizer corresponds to the calendar on which this copy of the event appears. Read-only. The default is False. + originalStartTime?: { + date: date; + dateTime: datetime; + timeZone?: string; + }; + + transparency?: EventTransparency; + visibility?: EventVisibility; + iCalUID: string; + sequence: integer; + + // The attendees of the event. + attendees?: { + id: string; + email: string; + displayName?: string; + organizer: boolean; + self: boolean; + resource: boolean; + optional?: boolean; + responseStatus: AttendeeResponseStatus; + comment?: string; + additionalGuests?: integer; + }[]; + + attendeesOmitted?: boolean; + + // Extended properties of the event. + extendedProperties?: { + private: { + (key: string): string; + }; + shared: { + (key: string): string; + } + }; + + // An absolute link to the Google+ hangout associated with this event. Read-only. + hangoutLink?: string; + + // A gadget that extends this event. + gadget?: { + type: string; + title: string; + link: string; + iconLink: string; + width?: integer; + height?: integer; + display?: GadgetDisplayMode; + preferences: { + (key: string): string; + } + }; + + anyoneCanAddSelf?: boolean; + guestsCanInviteOthers?: boolean; + guestsCanModify?: boolean; + guestsCanSeeOtherGuests?: boolean; + privateCopy?: boolean; + + // Whether this is a locked event copy where no changes can be made to the main event fields "summary", "description", "location", "start", "end" or "recurrence". The default is False. Read-Only. + locked?: boolean; + + reminders: { + useDefault: boolean; + overrides?: { + method: ReminderMethod; + minutes: integer; + }[]; + }; + + // Source from which the event was created. For example, a web page, an email message or any document identifiable by an URL with HTTP or HTTPS scheme. + // Can only be seen or modified by the creator of the event. + source?: { + url: string; + title: string; + }; + + // File attachments for the event. Currently only Google Drive attachments are supported. + attachments?: { + fileUrl: string; + title: string; + mimeType: string; + iconLink: string; + fileId: string; + }[]; + } +} diff --git a/gapi.calendar/tsconfig.json b/gapi.calendar/tsconfig.json new file mode 100644 index 0000000000..7613ee5b3d --- /dev/null +++ b/gapi.calendar/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "module": "commonjs", + "lib": ["es6", "dom"], + "strictNullChecks": true, + "noImplicitAny": true, + "noImplicitThis": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true + }, + "files": [ + "index.d.ts", + "gapi.calendar-tests.ts" + ] +} From 09898b0b428078dd8b0a4335e2e4df04ab1068ab Mon Sep 17 00:00:00 2001 From: Tom Goemaes Date: Tue, 28 Feb 2017 09:49:00 +0100 Subject: [PATCH 057/567] Update index.d.ts --- ramda/index.d.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ramda/index.d.ts b/ramda/index.d.ts index 44d4c33304..80fad023cc 100644 --- a/ramda/index.d.ts +++ b/ramda/index.d.ts @@ -8,7 +8,7 @@ declare var R: R.Static; declare namespace R { type Ord = number | string | boolean; - type Path = number | string; + type Path = (number | string)[]; interface ListIterator { (value: T, index: number, list: T[]): TResult; @@ -223,9 +223,9 @@ declare namespace R { * Makes a shallow clone of an object, setting or overriding the nodes required to create the given path, and * placing the specific value at the tail end of that path. */ - assocPath(path: Path[], val: T, obj: U): U; - assocPath(path: Path[], val: T): (obj: U) => U; - assocPath(path: Path[]): CurriedFunction2; + assocPath(path: Path, val: T, obj: U): U; + assocPath(path: Path, val: T): (obj: U) => U; + assocPath(path: Path): CurriedFunction2; /** * Wraps a function of any arity (including nullary) in a function that accepts exactly 2 @@ -441,8 +441,8 @@ declare namespace R { /** * Makes a shallow clone of an object, omitting the property at the given path. */ - dissocPath(path: Path[], obj: any): T; - dissocPath(path: Path[]): (obj: any) => T; + dissocPath(path: Path, obj: any): T; + dissocPath(path: Path): (obj: any) => T; /** * Divides two numbers. Equivalent to a / b. @@ -840,7 +840,7 @@ declare namespace R { * Returns a lens whose focus is the specified path. * See also view, set, over. */ - lensPath(path: Path[]): Lens; + lensPath(path: Path): Lens; /** * lensProp creates a lens that will focus on property k of the source object. @@ -1131,24 +1131,24 @@ declare namespace R { /** * Retrieve the value at a given path. */ - path(path: Path[], obj: any): T; - path(path: Path[]): (obj: any) => T; + path(path: Path, obj: any): T; + path(path: Path): (obj: any) => T; /** * Determines whether a nested path on an object has a specific value, * in `R.equals` terms. Most likely used to filter a list. */ - pathEq(path: Path[], val: any, obj: any): boolean; - pathEq(path: Path[], val: any): (obj: any) => boolean; - pathEq(path: Path[]): CurriedFunction2; + pathEq(path: Path, val: any, obj: any): boolean; + pathEq(path: Path, val: any): (obj: any) => boolean; + pathEq(path: Path): CurriedFunction2; /** * If the given, non-null object has a value at the given path, returns the value at that path. * Otherwise returns the provided default value. */ - pathOr(d: T, p: Path[], obj: any): T|any; - pathOr(d: T, p: Path[]): (obj: any) => T|any; - pathOr(d: T): CurriedFunction2; + pathOr(d: T, p: Path, obj: any): T|any; + pathOr(d: T, p: Path): (obj: any) => T|any; + pathOr(d: T): CurriedFunction2; /** * Returns a partial copy of an object containing only the keys specified. If the key does not exist, the From f7ab322332c2a6e3d923402cec1db0811ea753f2 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Thu, 2 Mar 2017 11:36:31 +0100 Subject: [PATCH 058/567] Modernizr: various fixes. Updated version to 3.3, since all everything new since 3.2 was already added. --- modernizr/index.d.ts | 95 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 77 insertions(+), 18 deletions(-) diff --git a/modernizr/index.d.ts b/modernizr/index.d.ts index 7fd0ffa316..44d3c40775 100644 --- a/modernizr/index.d.ts +++ b/modernizr/index.d.ts @@ -1,19 +1,19 @@ -// Type definitions for Modernizr 3.2 +// Type definitions for Modernizr 3.3 // Project: http://modernizr.com/ // Definitions by: Boris Yankov , Theodore Brown , Leon Yu , Luca Trazzi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface AudioBoolean { - ogg: boolean; - mp3: boolean; - wav: boolean; - m4a: boolean; + ogg: string; + mp3: string; + wav: string; + m4a: string; } interface VideoBoolean { - ogg: boolean; - h264: boolean; - webm: boolean; + ogg: string; + h264: string; + webm: string; } interface InputBoolean { @@ -45,6 +45,66 @@ interface InputTypesBoolean { week: boolean; } +interface CssColumnsBoolean extends Boolean { + breakafter: boolean; + breakbefore: boolean; + breakinside: boolean; + fill: boolean; + gap: boolean; + rule: boolean; + rulecolor: boolean; + rulestyle: boolean; + rulewidth: boolean; + span: boolean; + width: boolean; +} + +interface FlashBoolean extends Boolean { + blocked: boolean; +} + +interface IndexeddbBoolean extends Boolean { + deletedatabase: boolean; +} + +interface WebglextensionsBoolean extends Boolean { + ANGLE_instanced_arrays: boolean; + EXT_blend_minmax: boolean; + EXT_disjoint_timer_query: boolean; + EXT_frag_depth: boolean; + EXT_sRGB: boolean; + EXT_shader_texture_lod: boolean; + EXT_texture_filter_anisotropic: boolean; + OES_element_index_uint: boolean; + OES_standard_derivatives: boolean; + OES_texture_float: boolean; + OES_texture_float_linear: boolean; + OES_texture_half_float: boolean; + OES_texture_half_float_linear: boolean; + OES_vertex_array_object: boolean; + WEBGL_compressed_texture_etc1: boolean; + WEBGL_compressed_texture_s3tc: boolean; + WEBGL_debug_renderer_info: boolean; + WEBGL_debug_shaders: boolean; + WEBGL_depth_texture: boolean; + WEBGL_draw_buffers: boolean; + WEBGL_lose_context: boolean; + WEBKIT_EXT_texture_filter_anisotropic: boolean; + WEBKIT_WEBGL_compressed_texture_s3tc: boolean; + WEBKIT_WEBGL_depth_texture: boolean; + WEBKIT_WEBGL_lose_context: boolean; +} + +interface WebpBoolean extends Boolean { + alpha: boolean; + animation: boolean; + lossless: boolean; +} + +interface DatauriBoolean extends Boolean { + over32kb: boolean; +} + interface FeatureDetects { // Documented @@ -67,7 +127,7 @@ interface FeatureDetects { emoji: boolean; eventlistener: boolean; exiforientation: boolean; - flash: boolean; + flash: false | FlashBoolean; forcetouch: boolean; fullscreen: boolean; gamepads: boolean; @@ -77,7 +137,7 @@ interface FeatureDetects { history: boolean; htmlimports: boolean; ie8compat: boolean; - indexeddb: boolean; + indexeddb: false | IndexeddbBoolean; indexeddbblob: boolean; input: InputBoolean; search: boolean; @@ -143,7 +203,7 @@ interface FeatureDetects { csscalc: boolean; checked: boolean; csschunit: boolean; - csscolumns: boolean; + csscolumns: false | CssColumnsBoolean; cubicbezierrange: boolean; "display-runin": boolean; displaytable: boolean; @@ -266,8 +326,7 @@ interface FeatureDetects { webpalpha: boolean; webpanimation: boolean; webplossless: boolean; - "webp-lossless": boolean; - webp: boolean; + webp: false | WebpBoolean; inputformaction: boolean; inputformenctype: boolean; inputformmethod: boolean; @@ -299,12 +358,12 @@ interface FeatureDetects { smil: boolean; textareamaxlength: boolean; bloburls: boolean; - datauri: boolean; + datauri: false | DatauriBoolean; urlparser: boolean; videoautoplay: boolean; videoloop: boolean; videopreload: boolean; - webglextensions: boolean; + webglextensions: false | WebglextensionsBoolean; datachannel: boolean; getusermedia: boolean; peerconnection: boolean; @@ -344,8 +403,8 @@ interface Dictionary { interface ModernizrAPI { on(feature: string, cb: (result: boolean) => any): void; - addTest(feature: string, test: (() => boolean) | boolean): void; - addTest(feature: Dictionary): void; + addTest(feature: string, test: (() => boolean) | boolean): ModernizrStatic; + addTest(feature: Dictionary): ModernizrStatic; atRule(prop: string): boolean; @@ -360,7 +419,7 @@ interface ModernizrAPI { prefixedCSS(prop: string): string; - prefixedCSSValue(prop: string, value: string): string; + prefixedCSSValue(prop: string, value: string): boolean; _prefixes: string[]; From 52031f3484ee170fcd343fa90a7684855fb6844c Mon Sep 17 00:00:00 2001 From: Lauri Koskela Date: Thu, 2 Mar 2017 18:02:52 +0200 Subject: [PATCH 059/567] Update time scale options - add `minUnit` option - change `round` option to only accept TimeUnits - remove deprecated `format` option --- chart.js/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chart.js/index.d.ts b/chart.js/index.d.ts index 08781f4463..206be68c92 100644 --- a/chart.js/index.d.ts +++ b/chart.js/index.d.ts @@ -410,16 +410,16 @@ declare namespace Chart { } export interface TimeScale extends ChartScales { - format?: string; displayFormats?: TimeDisplayFormat; isoWeekday?: boolean; max?: string; min?: string; parser?: string | ((arg: any) => any); - round?: string; + round?: TimeUnit; tooltipFormat?: string; unit?: TimeUnit; unitStepSize?: number; + minUnit?: TimeUnit; } export interface RadialLinearScale { From 5f56a7e5e1eabe1d55740f3961ca1fa4c7988d6b Mon Sep 17 00:00:00 2001 From: Jed Mao Date: Sun, 5 Mar 2017 08:48:17 -0600 Subject: [PATCH 060/567] Update vinyl-fs options --- vinyl-fs/index.d.ts | 56 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/vinyl-fs/index.d.ts b/vinyl-fs/index.d.ts index 4fa6101b69..52aa5cd506 100644 --- a/vinyl-fs/index.d.ts +++ b/vinyl-fs/index.d.ts @@ -27,32 +27,70 @@ interface SrcOptions extends globStream.Options { /** * Specifies the folder relative to the cwd * This is used to determine the file names when saving in .dest() - * Default is where the glob begins + * Default: where the glob begins */ base?: string; /** * Setting this to false will make file.contents a paused stream * If true it will buffer the file contents - * Defaults to true + * Default: true */ buffer?: boolean; /** - * Setting this to false will ignore the contents of the file and disable writing to disk to speed up operations - * Defaults to true + * The mode the directory should be created with. + * Default: the process mode + */ + dirMode?: number; + + /** + * Whether or not you want globs to match on dot files or not + * (e.g., `.gitignore`). + */ + dot?: boolean; + + /** + * Whether or not to recursively resolve symlinks to their targets. + * Setting to `false` to preserve them as symlinks and make `file.symlink` + * equal the original symlink's target path. + * Default: true + */ + followSymlinks?: boolean; + + /** + * Setting this to false will ignore the contents of the file and disable + * writing to disk to speed up operations + * Default: true */ read?: boolean; - /** Only find files that have been modified since the time specified */ + /** + * Whether or not the symlink should be relative or absolute. + * Default: false + */ + relative?: boolean; + + /** Only find files that have been modified since the time specified */ since?: Date|number; - /** Setting this to true will create a duplex stream, one that passes through items and emits globbed files. - * Defaults to false */ + /** + * Causes the BOM to be stripped on UTF-8 encoded files. Set to `false` + * if you need the BOM for some reason. + */ + stripBOM?: boolean; + + /** + * Setting this to true will create a duplex stream, one that passes + * through items and emits globbed files. + * Default: false + */ passthrough?: boolean; - /** Setting this to true will enable sourcemaps. - * Defaults to false */ + /** + * Setting this to true will enable sourcemaps. + * Default: false + */ sourcemaps?: boolean; } From 638891042fc8b67f9c60022dfe6f7911723eda25 Mon Sep 17 00:00:00 2001 From: Leonidas Arvanitis Date: Sun, 5 Mar 2017 21:26:44 +0200 Subject: [PATCH 061/567] Fix and update according to version 2.1.3 - Added missing methods and options - Removed non-existing options - Expanded comments with default values For this update I used both the site and the code of Toastr to find missing and undocumented (only public ofc.) members. --- toastr/index.d.ts | 381 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 269 insertions(+), 112 deletions(-) diff --git a/toastr/index.d.ts b/toastr/index.d.ts index 5cd8b30c82..767627c95d 100644 --- a/toastr/index.d.ts +++ b/toastr/index.d.ts @@ -8,214 +8,371 @@ interface ToastrOptions { /** - * Optionally override the animation easing to show or hide the toasts. Default is swing. swing and linear are built into jQuery. - */ + * Optionally override the animation easing to show or hide the toasts. + * swing and linear are built into jQuery. + * @default swing + */ showEasing?: string; /** - * Optionally override the animation easing to show or hide the toasts. Default is swing. swing and linear are built into jQuery. - */ + * Optionally override the animation easing to show or hide the toasts. + * swing and linear are built into jQuery. + * @default swing + */ hideEasing?: string; /** - * Use the jQuery show/hide method of your choice. These default to fadeIn/fadeOut. The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery. - */ + * Use the jQuery show method of your choice. + * The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery. + * @default fadeIn + */ showMethod?: string; /** - * Use the jQuery show/hide method of your choice. These default to fadeIn/fadeOut. The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery. - */ + * Use the jQuery hide method of your choice. + * The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery. + * @default fadeOut + */ hideMethod?: string; /** - * Should a close button be shown - */ + * Should a close button be shown? + * @default undefined + */ closeButton?: boolean; /** - * Html for the close button - */ + * CSS class the close button will be given. + * @default toast-close-button + */ + closeClass?: string; + /** + * Time in milliseconds the toast should take to hide, when the close button is clicked. + * Falls back to hide configuration. + * @default false + */ + closeDuration?: number; + /** + * The animation easing while hiding the toast, when the close button is clicked. + * Falls back to hide configuration. + * swing and linear are built into jQuery. + * @default false + */ + closeEasing?: string; + /** + * Use the jQuery show/hide method of your choice, when the close button is clicked. + * Falls back to hide configuration. + * The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery. + * @default false + */ + closeMethod?: string; + /** + * Set to false so that the toast hides event if hovered. + * @default true + */ + closeOnHover?: boolean; + /** + * Html for the close button. + */ closeHtml?: string; /** - * Should clicking on toast dismiss it? - */ + * onCloseClick function callback, fired when the close button is clicked. + * Closing cannot be prevented by ev.stopPropagation() etc. + * @default undefined + */ + onCloseClick?: (ev: JQueryMouseEventObject) => void; + /** + * Should clicking on toast dismiss it? + * @default true + */ tapToDismiss?: boolean; /** - * CSS class the toast element will be given - */ + * CSS class the toast element will be given. + * @default toast + */ toastClass?: string; /** - * Id toast container will be given - */ + * Id toast container will be given. + * @default toast-container + */ containerId?: string; /** - * Should debug details be outputted to the console - */ + * Should debug details be outputted to the console? + * @default false + */ debug?: boolean; /** - * Time in milliseconds the toast should take to show - */ + * Time in milliseconds the toast should take to show. + * @default 300 + */ showDuration?: number; /** - * onShown function callback - **/ + * onShown function callback. + * @default undefined + */ onShown?: () => void; /** - * Time in milliseconds the toast should take to hide - */ + * Time in milliseconds the toast should take to hide. + * @default 1000 + */ hideDuration?: number; /** - * onHidden function callback - **/ + * onHidden function callback. + * @default undefined + */ onHidden?: () => void; /** - * Time in milliseconds the toast should be displayed after mouse over - */ + * Time in milliseconds the toast should be displayed after leaving mouse over. + * Set timeOut and extendedTimeOut to 0 to make it sticky. + * @default 1000 + */ extendedTimeOut?: number; + /** + * If specified, you must provide all classes. + */ iconClasses?: { /** - * Icon to use on error toasts - */ + * Icon to use on error toasts. + * @default toast-error + */ error: string; /** - * Icon to use on info toasts - */ + * Icon to use on info toasts. + * @default toast-info + */ info: string; /** - * Icon to use on success toasts - */ + * Icon to use on success toasts. + * @default toast-success + */ success: string; /** - * Icon to use on warning toasts - */ + * Icon to use on warning toasts. + * @default toast-warning + */ warning: string; }; /** - * Icon to use for toast - */ + * Icon to use for toast. + * @default toast-info + */ iconClass?: string; /** - * Where toast should be displayed - */ + * Where toast should be displayed. + * The default stylesheet covers: + * toast-top-left, toast-top-center, toast-top-right, toast-top-full-width, + * toast-bottom-left, toast-bottom-center, toast-bottom-right, toast-bottom-full-width + * @default toast-top-right + */ positionClass?: string; /** - * Where toast should be displayed - background - */ - backgroundpositionClass?: string; - /** - * Time in milliseconds that the toast should be displayed - */ + * Time in milliseconds that the toast should be displayed. + * Set timeOut and extendedTimeOut to 0 to make it sticky. + * @default 5000 + */ timeOut?: number; /** - * CSS class the title element will be given - */ + * CSS class the title element will be given. + * @default toast-title + */ titleClass?: string; /** - * CSS class the message element will be given - */ + * CSS class the message element will be given. + * @default toast-message + */ messageClass?: string; /** - * Set newest toast to appear on top - **/ + * Set newest toast to appear on top. + * @default true + */ newestOnTop?: boolean; /** - * The element to put the toastr container - **/ + * The element to put the toastr container + * @default body + */ target?: string; /** - * Rather than having identical toasts stack, set the preventDuplicates property to true. Duplicates are matched to the previous toast based on their message content. - */ + * Rather than having identical toasts stack, set the preventDuplicates property to true. + * Duplicates are matched to the previous toast based on their message content. + * @default false + */ preventDuplicates?: boolean; /** - * Visually indicates how long before a toast expires. - */ + * Visually indicates how long before a toast expires. + * @default false + */ progressBar?: boolean; /** - * Function to execute on toast click - */ - onclick?: () => void; + * CSS class the progressbar element will be given. + * @default toast-progress + */ + progressClass?: string; /** - * Set if toastr should parse containing html - **/ - allowHtml?: boolean; + * Function to execute on toast click. Closing cannot be prevented by ev.stopPropagation() etc. + * @default undefined + */ + onclick?: (ev: JQueryMouseEventObject) => void; /** - * Set if toastr should escape html - **/ + * Should the title and message text be escaped? + * @default false + */ escapeHtml?: boolean; + /** + * Flip the toastr to be displayed properly for right-to-left languages. + * @default false + */ + rtl?: boolean; } interface ToastrDisplayMethod { /** - * Create a toast - * - * @param message Message to display in toast - */ + * Create a toast + * + * @param message Message to display in toast + */ (message: string): JQuery; /** - * Create a toast - * - * @param message Message to display in toast - * @param title Title to display on toast - */ + * Create a toast + * + * @param message Message to display in toast + * @param title Title to display on toast + */ (message: string, title: string): JQuery; /** - * Create a toast - * - * @param message Message to display in toast - * @param title Title to display on toast - * @param overrides Option values for toast - */ + * Create a toast + * + * @param message Message to display in toast + * @param title Title to display on toast + * @param overrides Option values for toast + */ (message: string, title: string, overrides: ToastrOptions): JQuery; } +type ToastrType = 'error'|'info'|'success'|'warning'; + +interface ToastMap { + /** + * The toast type. + */ + type: ToastrType; + /** + * The toast message. + */ + message: string; + /** + * The toast icon class. + */ + iconClass: string; + /** + * The toast title. + */ + title?: string; + /** + * Any override options specified when the toast was created. + */ + optionsOverride?: ToastrOptions; +} + +interface ToastrResponse { + /** + * The internal toast id. + */ + toastId: number; + /** + * The current state of the toast. + */ + state: 'visible'|'hidden'; + /** + * The datetime the toast was opened. + */ + startTime: Date; + /** + * The datetime the toast was closed, if the state is hidden. + */ + endTime?: Date; + /** + * The toastr options. + */ + options: ToastrOptions; + /** + * The event's toast details. + */ + map: ToastMap; +} + interface Toastr { /** - * Clear toasts - */ + * Clear toasts + */ clear: { /** - * Clear all toasts - */ + * Clear all toasts + */ (): void; /** - * Clear specific toast - * - * @param toast Toast to clear - */ + * Clear specific toast + * + * @param toast Toast to clear + */ (toast: JQuery): void; - /** - * Clear specific toast - * - * @param toast Toast to clear - * @param clearOptions force clearing a toast, ignoring focus - */ - (toast: JQuery, clearOptions: { force: boolean }): void; + /** + * Clear specific toast + * + * @param toast Toast to clear + * @param clearOptions force clearing a toast, ignoring focus + */ + (toast: JQuery, clearOptions: {force: boolean}): void; }; /** - * Removes all toasts (without animation) - */ + * Removes all toasts (without animation) + */ remove: { (): void; }; /** - * Create an error toast - */ + * Create an error toast + */ error: ToastrDisplayMethod; /** - * Create an info toast - */ + * Create an info toast + */ info: ToastrDisplayMethod; /** - * Create an options object - */ + * The toatsr options object + */ options: ToastrOptions; /** - * Create a success toast - */ + * Create a success toast + */ success: ToastrDisplayMethod; /** - * Create a warning toast - */ + * Create a warning toast + */ warning: ToastrDisplayMethod; /** - * Get toastr version - */ + * Get toastr version + */ version: string; + /** + * Get or create a container. + */ + getContainer: { + /** + * Get the container by options.containerId. + * + * @param options Option values for the container + */ + (options?: ToastrOptions): JQuery, + /** + * Get the container by options.containerId. + * If it doesn't exist, it will be created according to options. + * + * @param options Option values for the container + * @param create Use true to create a container, if it doesn't exist + */ + (options: ToastrOptions, create: boolean): JQuery, + }; + /** + * Register a callback to be called when a toast gets created or hidden. + * + * @param callback The function which will be passed the event details. + */ + subscribe: (callback: (response: ToastrResponse) => any) => void; [key: string]: any; } From 5e762d799d6779106c33b899ed71839501b1443a Mon Sep 17 00:00:00 2001 From: Anton Kandybo Date: Mon, 6 Mar 2017 01:18:30 +0200 Subject: [PATCH 062/567] Add compression-webpack-plugin --- .../compression-webpack-plugin-tests.ts | 14 +++++++ compression-webpack-plugin/index.d.ts | 40 +++++++++++++++++++ compression-webpack-plugin/tsconfig.json | 20 ++++++++++ compression-webpack-plugin/tslint.json | 7 ++++ 4 files changed, 81 insertions(+) create mode 100644 compression-webpack-plugin/compression-webpack-plugin-tests.ts create mode 100644 compression-webpack-plugin/index.d.ts create mode 100644 compression-webpack-plugin/tsconfig.json create mode 100644 compression-webpack-plugin/tslint.json diff --git a/compression-webpack-plugin/compression-webpack-plugin-tests.ts b/compression-webpack-plugin/compression-webpack-plugin-tests.ts new file mode 100644 index 0000000000..4ee93c78b7 --- /dev/null +++ b/compression-webpack-plugin/compression-webpack-plugin-tests.ts @@ -0,0 +1,14 @@ +import { Configuration } from 'webpack' +import * as CompressionPlugin from 'compression-webpack-plugin' + +const c: Configuration = { + plugins: [ + new CompressionPlugin({ + asset: "[path].gz[query]", + algorithm: "gzip", + test: /\.js$|\.html$/, + threshold: 10240, + minRatio: 0.8 + }) + ] +}; diff --git a/compression-webpack-plugin/index.d.ts b/compression-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..cf65f55300 --- /dev/null +++ b/compression-webpack-plugin/index.d.ts @@ -0,0 +1,40 @@ +// Type definitions for compression-webpack-plugin 0.3.2 +// Project: https://github.com/webpack-contrib/compression-webpack-plugin +// Definitions by: Anton Kandybo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Plugin } from 'webpack'; + +export = CompressionPlugin; + +declare class CompressionPlugin extends Plugin { + constructor(options?: CompressionPlugin.Options); +} + +declare namespace CompressionPlugin { + export interface Options { + asset?: string; + algorithm?: string; + test?: RegExp | RegExp[]; + regExp?: RegExp | RegExp[]; + threshold?: number; + minRatio?: number; + + // zopfli options + verbose?: boolean; + verbose_more?: boolean; + numiterations?: number; + blocksplitting?: boolean; + blocksplittinglast?: boolean; + blocksplittingmax?: number; + + // zlib options + level?: number; + flush?: number; + chunkSize?: number; + windowBits?: number; + memLevel?: number; + strategy?: number; + dictionary?: any; + } +} diff --git a/compression-webpack-plugin/tsconfig.json b/compression-webpack-plugin/tsconfig.json new file mode 100644 index 0000000000..f9c84d64f8 --- /dev/null +++ b/compression-webpack-plugin/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "compression-webpack-plugin-tests.ts" + ] +} diff --git a/compression-webpack-plugin/tslint.json b/compression-webpack-plugin/tslint.json new file mode 100644 index 0000000000..02312e1c7d --- /dev/null +++ b/compression-webpack-plugin/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "../tslint.json", + "rules": { + "dt-header": false + } + } + \ No newline at end of file From 972fc4d5606f96fc50b01bf2578f2cff786dd3a7 Mon Sep 17 00:00:00 2001 From: Anton Kandybo Date: Mon, 6 Mar 2017 01:26:47 +0200 Subject: [PATCH 063/567] Added es6 lib --- compression-webpack-plugin/tsconfig.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compression-webpack-plugin/tsconfig.json b/compression-webpack-plugin/tsconfig.json index f9c84d64f8..70383d3658 100644 --- a/compression-webpack-plugin/tsconfig.json +++ b/compression-webpack-plugin/tsconfig.json @@ -2,6 +2,9 @@ "compilerOptions": { "module": "commonjs", "target": "es6", + "lib": [ + "es6" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, From 92be25fe09e45373607ca5c247622becc08a2751 Mon Sep 17 00:00:00 2001 From: Marcel Good Date: Sun, 5 Mar 2017 17:08:47 -0800 Subject: [PATCH 064/567] Update breeze-client type definitions --- breeze/index.d.ts | 104 ++++++++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 44 deletions(-) diff --git a/breeze/index.d.ts b/breeze/index.d.ts index 8cc109d746..323e9a8f87 100644 --- a/breeze/index.d.ts +++ b/breeze/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Breeze 1.5.x +// Type definitions for Breeze 1.6.3 // Project: http://www.breezejs.com/ // Definitions by: Boris Yankov , IdeaBlade // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,7 +12,10 @@ // Updated Jan 20 2015 for Breeze 1.5.2 and merging changes from DefinitelyTyped // Updated Feb 28 2015 add any/all clause on Predicate // Updated Jun 27 2016 - Marcel Good (www.ideablade.com) -// Updated Jul 28 2016 - Serkan "coni2k" Holat +// Updated Jun 29 2016 - Marcel Good (www.ideablade.com) +// Updated Jul 15 2016 - Added methods to JsonResultsAdapter - Steve Schmitt +// Updated Sep 23 2016 - Added core methods +// Updated March 5 2017 - Eliminate promises.IPromise and replace with Promise declare namespace breeze.core { @@ -89,6 +92,19 @@ declare namespace breeze.core { export function stringStartsWith(str: string, prefix: string): boolean; export function stringEndsWith(str: string, suffix: string): boolean; export function formatString(format: string, ...args: any[]): string; + + /** Change text to title case with spaces, e.g. 'myPropertyName12' to 'My Property Name 12' */ + export function titleCase(str: string): string; + + /** Return the ES5 property descriptor for the property, which may be on a prototype of the object */ + export function getPropertyDescriptor(obj: any, propertyName: string): PropertyDescriptor + + /** safely perform toJSON logic on objects with cycles. Replacer function can map or exclude properties. */ + export function toJSONSafe(obj: any, replacer: (prop: string, val: any) => any): any + + /** Default value replacer for toJSONSafe. Replaces entityAspect and other internal properties with undefined. */ + export function toJSONSafeReplacer(prop: string, val: any): any + } declare namespace breeze { @@ -214,19 +230,23 @@ declare namespace breeze { export class DataServiceAdapter { checkForRecomposition(interfaceInitializedArgs: { interfaceName: string; isDefault: boolean }): void; initialize(): void; - fetchMetadata(metadataStore: MetadataStore, dataService: DataService): breeze.promises.IPromise; - executeQuery(mappingContext: { getUrl: () => string; query: EntityQuery; dataService: DataService }): breeze.promises.IPromise; - saveChanges(saveContext: { resourceName: string; dataService: DataService }, saveBundle: Object): breeze.promises.IPromise; + fetchMetadata(metadataStore: MetadataStore, dataService: DataService): Promise; + executeQuery(mappingContext: { getUrl: () => string; query: EntityQuery; dataService: DataService }): Promise; + saveChanges(saveContext: { resourceName: string; dataService: DataService }, saveBundle: Object): Promise; JsonResultsAdapter: JsonResultsAdapter; } export class JsonResultsAdapter { name: string; extractResults: (data: {}) => {}; + extractSaveResults: (data: {}) => any[]; + extractKeyMappings: (data: {}) => KeyMapping[]; visitNode: (node: {}, queryContext: QueryContext, nodeContext: NodeContext) => { entityType?: EntityType; nodeId?: any; nodeRefId?: any; ignore?: boolean; }; constructor(config: { name: string; extractResults?: (data: {}) => {}; + extractSaveResults?: (data: {}) => any[]; + extractKeyMappings?: (data: {}) => KeyMapping[]; visitNode: (node: {}, queryContext: QueryContext, nodeContext: NodeContext) => { entityType?: EntityType; nodeId?: any; nodeRefId?: any; ignore?: boolean; }; }); } @@ -241,6 +261,7 @@ declare namespace breeze { export interface NodeContext { nodeType: string; + propertyName: string; } export class DataTypeSymbol extends breeze.core.EnumSymbol { @@ -333,8 +354,8 @@ declare namespace breeze { isNavigationPropertyLoaded(navigationProperty: string): boolean; isNavigationPropertyLoaded(navigationProperty: NavigationProperty): boolean; - loadNavigationProperty(navigationProperty: string, callback?: Function, errorCallback?: Function): breeze.promises.IPromise; - loadNavigationProperty(navigationProperty: NavigationProperty, callback?: Function, errorCallback?: Function): breeze.promises.IPromise; + loadNavigationProperty(navigationProperty: string, callback?: Function, errorCallback?: Function): Promise; + loadNavigationProperty(navigationProperty: NavigationProperty, callback?: Function, errorCallback?: Function): Promise; rejectChanges(): void; @@ -423,16 +444,16 @@ declare namespace breeze { createEntity(typeName: string, config?: {}, entityState?: EntityStateSymbol, mergeStrategy?: MergeStrategySymbol): Entity; createEntity(entityType: EntityType, config?: {}, entityState?: EntityStateSymbol, mergeStrategy?: MergeStrategySymbol): Entity; detachEntity(entity: Entity): boolean; - executeQuery(query: string, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): breeze.promises.IPromise; - executeQuery(query: EntityQuery, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): breeze.promises.IPromise; + executeQuery(query: string, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Promise; + executeQuery(query: EntityQuery, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Promise; executeQueryLocally(query: EntityQuery): Entity[]; exportEntities(entities?: Entity[], includeMetadata?: boolean): string; exportEntities(entities?: Entity[], options?: ExportEntitiesOptions): any; // string | Object - fetchEntityByKey(typeName: string, keyValue: any, checkLocalCacheFirst?: boolean): breeze.promises.IPromise; - fetchEntityByKey(typeName: string, keyValues: any[], checkLocalCacheFirst?: boolean): breeze.promises.IPromise; - fetchEntityByKey(entityKey: EntityKey): breeze.promises.IPromise; - fetchMetadata(callback?: (schema: any) => void, errorCallback?: breeze.core.ErrorCallback): breeze.promises.IPromise; + fetchEntityByKey(typeName: string, keyValue: any, checkLocalCacheFirst?: boolean): Promise; + fetchEntityByKey(typeName: string, keyValues: any[], checkLocalCacheFirst?: boolean): Promise; + fetchEntityByKey(entityKey: EntityKey): Promise; + fetchMetadata(callback?: (schema: any) => void, errorCallback?: breeze.core.ErrorCallback): Promise; generateTempKeyValue(entity: Entity): any; getChanges(): Entity[]; getChanges(entityTypeName: string): Entity[]; @@ -466,7 +487,7 @@ declare namespace breeze { importEntities(exportedData: Object, config?: { mergeStrategy?: MergeStrategySymbol; metadataVersionFn?: (any: any) => void }): { entities: Entity[]; tempKeyMapping: { [key: string]: EntityKey } }; rejectChanges(): Entity[]; - saveChanges(entities?: Entity[], saveOptions?: SaveOptions, callback?: SaveChangesSuccessCallback, errorCallback?: SaveChangesErrorCallback): breeze.promises.IPromise; + saveChanges(entities?: Entity[], saveOptions?: SaveOptions, callback?: SaveChangesSuccessCallback, errorCallback?: SaveChangesErrorCallback): Promise; setProperties(config: EntityManagerProperties): void; } @@ -554,7 +575,7 @@ declare namespace breeze { /** Create query from an expression tree */ constructor(tree: Object); - execute(callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): breeze.promises.IPromise; + execute(callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Promise; executeLocally(): Entity[]; expand(propertyPaths: string[]): EntityQuery; expand(propertyPaths: string): EntityQuery; @@ -591,6 +612,8 @@ declare namespace breeze { where(property: string, filterop: FilterQueryOpSymbol, property2: string, filterop2: FilterQueryOpSymbol, value: any): EntityQuery; // for any/all clauses where(property: string, filterop: string, property2: string, filterop2: string, value: any): EntityQuery; // for any/all clauses where(predicate: FilterQueryOpSymbol): EntityQuery; + where(anArray: IRecursiveArray): EntityQuery; + withParameters(params: Object): EntityQuery; toJSON(): string; @@ -721,13 +744,14 @@ declare namespace breeze { addDataService(dataService: DataService, shouldOverwrite?: boolean): void; addEntityType(structuralType: IStructuralType): void; exportMetadata(): string; - fetchMetadata(dataService: string, callback?: (data: any) => void, errorCallback?: breeze.core.ErrorCallback): breeze.promises.IPromise; - fetchMetadata(dataService: DataService, callback?: (data: any) => void, errorCallback?: breeze.core.ErrorCallback): breeze.promises.IPromise; + fetchMetadata(dataService: string, callback?: (data: any) => void, errorCallback?: breeze.core.ErrorCallback): Promise; + fetchMetadata(dataService: DataService, callback?: (data: any) => void, errorCallback?: breeze.core.ErrorCallback): Promise; getDataService(serviceName: string): DataService; getEntityType(entityTypeName: string, okIfNotFound?: boolean): IStructuralType; getEntityTypes(): IStructuralType[]; hasMetadataFor(serviceName: string): boolean; static importMetadata(exportedString: string): MetadataStore; + static normalizeTypeName(typeName: string): string; importMetadata(exportedString: string, allowMerge?: boolean): MetadataStore; isEmpty(): boolean; registerEntityTypeCtor(entityTypeName: string, entityCtor: Function, initializationFn?: (entity: Entity) => void, noTrackingFn?: (node: Object, entityType: EntityType) => Object): void; @@ -796,7 +820,7 @@ declare namespace breeze { export interface IRecursiveArray { [i: number]: T | IRecursiveArray; } - + export class Predicate { constructor(); constructor(property: string, operator: string, value: any); @@ -904,10 +928,16 @@ declare namespace breeze { export interface SaveResult { entities: Entity[]; - keyMappings: any; + keyMappings: KeyMapping[]; XHR: XMLHttpRequest; } + export interface KeyMapping { + entityTypeName: string; + tempValue: any; + realValue: any; + } + export class ValidationError { key: string; context: any; @@ -993,7 +1023,7 @@ declare namespace breeze { /** Creates a regular expression validator with a fixed expression. */ static makeRegExpValidator(validatorName: string, expression: RegExp, defaultMessage: string, context?: any): Validator; - /** Run this validator against the specified value. + /** Run this validator against the specified value. @param value {Object} Value to validate @param additionalContext {Object} Any additional contextual information that the Validator can make use of. @return {ValidationError|null} A ValidationError if validation fails, null otherwise */ @@ -1044,20 +1074,16 @@ declare namespace breeze.config { @return {an instance of the specified adapter} **/ export function getAdapterInstance(interfaceName: string, adapterName?: string): Object; - - export interface Adapter { - getRoutePrefix: Function - } /** - Initializes a single adapter implementation. Initialization means either newing a instance of the + Initializes a single adapter implementation. Initialization means either newing a instance of the specified interface and then calling "initialize" on it or simply calling "initialize" on the instance if it already exists. @param interfaceName {String} The name of the interface to which the adapter to initialize belongs. @param adapterName {String} - The name of a previously registered adapter to initialize. - @param isDefault=true {Boolean} - Whether to make this the default "adapter" for this interface. + @param isDefault=true {Boolean} - Whether to make this the default "adapter" for this interface. @return {an instance of the specified adapter} **/ - export function initializeAdapterInstance(interfaceName: string, adapterName: string, isDefault?: boolean): Adapter; + export function initializeAdapterInstance(interfaceName: string, adapterName: string, isDefault?: boolean): Object; export interface AdapterInstancesConfig { /** the name of a previously registered "ajax" adapter */ @@ -1080,15 +1106,15 @@ declare namespace breeze.config { export var objectRegistry: Object; /** Method use to register implementations of standard breeze interfaces. Calls to this method are usually - made as the last step within an adapter implementation. + made as the last step within an adapter implementation. @param interfaceName {String} - one of the following interface names "ajax", "dataService" or "modelLibrary" - @param adapterCtor {Function} - an ctor function that returns an instance of the specified interface. + @param adapterCtor {Function} - an ctor function that returns an instance of the specified interface. **/ export function registerAdapter(interfaceName: string, adapterCtor: Function): void; export function registerFunction(fn: Function, fnName: string): void; export function registerType(ctor: Function, typeName: string): void; //static setProperties(config: Object): void; //deprecated - /** + /** Set the promise implementation, if Q.js is not found. @param q - implementation of promise. @see http://wiki.commonjs.org/wiki/Promises/A */ @@ -1101,27 +1127,17 @@ declare namespace breeze.config { /** Promises interface used by Breeze. Usually implemented by Q (https://github.com/kriskowal/q) or angular.$q using breeze.config.setQ(impl) */ declare namespace breeze.promises { - export interface IPromise { - then(onFulfill: (value: T) => U, onReject?: (reason: any) => U): IPromise; - then(onFulfill: (value: T) => IPromise, onReject?: (reason: any) => U): IPromise; - then(onFulfill: (value: T) => U, onReject?: (reason: any) => IPromise): IPromise; - then(onFulfill: (value: T) => IPromise, onReject?: (reason: any) => IPromise): IPromise; - catch(onRejected: (reason: any) => U): IPromise; - catch(onRejected: (reason: any) => IPromise): IPromise; - finally(finallyCallback: () => any): IPromise; - } - export interface IDeferred { - promise: IPromise; + promise: Promise; resolve(value: T): void; reject(reason: any): void; } export interface IPromiseService { defer(): IDeferred; - reject(reason?: any): IPromise; - resolve(object: T): IPromise; - resolve(object: IPromise): IPromise; + reject(reason?: any): Promise; + resolve(object: T): Promise; + resolve(object: Promise): Promise; } } From da5139066741bd05d72d981936a696ddda51be4e Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 6 Mar 2017 14:35:08 +1100 Subject: [PATCH 065/567] tidy up some linting warnings --- fs-extra/fs-extra-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs-extra/fs-extra-tests.ts b/fs-extra/fs-extra-tests.ts index 896d6411f7..26ad80ffb4 100644 --- a/fs-extra/fs-extra-tests.ts +++ b/fs-extra/fs-extra-tests.ts @@ -2,7 +2,7 @@ /// import fs = require('fs-extra'); -import * as Path from 'path' +import * as Path from 'path'; var src: string; var dest: string; @@ -22,7 +22,7 @@ fs.copy(src, dest, { clobber: true, preserveTimestamps: true, - filter: (src: string) => {return false} + filter: (src: string) => { return false; } }, errorCallback ); @@ -43,7 +43,7 @@ fs.copySync(src, dest, { clobber: true, preserveTimestamps: true, - filter: (src: string) => {return false} + filter: (src: string) => { return false; } } ); fs.copySync(src, dest, From 23de3bee82fd19f2178a7179b9f649feba771210 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 6 Mar 2017 14:35:29 +1100 Subject: [PATCH 066/567] walk and walkSync now live in different packages --- fs-extra/fs-extra-tests.ts | 32 -------------------------------- fs-extra/index.d.ts | 3 --- 2 files changed, 35 deletions(-) diff --git a/fs-extra/fs-extra-tests.ts b/fs-extra/fs-extra-tests.ts index 26ad80ffb4..f2056d3e06 100644 --- a/fs-extra/fs-extra-tests.ts +++ b/fs-extra/fs-extra-tests.ts @@ -102,35 +102,3 @@ fs.ensureSymlink(path, errorCallback); fs.ensureSymlinkSync(path); fs.emptyDir(path, errorCallback); fs.emptyDirSync(path); - -var items: string[]; -fs.walk("my-path") - .on('data', function (item) { - items.push(item.path); - }) - .on('end', function () { - console.dir(items); - }); - -const ignoreHiddenFiles = (item: string): boolean => { - const basename = Path.basename(item) - return basename === '.' || basename[0] !== '.' -} - -const sortPaths = (left: string, right: string) => left.localeCompare(right); - -const options = { - filter: ignoreHiddenFiles, - pathSorter: sortPaths -} - -fs.walk(path, options) - .on('readable', function (this: fs.PathEntryStream) { - let item: fs.PathEntry | undefined - while ((item = this.read())) { - items.push(item.path) - } - }) - .on('end', function () { - - }) diff --git a/fs-extra/index.d.ts b/fs-extra/index.d.ts index 2cc47724c8..e30426321e 100644 --- a/fs-extra/index.d.ts +++ b/fs-extra/index.d.ts @@ -120,9 +120,6 @@ export type PathEntryStream = { read(): PathEntry | null } -export function walk(path: string, options?: WalkOptions): WalkEventEmitter; -export function walkSync(path: string): ReadonlyArray; - export interface CopyFilterFunction { (src: string): boolean } From 64708242be98bb708fe877226d7970aa34219b2b Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 6 Mar 2017 14:38:18 +1100 Subject: [PATCH 067/567] tag the version for fs-extra --- fs-extra/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs-extra/index.d.ts b/fs-extra/index.d.ts index e30426321e..e17b47115f 100644 --- a/fs-extra/index.d.ts +++ b/fs-extra/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for fs-extra +// Type definitions for fs-extra v2.0.0 // Project: https://github.com/jprichardson/node-fs-extra // Definitions by: midknight41 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 416210d5bbfba701abb723c8c7855d9bcd56258e Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Mon, 6 Mar 2017 14:38:30 +1100 Subject: [PATCH 068/567] add myself as a reviewer --- fs-extra/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs-extra/index.d.ts b/fs-extra/index.d.ts index e17b47115f..57f4a6fb24 100644 --- a/fs-extra/index.d.ts +++ b/fs-extra/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for fs-extra v2.0.0 // Project: https://github.com/jprichardson/node-fs-extra -// Definitions by: midknight41 +// Definitions by: midknight41 , Brendan Forster // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/fs-extra.d.ts From f3840dd3df0da771a82f174958bc376e6ef02d99 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Mon, 6 Mar 2017 10:54:34 +0100 Subject: [PATCH 069/567] Underscore: A bunch of fixes, and added a lot of "or undefined" for strict nulls. --- underscore/index.d.ts | 115 +++++++++++++++++---------------- underscore/underscore-tests.ts | 2 +- 2 files changed, 61 insertions(+), 56 deletions(-) diff --git a/underscore/index.d.ts b/underscore/index.d.ts index 48452b9e2e..f0f6784de3 100644 --- a/underscore/index.d.ts +++ b/underscore/index.d.ts @@ -153,9 +153,19 @@ declare module _ { **/ map( list: _.List, - iterator: _.ListIterator | _.IterateePropertyShorthand | _.IterateeMatcherShorthand, + iterator: _.ListIterator, context?: any): TResult[]; + map( + list: _.List, + iterator: _.IterateePropertyShorthand, + context?: any): T[]; + + map( + list: _.List, + iterator: _.IterateeMatcherShorthand, + context?: any): boolean[]; + /** * @see _.map * @param object Maps the properties of this object. @@ -171,18 +181,7 @@ declare module _ { /** * @see _.map **/ - collect( - list: _.List, - iterator: _.ListIterator | _.IterateePropertyShorthand | _.IterateeMatcherShorthand, - context?: any): TResult[]; - - /** - * @see _.map - **/ - collect( - object: _.Dictionary, - iterator: _.ObjectIterator, - context?: any): TResult[]; + collect: typeof _.map; /** * Also known as inject and foldl, reduce boils down a list of values into a single value. @@ -196,7 +195,7 @@ declare module _ { * @return Reduced object result. **/ reduce( - list: _.Collection, + list: _.List, iterator: _.MemoIterator, memo?: TResult, context?: any): TResult; @@ -211,11 +210,17 @@ declare module _ { * @see _.reduce **/ inject( - list: _.Collection, + list: _.List, iterator: _.MemoIterator, memo?: TResult, context?: any): TResult; + inject( + list: _.Dictionary, + iterator: _.MemoObjectIterator, + memo?: TResult, + context?: any): TResult; + /** * @see _.reduce **/ @@ -262,7 +267,7 @@ declare module _ { find( list: _.List, iterator: _.ListIterator, - context?: any): T; + context?: any): T | undefined; /** * @see _.find @@ -270,21 +275,21 @@ declare module _ { find( object: _.Dictionary, iterator: _.ObjectIterator, - context?: any): T; + context?: any): T | undefined; /** * @see _.find **/ find( object: _.List | _.Dictionary, - iterator: U): T; + iterator: U): T | undefined; /** * @see _.find **/ find( object: _.List | _.Dictionary, - iterator: string): T; + iterator: string): T | undefined; /** * @see _.find @@ -292,7 +297,7 @@ declare module _ { detect( list: _.List, iterator: _.ListIterator, - context?: any): T; + context?: any): T | undefined; /** * @see _.find @@ -300,21 +305,21 @@ declare module _ { detect( object: _.Dictionary, iterator: _.ObjectIterator, - context?: any): T; + context?: any): T | undefined; /** * @see _.find **/ detect( object: _.List | _.Dictionary, - iterator: U): T; + iterator: U): T | undefined; /** * @see _.find **/ detect( object: _.List | _.Dictionary, - iterator: string): T; + iterator: string): T | undefined; /** * Looks through each value in the list, returning an array of all the values that pass a truth @@ -372,7 +377,7 @@ declare module _ { **/ findWhere( list: _.List, - properties: U): T; + properties: U): T | undefined; /** * Returns the values in list without the elements that the truth test (iterator) passes. @@ -754,7 +759,7 @@ declare module _ { * @param array Retrieves the first element of this array. * @return Returns the first element of `array`. **/ - first(array: _.List): T; + first(array: _.List): T | undefined; /** * @see _.first @@ -767,7 +772,7 @@ declare module _ { /** * @see _.first **/ - head(array: _.List): T; + head(array: _.List): T | undefined; /** * @see _.first @@ -804,7 +809,7 @@ declare module _ { * @param array Retrieves the last element of this array. * @return Returns the last element of `array`. **/ - last(array: _.List): T; + last(array: _.List): T | undefined; /** * @see _.last @@ -3768,7 +3773,7 @@ declare module _ { * @param attrs Object with key values pair * @return Predicate function **/ - matches(attrs: T): _.ListIterator; + matches(attrs: T): _.ListIterator; /** * Returns a predicate function that will tell you if a passed in object contains all of the key/value properties present in attrs. @@ -3776,7 +3781,7 @@ declare module _ { * @param attrs Object with key values pair * @return Predicate function **/ - matcher(attrs: T): _.ListIterator; + matcher(attrs: T): _.ListIterator; /** * Returns a function that will itself return the key property of any passed-in object. @@ -4100,22 +4105,22 @@ declare module _ { * Wrapped type `any[]`. * @see _.each **/ - each(iterator: _.ListIterator, context?: any): T[]; + each(iterator: _.ListIterator, context?: any): _.List; /** * @see _.each **/ - each(iterator: _.ObjectIterator, context?: any): T[]; + each(iterator: _.ObjectIterator, context?: any): _.List; /** * @see _.each **/ - forEach(iterator: _.ListIterator, context?: any): T[]; + forEach(iterator: _.ListIterator, context?: any): _.List; /** * @see _.each **/ - forEach(iterator: _.ObjectIterator, context?: any): T[]; + forEach(iterator: _.ObjectIterator, context?: any): _.List; /** * Wrapped type `any[]`. @@ -4170,32 +4175,32 @@ declare module _ { * Wrapped type `any[]`. * @see _.find **/ - find(iterator: _.ListIterator | _.ObjectIterator, context?: any): T; + find(iterator: _.ListIterator | _.ObjectIterator, context?: any): T | undefined; /** * @see _.find **/ - find(interator: U): T; + find(interator: U): T | undefined; /** * @see _.find **/ - find(interator: string): T; + find(interator: string): T | undefined; /** * @see _.find **/ - detect(iterator: _.ListIterator | _.ObjectIterator, context?: any): T; + detect(iterator: _.ListIterator | _.ObjectIterator, context?: any): T | undefined; /** * @see _.find **/ - detect(interator?: U): T; + detect(interator?: U): T | undefined; /** * @see _.find **/ - detect(interator?: string): T; + detect(interator?: string): T | undefined; /** * Wrapped type `any[]`. @@ -4218,7 +4223,7 @@ declare module _ { * Wrapped type `any[]`. * @see _.findWhere **/ - findWhere(properties: U): T; + findWhere(properties: U): T | undefined; /** * Wrapped type `any[]`. @@ -4399,7 +4404,7 @@ declare module _ { * Wrapped type `any[]`. * @see _.first **/ - first(): T; + first(): T | undefined; /** * Wrapped type `any[]`. @@ -4410,7 +4415,7 @@ declare module _ { /** * @see _.first **/ - head(): T; + head(): T | undefined; /** * @see _.first @@ -4437,7 +4442,7 @@ declare module _ { * Wrapped type `any[]`. * @see _.last **/ - last(): T; + last(): T | undefined; /** * Wrapped type `any[]`. @@ -4690,7 +4695,7 @@ declare module _ { * Wrapped type `Function`. * @see _.negate **/ - negate(): boolean; + negate(): (...args: any[]) => boolean; /** * Wrapped type `Function[]`. @@ -4805,13 +4810,13 @@ declare module _ { * Wrapped type `any[]`. * @see _.matches **/ - matches(): _.ListIterator; + matches(): _.ListIterator; /** * Wrapped type `any[]`. * @see _.matcher **/ - matcher(): _.ListIterator; + matcher(): _.ListIterator; /** * Wrapped type `string`. @@ -5130,32 +5135,32 @@ declare module _ { * Wrapped type `any[]`. * @see _.find **/ - find(iterator: _.ListIterator | _.ObjectIterator, context?: any): _ChainSingle; + find(iterator: _.ListIterator | _.ObjectIterator, context?: any): _ChainSingle; /** * @see _.find **/ - find(interator: U): _ChainSingle; + find(interator: U): _ChainSingle; /** * @see _.find **/ - find(interator: string): _ChainSingle; + find(interator: string): _ChainSingle; /** * @see _.find **/ - detect(iterator: _.ListIterator | _.ObjectIterator, context?: any): _ChainSingle; + detect(iterator: _.ListIterator | _.ObjectIterator, context?: any): _ChainSingle; /** * @see _.find **/ - detect(interator: U): _ChainSingle; + detect(interator: U): _ChainSingle; /** * @see _.find **/ - detect(interator: string): _ChainSingle; + detect(interator: string): _ChainSingle; /** * Wrapped type `any[]`. @@ -5359,7 +5364,7 @@ declare module _ { * Wrapped type `any[]`. * @see _.first **/ - first(): _ChainSingle; + first(): _ChainSingle; /** * Wrapped type `any[]`. @@ -5765,13 +5770,13 @@ declare module _ { * Wrapped type `any[]`. * @see _.matches **/ - matches(): _Chain; + matches(): _Chain; /** * Wrapped type `any[]`. * @see _.matcher **/ - matcher(): _Chain; + matcher(): _Chain; /** * Wrapped type `string`. diff --git a/underscore/underscore-tests.ts b/underscore/underscore-tests.ts index d3a5729022..f5e8e984ef 100644 --- a/underscore/underscore-tests.ts +++ b/underscore/underscore-tests.ts @@ -212,7 +212,7 @@ interface Family { name: string; relation: string; } -var isUncleMoe = _.matches({ name: 'moe', relation: 'uncle' }); +var isUncleMoe = _.matches({ name: 'moe', relation: 'uncle' }); _.filter([{ name: 'larry', relation: 'father' }, { name: 'moe', relation: 'uncle' }], isUncleMoe); From d6bf165b66ae9fb11b8080eed64fba18207b7d54 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Mon, 6 Mar 2017 11:04:25 +0100 Subject: [PATCH 070/567] Underscore: Updated version number (I've done it before: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/11117) --- underscore/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/underscore/index.d.ts b/underscore/index.d.ts index f0f6784de3..856bf8e0fa 100644 --- a/underscore/index.d.ts +++ b/underscore/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Underscore 1.7.0 +// Type definitions for Underscore 1.8 // Project: http://underscorejs.org/ // Definitions by: Boris Yankov , Josh Baldwin , Christopher Currens // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From eadbc0cd3badb6f402d66311b171e57d860f0b84 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Mon, 6 Mar 2017 15:32:29 +0100 Subject: [PATCH 071/567] async: Various fixes, mostly related to strict-nulls. Also some places where the error type was wrong. --- async/index.d.ts | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/async/index.d.ts b/async/index.d.ts index e3fbe7e512..7f71f3b9bc 100644 --- a/async/index.d.ts +++ b/async/index.d.ts @@ -6,17 +6,16 @@ interface Dictionary { [key: string]: T; } interface ErrorCallback { (err?: T): void; } -interface AsyncWaterfallCallback { (err: E, ...args: any[]): void; } -interface AsyncBooleanResultCallback { (err: E, truthValue: boolean): void; } -interface AsyncResultCallback { (err: E, result: T): void; } -interface AsyncResultArrayCallback { (err: E, results: T[]): void; } -interface AsyncResultObjectCallback { (err: E, results: Dictionary): void; } +interface AsyncBooleanResultCallback { (err?: E, truthValue?: boolean): void; } +interface AsyncResultCallback { (err?: E, result?: T): void; } +interface AsyncResultArrayCallback { (err?: E, results?: (T | undefined)[]): void; } +interface AsyncResultObjectCallback { (err: E | undefined, results: Dictionary): void; } -interface AsyncFunction { (callback: (err?: E, result?: T) => void): void; } +interface AsyncFunction { (callback: (err?: E, result?: T) => void): any; } interface AsyncIterator { (item: T, callback: ErrorCallback): void; } interface AsyncForEachOfIterator { (item: T, key: number|string, callback: ErrorCallback): void; } interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; } -interface AsyncMemoIterator { (memo: R, item: T, callback: AsyncResultCallback): void; } +interface AsyncMemoIterator { (memo: R | undefined, item: T, callback: AsyncResultCallback): void; } interface AsyncBooleanIterator { (item: T, callback: AsyncBooleanResultCallback): void; } interface AsyncWorker { (task: T, callback: ErrorCallback): void; } @@ -76,7 +75,7 @@ interface AsyncPriorityQueue { interface AsyncCargo { length(): number; - payload: number; + payload?: number; push(task: any, callback? : Function): void; push(task: any[], callback? : Function): void; saturated(): void; @@ -186,25 +185,25 @@ interface Async { cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo; auto(tasks: any, concurrency?: number, callback?: AsyncResultCallback): void; autoInject(tasks: any, callback?: AsyncResultCallback): void; - retry(opts: number, task: (callback : AsyncResultCallback, results: any) => void, callback: AsyncResultCallback): void; - retry(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback, results : any) => void, callback: AsyncResultCallback): void; - retryable(opts: number | {times: number, interval: number}, task: AsyncFunction): AsyncFunction; - apply(fn: Function, ...arguments: any[]): AsyncFunction; + retry(opts: number, task: (callback : AsyncResultCallback, results: any) => void, callback: AsyncResultCallback): void; + retry(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback, results : any) => void, callback: AsyncResultCallback): void; + retryable(opts: number | {times: number, interval: number}, task: AsyncFunction): AsyncFunction; + apply(fn: Function, ...arguments: any[]): AsyncFunction; nextTick(callback: Function, ...args: any[]): void; setImmediate: typeof async.nextTick; - reflect(fn: AsyncFunction) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void; - reflectAll(tasks: AsyncFunction[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[]; + reflect(fn: AsyncFunction) : (callback: (err: null, result: {error?: E, value?: T}) => void) => void; + reflectAll(tasks: AsyncFunction[]): ((callback: (err: undefined, result: {error?: E, value?: T}) => void) => void)[]; - timeout(fn: AsyncFunction, milliseconds: number, info?: any): AsyncFunction; - timeout(fn: AsyncResultIterator, milliseconds: number, info?: any): AsyncResultIterator; + timeout(fn: AsyncFunction, milliseconds: number, info?: any): AsyncFunction; + timeout(fn: AsyncResultIterator, milliseconds: number, info?: any): AsyncResultIterator; times (n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; timesSeries(n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; timesLimit(n: number, limit: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; transform(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void; - transform(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void; + transform(arr: T[], acc: R[], iteratee: (acc: R[] | null, item: T | undefined[], key?: string, callback?: (error?: E) => void) => void): void; transform(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void; transform(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void; @@ -226,4 +225,3 @@ declare var async: Async; declare module "async" { export = async; } - From 66bd4290746e62eea9af862b46c22756c61e853a Mon Sep 17 00:00:00 2001 From: Steve Purol Date: Mon, 6 Mar 2017 14:11:17 -0500 Subject: [PATCH 072/567] recompose: withHandlers may take a factory function --- recompose/index.d.ts | 5 +++-- recompose/recompose-tests.tsx | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/recompose/index.d.ts b/recompose/index.d.ts index 3ff504fab3..6cef47160e 100644 --- a/recompose/index.d.ts +++ b/recompose/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Recompose v0.20.3 +// Type definitions for Recompose v0.22.0 // Project: https://github.com/acdlite/recompose // Definitions by: Iskander Sierra // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -50,8 +50,9 @@ declare module 'recompose' { type HandleCreators = { [handlerName: string]: mapper; }; + type HandleCreatorsFactory = (initialProps: TOutter) => HandleCreators; export function withHandlers( - handlerCreators: HandleCreators + handlerCreators: HandleCreators | HandleCreatorsFactory ): ComponentEnhancer; // defaultProps: https://github.com/acdlite/recompose/blob/master/docs/API.md#defaultprops diff --git a/recompose/recompose-tests.tsx b/recompose/recompose-tests.tsx index c4c66b3e2c..01bd1d28f5 100644 --- a/recompose/recompose-tests.tsx +++ b/recompose/recompose-tests.tsx @@ -73,6 +73,12 @@ function testWithHandlers() { onSubmit: (props: OutterProps) => (e: any) => {}, }); const enhanced: React.ComponentClass = enhancer(innerComponent); + + const enhancer2 = withHandlers((props: OutterProps) => ({ + onChange: (props: OutterProps) => (e: any) => {}, + onSubmit: (props: OutterProps) => (e: any) => {}, + })); + const enhanced2: React.ComponentClass = enhancer2(innerComponent); } function testDefaultProps() { From 53fd6a1051a5b6a74f9c5e1335e7286e30adb960 Mon Sep 17 00:00:00 2001 From: sqwk Date: Mon, 6 Mar 2017 23:19:10 +0100 Subject: [PATCH 073/567] Update Lowdb Test --- lowdb/index.d.ts | 1073 +++++++++++++++++++++--------------------- lowdb/lowdb-tests.ts | 5 +- 2 files changed, 547 insertions(+), 531 deletions(-) diff --git a/lowdb/index.d.ts b/lowdb/index.d.ts index ddd20e89ed..2beda1e2ba 100644 --- a/lowdb/index.d.ts +++ b/lowdb/index.d.ts @@ -1,536 +1,553 @@ -declare module 'lowdb' { - interface PromiseLike { - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; - } - - interface StringRepresentable { - toString(): string; - } - - interface List { - [index: number]: T; - length: number; - } - - interface Dictionary { - [index: string]: T; - } - - interface DictionaryIterator { - (value: T, key?: string, collection?: Dictionary): TResult; - } - - interface ListIterator { - (value: T, index: number, collection: List): TResult; - } - - interface StringIterator { - (char: string, index?: number, string?: string): TResult; - } - - interface MixinOptions { - chain?: boolean; - } - - interface LoDashWrapper { - - /** - * @see _.has - */ - has(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; - - /** - * @see _.hasIn - */ - hasIn(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; - - /** - * @see _.assign - */ - assign( - source: TSource - ): LoDashWrapper; - - /** - * @see _.assign - */ - assign( - source1: TSource1, - source2: TSource2 - ): LoDashWrapper; - - /** - * @see _.assign - */ - assign( - source1: TSource1, - source2: TSource2, - source3: TSource3 - ): LoDashWrapper; - - /** - * @see _.assign - */ - assign( - source1: TSource1, - source2: TSource2, - source3: TSource3, - source4: TSource4 - ): LoDashWrapper; - - /** - * @see _.assign - */ - assign(): LoDashWrapper; - - /** - * @see _.assign - */ - assign(...otherArgs: any[]): LoDashWrapper; - - /** - * @see _.cloneDeep - */ - cloneDeep(): LoDashWrapper; - - /** - * @see _.cloneDeep - */ - cloneDeep(): LoDashWrapper; - - /** - * @see _.cloneDeep - */ - cloneDeepWith(customizer: (value: any) => any): LoDashWrapper[]; - - /** - * @see _.cloneDeep - */ - cloneDeepWith(customizer: (value: any) => any): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults( - source1: S1, - ...sources: {}[] - ): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults( - source1: S1, - source2: S2, - ...sources: {}[] - ): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults( - source1: S1, - source2: S2, - source3: S3, - ...sources: {}[] - ): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults( - source1: S1, - source2: S2, - source3: S3, - source4: S4, - ...sources: {}[] - ): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults(): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults(...sources: {}[]): LoDashWrapper; - - /** - * @see _.get - */ - get(object: Object, - path: string | number | boolean | Array, - defaultValue?: TResult - ): LoDashWrapper; - - /** - * @see _.get - */ - get(path: string | number | boolean | Array, - defaultValue?: TResult - ): LoDashWrapper; - - - /** - * @see _.mixin - */ - mixin( - source: Dictionary, - options?: MixinOptions - ): LoDashWrapper; - - /** - * @see _.mixin - */ - mixin( - options?: MixinOptions - ): LoDashWrapper; - - /** - * @see _.set - */ - set( - path: StringRepresentable | StringRepresentable[], - value: any - ): LoDashWrapper; - - /** - * @see _.set - */ - set( - path: StringRepresentable | StringRepresentable[], - value: V - ): LoDashWrapper; - - /** - * @see _.find - */ - find( - predicate?: ListIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.find - */ - find( - predicate?: string, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.find - */ - find( - predicate?: TObject - ): LoDashWrapper; - - /** - * @see _.find - */ - filter( - predicate?: TObject - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter( - predicate?: ListIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter( - predicate: string, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter( - predicate: ListIterator | DictionaryIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter( - predicate?: StringIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter(predicate: W): LoDashWrapper; - /** - * @see _.map - */ - map( - iteratee?: ListIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.map - */ - map( - iteratee?: string - ): LoDashWrapper; - - /** - * @see _.map - */ - map( - iteratee?: TObject - ): LoDashWrapper; - /** - * @see _.map - */ - map( - iteratee?: ListIterator | DictionaryIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.range - */ - range( - end?: number, - step?: number - ): LoDashWrapper; - - /** - * @see _.rangeRight - */ - rangeRight( - end?: number, - step?: number - ): LoDashWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: ListIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: string, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: W - ): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy( - iteratee?: ListIterator - ): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy(iteratee: string): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy(whereValue: W): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy(): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy(...iteratees: (ListIterator | Object | string)[]): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy(iteratees: (ListIterator | string | Object)[]): LoDashWrapper; - - /** - * @see _.slice - */ - slice( - start?: number, - end?: number - ): LoDashWrapper; - - /** - * @see _.size - */ - size(): LoDashWrapper; - - /** - * @see _.take - */ - take(n?: number): LoDashWrapper; - - /** - * @see _.times - */ - times( - iteratee: (num: number) => TResult - ): LoDashWrapper; - - /** - * @see _.times - */ - times(): LoDashWrapper; - - /** - * @see _.uniqueId - */ - uniqueId(): LoDashWrapper; - - value(): T; - - pop(): T; - push(...items: T[]): LoDashWrapper; - shift(): T; - sort(compareFn?: (a: T, b: T) => number): LoDashWrapper; - splice(start: number): LoDashWrapper; - splice(start: number, deleteCount: number, ...items: any[]): LoDashWrapper; - unshift(...items: T[]): LoDashWrapper; - } - - interface Storage { - /** - * Reads the database. - * - * @param source The source location. - * @param deserialize The deserialize function to apply. - * @return Returns a promise with the deserialized db object. - */ - read?(source: string, deserialize: any): PromiseLike - /** - * Reads the database. - * - * @param source The source location. - * @param deserialize The deserialize function to apply. - * @return Returns the deserialized db object. - */ - read?(source: string, deserialize: any): Object - /** - * Writes to the database. - * - * @param destination The destination location. - * @param obj The object to write. - * @param serialize The serialize function to apply. - */ - write?(destination: string, obj: any, serialize: any): void - /** - * Writes to the database. - * - * @param destination The destination location. - * @param obj The object to write. - * @param serialize The serialize function to apply. - */ - write?(destination: string, obj: any, serialize: any): PromiseLike - } - - interface Format { - /** - * Writes to the database. - * - * @param obj The object to serialize. - * @return Returns the serialized object string. - */ - serialize(obj: Object): string - /** - * Writes to the database. - * - * @param data The object to deserialize. - * @return Returns the deserialized object. - */ - deserialize(data: string): Object - } - - interface Options { - /** - * The custom "storage" object. - */ - storage?: Storage - /** - * The custom "format" object. - */ - format?: Format - /** - * The flag to automatically persist changes. - */ - writeOnChange?: boolean - } - - export interface Low extends LoDashWrapper, Format { - /** - * Access current database state. - * Returns Returns the database state. - */ - getState(): Object - /** - * Drop or reset database state. - * @param newState New state of the database - */ - setState(newState: Object): void - /** - * Persist database. - * @param source The source location. - */ - write(source: string): void - /** - * Persist database. - * @param source The source location. - */ - write(source: string): PromiseLike - /** - * Read database. - * @param source The source location. - */ - read(source?: string): Object - /** - * Read database. - * @param source The source location. - */ - read(source?: string): PromiseLike +declare namespace lowdb { + + interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; + } + + interface StringRepresentable { + toString(): string; + } + + interface List { + [index: number]: T; + length: number; + } + + interface Dictionary { + [index: string]: T; + } + + interface DictionaryIterator { + (value: T, key?: string, collection?: Dictionary): TResult; + } + + interface ListIterator { + (value: T, index: number, collection: List): TResult; + } + + interface StringIterator { + (char: string, index?: number, string?: string): TResult; + } + + interface MixinOptions { + chain?: boolean; + } + + class LoDashWrapper { + + /** + * @see _.has + */ + has(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; + + /** + * @see _.hasIn + */ + hasIn(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source: TSource + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source1: TSource1, + source2: TSource2 + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3 + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4 + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign(): LoDashWrapper; + + /** + * @see _.assign + */ + assign(...otherArgs: any[]): LoDashWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep(): LoDashWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep(): LoDashWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeepWith(customizer: (value: any) => any): LoDashWrapper[]; + + /** + * @see _.cloneDeep + */ + cloneDeepWith(customizer: (value: any) => any): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults(): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults(...sources: {}[]): LoDashWrapper; + + /** + * @see _.get + */ + get(object: Object, + path: string | number | boolean | Array, + defaultValue?: TResult + ): LoDashWrapper; + + /** + * @see _.get + */ + get(path: string | number | boolean | Array, + defaultValue?: TResult + ): LoDashWrapper; + + + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): LoDashWrapper; + + /** + * @see _.mixin + */ + mixin( + options?: MixinOptions + ): LoDashWrapper; + + /** + * @see _.set + */ + set( + path: StringRepresentable | StringRepresentable[], + value: any + ): LoDashWrapper; + + /** + * @see _.set + */ + set( + path: StringRepresentable | StringRepresentable[], + value: V + ): LoDashWrapper; + + /** + * @see _.find + */ + find( + predicate?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.find + */ + find( + predicate?: string, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.find + */ + find( + predicate?: TObject + ): LoDashWrapper; + + /** + * @see _.find + */ + filter( + predicate?: TObject + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate: ListIterator | DictionaryIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate?: StringIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashWrapper; + /** + * @see _.map + */ + map( + iteratee?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashWrapper; + /** + * @see _.map + */ + map( + iteratee?: ListIterator | DictionaryIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.range + */ + range( + end?: number, + step?: number + ): LoDashWrapper; + + /** + * @see _.rangeRight + */ + rangeRight( + end?: number, + step?: number + ): LoDashWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator + ): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(...iteratees: (ListIterator | Object | string)[]): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratees: (ListIterator | string | Object)[]): LoDashWrapper; + + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashWrapper; + + /** + * @see _.size + */ + size(): LoDashWrapper; + + /** + * @see _.take + */ + take(n?: number): LoDashWrapper; + + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult + ): LoDashWrapper; + + /** + * @see _.times + */ + times(): LoDashWrapper; + + /** + * @see _.uniqueId + */ + uniqueId(): LoDashWrapper; + + value(): T; + + pop(): T; + push(...items: T[]): LoDashWrapper; + shift(): T; + sort(compareFn?: (a: T, b: T) => number): LoDashWrapper; + splice(start: number): LoDashWrapper; + splice(start: number, deleteCount: number, ...items: any[]): LoDashWrapper; + unshift(...items: T[]): LoDashWrapper; + } + + export interface Storage { + + /** + * Reads the database. + * + * @param source The source location. + * @param deserialize The deserialize function to apply. + * @return Returns a promise with the deserialized db object. + */ + read?(source: string, deserialize: any): PromiseLike + + /** + * Reads the database. + * + * @param source The source location. + * @param deserialize The deserialize function to apply. + * @return Returns the deserialized db object. + */ + read?(source: string, deserialize: any): Object + + /** + * Writes to the database. + * + * @param destination The destination location. + * @param obj The object to write. + * @param serialize The serialize function to apply. + */ + write?(destination: string, obj: any, serialize: any): void + + /** + * Writes to the database. + * + * @param destination The destination location. + * @param obj The object to write. + * @param serialize The serialize function to apply. + */ + write?(destination: string, obj: any, serialize: any): PromiseLike + } + + export interface Format { + + /** + * Writes to the database. + * + * @param obj The object to serialize. + * @return Returns the serialized object string. + */ + serialize(obj: Object): string + + /** + * Writes to the database. + * + * @param data The object to deserialize. + * @return Returns the deserialized object. + */ + deserialize(data: string): Object + } + + export interface Options { + + /** + * The custom "storage" object. + */ + storage?: Storage + + /** + * The custom "format" object. + */ + format?: Format + + /** + * The flag to automatically persist changes. + */ + writeOnChange?: boolean + + } + + export class Low extends LoDashWrapper { + + constructor(filePath: string, options?: Options); + + /** + * Access current database state. + * Returns Returns the database state. + */ + getState(): Object + + /** + * Drop or reset database state. + * @param newState New state of the database + */ + setState(newState: Object): void + + /** + * Persist database. + * @param source The source location. + */ + write(source: string): void + + /** + * Persist database. + * @param source The source location. + */ + write(source: string): PromiseLike + + /** + * Read database. + * @param source The source location. + */ + read(source?: string): Object + + /** + * Read database. + * @param source The source location. + */ + read(source?: string): PromiseLike + } // declare class lowdb { // new (source?: string, opts?: Options): Low; // (source?: string, opts?: Options) : Low; // } - -// declare module "lowdb" { -// export = lowdb; -// } - } +declare module "lowdb" { + export = lowdb.Low; +} \ No newline at end of file diff --git a/lowdb/lowdb-tests.ts b/lowdb/lowdb-tests.ts index d656c63b62..612288e8dd 100644 --- a/lowdb/lowdb-tests.ts +++ b/lowdb/lowdb-tests.ts @@ -1,9 +1,8 @@ import Lowdb = require('lowdb'); -Lowdb -let db = new Lowdb(); +const db = new Lowdb('db.json'); -db.defaults({ 'someObject': {}, 'anotherObject': {} }).value(); +db.defaults({ someObject: {}, anotherObject: {} }).value(); db.get('someObject').set('foo' , 'bar').value(); db.get('anotherObject').set('foo' , 'bar').value(); From 8bfb64811e76ee7217a78ae355ae6e6d8c6802fb Mon Sep 17 00:00:00 2001 From: sqwk Date: Mon, 6 Mar 2017 23:40:18 +0100 Subject: [PATCH 074/567] Update Lowdb Test --- lowdb/index.d.ts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lowdb/index.d.ts b/lowdb/index.d.ts index 2beda1e2ba..4118372647 100644 --- a/lowdb/index.d.ts +++ b/lowdb/index.d.ts @@ -1,3 +1,8 @@ +// Type definitions for Lowdb 0.15 +// Project: https://github.com/typicode/lowdb +// Definitions by: typicode, +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare namespace lowdb { interface PromiseLike { @@ -167,7 +172,7 @@ declare namespace lowdb { /** * @see _.get */ - get(object: Object, + get(object: any, path: string | number | boolean | Array, defaultValue?: TResult ): LoDashWrapper; @@ -184,7 +189,7 @@ declare namespace lowdb { * @see _.mixin */ mixin( - source: Dictionary, + source: Dictionary<() => void>, options?: MixinOptions ): LoDashWrapper; @@ -370,12 +375,12 @@ declare namespace lowdb { /** * @see _.sortBy */ - sortBy(...iteratees: (ListIterator | Object | string)[]): LoDashWrapper; + sortBy(...iteratees: (ListIterator | any | string)[]): LoDashWrapper; /** * @see _.sortBy */ - sortBy(iteratees: (ListIterator | string | Object)[]): LoDashWrapper; + sortBy(iteratees: (ListIterator | string | any)[]): LoDashWrapper; /** * @see _.slice @@ -441,7 +446,7 @@ declare namespace lowdb { * @param deserialize The deserialize function to apply. * @return Returns the deserialized db object. */ - read?(source: string, deserialize: any): Object + read?(source: string, deserialize: any): {} /** * Writes to the database. @@ -470,7 +475,7 @@ declare namespace lowdb { * @param obj The object to serialize. * @return Returns the serialized object string. */ - serialize(obj: Object): string + serialize(obj: any): string /** * Writes to the database. @@ -478,7 +483,7 @@ declare namespace lowdb { * @param data The object to deserialize. * @return Returns the deserialized object. */ - deserialize(data: string): Object + deserialize(data: string): any } export interface Options { @@ -508,13 +513,13 @@ declare namespace lowdb { * Access current database state. * Returns Returns the database state. */ - getState(): Object + getState(): any /** * Drop or reset database state. * @param newState New state of the database */ - setState(newState: Object): void + setState(newState: any): void /** * Persist database. @@ -532,13 +537,13 @@ declare namespace lowdb { * Read database. * @param source The source location. */ - read(source?: string): Object + read(source?: string): any /** * Read database. * @param source The source location. */ - read(source?: string): PromiseLike + read(source?: string): PromiseLike } From 393a3b4b8f777b405adaffcc7917b482e576aa7e Mon Sep 17 00:00:00 2001 From: Dasa Paddock Date: Mon, 6 Mar 2017 16:42:06 -0800 Subject: [PATCH 075/567] Update for ArcGIS API for JavaScript version 4.3 --- arcgis-js-api/index.d.ts | 1961 +++++++++++++++++++++++++++++++++++--- 1 file changed, 1814 insertions(+), 147 deletions(-) diff --git a/arcgis-js-api/index.d.ts b/arcgis-js-api/index.d.ts index 87df41a8d8..293c5190e9 100644 --- a/arcgis-js-api/index.d.ts +++ b/arcgis-js-api/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ArcGIS API for JavaScript 4.2 +// Type definitions for ArcGIS API for JavaScript 4.3 // Project: http://js.arcgis.com // Definitions by: Esri // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -32,14 +32,19 @@ declare namespace JSX { declare namespace __esri { export class Accessor { + constructor(obj?: any); + destroyed: boolean; initialized: boolean; declaredClass: string; destroy(): void; + get(propertyName: string): T; get(propertyName: string): any; set(propertyName: string, value: T): this; set(props: HashMap): this; + watch(path: string | string[], callback: WatchCallback, sync?: boolean): WatchHandle; + protected notifyChange(propertyName: string): void; protected _get(propertyName: string): any; protected _get(propertyName: string): T; @@ -69,18 +74,521 @@ declare namespace __esri { remove(): void; } + export interface EachAlwaysResult { + promise: IPromise; + value: any; + error: any; + } + export interface PausableWatchHandle { remove(): void; pause(): void; resume(): void; } + export interface FeatureEditResult { + objectId: number; + error: any; + } + export interface AttributeParamValue { attributeName: string; parameterName: string; value: string; } + export interface DataWorkspace { + id: string; + name: string; + } + + export interface GroupMembership { + id: number; + name: string; + } + + export interface HoldType { + description: string; + id: number; + name: string; + } + + export interface JobPriority { + description: string; + name: string; + value: number; + } + + export interface JobQuery { + id: number; + name: string; + } + + export interface JobStatus { + caption: string; + description: string; + id: number; + name: string; + } + + export interface JobQueryContainer { + containers: JobQueryContainer[]; + id: number; + name: string; + queries: JobQuery[]; + } + + export interface JobQueryDetails { + aliases: string[]; + fields: string[]; + id: number; + name: string; + orderBy: string; + tables: string[]; + where: string; + } + + export interface Privilege { + description: string; + id: number; + name: string; + } + + export interface UserDetails { + lastName: string; + address: string; + faxNumber: string; + firstName: string; + fullName: string; + groups: GroupMembership[]; + email: string; + phoneNumber: string; + privileges: Privilege[]; + roomNumber: string; + userName: string; + userQueries: JobQueryContainer[]; + zipCode: string; + } + + export interface VersionInfo { + access: string; + name: string; + parent: string; + } + + export interface WorkflowManagerServiceInfo { + jobPriorities: JobPriority[]; + activityTypes: ActivityType[]; + currentVersion: number; + dataWorkspaces: DataWorkspace[]; + holdTypes: HoldType[]; + configProperties: any; + jobStatuses: JobStatus[]; + jobTypes: JobType[]; + notificationTypes: NotificationType[]; + privileges: Privilege[]; + publicQueries: JobQueryContainer[]; + } + + export interface JobType { + category: string; + description: string; + id: string; + name: string; + state: string; + } + + export interface JobTypeDetails { + defaultParentVersionName: string; + autoExecuteCreatedJobs: boolean; + category: string; + defaultAssignedTo: string; + defaultAssignedType: string; + defaultDataWorkspaceId: string; + defaultDescription: string; + defaultDueDate: string; + defaultJobDuration: number; + canDataWorkspaceChange: boolean; + defaultPriority: string; + defaultStartDate: Date; + description: string; + id: string; + jobNamingScheme: string; + jobVersionNamingScheme: string; + mxdNamingScheme: string; + name: string; + state: string; + } + + export interface TableRelationship { + cardinality: string; + linkField: string; + tableAlias: string; + tableName: string; + } + + export interface JobCreationParameters { + loi: Geometry; + assignedTo: string; + autoCommitWorkflow: boolean; + autoExecute: boolean; + dataWorkspaceId: string; + description: string; + dueDate: Date; + jobTypeId: number; + assignedType: string; + name: string; + numJobs: string; + ownedBy: string; + parentJobId: number; + parentVersion: string; + priority: number; + startDate: Date; + user: string; + } + + export interface JobQueryParameters { + aliases: string; + fields: string; + orderBy: string; + tables: string; + where: string; + user: string; + } + + export interface JobUpdateParameters { + ownedBy: string; + assignedTo: string; + dataWorkspaceId: string; + description: string; + dueDate: Date; + loi: Geometry; + jobId: number; + name: string; + assignedType: string; + parentJobId: number; + parentVersion: string; + percent: number; + priority: number; + startDate: Date; + status: number; + versionName: string; + user: string; + } + + export interface AuxRecordDescription { + properties: any; + recordId: number; + tableName: string; + } + + export interface ActivityType { + desription: string; + id: number; + message: string; + name: string; + } + + export interface AuxRecordContainer { + records: AuxRecord; + relationshipType: string; + tableAlias: string; + tableName: string; + } + + export interface JobTaskJobInfo { + name: string; + assignedTo: string; + childJobIds: number[]; + createdBy: string; + createdDate: Date; + dataWorkspaceId: string; + description: string; + dueDate: Date; + endDate: Date; + id: number; + jobTypeId: number; + loi: Geometry; + assignedType: string; + ownedBy: string; + parentJobId: number; + parentVersion: string; + pendingDays: number; + percentageComplete: number; + priority: number; + stage: string; + startDate: Date; + status: number; + versionExists: boolean; + versionInfo: JobVersionInfo; + versionName: string; + } + + export interface QueryResult { + fields: QueryFieldInfo[]; + rows: string[]; + } + + export interface AuxRecord { + displayProperty: any; + id: number; + recordvalues: AuxRecordValue; + } + + export interface AuxRecordValue { + filter: string; + alias: string; + data: any; + dataType: string; + displayOrder: number; + displayType: string; + domain: string; + canUpdate: boolean; + length: number; + name: string; + required: boolean; + tableListClass: string; + tableListDisplayField: string; + tableListStoreField: string; + userVisible: boolean; + } + + export interface FieldValue { + description: string; + value: any; + } + + export interface JobVersionInfo { + dataWorkspaceId: string; + name: string; + parent: string; + created: boolean; + owner: string; + } + + export interface QueryFieldInfo { + alias: string; + length: string; + name: string; + type: string; + } + + export interface JobAttachment { + filename: string; + folder: string; + id: number; + storageType: string; + } + + export interface JobDependency { + depJobId: number; + depOnType: string; + depOnValue: string; + heldOnValue: number; + holdOnType: string; + id: number; + jobID: string; + } + + export interface ChangeRule { + description: string; + evaluators: any[]; + id: number; + name: string; + notifier: any; + summarize: boolean; + } + + export interface DataSetEvaluator { + dataSetConfigurations: DatasetConfiguration[]; + name: string; + type: string; + } + + export interface AOIEvaluator { + aoi: Polygon; + inverse: boolean; + name: string; + relation: string; + type: string; + useJobAOI: boolean; + } + + export interface DatasetConfiguration { + changeCondition: number; + changeFields: string; + dataset: string; + dataWorkspaceId: string; + name: string; + whereConditions: WhereCondition[]; + } + + export interface EmailNotifier { + attachJobAttachments: boolean; + message: string; + name: string; + senderEmail: string; + senderName: string; + subject: string; + subscribers: string[]; + type: string; + } + + export interface WhereCondition { + compareValue: any; + field: string; + operator: string; + } + + export interface NotificationType { + attachJobAttachments: boolean; + id: number; + message: string; + senderEmail: string; + senderName: string; + subject: string; + subscribers: string[]; + type: string; + } + + export interface ChangeRuleMatch { + changeTime: Date; + changeType: string; + dataset: string; + dataWorkspaceId: string; + id: string; + jobID: string; + ruleID: string; + } + + export interface ReportDataGroup { + aggregateLabel: string; + aggregateValue: string; + row: string[]; + value: string; + } + + export interface ReportData { + columns: string[]; + description: string; + groups: ReportDataGroup[]; + title: string; + } + + export interface Report { + description: string; + hierarchy: string; + id: number; + name: string; + title: string; + } + + export interface ExecuteInfo { + conflicts: WorkflowConflicts; + errorCode: number; + errorDescription: string; + executionResult: string; + hasConflicts: boolean; + hasReturnCode: boolean; + jobID: number; + returnCode: number; + stepID: number; + threwError: boolean; + } + + export interface Step { + hasBeenExecuted: boolean; + assignedTo: string; + async: boolean; + autoRun: boolean; + canSkip: boolean; + canSpawnConcurrency: boolean; + commonId: number; + defaultPercentComplete: number; + assignedType: string; + hasBeenStarted: boolean; + id: number; + name: string; + selfCheck: boolean; + statusId: number; + stepPercentComplete: number; + notificationType: string; + stepType: StepType; + } + + export interface StepType { + program: string; + arguments: string; + executionType: string; + id: number; + name: string; + description: string; + stepDescriptionLink: string; + stepDescriptionType: string; + stepIndicatorType: string; + supportedPlatform: string; + visible: boolean; + } + + export interface WorkflowDisplayDetails { + annotations: WorkflowAnnotationDisplayDetails[]; + paths: WorkflowPathDisplayDetails[]; + steps: WorkflowStepDisplayDetails[]; + } + + export interface WorkflowOption { + returnCode: number; + steps: WorkflowStepInfo[]; + } + + export interface WorkflowStepInfo { + id: number; + name: string; + } + + export interface WorkflowAnnotationDisplayDetails { + centerX: number; + centerY: number; + fillColor: any; + height: number; + label: string; + labelColor: any; + OutlineColor: any; + width: number; + } + + export interface WorkflowConflicts { + jobID: number; + options: WorkflowOption[]; + spawnsConcurrency: boolean; + stepId: number; + } + + export interface WorkflowPathDisplayDetails { + destStepId: number; + sourceStepID: number; + label: string; + labelColor: any; + labelX: number; + labelY: number; + lineColor: any; + pathObject: any; + } + + export interface WorkflowStepDisplayDetails { + labelColor: any; + centerX: number; + fillColor: any; + height: number; + label: string; + centerY: number; + OutlineColor: any; + shape: string; + stepId: number; + stepType: string; + width: number; + } + export interface ExternalRenderer { setup(): void; render(): void; @@ -139,26 +647,6 @@ declare namespace __esri { suggestionTemplate: string; } - export interface SearchViewModelLocatorSource { - categories: string[]; - countryCode: string; - localSearchOptions: any; - locationToAddressDistance: number; - searchTemplate: string; - locator: Locator; - singleLineFieldName: string; - } - - export interface SearchViewModelFeatureLayerSource { - displayField: string; - exactMatch: boolean; - featureLayer: FeatureLayer; - searchFields: string[]; - searchQueryParams: any; - suggestQueryParams: any; - suggestionTemplate: string; - } - export type GetHeader = (headerName: string) => string; export type WatchCallback = (newValue: any, oldValue: any, propertyName: string, target: Accessor) => void; @@ -282,11 +770,33 @@ declare namespace __esri { offset?: number; } + export interface FeatureLayerApplyEditsEdits { + addFeatures?: Graphic[]; + updateFeatures?: Graphic[]; + deleteFeatures?: Graphic[] | any[]; + } + + export interface FeatureLayerCapabilities { + operations: FeatureLayerCapabilitiesOperations; + } + + export interface FeatureLayerCapabilitiesOperations { + supportsAdd: boolean; + supportsDelete: boolean; + supportsUpdate: boolean; + supportsEditing: boolean; + supportsQuery: boolean; + } + export interface FeatureLayerElevationInfo { mode: string; offset?: number; } + export interface FeatureLayerGetFieldDomainOptions { + feature: Graphic; + } + export interface GraphicsLayerElevationInfo { mode: string; offset?: number; @@ -306,6 +816,21 @@ declare namespace __esri { offset?: number; } + export interface StreamLayerFilter { + geometry: Extent; + where: string; + } + + export interface StreamLayerPurgeOptions { + displayCount: number; + age: number; + } + + export interface StreamLayerUpdateFilterFilterChanges { + geometry: Extent; + where: string; + } + export interface VectorTileLayerCurrentStyleInfo { serviceUrl: string; styleUrl: string; @@ -382,6 +907,14 @@ declare namespace __esri { label: string; } + export interface PointCloudRendererPointSizeAlgorithm { + type: string; + useRealWorldSymbolSizes: boolean; + size: number; + scaleFactor: number; + minSize: number; + } + export interface PointCloudClassBreaksRendererColorClassBreakInfos { minValue: number; maxValue: number; @@ -422,8 +955,8 @@ declare namespace __esri { } export interface Symbol3DStyleOrigin { - styleName: string; - styleUrl: string; + styleName?: string; + styleUrl?: string; name: string; } @@ -508,6 +1041,294 @@ declare namespace __esri { tolerance: number; } + export interface ConfigurationTaskGetDataWorkspaceDetailsParams { + dataWorkspaceId: string; + user: string; + } + + export interface ConfigurationTaskGetUserJobQueryDetailsParams { + queryId: number; + user: string; + } + + export interface JobTaskAddEmbeddedAttachmentParams { + jobId: number; + form: any; + user: string; + } + + export interface JobTaskAddLinkedAttachmentParams { + jobId: number; + attachmentType: number; + path: string; + user: string; + } + + export interface JobTaskAddLinkedRecordParams { + jobId: number; + tableName: string; + user: string; + } + + export interface JobTaskAssignJobsParams { + jobIds: number[]; + assignedType: string; + assignedTo: string; + user: string; + } + + export interface JobTaskCloseJobsParams { + jobIds: number[]; + user: string; + } + + export interface JobTaskCreateDependencyParams { + jobId: number; + heldOnType: string; + heldOnValue: number; + depJobId: number; + depOnType: string; + depOnValue: number; + user: string; + } + + export interface JobTaskCreateHoldParams { + jobId: number; + holdTypeId: number; + comments: string; + user: string; + } + + export interface JobTaskCreateJobVersionParams { + jobId: number; + name: string; + parent: string; + user: string; + } + + export interface JobTaskDeleteAttachmentParams { + jobId: number; + attachmentId: number; + user: string; + } + + export interface JobTaskDeleteDependencyParams { + jobId: number; + dependencyId: number; + user: string; + } + + export interface JobTaskDeleteJobsParams { + jobIds: number[]; + deleteHistory?: boolean; + user: string; + } + + export interface JobTaskDeleteLinkedRecordParams { + jobId: number; + tableName: string; + recordId: number; + user: string; + } + + export interface JobTaskGetAttachmentContentUrlParams { + jobId: number; + attachmentId: number; + } + + export interface JobTaskListFieldValuesParams { + jobId: number; + tableName: string; + field: string; + user: string; + } + + export interface JobTaskListMultiLevelFieldValuesParams { + field: string; + previousSelectedValues: string[]; + user: string; + } + + export interface JobTaskLogActionParams { + jobId: number; + activityTypeId: number; + comments: string; + user: string; + } + + export interface JobTaskQueryJobsParams { + queryId: number; + user: string; + } + + export interface JobTaskQueryMultiLevelSelectedValuesParams { + field: string; + user: string; + } + + export interface JobTaskReleaseHoldParams { + jobId: number; + holdId: number; + } + + export interface JobTaskReopenClosedJobsParams { + jobIds: number[]; + user: string; + } + + export interface JobTaskSearchJobsParams { + text: string; + user: string; + } + + export interface JobTaskUnassignJobsParams { + jobIds: number[]; + user: string; + } + + export interface JobTaskUpdateNotesParams { + jobId: number; + notes: string; + user: string; + } + + export interface JobTaskUpdateRecordParams { + jobId: number; + record: AuxRecordDescription; + user: string; + } + + export interface NotificationTaskAddChangeRuleParams { + rule: ChangeRule; + user: string; + } + + export interface NotificationTaskDeleteChangeRuleParams { + ruleId: string; + user: string; + } + + export interface NotificationTaskNotifySessionParams { + sessionid: string; + deleteAfter: boolean; + user: string; + } + + export interface NotificationTaskQueryChangeRulesParams { + name: string; + description: string; + searchType: string; + user: string; + } + + export interface NotificationTaskRunSpatialNotificationOnHistoryParams { + dataWorkspaceId: string; + from: Date; + to: Date; + logMatches: boolean; + send: boolean; + user: string; + } + + export interface NotificationTaskSendNotificationParams { + jobId: number; + notificationType: string; + user: string; + } + + export interface NotificationTaskSubscribeToNotificationParams { + notificationTypeId: number; + email: string; + user: string; + } + + export interface NotificationTaskUnsubscribeFromNotificationParams { + notificationTypeId: number; + email: string; + user: string; + } + + export interface ReportTaskGenerateReportParams { + reportId: number; + user: string; + } + + export interface ReportTaskGetReportContentUrlParams { + reportId: number; + user: number; + } + + export interface ReportTaskGetReportDataParams { + reportId: number; + user: string; + } + + export interface TokenTaskParseTokensParams { + jobId: any; + stringToParse: string; + user: string; + } + + export interface WorkflowTaskCanRunStepParams { + jobId: number; + stepId: number; + user: string; + } + + export interface WorkflowTaskExecuteStepsParams { + jobId: number; + stepIds: number[]; + auto: boolean; + user: string; + } + + export interface WorkflowTaskGetStepDescriptionParams { + jobId: number; + stepId: number; + } + + export interface WorkflowTaskGetStepFileUrlParams { + jobId: number; + stepId: number; + } + + export interface WorkflowTaskGetStepParams { + jobId: number; + stepId: number; + } + + export interface WorkflowTaskMarkStepsAsDoneParams { + jobId: number; + stepIds: number[]; + user: string; + } + + export interface WorkflowTaskMoveToNextStepParams { + jobId: number; + stepId: number; + returnCode: number; + user: string; + } + + export interface WorkflowTaskRecreateWorkflowParams { + jobId: number; + user: string; + } + + export interface WorkflowTaskResolveConflictParams { + jobId: number; + stepId: number; + optionReturnCode: number; + optionStepIds: number[]; + user: string; + } + + export interface WorkflowTaskSetCurrentStepParams { + jobId: number; + stepId: number; + user: string; + } + export interface MapViewConstraints { lods?: LOD[]; minScale?: number; @@ -804,6 +1625,17 @@ declare namespace __esri { urlPrefix: string; } + export interface configWorkers { + loaderConfig: configWorkersLoaderConfig; + } + + export interface configWorkersLoaderConfig { + has: any; + paths: any; + map: any; + packages: any[]; + } + export interface requestEsriRequestOptions { callbackParamName?: string; query?: any; @@ -827,6 +1659,7 @@ declare namespace __esri { cast?: Function; readOnly?: boolean; aliasOf?: string; + value?: any; } export interface colorCreateContinuousRendererParams { @@ -895,21 +1728,22 @@ declare namespace __esri { title: string; } - export interface sizeCreateVisualVariableParams { + export interface sizeCreateVisualVariablesParams { layer: FeatureLayer | SceneLayer; field: string; normalizationField?: string; basemap?: string | Basemap; sizeScheme?: any | any | any; - legendOptions?: sizeCreateVisualVariableParamsLegendOptions; + legendOptions?: sizeCreateVisualVariablesParamsLegendOptions; statistics?: any; minValue?: number; maxValue?: number; view?: SceneView; worldScale?: boolean; + axis?: boolean; } - export interface sizeCreateVisualVariableParamsLegendOptions { + export interface sizeCreateVisualVariablesParamsLegendOptions { title: string; } @@ -972,6 +1806,7 @@ declare namespace __esri { } export interface univariateColorSizeCreateVisualVariablesParamsSizeOptions { + axis?: boolean; sizeScheme?: any | any | any; legendOptions?: univariateColorSizeCreateVisualVariablesParamsSizeOptionsLegendOptions; } @@ -1433,6 +2268,7 @@ declare namespace __esri { expand(factor: number): Extent; intersection(extent: Extent): Extent; intersects(geometry: Geometry): boolean; + normalize(): Extent[]; offset(dx: number, dy: number, dz: number): Extent; union(extent: Extent): Extent; } @@ -1519,6 +2355,7 @@ declare namespace __esri { copy(other: Point): void; distance(other: Point): number; equals(point: Point): boolean; + normalize(): Point; } interface PointConstructor { @@ -1556,6 +2393,9 @@ declare namespace __esri { interface PolygonConstructor { new(properties?: PolygonProperties): Polygon; + + fromExtent(extent: Extent): Polygon; + fromJSON(json: any): Polygon; } @@ -1873,6 +2713,7 @@ declare namespace __esri { } interface FeatureLayer extends Layer, PortalLayer, ScaleRangeLayer { + capabilities: FeatureLayerCapabilities; copyright: string; definitionExpression: string; elevationInfo: FeatureLayerElevationInfo; @@ -1898,7 +2739,9 @@ declare namespace __esri { url: string; version: number; + applyEdits(edits: FeatureLayerApplyEditsEdits): IPromise; createQuery(): Query; + getFieldDomain(fieldName: string, options?: FeatureLayerGetFieldDomainOptions): Domain; queryExtent(params?: Query): IPromise; queryFeatureCount(params?: Query): IPromise; queryFeatures(params?: Query): IPromise; @@ -1914,6 +2757,7 @@ declare namespace __esri { export const FeatureLayer: FeatureLayerConstructor; interface FeatureLayerProperties extends LayerProperties, PortalLayerProperties, ScaleRangeLayerProperties { + capabilities?: FeatureLayerCapabilities; copyright?: string; definitionExpression?: string; elevationInfo?: FeatureLayerElevationInfo; @@ -1940,6 +2784,26 @@ declare namespace __esri { version?: number; } + interface GeoRSSLayer extends Layer { + lineSymbol: SimpleLineSymbol; + pointSymbol: PictureMarkerSymbol; + polygonSymbol: SimpleFillSymbol; + url: string; + } + + interface GeoRSSLayerConstructor { + new(properties?: GeoRSSLayerProperties): GeoRSSLayer; + } + + export const GeoRSSLayer: GeoRSSLayerConstructor; + + interface GeoRSSLayerProperties extends LayerProperties { + lineSymbol?: SimpleLineSymbolProperties; + pointSymbol?: PictureMarkerSymbolProperties; + polygonSymbol?: SimpleFillSymbolProperties; + url?: string; + } + interface GraphicsLayer extends Layer, ScaleRangeLayer { elevationInfo: GraphicsLayerElevationInfo; graphics: Collection; @@ -2061,6 +2925,7 @@ declare namespace __esri { } interface SceneLayer extends Layer, SceneService, PortalLayer { + definitionExpression: string; elevationInfo: SceneLayerElevationInfo; fields: Field[]; geometryType: string; @@ -2072,6 +2937,7 @@ declare namespace __esri { popupTemplate: PopupTemplate; renderer: Renderer; + createQuery(): Query; getFieldUsageInfo(fieldName: string): any; queryExtent(params?: Query): IPromise; queryFeatureCount(params?: Query): IPromise; @@ -2088,6 +2954,7 @@ declare namespace __esri { export const SceneLayer: SceneLayerConstructor; interface SceneLayerProperties extends LayerProperties, SceneServiceProperties, PortalLayerProperties { + definitionExpression?: string; elevationInfo?: SceneLayerElevationInfo; fields?: FieldProperties[]; geometryType?: string; @@ -2101,9 +2968,12 @@ declare namespace __esri { } interface StreamLayer extends FeatureLayer { + filter: StreamLayerFilter; geometryDefinition: Extent; maximumTrackPoints: number; - purgeOptions: any; + purgeOptions: StreamLayerPurgeOptions; + + updateFilter(filterChanges: StreamLayerUpdateFilterFilterChanges): IPromise; } interface StreamLayerConstructor { @@ -2115,9 +2985,10 @@ declare namespace __esri { export const StreamLayer: StreamLayerConstructor; interface StreamLayerProperties extends FeatureLayerProperties { + filter?: StreamLayerFilter; geometryDefinition?: ExtentProperties; maximumTrackPoints?: number; - purgeOptions?: any; + purgeOptions?: StreamLayerPurgeOptions; } interface UnknownLayer extends Layer { @@ -2199,13 +3070,20 @@ declare namespace __esri { } interface CodedValueDomainConstructor { - new(properties?: any): CodedValueDomain; + new(properties?: CodedValueDomainProperties): CodedValueDomain; + getName(code: string | number): string; + + fromJSON(json: any): CodedValueDomain; } export const CodedValueDomain: CodedValueDomainConstructor; + interface CodedValueDomainProperties extends DomainProperties { + codedValues?: CodedValueDomainCodedValues[]; + } + interface DimensionalDefinition { dimensionName: string; isSlice: boolean; @@ -2221,20 +3099,25 @@ declare namespace __esri { export const DimensionalDefinition: DimensionalDefinitionConstructor; - interface Domain { + interface Domain extends Accessor, JSONSupport { name: string; type: string; - - toJSON(): any; } interface DomainConstructor { - new(): Domain; + new(properties?: DomainProperties): Domain; + + fromJSON(json: any): Domain; } export const Domain: DomainConstructor; - interface Field extends JSONSupport { + interface DomainProperties { + name?: string; + type?: string; + } + + interface Field extends Accessor, JSONSupport { alias: string; domain: Domain; editable: boolean; @@ -2254,7 +3137,7 @@ declare namespace __esri { interface FieldProperties { alias?: string; - domain?: Domain; + domain?: DomainProperties; editable?: boolean; length?: number; name?: string; @@ -2262,7 +3145,7 @@ declare namespace __esri { type?: string; } - interface ImageParameters { + interface ImageParameters extends Accessor { dpi: number; extent: Extent; format: string; @@ -2278,20 +3161,39 @@ declare namespace __esri { } interface ImageParametersConstructor { - new(properties?: any): ImageParameters; + new(properties?: ImageParametersProperties): ImageParameters; } export const ImageParameters: ImageParametersConstructor; + interface ImageParametersProperties { + dpi?: number; + extent?: ExtentProperties; + format?: string; + height?: number; + imageSpatialReference?: SpatialReferenceProperties; + layerDefinitions?: string[]; + layerIds?: number[]; + layerOption?: string; + transparent?: boolean; + width?: number; + } + interface InheritedDomain extends Domain { } interface InheritedDomainConstructor { - new(): InheritedDomain; + new(properties?: InheritedDomainProperties): InheritedDomain; + + fromJSON(json: any): InheritedDomain; } export const InheritedDomain: InheritedDomainConstructor; + interface InheritedDomainProperties extends DomainProperties { + + } + interface LabelClass extends Accessor, JSONSupport { labelExpression: string; labelExpressionInfo: LabelClassLabelExpressionInfo; @@ -2301,6 +3203,8 @@ declare namespace __esri { symbol: TextSymbol | LabelSymbol3D; useCodedValues: boolean; where: string; + + clone(): LabelClass; } interface LabelClassConstructor { @@ -2372,7 +3276,7 @@ declare namespace __esri { width?: number; } - interface MosaicRule extends JSONSupport { + interface MosaicRule extends Accessor, JSONSupport { ascending: boolean; lockRasterIds: number[]; method: string; @@ -2406,7 +3310,7 @@ declare namespace __esri { where?: string; } - interface PixelBlock { + interface PixelBlock extends Accessor { height: number; mask: number[]; pixels: number[][]; @@ -2421,23 +3325,39 @@ declare namespace __esri { } interface PixelBlockConstructor { - new(properties?: any): PixelBlock; + new(properties?: PixelBlockProperties): PixelBlock; } export const PixelBlock: PixelBlockConstructor; + interface PixelBlockProperties { + height?: number; + mask?: number[]; + pixels?: number[][]; + pixelType?: string; + statistics?: PixelBlockStatistics[]; + width?: number; + } + interface RangeDomain extends Domain { maxValue: number; minValue: number; } interface RangeDomainConstructor { - new(): RangeDomain; + new(properties?: RangeDomainProperties): RangeDomain; + + fromJSON(json: any): RangeDomain; } export const RangeDomain: RangeDomainConstructor; - interface RasterFunction extends JSONSupport { + interface RangeDomainProperties extends DomainProperties { + maxValue?: number; + minValue?: number; + } + + interface RasterFunction extends Accessor, JSONSupport { functionArguments: any; functionName: string; outputPixelType: string; @@ -2875,6 +3795,7 @@ declare namespace __esri { role: string; roleId: string; thumbnailUrl: string; + units: string; userContentUrl: string; username: string; @@ -2907,6 +3828,7 @@ declare namespace __esri { role?: string; roleId?: string; thumbnailUrl?: string; + units?: string; userContentUrl?: string; username?: string; } @@ -3005,7 +3927,7 @@ declare namespace __esri { valueExpression: string; valueExpressionTitle: string; - addUniqueValueInfo(valueOrInfo: string | any, symbol: Symbol): void; + addUniqueValueInfo(valueOrInfo: string | any, symbol?: Symbol): void; clone(): UniqueValueRenderer; getUniqueValueInfo(graphic: Graphic): any; removeUniqueValueInfo(value: string): void; @@ -3034,6 +3956,7 @@ declare namespace __esri { } interface PointCloudRenderer extends Accessor, JSONSupport { + pointSizeAlgorithm: PointCloudRendererPointSizeAlgorithm; pointsPerInch: number; } @@ -3046,6 +3969,7 @@ declare namespace __esri { export const PointCloudRenderer: PointCloudRendererConstructor; interface PointCloudRendererProperties { + pointSizeAlgorithm?: PointCloudRendererPointSizeAlgorithm; pointsPerInch?: number; } @@ -3133,6 +4057,30 @@ declare namespace __esri { type?: string; } + interface Action extends Accessor { + className: string; + id: string; + image: string; + title: string; + visible: boolean; + + clone(): Action; + } + + interface ActionConstructor { + new(properties?: ActionProperties): Action; + } + + export const Action: ActionConstructor; + + interface ActionProperties { + className?: string; + id?: string; + image?: string; + title?: string; + visible?: boolean; + } + interface ExtrudeSymbol3DLayer extends Symbol3DLayer { size: number; @@ -3817,8 +4765,6 @@ declare namespace __esri { } interface QueryTask extends Task { - gdbVersion: string; - execute(params: Query, requestOptions?: any): IPromise; executeForCount(params: Query, requestOptions?: any): IPromise; executeForExtent(params: Query, requestOptions?: any): IPromise; @@ -3833,7 +4779,7 @@ declare namespace __esri { export const QueryTask: QueryTaskConstructor; interface QueryTaskProperties extends TaskProperties { - gdbVersion?: string; + } interface PrintTask extends Task { @@ -4276,6 +5222,7 @@ declare namespace __esri { foundFieldName: string; layerId: number; layerName: string; + value: void; } interface FindResultConstructor { @@ -4292,6 +5239,7 @@ declare namespace __esri { foundFieldName?: string; layerId?: number; layerName?: string; + value?: void; } interface GeneralizeParameters extends Accessor { @@ -5042,6 +5990,173 @@ declare namespace __esri { trimExtendTo?: PolylineProperties; } + interface ConfigurationTask extends Task { + url: string; + + getAllGroups(requestOptions?: any): IPromise; + getAllUsers(requestOptions?: any): IPromise; + getDataWorkspaceDetails(params: ConfigurationTaskGetDataWorkspaceDetailsParams, requestOptions?: any): IPromise; + getGroup(groupId: number, requestOptions?: any): IPromise; + getJobTypeDetails(jobTypeId: number, requestOptions?: any): IPromise; + getPublicJobQueryDetails(queryId: number, requestOptions?: any): IPromise; + getServiceInfo(requestOptions?: any): IPromise; + getTableRelationshipsDetails(requestOptions?: any): IPromise; + getUser(user: string, requestOptions?: any): IPromise; + getUserJobQueryDetails(params: ConfigurationTaskGetUserJobQueryDetailsParams, requestOptions?: any): IPromise; + getVisibleJobTypes(user: string, requestOptions?: any): IPromise; + } + + interface ConfigurationTaskConstructor { + new(properties?: ConfigurationTaskProperties): ConfigurationTask; + } + + export const ConfigurationTask: ConfigurationTaskConstructor; + + interface ConfigurationTaskProperties extends TaskProperties { + url?: string; + } + + interface JobTask extends Task { + url: string; + + addEmbeddedAttachment(params: JobTaskAddEmbeddedAttachmentParams, requestOptions?: any): IPromise; + addLinkedAttachment(params: JobTaskAddLinkedAttachmentParams, requestOptions?: any): IPromise; + addLinkedRecord(params: JobTaskAddLinkedRecordParams, requestOptions?: any): IPromise; + assignJobs(params: JobTaskAssignJobsParams, requestOptions?: any): IPromise; + closeJobs(params: JobTaskCloseJobsParams, requestOptions?: any): IPromise; + createDependency(params: JobTaskCreateDependencyParams, requestOptions?: any): IPromise; + createHold(params: JobTaskCreateHoldParams, requestOptions?: any): IPromise; + createJobs(params: JobCreationParameters, requestOptions?: any): IPromise; + createJobVersion(params: JobTaskCreateJobVersionParams, requestOptions?: any): IPromise; + deleteAttachment(params: JobTaskDeleteAttachmentParams, requestOptions?: any): IPromise; + deleteDependency(params: JobTaskDeleteDependencyParams, requestOptions?: any): IPromise; + deleteJobs(params: JobTaskDeleteJobsParams, requestOptions?: any): IPromise; + deleteLinkedRecord(params: JobTaskDeleteLinkedRecordParams, requestOptions?: any): IPromise; + getActivityLog(jobId: number, requestOptions?: any): IPromise; + getAttachmentContentUrl(params: JobTaskGetAttachmentContentUrlParams): string; + getAttachments(jobId: number, requestOptions?: any): IPromise; + getDependencies(jobId: number, requestOptions?: any): IPromise; + getExtendedProperties(jobId: number, requestOptions?: any): IPromise; + getHolds(jobId: number, requestOptions?: any): IPromise; + getJob(jobId: number, requestOptions?: any): IPromise; + getJobIds(requestOptions?: any): IPromise; + getNotes(jobId: number, requestOptions?: any): IPromise; + listFieldValues(params: JobTaskListFieldValuesParams, requestOptions?: any): IPromise; + listMultiLevelFieldValues(params: JobTaskListMultiLevelFieldValuesParams, requestOptions?: any): IPromise; + logAction(params: JobTaskLogActionParams, requestOptions?: any): IPromise; + queryJobs(params: JobTaskQueryJobsParams, requestOptions?: any): IPromise; + queryJobsAdHoc(params: JobQueryParameters, requestOptions?: any): IPromise; + queryMultiLevelSelectedValues(params: JobTaskQueryMultiLevelSelectedValuesParams, requestOptions?: any): IPromise; + releaseHold(params: JobTaskReleaseHoldParams, requestOptions?: any): IPromise; + reopenClosedJobs(params: JobTaskReopenClosedJobsParams, requestOptions?: any): IPromise; + searchJobs(params: JobTaskSearchJobsParams, requestOptions?: any): IPromise; + unassignJobs(params: JobTaskUnassignJobsParams, requestOptions?: any): IPromise; + updateJob(params: JobUpdateParameters, requestOptions?: any): IPromise; + updateNotes(params: JobTaskUpdateNotesParams, requestOptions?: any): IPromise; + updateRecord(params: JobTaskUpdateRecordParams, requestOptions?: any): IPromise; + } + + interface JobTaskConstructor { + new(properties?: JobTaskProperties): JobTask; + } + + export const JobTask: JobTaskConstructor; + + interface JobTaskProperties extends TaskProperties { + url?: string; + } + + interface NotificationTask extends Task { + url: string; + + addChangeRule(params: NotificationTaskAddChangeRuleParams, requestOptions?: any): IPromise; + deleteChangeRule(params: NotificationTaskDeleteChangeRuleParams, requestOptions?: any): IPromise; + getAllChangeRules(requestOptions?: any): IPromise; + getChangeRule(ruleId: string, requestOptions?: any): IPromise; + getChangeRuleMatch(matchId: string, requestOptions?: any): IPromise; + getDatabaseTime(dataWorkspaceId: string, requestOptions?: any): IPromise; + getSessionMatches(sessionId: string, requestOptions?: any): IPromise; + notifySession(params: NotificationTaskNotifySessionParams, requestOptions?: any): IPromise; + queryChangeRules(params: NotificationTaskQueryChangeRulesParams, requestOptions?: any): IPromise; + runSpatialNotificationOnHistory(params: NotificationTaskRunSpatialNotificationOnHistoryParams, requestOptions?: any): IPromise; + sendNotification(params: NotificationTaskSendNotificationParams, requestOptions?: any): IPromise; + subscribeToNotification(params: NotificationTaskSubscribeToNotificationParams, requestOptions?: any): IPromise; + unsubscribeFromNotification(params: NotificationTaskUnsubscribeFromNotificationParams, requestOptions?: any): IPromise; + } + + interface NotificationTaskConstructor { + new(properties?: NotificationTaskProperties): NotificationTask; + } + + export const NotificationTask: NotificationTaskConstructor; + + interface NotificationTaskProperties extends TaskProperties { + url?: string; + } + + interface ReportTask extends Task { + url: string; + + generateReport(params: ReportTaskGenerateReportParams, requestOptions?: any): IPromise; + getAllReports(requestOptions?: any): IPromise; + getReportContentUrl(params: ReportTaskGetReportContentUrlParams): string; + getReportData(params: ReportTaskGetReportDataParams, requestOptions?: any): IPromise; + getReportStylesheet(reportId: number, requestOptions?: any): IPromise; + } + + interface ReportTaskConstructor { + new(properties?: ReportTaskProperties): ReportTask; + } + + export const ReportTask: ReportTaskConstructor; + + interface ReportTaskProperties extends TaskProperties { + url?: string; + } + + interface TokenTask extends Task { + parseTokens(params: TokenTaskParseTokensParams, requestOptions?: any): IPromise; + } + + interface TokenTaskConstructor { + new(properties?: TokenTaskProperties): TokenTask; + } + + export const TokenTask: TokenTaskConstructor; + + interface TokenTaskProperties extends TaskProperties { + + } + + interface WorkflowTask extends Task { + url: string; + + canRunStep(params: WorkflowTaskCanRunStepParams, requestOptions?: any): IPromise; + executeSteps(params: WorkflowTaskExecuteStepsParams, requestOptions?: any): IPromise; + getAllSteps(jobId: number, requestOptions?: any): IPromise; + getCurrentSteps(jobId: number, requestOptions?: any): IPromise; + getStep(params: WorkflowTaskGetStepParams, requestOptions?: any): IPromise; + getStepDescription(params: WorkflowTaskGetStepDescriptionParams, requestOptions?: any): IPromise; + getStepFileUrl(params: WorkflowTaskGetStepFileUrlParams): string; + getWorkflowDisplayDetails(jobId: number, requestOptions?: any): IPromise; + getWorkflowImageUrl(jobId: number): string; + markStepsAsDone(params: WorkflowTaskMarkStepsAsDoneParams, requestOptions?: any): IPromise; + moveToNextStep(params: WorkflowTaskMoveToNextStepParams, requestOptions?: any): IPromise; + recreateWorkflow(params: WorkflowTaskRecreateWorkflowParams, requestOptions?: any): IPromise; + resolveConflict(params: WorkflowTaskResolveConflictParams, requestOptions?: any): IPromise; + setCurrentStep(params: WorkflowTaskSetCurrentStepParams, requestOptions?: any): IPromise; + } + + interface WorkflowTaskConstructor { + new(properties?: WorkflowTaskProperties): WorkflowTask; + } + + export const WorkflowTask: WorkflowTaskConstructor; + + interface WorkflowTaskProperties extends TaskProperties { + url?: string; + } + interface MapView extends View { center: Point; constraints: MapViewConstraints; @@ -5053,6 +6168,7 @@ declare namespace __esri { zoom: number; goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | any, options?: MapViewGoToOptions): IPromise; + hasEventListener(type: string): boolean; hitTest(screenPoint: MapViewHitTestScreenPoint): IPromise; on(type: string | string[], modifiersOrHandler: string[] | Function, handler?: Function): any; toMap(screenPoint: ScreenPoint, mapPoint?: Point): Point; @@ -5090,6 +6206,7 @@ declare namespace __esri { zoom: number; goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | Camera | any, options?: SceneViewGoToOptions): IPromise; + hasEventListener(type: string): boolean; hitTest(screenPoint: SceneViewHitTestScreenPoint): IPromise; on(type: string | string[], modifiersOrHandler: string[] | Function, handler?: Function): any; toMap(screenPoint: ScreenPoint, mapPoint?: Point): Point; @@ -5116,7 +6233,7 @@ declare namespace __esri { zoom?: number; } - interface View extends Accessor, corePromise, Evented, BreakpointsOwner, DOMContainer { + interface View extends Accessor, corePromise, BreakpointsOwner, DOMContainer { allLayerViews: Collection; animation: ViewAnimation; graphics: Collection; @@ -5238,16 +6355,33 @@ declare namespace __esri { pixelData?: ImageryLayerViewPixelData; } + interface SceneLayerView extends LayerView { + queryExtent(params?: Query): IPromise; + queryFeatureCount(params?: Query): IPromise; + queryFeatures(params?: Query): IPromise; + queryObjectIds(params?: Query): IPromise; + } + + interface SceneLayerViewConstructor { + new(properties?: SceneLayerViewProperties): SceneLayerView; + } + + export const SceneLayerView: SceneLayerViewConstructor; + + interface SceneLayerViewProperties extends LayerViewProperties { + + } + interface UI extends Accessor { container: any; height: number; padding: any; - view: SceneView | MapView; + view: MapView | SceneView; width: number; - add(component: any | any[], position?: string | any): void; + add(component: Widget | any | string | any | any, position?: string | any): void; empty(position?: string): void; - move(component: any | any[], position?: string): void; + move(component: Widget | any | string | any | any, position?: string): void; remove(component: any | any[]): void; } @@ -5261,7 +6395,7 @@ declare namespace __esri { container?: any; height?: number; padding?: any | number; - view?: SceneView | MapView; + view?: MapView | SceneView; width?: number; } @@ -5406,9 +6540,11 @@ declare namespace __esri { visibleLayers?: SlideVisibleLayers; } - interface Attribution extends Accessor { - view: SceneView | MapView; + interface Attribution extends Widget { + view: MapView | SceneView; viewModel: AttributionViewModel; + + render(): any; } interface AttributionConstructor { @@ -5417,18 +6553,41 @@ declare namespace __esri { export const Attribution: AttributionConstructor; - interface AttributionProperties { - view?: SceneView | MapView; + interface AttributionProperties extends WidgetProperties { + view?: MapView | SceneView; viewModel?: AttributionViewModel; } - interface BasemapToggle extends Accessor, Evented { + interface BasemapGallery extends Widget { + activeBasemap: Basemap; + source: LocalBasemapsSource | PortalBasemapsSource; + view: MapView | SceneView; + viewModel: BasemapGalleryViewModel; + + render(): any; + } + + interface BasemapGalleryConstructor { + new(properties?: BasemapGalleryProperties): BasemapGallery; + } + + export const BasemapGallery: BasemapGalleryConstructor; + + interface BasemapGalleryProperties extends WidgetProperties { + activeBasemap?: BasemapProperties; + source?: LocalBasemapsSource | PortalBasemapsSource; + view?: MapView | SceneView; + viewModel?: BasemapGalleryViewModelProperties; + } + + interface BasemapToggle extends Widget { activeBasemap: Basemap; nextBasemap: Basemap; titleVisible: boolean; - view: SceneView | MapView; + view: MapView | SceneView; viewModel: BasemapToggleViewModel; + render(): any; toggle(): void; } @@ -5438,15 +6597,15 @@ declare namespace __esri { export const BasemapToggle: BasemapToggleConstructor; - interface BasemapToggleProperties { + interface BasemapToggleProperties extends WidgetProperties { activeBasemap?: BasemapProperties; nextBasemap?: Basemap | string; titleVisible?: boolean; - view?: SceneView | MapView; + view?: MapView | SceneView; viewModel?: BasemapToggleViewModelProperties; } - interface ColorSlider extends Accessor { + interface ColorSlider extends Accessor, Widgette { handlesVisible: boolean; histogram: any; histogramVisible: boolean; @@ -5469,7 +6628,7 @@ declare namespace __esri { export const ColorSlider: ColorSliderConstructor; - interface ColorSliderProperties { + interface ColorSliderProperties extends WidgetteProperties { handlesVisible?: boolean; histogram?: any; histogramVisible?: boolean; @@ -5486,10 +6645,11 @@ declare namespace __esri { visualVariable?: any; } - interface Compass extends Accessor { - view: SceneView | MapView; + interface Compass extends Widget { + view: MapView | SceneView; viewModel: CompassViewModel; + render(): any; reset(): void; } @@ -5499,17 +6659,51 @@ declare namespace __esri { export const Compass: CompassConstructor; - interface CompassProperties { - view?: SceneView | MapView; + interface CompassProperties extends WidgetProperties { + view?: MapView | SceneView; viewModel?: CompassViewModelProperties; } - interface Home extends Accessor, Evented { + interface Expand extends Widget { + collapseTooltip: string; + content: any; + expanded: boolean; + expandIconClass: string; + expandTooltip: string; + iconNumber: string; + view: MapView | SceneView; + viewModel: ExpandViewModel; + + collapse(): void; + expand(): void; + render(): any; + toggle(): void; + } + + interface ExpandConstructor { + new(properties?: ExpandProperties): Expand; + } + + export const Expand: ExpandConstructor; + + interface ExpandProperties extends WidgetProperties { + collapseTooltip?: string; + content?: any | any | string | Widget; + expanded?: boolean; + expandIconClass?: string; + expandTooltip?: string; + iconNumber?: string; + view?: MapView | SceneView; + viewModel?: ExpandViewModelProperties; + } + + interface Home extends Widget { view: MapView | SceneView; viewModel: HomeViewModel; viewpoint: Viewpoint; go(): void; + render(): any; } interface HomeConstructor { @@ -5518,7 +6712,7 @@ declare namespace __esri { export const Home: HomeConstructor; - interface HomeProperties { + interface HomeProperties extends WidgetProperties { view?: MapView | SceneView; viewModel?: HomeViewModelProperties; viewpoint?: ViewpointProperties; @@ -5526,10 +6720,12 @@ declare namespace __esri { interface LayerList extends Widget { createActionsFunction: Function; - view: SceneView | MapView; + operationalItems: Collection; + view: MapView | SceneView; viewModel: LayerListViewModel; render(): any; + triggerAction(action: Action, item: ListItem): void; } interface LayerListConstructor { @@ -5540,13 +6736,14 @@ declare namespace __esri { interface LayerListProperties extends WidgetProperties { createActionsFunction?: Function; - view?: SceneView | MapView; + operationalItems?: Collection; + view?: MapView | SceneView; viewModel?: LayerListViewModelProperties; } - interface Legend extends Accessor { + interface Legend extends Accessor, Widgette { layerInfos: LegendLayerInfos[]; - view: SceneView | MapView; + view: MapView | SceneView; } interface LegendConstructor { @@ -5555,12 +6752,12 @@ declare namespace __esri { export const Legend: LegendConstructor; - interface LegendProperties { + interface LegendProperties extends WidgetteProperties { layerInfos?: LegendLayerInfos[]; - view?: SceneView | MapView; + view?: MapView | SceneView; } - interface Locate extends Accessor, Evented { + interface Locate extends Widget { geolocationOptions: any; goToLocationEnabled: boolean; graphic: Graphic; @@ -5568,6 +6765,7 @@ declare namespace __esri { viewModel: LocateViewModel; locate(): IPromise; + render(): any; } interface LocateConstructor { @@ -5576,7 +6774,7 @@ declare namespace __esri { export const Locate: LocateConstructor; - interface LocateProperties { + interface LocateProperties extends WidgetProperties { geolocationOptions?: any; goToLocationEnabled?: boolean; graphic?: GraphicProperties; @@ -5584,11 +6782,12 @@ declare namespace __esri { viewModel?: LocateViewModelProperties; } - interface NavigationToggle extends Accessor { + interface NavigationToggle extends Widget { layout: string; view: SceneView; viewModel: NavigationToggleViewModel; + render(): any; toggle(): void; } @@ -5598,13 +6797,13 @@ declare namespace __esri { export const NavigationToggle: NavigationToggleConstructor; - interface NavigationToggleProperties { + interface NavigationToggleProperties extends WidgetProperties { layout?: string; view?: SceneViewProperties; viewModel?: NavigationToggleViewModelProperties; } - interface Popup extends Accessor, Evented { + interface Popup extends Accessor, Widgette, Evented { actions: Collection; content: string; currentDockPosition: string; @@ -5636,7 +6835,7 @@ declare namespace __esri { export const Popup: PopupConstructor; - interface PopupProperties { + interface PopupProperties extends WidgetteProperties { actions?: Collection; content?: string | any; currentDockPosition?: string; @@ -5674,12 +6873,34 @@ declare namespace __esri { viewModel?: PrintViewModelProperties; } - interface Search extends Accessor, Evented { + interface ScaleBar extends Widget { + style: string; + unit: string; + view: MapView; + viewModel: ScaleBarViewModel; + + render(): any; + } + + interface ScaleBarConstructor { + new(properties?: ScaleBarProperties): ScaleBar; + } + + export const ScaleBar: ScaleBarConstructor; + + interface ScaleBarProperties extends WidgetProperties { + style?: string; + unit?: string; + view?: MapViewProperties; + viewModel?: ScaleBarViewModelProperties; + } + + interface Search extends Widget { activeSource: FeatureLayer | Locator; activeSourceIndex: number; allPlaceholder: string; autoSelect: boolean; - defaultSource: any; + defaultSource: any | any; maxResults: number; maxSuggestions: number; minSuggestCharacters: number; @@ -5690,6 +6911,7 @@ declare namespace __esri { resultGraphicEnabled: boolean; results: any[]; searchAllEnabled: boolean; + searching: boolean; searchTerm: string; selectedResult: any; sources: SearchSources; @@ -5699,6 +6921,7 @@ declare namespace __esri { viewModel: SearchViewModel; clear(): void; + render(): any; search(searchTerm?: string | Geometry | any | number[][]): IPromise; suggest(value?: string): IPromise; } @@ -5709,12 +6932,12 @@ declare namespace __esri { export const Search: SearchConstructor; - interface SearchProperties { + interface SearchProperties extends WidgetProperties { activeSource?: FeatureLayer | Locator; activeSourceIndex?: number; allPlaceholder?: string; autoSelect?: boolean; - defaultSource?: any; + defaultSource?: any | any; maxResults?: number; maxSuggestions?: number; minSuggestCharacters?: number; @@ -5725,6 +6948,7 @@ declare namespace __esri { resultGraphicEnabled?: boolean; results?: any[]; searchAllEnabled?: boolean; + searching?: boolean; searchTerm?: string; selectedResult?: any; sources?: SearchSources; @@ -5734,7 +6958,7 @@ declare namespace __esri { viewModel?: SearchViewModelProperties; } - interface SizeSlider extends Accessor { + interface SizeSlider extends Accessor, Widgette { handlesVisible: boolean; histogram: any; histogramVisible: boolean; @@ -5757,7 +6981,7 @@ declare namespace __esri { export const SizeSlider: SizeSliderConstructor; - interface SizeSliderProperties { + interface SizeSliderProperties extends WidgetteProperties { handlesVisible?: boolean; histogram?: any; histogramVisible?: boolean; @@ -5774,7 +6998,7 @@ declare namespace __esri { visualVariable?: any; } - interface Track extends Accessor { + interface Track extends Widget { geolocationOptions: any; goToLocationEnabled: boolean; graphic: Graphic; @@ -5782,6 +7006,7 @@ declare namespace __esri { view: MapView | SceneView; viewModel: TrackViewModel; + render(): any; start(): void; stop(): void; } @@ -5792,7 +7017,7 @@ declare namespace __esri { export const Track: TrackConstructor; - interface TrackProperties { + interface TrackProperties extends WidgetProperties { geolocationOptions?: any; goToLocationEnabled?: boolean; graphic?: GraphicProperties; @@ -5801,7 +7026,7 @@ declare namespace __esri { viewModel?: TrackViewModelProperties; } - interface UnivariateColorSizeSlider extends Accessor { + interface UnivariateColorSizeSlider extends Accessor, Widgette { handlesVisible: boolean; histogram: any; histogramVisible: boolean; @@ -5824,7 +7049,7 @@ declare namespace __esri { export const UnivariateColorSizeSlider: UnivariateColorSizeSliderConstructor; - interface UnivariateColorSizeSliderProperties { + interface UnivariateColorSizeSliderProperties extends WidgetteProperties { handlesVisible?: boolean; histogram?: any; histogramVisible?: boolean; @@ -5847,7 +7072,9 @@ declare namespace __esri { id: string; destroy(): void; + own(handles: any[]): void; postInitialize(): void; + renderNow(): void; scheduleRender(): void; startup(): void; } @@ -5859,15 +7086,16 @@ declare namespace __esri { export const Widget: WidgetConstructor; interface WidgetProperties { - container?: string; + container?: string | any; destroyed?: boolean; id?: string; } - interface Zoom extends Accessor { - view: SceneView | MapView; + interface Zoom extends Widget { + view: MapView | SceneView; viewModel: ZoomViewModel; + render(): any; zoomIn(): void; zoomOut(): void; } @@ -5878,8 +7106,8 @@ declare namespace __esri { export const Zoom: ZoomConstructor; - interface ZoomProperties { - view?: SceneView | MapView; + interface ZoomProperties extends WidgetProperties { + view?: MapView | SceneView; viewModel?: ZoomViewModelProperties; } @@ -5887,7 +7115,7 @@ declare namespace __esri { attributionText: string; itemDelimiter: string; state: string; - view: SceneView | MapView; + view: MapView | SceneView; } interface AttributionViewModelConstructor { @@ -5896,11 +7124,35 @@ declare namespace __esri { export const AttributionViewModel: AttributionViewModelConstructor; + interface BasemapGalleryViewModel extends Accessor { + activeBasemap: Basemap; + items: Collection; + source: LocalBasemapsSource | PortalBasemapsSource; + state: string; + view: MapView | SceneView; + + basemapEquals(basemap1: Basemap, basemap2: Basemap): boolean; + } + + interface BasemapGalleryViewModelConstructor { + new(properties?: BasemapGalleryViewModelProperties): BasemapGalleryViewModel; + } + + export const BasemapGalleryViewModel: BasemapGalleryViewModelConstructor; + + interface BasemapGalleryViewModelProperties { + activeBasemap?: BasemapProperties; + items?: Collection; + source?: LocalBasemapsSource | PortalBasemapsSource; + state?: string; + view?: MapView | SceneView; + } + interface BasemapToggleViewModel extends Accessor, Evented { activeBasemap: Basemap; nextBasemap: Basemap; state: string; - view: SceneView | MapView; + view: MapView | SceneView; toggle(): void; } @@ -5915,12 +7167,13 @@ declare namespace __esri { activeBasemap?: BasemapProperties; nextBasemap?: Basemap | string; state?: string; - view?: SceneView | MapView; + view?: MapView | SceneView; } interface CompassViewModel extends Accessor { + orientation: any; state: string; - view: SceneView | MapView; + view: MapView | SceneView; reset(): void; } @@ -5932,8 +7185,27 @@ declare namespace __esri { export const CompassViewModel: CompassViewModelConstructor; interface CompassViewModelProperties { + orientation?: any; state?: string; - view?: SceneView | MapView; + view?: MapView | SceneView; + } + + interface ExpandViewModel extends Accessor { + expanded: boolean; + state: string; + view: MapView | SceneView; + } + + interface ExpandViewModelConstructor { + new(properties?: ExpandViewModelProperties): ExpandViewModel; + } + + export const ExpandViewModel: ExpandViewModelConstructor; + + interface ExpandViewModelProperties { + expanded?: boolean; + state?: string; + view?: MapView | SceneView; } interface HomeViewModel extends Accessor, Evented { @@ -5960,9 +7232,9 @@ declare namespace __esri { createActionsFunction: Function; operationalItems: Collection; state: string; - view: SceneView | MapView; + view: MapView | SceneView; - triggerAction(actionIndex: number): void; + triggerAction(action: Action, item: ListItem): void; } interface LayerListViewModelConstructor { @@ -5975,9 +7247,32 @@ declare namespace __esri { createActionsFunction?: Function; operationalItems?: Collection; state?: string; - view?: SceneView | MapView; + view?: MapView | SceneView; } + interface ListItem { + actionsOpen: boolean; + actionsSections: Collection; + children: Collection; + error: Error; + layer: Layer; + open: boolean; + title: string; + updating: boolean; + view: MapView | SceneView; + visibilityMode: string; + visible: boolean; + visibleAtCurrentScale: boolean; + + clone(): ListItem; + } + + interface ListItemConstructor { + new(): ListItem; + } + + export const ListItem: ListItemConstructor; + interface LocateViewModel extends Accessor, Evented, GeolocationPositioning { state: string; @@ -6075,6 +7370,20 @@ declare namespace __esri { view?: MapView | SceneView; } + interface ScaleBarViewModel extends Accessor { + view: MapView; + } + + interface ScaleBarViewModelConstructor { + new(properties?: ScaleBarViewModelProperties): ScaleBarViewModel; + } + + export const ScaleBarViewModel: ScaleBarViewModelConstructor; + + interface ScaleBarViewModelProperties { + view?: MapViewProperties; + } + interface SearchViewModel extends Accessor, Evented { activeSource: FeatureLayer | Locator; activeSourceIndex: number; @@ -6163,7 +7472,7 @@ declare namespace __esri { canZoomIn: boolean; canZoomOut: boolean; state: string; - view: SceneView | MapView; + view: MapView | SceneView; zoomIn(): void; zoomOut(): void; @@ -6179,7 +7488,7 @@ declare namespace __esri { canZoomIn?: boolean; canZoomOut?: boolean; state?: string; - view?: SceneView | MapView; + view?: MapView | SceneView; } interface JSONSupport { @@ -6301,6 +7610,8 @@ declare namespace __esri { dpi: number; gdbVersion: string; imageFormat: string; + imageMaxHeight: number; + imageMaxWidth: number; imageTransparency: boolean; sublayers: Collection; @@ -6320,6 +7631,8 @@ declare namespace __esri { dpi?: number; gdbVersion?: string; imageFormat?: string; + imageMaxHeight?: number; + imageMaxWidth?: number; imageTransparency?: boolean; sublayers?: Collection; } @@ -6547,6 +7860,24 @@ declare namespace __esri { width?: number; } + interface Widgette { + container: string | any; + visible: boolean; + + destroy(): void; + } + + interface WidgetteConstructor { + new(): Widgette; + } + + export const Widgette: WidgetteConstructor; + + interface WidgetteProperties { + container?: string | any; + visible?: boolean; + } + interface GeolocationPositioning { geolocationOptions: any; goToLocationEnabled: boolean; @@ -6569,8 +7900,10 @@ declare namespace __esri { interface config { geometryServiceUrl: string; + geoRSSServiceUrl: string; portalUrl: string; request: configRequest; + workers: configWorkers; } export const config: config; @@ -6596,13 +7929,19 @@ declare namespace __esri { export const lang: lang; interface promiseUtils { - eachAlways(promises: IPromise[]): IPromise[]; - reject(error?: any): IPromise; - resolve(value?: any): IPromise; + eachAlways(promises: IPromise[] | any): IPromise | any; + reject(error?: any): IPromise; + resolve(value?: T): IPromise; } export const promiseUtils: promiseUtils; + interface requireUtils { + when(moduleRequire: any, moduleNames: string[] | string): IPromise; + } + + export const requireUtils: requireUtils; + interface urlUtils { addProxyRule(rule: urlUtilsAddProxyRuleRule): number; getProxyRule(url: string): any; @@ -6636,7 +7975,7 @@ declare namespace __esri { interface decorators { aliasOf(propertyName: string): Function; cast(propertyName: string): Function; - cast(classFunction: Function): void; + cast(classFunction: Function): Function; declared(baseClass: T, ...mixinClasses: any[]): T; property(propertyMetadata?: decoratorsPropertyPropertyMetadata): Function; subclass(declaredClass?: string): Function; @@ -6739,6 +8078,12 @@ declare namespace __esri { export const jsonUtils: jsonUtils; + interface normalizeUtils { + normalizeCentralMeridian(geometries: Geometry[], geometryService?: GeometryService): IPromise; + } + + export const normalizeUtils: normalizeUtils; + interface webMercatorUtils { canProject(source: SpatialReference | any, target: SpatialReference | any): boolean; geographicToWebMercator(geometry: Geometry): Geometry; @@ -6765,7 +8110,7 @@ declare namespace __esri { interface size { createContinuousRenderer(params: sizeCreateContinuousRendererParams): IPromise; - createVisualVariable(params: sizeCreateVisualVariableParams): IPromise; + createVisualVariables(params: sizeCreateVisualVariablesParams): IPromise; } export const size: size; @@ -6787,13 +8132,17 @@ declare namespace __esri { histogram(params: histogramHistogramParams): IPromise; } - export const histogram: histogram; + const __histogramMapped: histogram; + export const histogram: typeof __histogramMapped.histogram; + interface summaryStatistics { summaryStatistics(params: summaryStatisticsSummaryStatisticsParams): IPromise; } - export const summaryStatistics: summaryStatistics; + const __summaryStatisticsMapped: summaryStatistics; + export const summaryStatistics: typeof __summaryStatisticsMapped.summaryStatistics; + interface symbologyColor { cloneScheme(scheme: any): any; @@ -6824,16 +8173,6 @@ declare namespace __esri { export const supportJsonUtils: supportJsonUtils; - interface Action { - className: string; - id: string; - image: string; - title: string; - visible: boolean; - } - - export const Action: Action; - interface symbolsSupportJsonUtils { fromJSON(json: any): Symbol; } @@ -6861,20 +8200,30 @@ declare namespace __esri { export const widget: widget; - interface ListItem { - actionsOpen: boolean; - actionsSections: Collection; - children: Collection; + interface BasemapGalleryItem { + basemap: Basemap; error: Error; - open: boolean; - title: string; - updating: boolean; - visibilityMode: string; - visible: boolean; - visibleAtCurrentScale: boolean; + state: string; + view: MapView | SceneView; } - export const ListItem: ListItem; + export const BasemapGalleryItem: BasemapGalleryItem; + + interface LocalBasemapsSource { + basemaps: Collection; + state: string; + } + + export const LocalBasemapsSource: LocalBasemapsSource; + + interface PortalBasemapsSource { + basemaps: Collection; + filterFunction: Function; + portal: Portal; + state: string; + } + + export const PortalBasemapsSource: PortalBasemapsSource; } declare module "esri" { @@ -6888,10 +8237,116 @@ declare module "esri" { export import WatchHandle = __esri.WatchHandle; + export import EachAlwaysResult = __esri.EachAlwaysResult; + export import PausableWatchHandle = __esri.PausableWatchHandle; + export import FeatureEditResult = __esri.FeatureEditResult; + export import AttributeParamValue = __esri.AttributeParamValue; + export import DataWorkspace = __esri.DataWorkspace; + + export import GroupMembership = __esri.GroupMembership; + + export import HoldType = __esri.HoldType; + + export import JobPriority = __esri.JobPriority; + + export import JobQuery = __esri.JobQuery; + + export import JobStatus = __esri.JobStatus; + + export import JobQueryContainer = __esri.JobQueryContainer; + + export import JobQueryDetails = __esri.JobQueryDetails; + + export import Privilege = __esri.Privilege; + + export import UserDetails = __esri.UserDetails; + + export import VersionInfo = __esri.VersionInfo; + + export import WorkflowManagerServiceInfo = __esri.WorkflowManagerServiceInfo; + + export import JobType = __esri.JobType; + + export import JobTypeDetails = __esri.JobTypeDetails; + + export import TableRelationship = __esri.TableRelationship; + + export import JobCreationParameters = __esri.JobCreationParameters; + + export import JobQueryParameters = __esri.JobQueryParameters; + + export import JobUpdateParameters = __esri.JobUpdateParameters; + + export import AuxRecordDescription = __esri.AuxRecordDescription; + + export import ActivityType = __esri.ActivityType; + + export import AuxRecordContainer = __esri.AuxRecordContainer; + + export import JobTaskJobInfo = __esri.JobTaskJobInfo; + + export import QueryResult = __esri.QueryResult; + + export import AuxRecord = __esri.AuxRecord; + + export import AuxRecordValue = __esri.AuxRecordValue; + + export import FieldValue = __esri.FieldValue; + + export import JobVersionInfo = __esri.JobVersionInfo; + + export import QueryFieldInfo = __esri.QueryFieldInfo; + + export import JobAttachment = __esri.JobAttachment; + + export import JobDependency = __esri.JobDependency; + + export import ChangeRule = __esri.ChangeRule; + + export import DataSetEvaluator = __esri.DataSetEvaluator; + + export import AOIEvaluator = __esri.AOIEvaluator; + + export import DatasetConfiguration = __esri.DatasetConfiguration; + + export import EmailNotifier = __esri.EmailNotifier; + + export import WhereCondition = __esri.WhereCondition; + + export import NotificationType = __esri.NotificationType; + + export import ChangeRuleMatch = __esri.ChangeRuleMatch; + + export import ReportDataGroup = __esri.ReportDataGroup; + + export import ReportData = __esri.ReportData; + + export import Report = __esri.Report; + + export import ExecuteInfo = __esri.ExecuteInfo; + + export import Step = __esri.Step; + + export import StepType = __esri.StepType; + + export import WorkflowDisplayDetails = __esri.WorkflowDisplayDetails; + + export import WorkflowOption = __esri.WorkflowOption; + + export import WorkflowStepInfo = __esri.WorkflowStepInfo; + + export import WorkflowAnnotationDisplayDetails = __esri.WorkflowAnnotationDisplayDetails; + + export import WorkflowConflicts = __esri.WorkflowConflicts; + + export import WorkflowPathDisplayDetails = __esri.WorkflowPathDisplayDetails; + + export import WorkflowStepDisplayDetails = __esri.WorkflowStepDisplayDetails; + export import ExternalRenderer = __esri.ExternalRenderer; export import RenderContext = __esri.RenderContext; @@ -6906,10 +8361,6 @@ declare module "esri" { export import FeatureLayerSource = __esri.FeatureLayerSource; - export import SearchViewModelLocatorSource = __esri.SearchViewModelLocatorSource; - - export import SearchViewModelFeatureLayerSource = __esri.SearchViewModelFeatureLayerSource; - export import GetHeader = __esri.GetHeader; export import WatchCallback = __esri.WatchCallback; @@ -6966,8 +8417,16 @@ declare module "esri" { export import CSVLayerElevationInfo = __esri.CSVLayerElevationInfo; + export import FeatureLayerApplyEditsEdits = __esri.FeatureLayerApplyEditsEdits; + + export import FeatureLayerCapabilities = __esri.FeatureLayerCapabilities; + + export import FeatureLayerCapabilitiesOperations = __esri.FeatureLayerCapabilitiesOperations; + export import FeatureLayerElevationInfo = __esri.FeatureLayerElevationInfo; + export import FeatureLayerGetFieldDomainOptions = __esri.FeatureLayerGetFieldDomainOptions; + export import GraphicsLayerElevationInfo = __esri.GraphicsLayerElevationInfo; export import LayerFromArcGISServerUrlParams = __esri.LayerFromArcGISServerUrlParams; @@ -6976,6 +8435,12 @@ declare module "esri" { export import SceneLayerElevationInfo = __esri.SceneLayerElevationInfo; + export import StreamLayerFilter = __esri.StreamLayerFilter; + + export import StreamLayerPurgeOptions = __esri.StreamLayerPurgeOptions; + + export import StreamLayerUpdateFilterFilterChanges = __esri.StreamLayerUpdateFilterFilterChanges; + export import VectorTileLayerCurrentStyleInfo = __esri.VectorTileLayerCurrentStyleInfo; export import CodedValueDomainCodedValues = __esri.CodedValueDomainCodedValues; @@ -7004,6 +8469,8 @@ declare module "esri" { export import UniqueValueRendererUniqueValueInfos = __esri.UniqueValueRendererUniqueValueInfos; + export import PointCloudRendererPointSizeAlgorithm = __esri.PointCloudRendererPointSizeAlgorithm; + export import PointCloudClassBreaksRendererColorClassBreakInfos = __esri.PointCloudClassBreaksRendererColorClassBreakInfos; export import PointCloudStretchRendererStops = __esri.PointCloudStretchRendererStops; @@ -7042,6 +8509,102 @@ declare module "esri" { export import QueryQuantizationParameters = __esri.QueryQuantizationParameters; + export import ConfigurationTaskGetDataWorkspaceDetailsParams = __esri.ConfigurationTaskGetDataWorkspaceDetailsParams; + + export import ConfigurationTaskGetUserJobQueryDetailsParams = __esri.ConfigurationTaskGetUserJobQueryDetailsParams; + + export import JobTaskAddEmbeddedAttachmentParams = __esri.JobTaskAddEmbeddedAttachmentParams; + + export import JobTaskAddLinkedAttachmentParams = __esri.JobTaskAddLinkedAttachmentParams; + + export import JobTaskAddLinkedRecordParams = __esri.JobTaskAddLinkedRecordParams; + + export import JobTaskAssignJobsParams = __esri.JobTaskAssignJobsParams; + + export import JobTaskCloseJobsParams = __esri.JobTaskCloseJobsParams; + + export import JobTaskCreateDependencyParams = __esri.JobTaskCreateDependencyParams; + + export import JobTaskCreateHoldParams = __esri.JobTaskCreateHoldParams; + + export import JobTaskCreateJobVersionParams = __esri.JobTaskCreateJobVersionParams; + + export import JobTaskDeleteAttachmentParams = __esri.JobTaskDeleteAttachmentParams; + + export import JobTaskDeleteDependencyParams = __esri.JobTaskDeleteDependencyParams; + + export import JobTaskDeleteJobsParams = __esri.JobTaskDeleteJobsParams; + + export import JobTaskDeleteLinkedRecordParams = __esri.JobTaskDeleteLinkedRecordParams; + + export import JobTaskGetAttachmentContentUrlParams = __esri.JobTaskGetAttachmentContentUrlParams; + + export import JobTaskListFieldValuesParams = __esri.JobTaskListFieldValuesParams; + + export import JobTaskListMultiLevelFieldValuesParams = __esri.JobTaskListMultiLevelFieldValuesParams; + + export import JobTaskLogActionParams = __esri.JobTaskLogActionParams; + + export import JobTaskQueryJobsParams = __esri.JobTaskQueryJobsParams; + + export import JobTaskQueryMultiLevelSelectedValuesParams = __esri.JobTaskQueryMultiLevelSelectedValuesParams; + + export import JobTaskReleaseHoldParams = __esri.JobTaskReleaseHoldParams; + + export import JobTaskReopenClosedJobsParams = __esri.JobTaskReopenClosedJobsParams; + + export import JobTaskSearchJobsParams = __esri.JobTaskSearchJobsParams; + + export import JobTaskUnassignJobsParams = __esri.JobTaskUnassignJobsParams; + + export import JobTaskUpdateNotesParams = __esri.JobTaskUpdateNotesParams; + + export import JobTaskUpdateRecordParams = __esri.JobTaskUpdateRecordParams; + + export import NotificationTaskAddChangeRuleParams = __esri.NotificationTaskAddChangeRuleParams; + + export import NotificationTaskDeleteChangeRuleParams = __esri.NotificationTaskDeleteChangeRuleParams; + + export import NotificationTaskNotifySessionParams = __esri.NotificationTaskNotifySessionParams; + + export import NotificationTaskQueryChangeRulesParams = __esri.NotificationTaskQueryChangeRulesParams; + + export import NotificationTaskRunSpatialNotificationOnHistoryParams = __esri.NotificationTaskRunSpatialNotificationOnHistoryParams; + + export import NotificationTaskSendNotificationParams = __esri.NotificationTaskSendNotificationParams; + + export import NotificationTaskSubscribeToNotificationParams = __esri.NotificationTaskSubscribeToNotificationParams; + + export import NotificationTaskUnsubscribeFromNotificationParams = __esri.NotificationTaskUnsubscribeFromNotificationParams; + + export import ReportTaskGenerateReportParams = __esri.ReportTaskGenerateReportParams; + + export import ReportTaskGetReportContentUrlParams = __esri.ReportTaskGetReportContentUrlParams; + + export import ReportTaskGetReportDataParams = __esri.ReportTaskGetReportDataParams; + + export import TokenTaskParseTokensParams = __esri.TokenTaskParseTokensParams; + + export import WorkflowTaskCanRunStepParams = __esri.WorkflowTaskCanRunStepParams; + + export import WorkflowTaskExecuteStepsParams = __esri.WorkflowTaskExecuteStepsParams; + + export import WorkflowTaskGetStepDescriptionParams = __esri.WorkflowTaskGetStepDescriptionParams; + + export import WorkflowTaskGetStepFileUrlParams = __esri.WorkflowTaskGetStepFileUrlParams; + + export import WorkflowTaskGetStepParams = __esri.WorkflowTaskGetStepParams; + + export import WorkflowTaskMarkStepsAsDoneParams = __esri.WorkflowTaskMarkStepsAsDoneParams; + + export import WorkflowTaskMoveToNextStepParams = __esri.WorkflowTaskMoveToNextStepParams; + + export import WorkflowTaskRecreateWorkflowParams = __esri.WorkflowTaskRecreateWorkflowParams; + + export import WorkflowTaskResolveConflictParams = __esri.WorkflowTaskResolveConflictParams; + + export import WorkflowTaskSetCurrentStepParams = __esri.WorkflowTaskSetCurrentStepParams; + export import MapViewConstraints = __esri.MapViewConstraints; export import MapViewGoToOptions = __esri.MapViewGoToOptions; @@ -7124,6 +8687,10 @@ declare module "esri" { export import configRequestProxyRules = __esri.configRequestProxyRules; + export import configWorkers = __esri.configWorkers; + + export import configWorkersLoaderConfig = __esri.configWorkersLoaderConfig; + export import requestEsriRequestOptions = __esri.requestEsriRequestOptions; export import urlUtilsAddProxyRuleRule = __esri.urlUtilsAddProxyRuleRule; @@ -7144,9 +8711,9 @@ declare module "esri" { export import sizeCreateContinuousRendererParamsLegendOptions = __esri.sizeCreateContinuousRendererParamsLegendOptions; - export import sizeCreateVisualVariableParams = __esri.sizeCreateVisualVariableParams; + export import sizeCreateVisualVariablesParams = __esri.sizeCreateVisualVariablesParams; - export import sizeCreateVisualVariableParamsLegendOptions = __esri.sizeCreateVisualVariableParamsLegendOptions; + export import sizeCreateVisualVariablesParamsLegendOptions = __esri.sizeCreateVisualVariablesParamsLegendOptions; export import univariateColorSizeCreateContinuousRendererParams = __esri.univariateColorSizeCreateContinuousRendererParams; @@ -7351,6 +8918,11 @@ declare module "esri/layers/FeatureLayer" { export = FeatureLayer; } +declare module "esri/layers/GeoRSSLayer" { + import GeoRSSLayer = __esri.GeoRSSLayer; + export = GeoRSSLayer; +} + declare module "esri/layers/GraphicsLayer" { import GraphicsLayer = __esri.GraphicsLayer; export = GraphicsLayer; @@ -7571,6 +9143,11 @@ declare module "esri/renderers/PointCloudUniqueValueRenderer" { export = PointCloudUniqueValueRenderer; } +declare module "esri/support/Action" { + import Action = __esri.Action; + export = Action; +} + declare module "esri/symbols/ExtrudeSymbol3DLayer" { import ExtrudeSymbol3DLayer = __esri.ExtrudeSymbol3DLayer; export = ExtrudeSymbol3DLayer; @@ -7961,6 +9538,36 @@ declare module "esri/tasks/support/TrimExtendParameters" { export = TrimExtendParameters; } +declare module "esri/tasks/workflow/ConfigurationTask" { + import ConfigurationTask = __esri.ConfigurationTask; + export = ConfigurationTask; +} + +declare module "esri/tasks/workflow/JobTask" { + import JobTask = __esri.JobTask; + export = JobTask; +} + +declare module "esri/tasks/workflow/NotificationTask" { + import NotificationTask = __esri.NotificationTask; + export = NotificationTask; +} + +declare module "esri/tasks/workflow/ReportTask" { + import ReportTask = __esri.ReportTask; + export = ReportTask; +} + +declare module "esri/tasks/workflow/TokenTask" { + import TokenTask = __esri.TokenTask; + export = TokenTask; +} + +declare module "esri/tasks/workflow/WorkflowTask" { + import WorkflowTask = __esri.WorkflowTask; + export = WorkflowTask; +} + declare module "esri/views/MapView" { import MapView = __esri.MapView; export = MapView; @@ -8001,6 +9608,11 @@ declare module "esri/views/layers/ImageryLayerView" { export = ImageryLayerView; } +declare module "esri/views/layers/SceneLayerView" { + import SceneLayerView = __esri.SceneLayerView; + export = SceneLayerView; +} + declare module "esri/views/ui/UI" { import UI = __esri.UI; export = UI; @@ -8046,6 +9658,11 @@ declare module "esri/widgets/Attribution" { export = Attribution; } +declare module "esri/widgets/BasemapGallery" { + import BasemapGallery = __esri.BasemapGallery; + export = BasemapGallery; +} + declare module "esri/widgets/BasemapToggle" { import BasemapToggle = __esri.BasemapToggle; export = BasemapToggle; @@ -8061,6 +9678,11 @@ declare module "esri/widgets/Compass" { export = Compass; } +declare module "esri/widgets/Expand" { + import Expand = __esri.Expand; + export = Expand; +} + declare module "esri/widgets/Home" { import Home = __esri.Home; export = Home; @@ -8096,6 +9718,11 @@ declare module "esri/widgets/Print" { export = Print; } +declare module "esri/widgets/ScaleBar" { + import ScaleBar = __esri.ScaleBar; + export = ScaleBar; +} + declare module "esri/widgets/Search" { import Search = __esri.Search; export = Search; @@ -8131,6 +9758,11 @@ declare module "esri/widgets/Attribution/AttributionViewModel" { export = AttributionViewModel; } +declare module "esri/widgets/BasemapGallery/BasemapGalleryViewModel" { + import BasemapGalleryViewModel = __esri.BasemapGalleryViewModel; + export = BasemapGalleryViewModel; +} + declare module "esri/widgets/BasemapToggle/BasemapToggleViewModel" { import BasemapToggleViewModel = __esri.BasemapToggleViewModel; export = BasemapToggleViewModel; @@ -8141,6 +9773,11 @@ declare module "esri/widgets/Compass/CompassViewModel" { export = CompassViewModel; } +declare module "esri/widgets/Expand/ExpandViewModel" { + import ExpandViewModel = __esri.ExpandViewModel; + export = ExpandViewModel; +} + declare module "esri/widgets/Home/HomeViewModel" { import HomeViewModel = __esri.HomeViewModel; export = HomeViewModel; @@ -8151,6 +9788,11 @@ declare module "esri/widgets/LayerList/LayerListViewModel" { export = LayerListViewModel; } +declare module "esri/widgets/LayerList/ListItem" { + import ListItem = __esri.ListItem; + export = ListItem; +} + declare module "esri/widgets/Locate/LocateViewModel" { import LocateViewModel = __esri.LocateViewModel; export = LocateViewModel; @@ -8171,6 +9813,11 @@ declare module "esri/widgets/Popup/PopupViewModel" { export = PopupViewModel; } +declare module "esri/widgets/ScaleBar/ScaleBarViewModel" { + import ScaleBarViewModel = __esri.ScaleBarViewModel; + export = ScaleBarViewModel; +} + declare module "esri/widgets/Search/SearchViewModel" { import SearchViewModel = __esri.SearchViewModel; export = SearchViewModel; @@ -8266,6 +9913,11 @@ declare module "esri/views/DOMContainer" { export = DOMContainer; } +declare module "esri/widgets/Widgette" { + import Widgette = __esri.Widgette; + export = Widgette; +} + declare module "esri/widgets/support/GeolocationPositioning" { import GeolocationPositioning = __esri.GeolocationPositioning; export = GeolocationPositioning; @@ -8296,6 +9948,11 @@ declare module "esri/core/promiseUtils" { export = promiseUtils; } +declare module "esri/core/requireUtils" { + import requireUtils = __esri.requireUtils; + export = requireUtils; +} + declare module "esri/core/urlUtils" { import urlUtils = __esri.urlUtils; export = urlUtils; @@ -8331,6 +9988,11 @@ declare module "esri/geometry/support/jsonUtils" { export = jsonUtils; } +declare module "esri/geometry/support/normalizeUtils" { + import normalizeUtils = __esri.normalizeUtils; + export = normalizeUtils; +} + declare module "esri/geometry/support/webMercatorUtils" { import webMercatorUtils = __esri.webMercatorUtils; export = webMercatorUtils; @@ -8391,11 +10053,6 @@ declare module "esri/renderers/support/jsonUtils" { export = supportJsonUtils; } -declare module "esri/support/Action" { - import Action = __esri.Action; - export = Action; -} - declare module "esri/symbols/support/jsonUtils" { import symbolsSupportJsonUtils = __esri.symbolsSupportJsonUtils; export = symbolsSupportJsonUtils; @@ -8411,7 +10068,17 @@ declare module "esri/widgets/support/widget" { export = widget; } -declare module "esri/widgets/LayerList/ListItem" { - import ListItem = __esri.ListItem; - export = ListItem; +declare module "esri/widgets/BasemapGallery/BasemapGalleryItem" { + import BasemapGalleryItem = __esri.BasemapGalleryItem; + export = BasemapGalleryItem; } + +declare module "esri/widgets/BasemapGallery/support/LocalBasemapsSource" { + import LocalBasemapsSource = __esri.LocalBasemapsSource; + export = LocalBasemapsSource; +} + +declare module "esri/widgets/BasemapGallery/support/PortalBasemapsSource" { + import PortalBasemapsSource = __esri.PortalBasemapsSource; + export = PortalBasemapsSource; +} \ No newline at end of file From d581cd13ab2425f27373d4e220932ce9b26bd315 Mon Sep 17 00:00:00 2001 From: Belinda Teh Date: Mon, 6 Mar 2017 16:43:00 -0800 Subject: [PATCH 076/567] Update qs definitions to include 'sort' in its stringify options --- qs/index.d.ts | 4 +++- qs/qs-tests.ts | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/qs/index.d.ts b/qs/index.d.ts index c23c02f871..400cc7a1e4 100644 --- a/qs/index.d.ts +++ b/qs/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for qs 6.2.0 // Project: https://github.com/hapijs/qs -// Definitions by: Roman Korneev , Leon Yu +// Definitions by: Roman Korneev , Leon Yu , +// Belinda Teh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = QueryString; @@ -16,6 +17,7 @@ declare namespace QueryString { filter?: Array | ((prefix: string, value: any) => any); arrayFormat?: 'indices' | 'brackets' | 'repeat'; indices?: boolean; + sort?: (a: any, b: any) => number; } interface IParseOptions { diff --git a/qs/qs-tests.ts b/qs/qs-tests.ts index bcff0a0762..f3d361476e 100644 --- a/qs/qs-tests.ts +++ b/qs/qs-tests.ts @@ -249,3 +249,8 @@ qs.parse('a=b&c=d', { delimiter: '&' }); var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder }); assert.deepEqual(obj, { a: 'こんにちは!' }); } + +() => { + var sorted = qs.stringify({ a: 1, c: 3, b: 2 }, { sort: (a, b) => a.localeCompare(b) }) + assert.equal(sorted, 'a=1&b=2&c=3') +} From 01e6251cd20e73a71f73207272be11d4bf2e9eff Mon Sep 17 00:00:00 2001 From: Belinda Teh Date: Mon, 6 Mar 2017 16:51:48 -0800 Subject: [PATCH 077/567] Update qs tests to 4 space indent --- qs/qs-tests.ts | 256 ++++++++++++++++++++++++------------------------- 1 file changed, 128 insertions(+), 128 deletions(-) diff --git a/qs/qs-tests.ts b/qs/qs-tests.ts index f3d361476e..10a911c2dc 100644 --- a/qs/qs-tests.ts +++ b/qs/qs-tests.ts @@ -8,82 +8,82 @@ qs.parse('a=b'); qs.parse('a=b&c=d', { delimiter: '&' }); () => { - var obj = qs.parse('a=c'); - assert.deepEqual(obj, { a: 'c' }); + var obj = qs.parse('a=c'); + assert.deepEqual(obj, { a: 'c' }); - var str = qs.stringify(obj); - assert.equal(str, 'a=c'); + var str = qs.stringify(obj); + assert.equal(str, 'a=c'); } () => { - var plainObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true }); - assert.deepEqual(plainObject, { a: { hasOwnProperty: 'b' } }); + var plainObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true }); + assert.deepEqual(plainObject, { a: { hasOwnProperty: 'b' } }); } () => { - var protoObject = qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }); - assert.deepEqual(protoObject, { a: { hasOwnProperty: 'b' } }); + var protoObject = qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }); + assert.deepEqual(protoObject, { a: { hasOwnProperty: 'b' } }); } () => { - assert.deepEqual(qs.parse('a%5Bb%5D=c'), { - a: { b: 'c' } - }); + assert.deepEqual(qs.parse('a%5Bb%5D=c'), { + a: { b: 'c' } + }); } () => { - assert.deepEqual(qs.parse('foo[bar][baz]=foobarbaz'), { - foo: { - bar: { - baz: 'foobarbaz' - } - } - }); -} - -() => { - var expected = { - a: { - b: { - c: { - d: { - e: { - f: { - '[g][h][i]': 'j' - } + assert.deepEqual(qs.parse('foo[bar][baz]=foobarbaz'), { + foo: { + bar: { + baz: 'foobarbaz' } - } } - } - } - }; - var string = 'a[b][c][d][e][f][g][h][i]=j'; - assert.deepEqual(qs.parse(string), expected); + }); } () => { - var deep = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 }); - assert.deepEqual(deep, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }); + var expected = { + a: { + b: { + c: { + d: { + e: { + f: { + '[g][h][i]': 'j' + } + } + } + } + } + } + }; + var string = 'a[b][c][d][e][f][g][h][i]=j'; + assert.deepEqual(qs.parse(string), expected); } () => { - var limited = qs.parse('a=b&c=d', { parameterLimit: 1 }); - assert.deepEqual(limited, { a: 'b' }); + var deep = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 }); + assert.deepEqual(deep, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }); } () => { - var delimited = qs.parse('a=b;c=d', { delimiter: ';' }); - assert.deepEqual(delimited, { a: 'b', c: 'd' }); + var limited = qs.parse('a=b&c=d', { parameterLimit: 1 }); + assert.deepEqual(limited, { a: 'b' }); } () => { - var regexed = qs.parse('a=b;c=d,e=f', { delimiter: /[;,]/ }); - assert.deepEqual(regexed, { a: 'b', c: 'd', e: 'f' }); + var delimited = qs.parse('a=b;c=d', { delimiter: ';' }); + assert.deepEqual(delimited, { a: 'b', c: 'd' }); } () => { - var withDots = qs.parse('a.b=c', { allowDots: true }); - assert.deepEqual(withDots, { a: { b: 'c' } }); + var regexed = qs.parse('a=b;c=d,e=f', { delimiter: /[;,]/ }); + assert.deepEqual(regexed, { a: 'b', c: 'd', e: 'f' }); +} + +() => { + var withDots = qs.parse('a.b=c', { allowDots: true }); + assert.deepEqual(withDots, { a: { b: 'c' } }); } () => { @@ -92,165 +92,165 @@ qs.parse('a=b&c=d', { delimiter: '&' }); } () => { - var withIndexes = qs.parse('a[1]=c&a[0]=b'); - assert.deepEqual(withIndexes, { a: ['b', 'c'] }); + var withIndexes = qs.parse('a[1]=c&a[0]=b'); + assert.deepEqual(withIndexes, { a: ['b', 'c'] }); } () => { - var noSparse = qs.parse('a[1]=b&a[15]=c'); - assert.deepEqual(noSparse, { a: ['b', 'c'] }); + var noSparse = qs.parse('a[1]=b&a[15]=c'); + assert.deepEqual(noSparse, { a: ['b', 'c'] }); } () => { - var withEmptyString = qs.parse('a[]=&a[]=b'); - assert.deepEqual(withEmptyString, { a: ['', 'b'] }); + var withEmptyString = qs.parse('a[]=&a[]=b'); + assert.deepEqual(withEmptyString, { a: ['', 'b'] }); - var withIndexedEmptyString = qs.parse('a[0]=b&a[1]=&a[2]=c'); - assert.deepEqual(withIndexedEmptyString, { a: ['b', '', 'c'] }); + var withIndexedEmptyString = qs.parse('a[0]=b&a[1]=&a[2]=c'); + assert.deepEqual(withIndexedEmptyString, { a: ['b', '', 'c'] }); } () => { - var withMaxIndex = qs.parse('a[100]=b'); - assert.deepEqual(withMaxIndex, { a: { '100': 'b' } }); + var withMaxIndex = qs.parse('a[100]=b'); + assert.deepEqual(withMaxIndex, { a: { '100': 'b' } }); } () => { - var withArrayLimit = qs.parse('a[1]=b', { arrayLimit: 0 }); - assert.deepEqual(withArrayLimit, { a: { '1': 'b' } }); + var withArrayLimit = qs.parse('a[1]=b', { arrayLimit: 0 }); + assert.deepEqual(withArrayLimit, { a: { '1': 'b' } }); } () => { - var noParsingArrays = qs.parse('a[]=b', { parseArrays: false }); - assert.deepEqual(noParsingArrays, { a: { '0': 'b' } }); + var noParsingArrays = qs.parse('a[]=b', { parseArrays: false }); + assert.deepEqual(noParsingArrays, { a: { '0': 'b' } }); } () => { - var mixedNotation = qs.parse('a[0]=b&a[b]=c'); - assert.deepEqual(mixedNotation, { a: { '0': 'b', b: 'c' } }); + var mixedNotation = qs.parse('a[0]=b&a[b]=c'); + assert.deepEqual(mixedNotation, { a: { '0': 'b', b: 'c' } }); } () => { - var arraysOfObjects = qs.parse('a[][b]=c'); - assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] }); + var arraysOfObjects = qs.parse('a[][b]=c'); + assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] }); } () => { - assert.equal(qs.stringify({ a: 'b' }), 'a=b'); - assert.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); + assert.equal(qs.stringify({ a: 'b' }), 'a=b'); + assert.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); } () => { - var unencoded = qs.stringify({ a: { b: 'c' } }, { encode: false }); - assert.equal(unencoded, 'a[b]=c'); + var unencoded = qs.stringify({ a: { b: 'c' } }, { encode: false }); + assert.equal(unencoded, 'a[b]=c'); } () => { - var encoded = qs.stringify({ a: { b: 'c' } }, { - encoder: function (str) { - // Passed in values `a`, `b`, `c` - return // Return encoded string - } - }) + var encoded = qs.stringify({ a: { b: 'c' } }, { + encoder: function (str) { + // Passed in values `a`, `b`, `c` + return // Return encoded string + } + }) } () => { - var decoded = qs.parse('x=z', { - decoder: function (str) { - // Passed in values `x`, `z` - return // Return decoded string - } - }) + var decoded = qs.parse('x=z', { + decoder: function (str) { + // Passed in values `x`, `z` + return // Return decoded string + } + }) } () => { - qs.stringify({ a: ['b', 'c', 'd'] }); - // 'a[0]=b&a[1]=c&a[2]=d' + qs.stringify({ a: ['b', 'c', 'd'] }); + // 'a[0]=b&a[1]=c&a[2]=d' } () => { - qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }); - // 'a=b&a=c&a=d' + qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }); + // 'a=b&a=c&a=d' } () => { - qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }) - // 'a[0]=b&a[1]=c' - qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }) - // 'a[]=b&a[]=c' - qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) - // 'a=b&a=c' + qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }) + // 'a[0]=b&a[1]=c' + qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }) + // 'a[]=b&a[]=c' + qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) + // 'a=b&a=c' } () => { - assert.equal(qs.stringify({ a: '' }), 'a='); + assert.equal(qs.stringify({ a: '' }), 'a='); } () => { - assert.equal(qs.stringify({ a: null, b: undefined }), 'a='); + assert.equal(qs.stringify({ a: null, b: undefined }), 'a='); } () => { - assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); + assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); } () => { - qs.stringify({ a: 'b', c: 'd', e: { f: new Date(123), g: [2] } }, { filter: function (prefix, value) { - if (prefix == 'b') { - // Return an `undefined` value to omit a property. - return; - } - if (prefix == 'e[f]') { - return value.getTime(); - } - if (prefix == 'e[g][0]') { - return value * 2; - } - return value; - } }); - // 'a=b&c=d&e[f]=123&e[g][0]=4' - qs.stringify({ a: 'b', c: 'd', e: 'f' }, { filter: ['a', 'e'] }); - // 'a=b&e=f' - qs.stringify({ a: ['b', 'c', 'd'], e: 'f' }, { filter: ['a', 0, 2] }); + qs.stringify({ a: 'b', c: 'd', e: { f: new Date(123), g: [2] } }, { filter: function (prefix, value) { + if (prefix == 'b') { + // Return an `undefined` value to omit a property. + return; + } + if (prefix == 'e[f]') { + return value.getTime(); + } + if (prefix == 'e[g][0]') { + return value * 2; + } + return value; + } }); + // 'a=b&c=d&e[f]=123&e[g][0]=4' + qs.stringify({ a: 'b', c: 'd', e: 'f' }, { filter: ['a', 'e'] }); + // 'a=b&e=f' + qs.stringify({ a: ['b', 'c', 'd'], e: 'f' }, { filter: ['a', 0, 2] }); } () => { - var withNull = qs.stringify({ a: null, b: '' }); - assert.equal(withNull, 'a=&b='); + var withNull = qs.stringify({ a: null, b: '' }); + assert.equal(withNull, 'a=&b='); } () => { - var equalsInsensitive = qs.parse('a&b='); - assert.deepEqual(equalsInsensitive, { a: '', b: '' }); + var equalsInsensitive = qs.parse('a&b='); + assert.deepEqual(equalsInsensitive, { a: '', b: '' }); } () => { - var strictNull = qs.stringify({ a: null, b: '' }, { strictNullHandling: true }); - assert.equal(strictNull, 'a&b='); + var strictNull = qs.stringify({ a: null, b: '' }, { strictNullHandling: true }); + assert.equal(strictNull, 'a&b='); } () => { - var parsedStrictNull = qs.parse('a&b=', { strictNullHandling: true }); - assert.deepEqual(parsedStrictNull, { a: null, b: '' }); + var parsedStrictNull = qs.parse('a&b=', { strictNullHandling: true }); + assert.deepEqual(parsedStrictNull, { a: null, b: '' }); } () => { - var nullsSkipped = qs.stringify({ a: 'b', c: null }, { skipNulls: true }); - assert.equal(nullsSkipped, 'a=b'); + var nullsSkipped = qs.stringify({ a: 'b', c: null }, { skipNulls: true }); + assert.equal(nullsSkipped, 'a=b'); } () => { - var encoder = () => {}; - var shiftJISEncoded = qs.stringify({ a: 'こんにちは!' }, { encoder: encoder }); - assert.equal(shiftJISEncoded, 'a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I'); + var encoder = () => {}; + var shiftJISEncoded = qs.stringify({ a: 'こんにちは!' }, { encoder: encoder }); + assert.equal(shiftJISEncoded, 'a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I'); } () => { - var decoder = () => {}; - var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder }); - assert.deepEqual(obj, { a: 'こんにちは!' }); + var decoder = () => {}; + var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder }); + assert.deepEqual(obj, { a: 'こんにちは!' }); } () => { - var sorted = qs.stringify({ a: 1, c: 3, b: 2 }, { sort: (a, b) => a.localeCompare(b) }) - assert.equal(sorted, 'a=1&b=2&c=3') + var sorted = qs.stringify({ a: 1, c: 3, b: 2 }, { sort: (a, b) => a.localeCompare(b) }) + assert.equal(sorted, 'a=1&b=2&c=3') } From c87f276f9a6ec3e1c8061ddec297e2d6da21cc61 Mon Sep 17 00:00:00 2001 From: Belinda Teh Date: Mon, 6 Mar 2017 16:52:57 -0800 Subject: [PATCH 078/567] Update qs tests to 4 space indent --- qs/qs-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qs/qs-tests.ts b/qs/qs-tests.ts index 10a911c2dc..f3e5ca3230 100644 --- a/qs/qs-tests.ts +++ b/qs/qs-tests.ts @@ -147,8 +147,8 @@ qs.parse('a=b&c=d', { delimiter: '&' }); () => { var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str) { - // Passed in values `a`, `b`, `c` - return // Return encoded string + // Passed in values `a`, `b`, `c` + return // Return encoded string } }) } @@ -156,8 +156,8 @@ qs.parse('a=b&c=d', { delimiter: '&' }); () => { var decoded = qs.parse('x=z', { decoder: function (str) { - // Passed in values `x`, `z` - return // Return decoded string + // Passed in values `x`, `z` + return // Return decoded string } }) } From e19736d7fe980db3ddf649d7fb5a78a028c81d0f Mon Sep 17 00:00:00 2001 From: bappleyard Date: Tue, 7 Mar 2017 09:09:09 +0000 Subject: [PATCH 079/567] #15029 include declaration for DOMImplementation --- xmldom/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) mode change 100644 => 100755 xmldom/index.d.ts diff --git a/xmldom/index.d.ts b/xmldom/index.d.ts old mode 100644 new mode 100755 index dfbe34599c..8c252389cc --- a/xmldom/index.d.ts +++ b/xmldom/index.d.ts @@ -7,6 +7,11 @@ declare namespace xmldom { var DOMParser: DOMParserStatic; var XMLSerializer: XMLSerializerStatic; + var DOMImplementation: DOMImplementationStatic; + + interface DOMImplementationStatic { + new(): DOMImplementation; + } interface DOMParserStatic { new (): DOMParser; From 7d3e93b80d9c7d07d986a2e580618c23be99914d Mon Sep 17 00:00:00 2001 From: Mikael Kohlmyr Date: Tue, 7 Mar 2017 13:25:21 +0100 Subject: [PATCH 080/567] Fix es6 import for blueimp-md5. --- blueimp-md5/blueimp-md5-tests.ts | 7 +++---- blueimp-md5/index.d.ts | 8 +++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/blueimp-md5/blueimp-md5-tests.ts b/blueimp-md5/blueimp-md5-tests.ts index 18edc69b57..1e2348dc7b 100644 --- a/blueimp-md5/blueimp-md5-tests.ts +++ b/blueimp-md5/blueimp-md5-tests.ts @@ -1,6 +1,5 @@ +import * as md5 from "blueimp-md5"; -import blueimp = require('blueimp-md5'); - -function hash(): boolean { - return blueimp.md5('hello world') === '5eb63bbbe01eeed093cb22bb8f5acdc3'; +function hash1(): string { + return md5('hello world'); } diff --git a/blueimp-md5/index.d.ts b/blueimp-md5/index.d.ts index b51f554e32..656bd4316b 100644 --- a/blueimp-md5/index.d.ts +++ b/blueimp-md5/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for blueimp-md5 v1.1.0 +// Type definitions for blueimp-md5 v2.7.0 // Project: https://github.com/blueimp/JavaScript-MD5 -// Definitions by: Ray Martone +// Definitions by: Ray Martone , Mikael Kohlmyr // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export declare function md5(value: string, key?: string, raw?: boolean): string; +declare function md5(value: string, key?: string, raw?: boolean): string; +declare namespace md5 { } +export = md5; From cebf787454d64884e1ff2306d62148018eb401ac Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Tue, 7 Mar 2017 23:14:25 -0500 Subject: [PATCH 081/567] react-day-picker add tslint.json --- react-day-picker/tslint.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 react-day-picker/tslint.json diff --git a/react-day-picker/tslint.json b/react-day-picker/tslint.json new file mode 100644 index 0000000000..ec365f164b --- /dev/null +++ b/react-day-picker/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} From a45eb5ec85c5c5ba5183ccf82e75aa75c04e5969 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Tue, 7 Mar 2017 23:22:30 -0500 Subject: [PATCH 082/567] react-day-picker add types react and reformat tsconfig.json --- react-day-picker/tsconfig.json | 46 ++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/react-day-picker/tsconfig.json b/react-day-picker/tsconfig.json index 943c51e1e6..4cf47535ad 100644 --- a/react-day-picker/tsconfig.json +++ b/react-day-picker/tsconfig.json @@ -1,24 +1,26 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../", - "jsx": "react", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "react-day-picker-tests.tsx" - ] + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [ + "react" + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-day-picker-tests.tsx" + ] } From 60a8ba65e05048e097fdfa74b7fce9d9f19b92f7 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Tue, 7 Mar 2017 23:23:02 -0500 Subject: [PATCH 083/567] react-day-picker redo types to external module syntax, fix missing fields --- react-day-picker/index.d.ts | 252 +++++++++++++++++++++--------------- 1 file changed, 148 insertions(+), 104 deletions(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index 01c5492922..e50ff542b0 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -1,113 +1,157 @@ -// Type definitions for react-day-picker v1.2.0 +// Type definitions for react-day-picker 1.2 // Project: https://github.com/gpbl/react-day-picker // Definitions by: Giampaolo Bellavite , Jason Killian // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -/// +import * as React from 'react'; -declare module "react-day-picker" { - import DayPicker = ReactDayPicker.DayPicker; - export = DayPicker; +interface LocaleUtils { + formatDay(day: Date, locale: string): string; + formatMonthTitle(month: Date, locale: string): string; + formatWeekdayLong(weekday: number, locale: string): string; + formatWeekdayShort(weekday: number, locale: string): string; + getFirstDayOfWeek(locale: string): number; + getMonths(locale: string): [string, string, string, string, string, string, string, string, string, string, string, string]; } -declare var DayPicker: typeof ReactDayPicker.DayPicker; - -declare namespace ReactDayPicker { - interface LocaleUtils { - formatMonthTitle: (month: Date, locale: string) => string; - formatWeekdayShort: (weekday: number, locale: string) => string; - formatWeekdayLong: (weekday: number, locale: string) => string; - getFirstDayOfWeek: (locale: string) => number; - getMonths: (locale: string) => string[]; - } - - interface DayModifiers { - selected?: boolean; - disabled?: boolean; - [name: string]: boolean | undefined; - } - - interface Modifiers { - [name: string]: (date: Date) => boolean; - } - - interface CaptionElementProps extends React.Props { - date?: Date; - localeUtils?: LocaleUtils; - locale?: string; - onClick?: React.MouseEventHandler<{}>; - } - - interface NavbarElementProps extends React.Props { - className?: string; - previousMonth?: Date; - nextMonth?: Date; - showPreviousButton?: boolean; - showNextButton?: boolean; - onPreviousClick(): void; - onNextClick(): void; - dir?: string; - localeUtils?: LocaleUtils; - locale?: string; - - } - - interface WeekdayElementProps extends React.Props { - weekday?: number; - className?: string; - localeUtils?: LocaleUtils; - locale?: string; - } - - interface Props extends React.Props{ - modifiers?: Modifiers; - initialMonth?: Date; - numberOfMonths?: number; - renderDay?: (date: Date) => number | string | JSX.Element; - enableOutsideDays?: boolean; - firstDayOfWeek?:number; - canChangeMonth?: boolean; - disabledDays?: (date: Date) => boolean; - fixedWeeks?: boolean; - fromMonth?: Date; - reverseMonths?: boolean; - toMonth?: Date; - localeUtils?: LocaleUtils; - locale?: string; - captionElement?: React.ReactElement; - onDayClick?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; - onDayTouchTap?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; - onDayMouseEnter?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; - onDayMouseLeave?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; - onDayTouchEnd?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; - onDayTouchStart?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; - navbarElement?: React.ReactElement; - weekdayElement?: React.ReactElement; - onMonthChange?: (month: Date) => any; - onCaptionClick?: (e: React.SyntheticEvent<{}>, month: Date) => any; - className?: string; - selectedDays?: (date: Date) => boolean; - style?: React.CSSProperties; - tabIndex?: number; - } - - class DayPicker extends React.Component { - showMonth(month: Date): void; - showPreviousMonth(): void; - showNextMonth(): void; - } - - namespace DayPicker { - var LocaleUtils: LocaleUtils; - namespace DateUtils { - function addMonths(d: Date, n: number): Date; - function clone(d: Date): Date; - function isSameDay(d1?: Date, d2?: Date): boolean; - function isPastDay(d: Date): boolean; - function isDayBetween(day: Date, startDate: Date, endDate: Date): boolean; - function addDayToRange(day: Date, range: { from?: Date, to?: Date }): { from?: Date, to?: Date }; - function isDayInRange(day: Date, range: { from?: Date, to?: Date }): boolean; - } - } +interface DateUtils { + addMonths(d: Date, n: number): Date; + clone(d: Date): Date; + isSameDay(d1: Date, d2: Date): Date; + isPastDay(d: Date): boolean; + isFutureDay(d: Date): boolean; + isDayBetween(day: Date, begin: Date, end: Date): boolean; + addDayToRange(day: Date, range: RangeModifier): RangeModifier; + isDayInRange(day: Date, range: RangeModifier): boolean; } + +interface CaptionElementProps { + date: Date; + localeUtils: LocaleUtils; + locale: string; + onClick: typeof Props.onCaptionClick; +} + +interface NavbarElementProps { + className: string; + previousMonth: Date; + nextMonth: Date; + showPreviousButton: boolean; + showNextButton: boolean; + onPreviousClick(): void; + onNextClick(): void; + dir: string; + localeUtils: LocaleUtils; + locale: string; +} + +interface WeekdayElementProps { + weekday: number; + className: string; + localeUtils: LocaleUtils; + locale: string; +} + +interface ClassNames { + container: string; + interactionDisabled: string; + navBar: string; + navButtonPrev: string; + navButtonNext: string; + + month: string; + caption: string; + weekdays: string; + weekdaysRow: string; + weekday: string; + body: string; + week: string; + day: string; + + today: string; + selected: string; + disabled: string; + outside: string; +} + +interface RangeModifier { + from: Date; + to: Date; +} +interface BeforeModifier { + before: Date; +} +interface AfterModifier { + after: Date; +} +interface FunctionModifier { + (date: Date): boolean; +} +type Modifier = RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; + +interface Modifiers { + today: Modifier | Modifier[]; + outside: Modifier | Modifier[]; + [other: string]: Modifier | Modifier[] | undefined; +} + +interface Props { + canChangeMonth?: boolean; + captionElement?: React.SFC; + className?: string; + classNames?: ClassNames; + containerProps?: React.HTMLAttributes; + disabledDays?: Modifier | Modifier[]; + enableOutsideDays?: boolean; + firstDayOfWeek?: number; + fixedWeeks?: boolean; + fromMonth?: Date; + initialMonth?: Date; + labels?: { previousMonth: string; nextMonth: string; }; + locale?: string; + localeUtils?: LocaleUtils; + modifiers?: Modifiers; + month?: Date; + months?: [string, string, string, string, string, string, string, string, string, string, string, string]; + navbarElement?: React.SFC | React.ComponentClass; + numberOfMonths?: number; + onBlur?(e: React.FocusEvent): void; + onCaptionClick?(month: Date, e: React.MouseEvent): void; + onDayClick?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; + onDayKeyDown?(day: Date, modifiers: Modifiers, e: React.KeyboardEvent): void; + onDayMouseEnter?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; + onDayMouseLeave?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; + onDayTouchEnd?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; + onDayTouchStart?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; + onFocus?(e: React.FocusEvent): void; + onKeyDown?(e: React.KeyboardEvent): void; + onMonthChange?(month: Date): void; + pagedNavigation?: boolean; + renderDay?(date: Date, modifiers: Modifiers): React.ReactNode; + reverseMonths?: boolean; + selectedDays?: Modifier | Modifier[]; + toMonth?: Date; + weekdayElement?: React.SFC | React.ComponentClass; + weekdaysLong?: [string, string, string, string, string, string, string]; + weekdaysShort?: [string, string, string, string, string, string, string]; +} + + +class DayPicker extends React.Component { + showMonth(month: Date): void; + + showPreviousMonth(): void; + + showNextMonth(): void; + + showPreviousYear(): void; + + showNextYear(): void; + + static readonly VERSION: string; + static readonly LocaleUtils: LocaleUtils; + static readonly DateUtils: DateUtils; +} + +export = DayPicker; From 7d55759e192e42ff871ee148a95b8707fd79c3a6 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Wed, 8 Mar 2017 00:35:03 -0500 Subject: [PATCH 084/567] react-day-picker merge types into namespace for export = syntax --- react-day-picker/index.d.ts | 270 ++++++++++++++++++------------------ 1 file changed, 135 insertions(+), 135 deletions(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index e50ff542b0..3f166a0c84 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -6,139 +6,143 @@ import * as React from 'react'; -interface LocaleUtils { - formatDay(day: Date, locale: string): string; - formatMonthTitle(month: Date, locale: string): string; - formatWeekdayLong(weekday: number, locale: string): string; - formatWeekdayShort(weekday: number, locale: string): string; - getFirstDayOfWeek(locale: string): number; - getMonths(locale: string): [string, string, string, string, string, string, string, string, string, string, string, string]; +declare namespace DayPicker { + export interface LocaleUtils { + formatDay(day: Date, locale: string): string; + formatMonthTitle(month: Date, locale: string): string; + formatWeekdayLong(weekday: number, locale: string): string; + formatWeekdayShort(weekday: number, locale: string): string; + getFirstDayOfWeek(locale: string): number; + getMonths(locale: string): [string, string, string, string, string, string, string, string, string, string, string, string]; + } + + export interface DateUtils { + addMonths(d: Date, n: number): Date; + clone(d: Date): Date; + isSameDay(d1: Date, d2: Date): Date; + isPastDay(d: Date): boolean; + isFutureDay(d: Date): boolean; + isDayBetween(day: Date, begin: Date, end: Date): boolean; + addDayToRange(day: Date, range: RangeModifier): RangeModifier; + isDayInRange(day: Date, range: RangeModifier): boolean; + } + + export interface CaptionElementProps { + date?: Date; + localeUtils?: LocaleUtils; + locale?: string; + onClick?(month: Date, e: React.MouseEvent): void; + } + + export interface NavbarElementProps { + className?: string; + previousMonth?: Date; + nextMonth?: Date; + showPreviousButton?: boolean; + showNextButton?: boolean; + onPreviousClick?(): void; + onNextClick?(): void; + dir?: string; + localeUtils?: LocaleUtils; + locale?: string; + } + + export interface WeekdayElementProps { + weekday?: number; + className?: string; + localeUtils?: LocaleUtils; + locale?: string; + } + + export interface ClassNames { + container: string; + interactionDisabled: string; + navBar: string; + navButtonPrev: string; + navButtonNext: string; + + month: string; + caption: string; + weekdays: string; + weekdaysRow: string; + weekday: string; + body: string; + week: string; + day: string; + + today: string; + selected: string; + disabled: string; + outside: string; + } + + export interface RangeModifier { + from: Date; + to: Date; + } + export interface BeforeModifier { + before: Date; + } + export interface AfterModifier { + after: Date; + } + export interface FunctionModifier { + (date: Date): boolean; + } + export type Modifier = RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; + + export interface Modifiers { + today: Modifier | Modifier[]; + outside: Modifier | Modifier[]; + [other: string]: Modifier | Modifier[] | undefined; + } + + export interface Props { + canChangeMonth?: boolean; + captionElement?: React.ReactElement; + className?: string; + classNames?: ClassNames; + containerProps?: React.HTMLAttributes; + disabledDays?: Modifier | Modifier[]; + enableOutsideDays?: boolean; + firstDayOfWeek?: number; + fixedWeeks?: boolean; + fromMonth?: Date; + initialMonth?: Date; + labels?: { previousMonth: string; nextMonth: string; }; + locale?: string; + localeUtils?: LocaleUtils; + modifiers?: Partial; + month?: Date; + months?: [string, string, string, string, string, string, string, string, string, string, string, string]; + navbarElement?: React.ReactElement; + numberOfMonths?: number; + onBlur?(e: React.FocusEvent): void; + onCaptionClick?(month: Date, e: React.MouseEvent): void; + onDayClick?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; + onDayKeyDown?(day: Date, modifiers: Modifiers, e: React.KeyboardEvent): void; + onDayMouseEnter?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; + onDayMouseLeave?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; + onDayTouchEnd?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; + onDayTouchStart?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; + onFocus?(e: React.FocusEvent): void; + onKeyDown?(e: React.KeyboardEvent): void; + onMonthChange?(month: Date): void; + pagedNavigation?: boolean; + renderDay?(date: Date, modifiers: Modifiers): React.ReactNode; + reverseMonths?: boolean; + selectedDays?: Modifier | Modifier[]; + toMonth?: Date; + weekdayElement?: React.ReactElement; + weekdaysLong?: [string, string, string, string, string, string, string]; + weekdaysShort?: [string, string, string, string, string, string, string]; + } + const VERSION: string; + const LocaleUtils: DayPicker.LocaleUtils; + const DateUtils: DayPicker.DateUtils; } -interface DateUtils { - addMonths(d: Date, n: number): Date; - clone(d: Date): Date; - isSameDay(d1: Date, d2: Date): Date; - isPastDay(d: Date): boolean; - isFutureDay(d: Date): boolean; - isDayBetween(day: Date, begin: Date, end: Date): boolean; - addDayToRange(day: Date, range: RangeModifier): RangeModifier; - isDayInRange(day: Date, range: RangeModifier): boolean; -} - -interface CaptionElementProps { - date: Date; - localeUtils: LocaleUtils; - locale: string; - onClick: typeof Props.onCaptionClick; -} - -interface NavbarElementProps { - className: string; - previousMonth: Date; - nextMonth: Date; - showPreviousButton: boolean; - showNextButton: boolean; - onPreviousClick(): void; - onNextClick(): void; - dir: string; - localeUtils: LocaleUtils; - locale: string; -} - -interface WeekdayElementProps { - weekday: number; - className: string; - localeUtils: LocaleUtils; - locale: string; -} - -interface ClassNames { - container: string; - interactionDisabled: string; - navBar: string; - navButtonPrev: string; - navButtonNext: string; - - month: string; - caption: string; - weekdays: string; - weekdaysRow: string; - weekday: string; - body: string; - week: string; - day: string; - - today: string; - selected: string; - disabled: string; - outside: string; -} - -interface RangeModifier { - from: Date; - to: Date; -} -interface BeforeModifier { - before: Date; -} -interface AfterModifier { - after: Date; -} -interface FunctionModifier { - (date: Date): boolean; -} -type Modifier = RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; - -interface Modifiers { - today: Modifier | Modifier[]; - outside: Modifier | Modifier[]; - [other: string]: Modifier | Modifier[] | undefined; -} - -interface Props { - canChangeMonth?: boolean; - captionElement?: React.SFC; - className?: string; - classNames?: ClassNames; - containerProps?: React.HTMLAttributes; - disabledDays?: Modifier | Modifier[]; - enableOutsideDays?: boolean; - firstDayOfWeek?: number; - fixedWeeks?: boolean; - fromMonth?: Date; - initialMonth?: Date; - labels?: { previousMonth: string; nextMonth: string; }; - locale?: string; - localeUtils?: LocaleUtils; - modifiers?: Modifiers; - month?: Date; - months?: [string, string, string, string, string, string, string, string, string, string, string, string]; - navbarElement?: React.SFC | React.ComponentClass; - numberOfMonths?: number; - onBlur?(e: React.FocusEvent): void; - onCaptionClick?(month: Date, e: React.MouseEvent): void; - onDayClick?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; - onDayKeyDown?(day: Date, modifiers: Modifiers, e: React.KeyboardEvent): void; - onDayMouseEnter?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; - onDayMouseLeave?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; - onDayTouchEnd?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; - onDayTouchStart?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; - onFocus?(e: React.FocusEvent): void; - onKeyDown?(e: React.KeyboardEvent): void; - onMonthChange?(month: Date): void; - pagedNavigation?: boolean; - renderDay?(date: Date, modifiers: Modifiers): React.ReactNode; - reverseMonths?: boolean; - selectedDays?: Modifier | Modifier[]; - toMonth?: Date; - weekdayElement?: React.SFC | React.ComponentClass; - weekdaysLong?: [string, string, string, string, string, string, string]; - weekdaysShort?: [string, string, string, string, string, string, string]; -} - - -class DayPicker extends React.Component { +declare class DayPicker extends React.Component { showMonth(month: Date): void; showPreviousMonth(): void; @@ -148,10 +152,6 @@ class DayPicker extends React.Component { showPreviousYear(): void; showNextYear(): void; - - static readonly VERSION: string; - static readonly LocaleUtils: LocaleUtils; - static readonly DateUtils: DateUtils; } export = DayPicker; From 99e2521b64f732b59ab658a54673ffa083adbe1e Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Wed, 8 Mar 2017 00:35:31 -0500 Subject: [PATCH 085/567] react-day-picker typing tests passing --- react-day-picker/react-day-picker-tests.tsx | 30 +++++++++------------ 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/react-day-picker/react-day-picker-tests.tsx b/react-day-picker/react-day-picker-tests.tsx index e8a17b5087..deecb3e21a 100644 --- a/react-day-picker/react-day-picker-tests.tsx +++ b/react-day-picker/react-day-picker-tests.tsx @@ -1,37 +1,33 @@ import * as React from 'react'; -import * as DayPicker2 from "react-day-picker"; +import DayPicker = require('react-day-picker'); function isSunday(day: Date) { return day.getDay() === 0; } -// make sure global variable version works -function MyComponent2() { - return +function MyComponent() { + return ( + + ); } DayPicker.DateUtils.clone(new Date()); -DayPicker.DateUtils.isDayInRange(new Date(), {from: new Date()}); +DayPicker.DateUtils.isDayInRange(new Date(), { from: new Date(), to: new Date(2050) }); -// make sure imported version works -function MyComponent() { - return +interface MyCaptionProps extends DayPicker.CaptionElementProps { } -DayPicker2.DateUtils.clone(new Date()); -DayPicker2.DateUtils.isDayInRange(new Date(), { from: new Date() }); - -// test interface for captionElement prop -interface MyCaptionProps extends ReactDayPicker.CaptionElementProps { } class Caption extends React.Component { render() { const { date, locale, localeUtils, onClick } = this.props; - if (!date || !localeUtils || typeof locale === 'undefined') { - return null + if (!date || !localeUtils || !onClick || typeof locale === 'undefined') { + return null; } return ( -
- { localeUtils.formatMonthTitle(date, locale) } +
onClick(date, e) }> + { localeUtils.formatMonthTitle(date, locale) }
); } From 395d4c556b1937ba6820a6c7859b641356a09eb5 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Wed, 8 Mar 2017 00:41:42 -0500 Subject: [PATCH 086/567] react-day-picker update version string --- react-day-picker/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index 3f166a0c84..1e99e1f48b 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-day-picker 1.2 +// Type definitions for react-day-picker 5.1 // Project: https://github.com/gpbl/react-day-picker // Definitions by: Giampaolo Bellavite , Jason Killian // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 92c994bf7d1875d50100812e2817234e7cde0351 Mon Sep 17 00:00:00 2001 From: "Lopez, Manuel" Date: Wed, 8 Mar 2017 11:18:44 +0100 Subject: [PATCH 087/567] Update types, in order to allow to reuse params and/or attach in a new custom world --- cucumber/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cucumber/index.d.ts b/cucumber/index.d.ts index 99f31c5372..fb2ed7e138 100644 --- a/cucumber/index.d.ts +++ b/cucumber/index.d.ts @@ -75,7 +75,7 @@ declare namespace cucumber { After(code: HookCode): void; Around(code: AroundCode):void; setDefaultTimeout(time:number): void; - setWorldConstructor(world: () => void): void; + setWorldConstructor(world: (() => void) | ({})): void; registerHandler(handlerOption:string, code:(event:any, callback:CallbackStepDefinition) =>void): void; registerListener(listener: EventListener): void; addTransform(transform: Transform): void; From acb5edf962060577cd4ff68bf2f42b1f8477a304 Mon Sep 17 00:00:00 2001 From: sqwk Date: Wed, 8 Mar 2017 11:48:25 +0100 Subject: [PATCH 088/567] fix: Make Chainable Work --- lowdb/index.d.ts | 130 +++++++++++++++++++++++------------------------ 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/lowdb/index.d.ts b/lowdb/index.d.ts index 4118372647..3ca15155e1 100644 --- a/lowdb/index.d.ts +++ b/lowdb/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: typicode, // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace lowdb { +declare namespace Lowdb { interface PromiseLike { /** @@ -45,24 +45,24 @@ declare namespace lowdb { chain?: boolean; } - class LoDashWrapper { + class LoDashWrapper> { /** * @see _.has */ - has(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; + has(path: StringRepresentable | StringRepresentable[]): LowEntryClass; /** * @see _.hasIn */ - hasIn(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; + hasIn(path: StringRepresentable | StringRepresentable[]): LowEntryClass; /** * @see _.assign */ assign( source: TSource - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.assign @@ -70,7 +70,7 @@ declare namespace lowdb { assign( source1: TSource1, source2: TSource2 - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.assign @@ -79,7 +79,7 @@ declare namespace lowdb { source1: TSource1, source2: TSource2, source3: TSource3 - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.assign @@ -89,37 +89,37 @@ declare namespace lowdb { source2: TSource2, source3: TSource3, source4: TSource4 - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.assign */ - assign(): LoDashWrapper; + assign(): LowEntryClass; /** * @see _.assign */ - assign(...otherArgs: any[]): LoDashWrapper; + assign(...otherArgs: any[]): LowEntryClass; /** * @see _.cloneDeep */ - cloneDeep(): LoDashWrapper; + cloneDeep(): LowEntryClass; /** * @see _.cloneDeep */ - cloneDeep(): LoDashWrapper; + cloneDeep(): LowEntryClass; /** * @see _.cloneDeep */ - cloneDeepWith(customizer: (value: any) => any): LoDashWrapper[]; + cloneDeepWith(customizer: (value: any) => any): LowEntryClass[]; /** * @see _.cloneDeep */ - cloneDeepWith(customizer: (value: any) => any): LoDashWrapper; + cloneDeepWith(customizer: (value: any) => any): LowEntryClass; /** * @see _.defaults @@ -127,7 +127,7 @@ declare namespace lowdb { defaults( source1: S1, ...sources: {}[] - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.defaults @@ -136,7 +136,7 @@ declare namespace lowdb { source1: S1, source2: S2, ...sources: {}[] - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.defaults @@ -146,7 +146,7 @@ declare namespace lowdb { source2: S2, source3: S3, ...sources: {}[] - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.defaults @@ -157,17 +157,17 @@ declare namespace lowdb { source3: S3, source4: S4, ...sources: {}[] - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.defaults */ - defaults(): LoDashWrapper; + defaults(): LowEntryClass; /** * @see _.defaults */ - defaults(...sources: {}[]): LoDashWrapper; + defaults(...sources: {}[]): LowEntryClass; /** * @see _.get @@ -175,14 +175,14 @@ declare namespace lowdb { get(object: any, path: string | number | boolean | Array, defaultValue?: TResult - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.get */ get(path: string | number | boolean | Array, defaultValue?: TResult - ): LoDashWrapper; + ): LowEntryClass; /** @@ -191,14 +191,14 @@ declare namespace lowdb { mixin( source: Dictionary<() => void>, options?: MixinOptions - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.mixin */ mixin( options?: MixinOptions - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.set @@ -206,7 +206,7 @@ declare namespace lowdb { set( path: StringRepresentable | StringRepresentable[], value: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.set @@ -214,7 +214,7 @@ declare namespace lowdb { set( path: StringRepresentable | StringRepresentable[], value: V - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.find @@ -222,7 +222,7 @@ declare namespace lowdb { find( predicate?: ListIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.find @@ -230,21 +230,21 @@ declare namespace lowdb { find( predicate?: string, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.find */ find( predicate?: TObject - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.find */ filter( predicate?: TObject - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.filter @@ -252,7 +252,7 @@ declare namespace lowdb { filter( predicate?: ListIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.filter @@ -260,7 +260,7 @@ declare namespace lowdb { filter( predicate: string, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.filter @@ -268,7 +268,7 @@ declare namespace lowdb { filter( predicate: ListIterator | DictionaryIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.filter @@ -276,40 +276,40 @@ declare namespace lowdb { filter( predicate?: StringIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.filter */ - filter(predicate: W): LoDashWrapper; + filter(predicate: W): LowEntryClass; /** * @see _.map */ map( iteratee?: ListIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.map */ map( iteratee?: string - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.map */ map( iteratee?: TObject - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.map */ map( iteratee?: ListIterator | DictionaryIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.range @@ -317,7 +317,7 @@ declare namespace lowdb { range( end?: number, step?: number - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.rangeRight @@ -325,7 +325,7 @@ declare namespace lowdb { rangeRight( end?: number, step?: number - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.remove @@ -333,7 +333,7 @@ declare namespace lowdb { remove( predicate?: ListIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.remove @@ -341,46 +341,46 @@ declare namespace lowdb { remove( predicate?: string, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.remove */ remove( predicate?: W - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.sortBy */ sortBy( iteratee?: ListIterator - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.sortBy */ - sortBy(iteratee: string): LoDashWrapper; + sortBy(iteratee: string): LowEntryClass; /** * @see _.sortBy */ - sortBy(whereValue: W): LoDashWrapper; + sortBy(whereValue: W): LowEntryClass; /** * @see _.sortBy */ - sortBy(): LoDashWrapper; + sortBy(): LowEntryClass; /** * @see _.sortBy */ - sortBy(...iteratees: (ListIterator | any | string)[]): LoDashWrapper; + sortBy(...iteratees: (ListIterator | any | string)[]): LowEntryClass; /** * @see _.sortBy */ - sortBy(iteratees: (ListIterator | string | any)[]): LoDashWrapper; + sortBy(iteratees: (ListIterator | string | any)[]): LowEntryClass; /** * @see _.slice @@ -388,44 +388,44 @@ declare namespace lowdb { slice( start?: number, end?: number - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.size */ - size(): LoDashWrapper; + size(): LowEntryClass; /** * @see _.take */ - take(n?: number): LoDashWrapper; + take(n?: number): LowEntryClass; /** * @see _.times */ times( iteratee: (num: number) => TResult - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.times */ - times(): LoDashWrapper; + times(): LowEntryClass; /** * @see _.uniqueId */ - uniqueId(): LoDashWrapper; + uniqueId(): LowEntryClass; value(): T; pop(): T; - push(...items: T[]): LoDashWrapper; + push(...items: T[]): LowEntryClass; shift(): T; - sort(compareFn?: (a: T, b: T) => number): LoDashWrapper; - splice(start: number): LoDashWrapper; - splice(start: number, deleteCount: number, ...items: any[]): LoDashWrapper; - unshift(...items: T[]): LoDashWrapper; + sort(compareFn?: (a: T, b: T) => number): LowEntryClass; + splice(start: number): LowEntryClass; + splice(start: number, deleteCount: number, ...items: any[]): LowEntryClass; + unshift(...items: T[]): LowEntryClass; } export interface Storage { @@ -505,7 +505,7 @@ declare namespace lowdb { } - export class Low extends LoDashWrapper { + export class Lowdb extends LoDashWrapper { constructor(filePath: string, options?: Options); @@ -525,13 +525,13 @@ declare namespace lowdb { * Persist database. * @param source The source location. */ - write(source: string): void + write(source?: string): void /** * Persist database. * @param source The source location. */ - write(source: string): PromiseLike + write(source?: string): PromiseLike /** * Read database. @@ -554,5 +554,5 @@ declare namespace lowdb { } declare module "lowdb" { - export = lowdb.Low; + export = Lowdb.Lowdb; } \ No newline at end of file From 162688615a8f5e9980b12633e4c19ff54aaefe84 Mon Sep 17 00:00:00 2001 From: sqwk Date: Wed, 8 Mar 2017 11:48:54 +0100 Subject: [PATCH 089/567] fix: Update Tests for v15.5 --- lowdb/lowdb-tests.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lowdb/lowdb-tests.ts b/lowdb/lowdb-tests.ts index 612288e8dd..b7e0f4f5f6 100644 --- a/lowdb/lowdb-tests.ts +++ b/lowdb/lowdb-tests.ts @@ -2,10 +2,15 @@ import Lowdb = require('lowdb'); const db = new Lowdb('db.json'); -db.defaults({ someObject: {}, anotherObject: {} }).value(); +db.defaults({ someObject: {}, anotherObject: {} }).write(); -db.get('someObject').set('foo' , 'bar').value(); -db.get('anotherObject').set('foo' , 'bar').value(); -db.set('singleValue', 'foo').value(); +db.get('someObject').set('foo' , 'bar').write(); +db.get('someObject.foo').value(); + +db.get('anotherObject').set('foo' , 'bar').write(); +db.get('anotherObject.foo').value(); + +db.set('singleValue', 'foo').write(); +db.get('singleValue').value(); console.log(db.getState()); From 673f3c9b72d71b51476be7b072f5d621733c31f3 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Wed, 8 Mar 2017 10:59:34 -0500 Subject: [PATCH 090/567] react-day-picker remove tsconfig.json types react and add reference comment in index.d.ts --- react-day-picker/index.d.ts | 2 ++ react-day-picker/tsconfig.json | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index 1e99e1f48b..d1f71a911e 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 +/// + import * as React from 'react'; declare namespace DayPicker { diff --git a/react-day-picker/tsconfig.json b/react-day-picker/tsconfig.json index 4cf47535ad..823be84e03 100644 --- a/react-day-picker/tsconfig.json +++ b/react-day-picker/tsconfig.json @@ -13,9 +13,7 @@ "typeRoots": [ "../" ], - "types": [ - "react" - ], + "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, From d6472a73263a821cf19241bd4df444ec01c64668 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Wed, 8 Mar 2017 11:12:26 -0500 Subject: [PATCH 091/567] react-day-picker remove reference type react because it is already imported --- react-day-picker/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index d1f71a911e..1e99e1f48b 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -4,8 +4,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -/// - import * as React from 'react'; declare namespace DayPicker { From 476377219255cabaf8ba512ccb4ac1cd5cb68907 Mon Sep 17 00:00:00 2001 From: Ben Swartz Date: Wed, 8 Mar 2017 11:18:34 -0800 Subject: [PATCH 092/567] Update Faker Definitions to V4.1.0 --- faker/faker-tests.ts | 22 +++ faker/index.d.ts | 36 +++- faker/v3/faker-tests.ts | 183 ++++++++++++++++++ faker/v3/index.d.ts | 416 ++++++++++++++++++++++++++++++++++++++++ faker/v3/tsconfig.json | 25 +++ 5 files changed, 680 insertions(+), 2 deletions(-) create mode 100644 faker/v3/faker-tests.ts create mode 100644 faker/v3/index.d.ts create mode 100644 faker/v3/tsconfig.json diff --git a/faker/faker-tests.ts b/faker/faker-tests.ts index 4dc2a3735f..5fb6a53746 100644 --- a/faker/faker-tests.ts +++ b/faker/faker-tests.ts @@ -52,6 +52,11 @@ resultStr = faker.company.bsAdjective(); resultStr = faker.company.bsBuzz(); resultStr = faker.company.bsNoun(); +resultStr = faker.database.column(); +resultStr = faker.database.type(); +resultStr = faker.database.collation(); +resultStr = faker.database.engine(); + resultDate = faker.date.past(); resultDate = faker.date.future(); resultDate = faker.date.between('foo', 'bar'); @@ -80,6 +85,8 @@ resultStr = faker.finance.transactionType(); resultStr = faker.finance.currencyCode(); resultStr = faker.finance.currencyName(); resultStr = faker.finance.currencySymbol(); +resultStr = faker.finance.bitcoinAddress(); +resultStr = faker.finance.bic(); resultStr = faker.hacker.abbreviation(); resultStr = faker.hacker.adjective(); @@ -110,6 +117,8 @@ resultStr = userCard.address.suite; resultStr = faker.internet.avatar(); resultStr = faker.internet.email(); resultStr = faker.internet.email('foo', 'bar', 'quux'); +resultStr = faker.internet.exampleEmail(); +resultStr = faker.internet.exampleEmail('foo', 'bar'); resultStr = faker.internet.protocol(); resultStr = faker.internet.url(); resultStr = faker.internet.domainName(); @@ -128,12 +137,18 @@ resultStr = faker.lorem.words(); resultStr = faker.lorem.words(0); resultStr = faker.lorem.sentence(); resultStr = faker.lorem.sentence(0, 0); +resultStr = faker.lorem.slug(); +resultStr = faker.lorem.slug(0); resultStr = faker.lorem.sentences(); resultStr = faker.lorem.sentences(0); resultStr = faker.lorem.paragraph(); resultStr = faker.lorem.paragraph(0); resultStr = faker.lorem.paragraphs(); resultStr = faker.lorem.paragraphs(0, ''); +resultStr = faker.lorem.text(); +resultStr = faker.lorem.text(0); +resultStr = faker.lorem.lines(); +resultStr = faker.lorem.lines(0); resultStr = faker.name.firstName(); resultStr = faker.name.firstName(0); @@ -169,6 +184,13 @@ resultStr = faker.random.objectElement(); resultStr = faker.random.objectElement({foo: 'bar', field: 'foo'}); resultStr = faker.random.uuid(); resultBool = faker.random.boolean(); +resultStr = faker.random.word(); +resultStr = faker.random.words(); +resultStr = faker.random.words(0); +resultStr = faker.random.image(); +resultStr = faker.random.locale(); +resultStr = faker.random.alphaNumeric(); +resultStr = faker.random.alphaNumeric(0); resultStr = faker.system.fileName( "foo", "bar" ); resultStr = faker.system.commonFileName( "foo", "bar" ); diff --git a/faker/index.d.ts b/faker/index.d.ts index 01e01b8b8b..8c6ea8ec6f 100644 --- a/faker/index.d.ts +++ b/faker/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for faker v3.1 +// Based off type definitions for faker v4.1.0 // Project: http://marak.com/faker.js/ -// Definitions by: Bas Pennings , Yuki Kokubun +// Definitions by: Ben Swartz , Bas Pennings , Yuki Kokubun // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var fakerStatic: Faker.FakerStatic; @@ -52,6 +52,13 @@ declare namespace Faker { bsNoun(): string; }; + database: { + column(): string; + type(): string; + collation(): string; + engine(): string; + }; + date: { past(years?: number, refDate?: string|Date): Date; future(years?: number, refDate?: string|Date): Date; @@ -72,6 +79,8 @@ declare namespace Faker { currencyCode(): string; currencyName(): string; currencySymbol(): string; + bitcoinAddress(): string; + bic(): string }; hacker: { @@ -116,11 +125,13 @@ declare namespace Faker { sports(width?: number, height?: number): string; technics(width?: number, height?: number): string; transport(width?: number, height?: number): string; + dataUri(width?: number, height?: number): string; }; internet: { avatar(): string; email(firstName?: string, lastName?: string, provider?: string): string; + exampleEmail(firstName?: string, lastName?: string): string; userName(firstName?: string, lastName?: string): string; protocol(): string; url(): string; @@ -128,6 +139,7 @@ declare namespace Faker { domainSuffix(): string; domainWord(): string; ip(): string; + ipv6(): string; userAgent(): string; color(baseRed255?: number, baseGreen255?: number, baseBlue255?: number): string; mac(): string; @@ -138,9 +150,12 @@ declare namespace Faker { word(): string; words(num?: number): string; sentence(wordCount?: number, range?: number): string; + slug(wordCount?: number): string; sentences(sentenceCount?: number): string; paragraph(sentenceCount?: number): string; paragraphs(paragraphCount?: number, separator?: string): string; + text(times?: number): string; + lines(lineCount?: number): string; }; name: { @@ -171,6 +186,11 @@ declare namespace Faker { objectElement(object?: { [key: string]: T }, field?: any): T; uuid(): string; boolean(): boolean; + word(): string; // TODO: have ability to return specific type of word? As in: noun, adjective, verb, etc + words(count?: number): string; + image(): string; + locale(): string; + alphaNumeric(count?: number): string; }; system: { @@ -275,6 +295,14 @@ declare module "faker" { export = fakerStatic; } +declare module "faker/locale/az" { + export = fakerStatic; +} + +declare module "faker/locale/cz" { + export = fakerStatic; +} + declare module "faker/locale/de" { export = fakerStatic; } @@ -351,6 +379,10 @@ declare module "faker/locale/ge" { export = fakerStatic; } +declare module "faker/locale/id_ID" { + export = fakerStatic; +} + declare module "faker/locale/it" { export = fakerStatic; } diff --git a/faker/v3/faker-tests.ts b/faker/v3/faker-tests.ts new file mode 100644 index 0000000000..4dc2a3735f --- /dev/null +++ b/faker/v3/faker-tests.ts @@ -0,0 +1,183 @@ + + +let resultStr: string; +let resultBool: boolean; +let resultNum: number; +let resultStrArr: string[]; +let resultDate: Date; + +import faker = require('faker'); +faker.locale = 'en'; + +resultStr = faker.address.zipCode(); +resultStr = faker.address.zipCode('###'); +resultStr = faker.address.city(); +resultStr = faker.address.city(0); +resultStr = faker.address.cityPrefix(); +resultStr = faker.address.citySuffix(); +resultStr = faker.address.streetName(); +resultStr = faker.address.streetAddress(); +resultStr = faker.address.streetAddress(false);; +resultStr = faker.address.streetSuffix(); +resultStr = faker.address.streetPrefix(); +resultStr = faker.address.secondaryAddress(); +resultStr = faker.address.county(); +resultStr = faker.address.country(); +resultStr = faker.address.countryCode(); +resultStr = faker.address.state(); +resultStr = faker.address.state(false); +resultStr = faker.address.stateAbbr(); +resultStr = faker.address.latitude(); +resultStr = faker.address.longitude(); + +resultStr = faker.commerce.color(); +resultStr = faker.commerce.department(); +resultStr = faker.commerce.productName(); +resultStr = faker.commerce.price(); +resultStr = faker.commerce.price(0, 0, 0, '#'); +resultStr = faker.commerce.productAdjective(); +resultStr = faker.commerce.productMaterial(); +resultStr = faker.commerce.product(); + +resultStrArr = faker.company.suffixes(); +resultStr = faker.company.companyName(); +resultStr = faker.company.companyName(0); +resultStr = faker.company.companySuffix(); +resultStr = faker.company.catchPhrase(); +resultStr = faker.company.bs(); +resultStr = faker.company.catchPhraseAdjective(); +resultStr = faker.company.catchPhraseDescriptor(); +resultStr = faker.company.catchPhraseNoun(); +resultStr = faker.company.bsAdjective(); +resultStr = faker.company.bsBuzz(); +resultStr = faker.company.bsNoun(); + +resultDate = faker.date.past(); +resultDate = faker.date.future(); +resultDate = faker.date.between('foo', 'bar'); +resultDate = faker.date.between(new Date(), new Date()); +resultDate = faker.date.recent(); +resultDate = faker.date.recent(100); +resultStr = faker.date.month(); +resultStr = faker.date.month({ + abbr: true, + context: true +}); +resultStr = faker.date.weekday(); +resultStr = faker.date.weekday({ + abbr: true, + context: true +}); + +resultStr = faker.finance.account(); +resultStr = faker.finance.account(0); +resultStr = faker.finance.accountName(); +resultStr = faker.finance.mask(); +resultStr = faker.finance.mask(0, false, false); +resultStr = faker.finance.amount(); +resultStr = faker.finance.amount(0, 0, 0, '#'); +resultStr = faker.finance.transactionType(); +resultStr = faker.finance.currencyCode(); +resultStr = faker.finance.currencyName(); +resultStr = faker.finance.currencySymbol(); + +resultStr = faker.hacker.abbreviation(); +resultStr = faker.hacker.adjective(); +resultStr = faker.hacker.noun(); +resultStr = faker.hacker.verb(); +resultStr = faker.hacker.ingverb(); +resultStr = faker.hacker.phrase(); + +resultStr = faker.helpers.randomize(); +resultNum = faker.helpers.randomize([1,2,3,4]); +resultStr = faker.helpers.randomize(['foo', 'bar', 'quux']); +resultStr = faker.helpers.slugify('foo bar quux'); +resultStr = faker.helpers.replaceSymbolWithNumber('foo# bar#'); +resultStr = faker.helpers.replaceSymbols('foo# bar? quux#'); +resultStrArr = faker.helpers.shuffle(['foo', 'bar', 'quux']); +resultStr = faker.helpers.mustache('{{foo}}{{bar}}', {foo: 'x', bar: 'y'}); + +const card = faker.helpers.createCard(); +resultStr = card.name; +resultStr = card.address.streetA; +const contextualCard = faker.helpers.contextualCard(); +resultStr = contextualCard.name; +resultStr = contextualCard.address.suite; +const userCard = faker.helpers.userCard(); +resultStr = userCard.name; +resultStr = userCard.address.suite; + +resultStr = faker.internet.avatar(); +resultStr = faker.internet.email(); +resultStr = faker.internet.email('foo', 'bar', 'quux'); +resultStr = faker.internet.protocol(); +resultStr = faker.internet.url(); +resultStr = faker.internet.domainName(); +resultStr = faker.internet.domainSuffix(); +resultStr = faker.internet.domainWord(); +resultStr = faker.internet.ip(); +resultStr = faker.internet.userAgent(); +resultStr = faker.internet.color(); +resultStr = faker.internet.color(0, 0, 0); +resultStr = faker.internet.mac(); +resultStr = faker.internet.password(); +resultStr = faker.internet.password(0, false, '#', 'foo'); + +resultStr = faker.lorem.word(); +resultStr = faker.lorem.words(); +resultStr = faker.lorem.words(0); +resultStr = faker.lorem.sentence(); +resultStr = faker.lorem.sentence(0, 0); +resultStr = faker.lorem.sentences(); +resultStr = faker.lorem.sentences(0); +resultStr = faker.lorem.paragraph(); +resultStr = faker.lorem.paragraph(0); +resultStr = faker.lorem.paragraphs(); +resultStr = faker.lorem.paragraphs(0, ''); + +resultStr = faker.name.firstName(); +resultStr = faker.name.firstName(0); +resultStr = faker.name.lastName(); +resultStr = faker.name.lastName(0); +resultStr = faker.name.findName(); +resultStr = faker.name.findName('', '', 0); +resultStr = faker.name.jobTitle(); +resultStr = faker.name.prefix(); +resultStr = faker.name.suffix(); +resultStr = faker.name.title(); +resultStr = faker.name.jobDescriptor(); +resultStr = faker.name.jobArea(); +resultStr = faker.name.jobType(); + +resultStr = faker.phone.phoneNumber(); +resultStr = faker.phone.phoneNumber('#'); +resultStr = faker.phone.phoneNumberFormat(); +// https://github.com/Marak/faker.js/blob/master/lib/phone_number.js#L9-L13 +resultStr = faker.phone.phoneNumberFormat(0); +resultStr = faker.phone.phoneFormats(); + +resultNum = faker.random.number(); +resultNum = faker.random.number(0); +resultNum = faker.random.number({ + min: 0, + max: 0, + precision: 0 +}); +resultStr = faker.random.arrayElement(); +resultStr = faker.random.arrayElement(['foo', 'bar', 'quux']) +resultStr = faker.random.objectElement(); +resultStr = faker.random.objectElement({foo: 'bar', field: 'foo'}); +resultStr = faker.random.uuid(); +resultBool = faker.random.boolean(); + +resultStr = faker.system.fileName( "foo", "bar" ); +resultStr = faker.system.commonFileName( "foo", "bar" ); +resultStr = faker.system.mimeType(); +resultStr = faker.system.commonFileType(); +resultStr = faker.system.commonFileExt(); +resultStr = faker.system.fileType(); +resultStr = faker.system.fileExt( "foo" ); +resultStr = faker.system.semver(); + +import fakerEn = require('faker/locale/en'); +resultStr = faker.name.firstName(); diff --git a/faker/v3/index.d.ts b/faker/v3/index.d.ts new file mode 100644 index 0000000000..01e01b8b8b --- /dev/null +++ b/faker/v3/index.d.ts @@ -0,0 +1,416 @@ +// Type definitions for faker v3.1 +// Project: http://marak.com/faker.js/ +// Definitions by: Bas Pennings , Yuki Kokubun +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare var fakerStatic: Faker.FakerStatic; + +declare namespace Faker { + interface FakerStatic { + locale: string; + + address: { + zipCode(format?: string): string; + city(format?: number): string; + cityPrefix(): string; + citySuffix(): string; + streetName(): string; + streetAddress(useFullAddress?: boolean): string; + streetSuffix(): string; + streetPrefix(): string; + secondaryAddress(): string; + county(): string; + country(): string; + countryCode(): string; + state(useAbbr?: boolean): string; + stateAbbr(): string; + latitude(): string; + longitude(): string; + }; + + commerce: { + color(): string; + department(): string; + productName(): string; + price(min?: number, max?: number, dec?: number, symbol?: string): string; + productAdjective(): string; + productMaterial(): string; + product(): string; + }; + + company: { + suffixes(): string[]; + companyName(format?: number): string; + companySuffix(): string; + catchPhrase(): string; + bs(): string; + catchPhraseAdjective(): string; + catchPhraseDescriptor(): string; + catchPhraseNoun(): string; + bsAdjective(): string; + bsBuzz(): string; + bsNoun(): string; + }; + + date: { + past(years?: number, refDate?: string|Date): Date; + future(years?: number, refDate?: string|Date): Date; + between(from: string|number|Date, to: string|Date): Date; + recent(days?: number): Date; + month(options?: { abbr?: boolean, context?: boolean }): string; + weekday(options?: { abbr?: boolean, context?: boolean }): string; + }; + + fake(str: string): string; + + finance: { + account(length?: number): string; + accountName(): string; + mask(length?: number, parens?: boolean, elipsis?: boolean): string; + amount(min?:number, max?: number, dec?: number, symbol?: string): string; + transactionType(): string; + currencyCode(): string; + currencyName(): string; + currencySymbol(): string; + }; + + hacker: { + abbreviation(): string; + adjective(): string; + noun(): string; + verb(): string; + ingverb(): string; + phrase(): string; + }; + + helpers: { + randomize(array: T[]): T; + randomize(): string; + slugify(string?: string): string; + replaceSymbolWithNumber(string?: string, symbol?: string): string; + replaceSymbols(string?: string): string; + shuffle(o: T[]): T[]; + shuffle(): string[]; + mustache(str: string, data: { [key: string]: string|((substring: string, ...args: any[]) => string) }): string; + createCard(): Faker.Card; + contextualCard(): Faker.ContextualCard; + userCard(): Faker.UserCard; + createTransaction(): Faker.Transaction; + }; + + + image: { + image(): string; + avatar(): string; + imageUrl(width?: number, height?: number, category?: string): string; + abstract(width?: number, height?: number): string; + animals(width?: number, height?: number): string; + business(width?: number, height?: number): string; + cats(width?: number, height?: number): string; + city(width?: number, height?: number): string; + food(width?: number, height?: number): string; + nightlife(width?: number, height?: number): string; + fashion(width?: number, height?: number): string; + people(width?: number, height?: number): string; + nature(width?: number, height?: number): string; + sports(width?: number, height?: number): string; + technics(width?: number, height?: number): string; + transport(width?: number, height?: number): string; + }; + + internet: { + avatar(): string; + email(firstName?: string, lastName?: string, provider?: string): string; + userName(firstName?: string, lastName?: string): string; + protocol(): string; + url(): string; + domainName(): string; + domainSuffix(): string; + domainWord(): string; + ip(): string; + userAgent(): string; + color(baseRed255?: number, baseGreen255?: number, baseBlue255?: number): string; + mac(): string; + password(len?: number, memorable?: boolean, pattern?: string|RegExp, prefix?: string): string; + }; + + lorem: { + word(): string; + words(num?: number): string; + sentence(wordCount?: number, range?: number): string; + sentences(sentenceCount?: number): string; + paragraph(sentenceCount?: number): string; + paragraphs(paragraphCount?: number, separator?: string): string; + }; + + name: { + firstName(gender?: number): string; + lastName(gender?: number): string; + findName(firstName?: string, lastName?: string, gender?: number): string; + jobTitle(): string; + prefix(): string; + suffix(): string; + title(): string; + jobDescriptor(): string; + jobArea(): string; + jobType(): string; + }; + + phone: { + phoneNumber(format?: string): string; + phoneNumberFormat(phoneFormatsArrayIndex?: number): string; + phoneFormats(): string; + }; + + random: { + number(max: number): number; + number(options?: { min?: number, max?: number, precision?: number }): number; + arrayElement(): string; + arrayElement(array: T[]): T; + objectElement(object?: { [key: string]: any }, field?: "key"): string; + objectElement(object?: { [key: string]: T }, field?: any): T; + uuid(): string; + boolean(): boolean; + }; + + system: { + fileName(ext: string, type: string): string; + commonFileName(ext: string, type: string): string; + mimeType(): string; + commonFileType(): string; + commonFileExt(): string; + fileType(): string; + fileExt(mimeType: string): string; + //directoryPath(): string; + //filePath(): string; + semver(): string; + }; + + seed(value: number): void; + } + + interface Card { + name: string; + username: string; + email: string; + address: FullAddress; + phone: string; + website: string; + company: Company; + posts: Post[]; + accountHistory: string[]; + } + + interface FullAddress { + streetA: string; + streetB: string; + streetC: string; + streetD: string; + city: string; + state: string; + county: string; + zipcode: string; + geo: Geo; + } + + interface Geo { + lat: string; + lng: string; + } + + interface Company { + name: string; + catchPhrase: string; + bs: string; + } + + interface Post { + words: string; + sentence: string; + sentences: string; + paragraph: string; + } + + interface ContextualCard { + name: string; + username: string; + email: string; + dob: Date; + phone: string; + address: Address; + website: string; + company: Company; + } + + interface Address { + street: string; + suite: string; + city: string; + state: string; + zipcode: string; + geo: Geo; + } + + interface UserCard { + name: string; + username: string; + email: string; + address: Address; + phone: string; + website: string; + company: Company; + } + + interface Transaction { + amount: string; + date: Date; + business: string; + name: string; + type: string; + account: string; + } +} + +declare module "faker" { + export = fakerStatic; +} + +declare module "faker/locale/de" { + export = fakerStatic; +} + +declare module "faker/locale/de_AT" { + export = fakerStatic; +} + +declare module "faker/locale/de_CH" { + export = fakerStatic; +} + +declare module "faker/locale/el_GR" { + export = fakerStatic; +} + +declare module "faker/locale/en" { + export = fakerStatic; +} + +declare module "faker/locale/en_AU" { + export = fakerStatic; +} + +declare module "faker/locale/en_BORK" { + export = fakerStatic; +} + +declare module "faker/locale/en_CA" { + export = fakerStatic; +} + +declare module "faker/locale/en_GB" { + export = fakerStatic; +} + +declare module "faker/locale/en_IE" { + export = fakerStatic; +} + +declare module "faker/locale/en_IND" { + export = fakerStatic; +} + +declare module "faker/locale/en_US" { + export = fakerStatic; +} + +declare module "faker/locale/en_au_ocker" { + export = fakerStatic; +} + +declare module "faker/locale/es" { + export = fakerStatic; +} + +declare module "faker/locale/es_MX" { + export = fakerStatic; +} + +declare module "faker/locale/fa" { + export = fakerStatic; +} + +declare module "faker/locale/fr" { + export = fakerStatic; +} + +declare module "faker/locale/fr_CA" { + export = fakerStatic; +} + +declare module "faker/locale/ge" { + export = fakerStatic; +} + +declare module "faker/locale/it" { + export = fakerStatic; +} + +declare module "faker/locale/ja" { + export = fakerStatic; +} + +declare module "faker/locale/ko" { + export = fakerStatic; +} + +declare module "faker/locale/nb_NO" { + export = fakerStatic; +} + +declare module "faker/locale/nep" { + export = fakerStatic; +} + +declare module "faker/locale/nl" { + export = fakerStatic; +} + +declare module "faker/locale/pl" { + export = fakerStatic; +} + +declare module "faker/locale/pt_BR" { + export = fakerStatic; +} + +declare module "faker/locale/ru" { + export = fakerStatic; +} + +declare module "faker/locale/sk" { + export = fakerStatic; +} + +declare module "faker/locale/sv" { + export = fakerStatic; +} + +declare module "faker/locale/tr" { + export = fakerStatic; +} + +declare module "faker/locale/uk" { + export = fakerStatic; +} + +declare module "faker/locale/vi" { + export = fakerStatic; +} + +declare module "faker/locale/zh_CN" { + export = fakerStatic; +} + +declare module "faker/locale/zh_TW" { + export = fakerStatic; +} diff --git a/faker/v3/tsconfig.json b/faker/v3/tsconfig.json new file mode 100644 index 0000000000..40af61eba9 --- /dev/null +++ b/faker/v3/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "paths": { + "faker": [ "faker/v3" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "faker-tests.ts" + ] +} From eed88053b0ec98c27e50e77b4216053aa455d432 Mon Sep 17 00:00:00 2001 From: abeall Date: Wed, 8 Mar 2017 14:24:11 -0500 Subject: [PATCH 093/567] Added browser name values --- detect-browser/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detect-browser/index.d.ts b/detect-browser/index.d.ts index 0f845cd781..5ca68eabdf 100644 --- a/detect-browser/index.d.ts +++ b/detect-browser/index.d.ts @@ -6,7 +6,7 @@ /** * Browser name */ -export const name: string; +export const name: "edge" | "yandexbrowser" | "chrome" | "crios" | "firefox" | "opera" | "ie" | "bb10" | "android" | "ios" | "safari"; /** * Browser version From 023d4ef9370dc1a7ca348d75cb4b0e42c890dee5 Mon Sep 17 00:00:00 2001 From: abeall Date: Wed, 8 Mar 2017 14:26:53 -0500 Subject: [PATCH 094/567] Updated version --- detect-browser/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detect-browser/index.d.ts b/detect-browser/index.d.ts index 5ca68eabdf..57ed80c411 100644 --- a/detect-browser/index.d.ts +++ b/detect-browser/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for detect-browser v1.3.3 +// Type definitions for detect-browser v1.6.2 // Project: https://github.com/DamonOehlman/detect-browser // Definitions by: Rogier Schouten // Definitions: https://github.com/borisyankov/DefinitelyTyped From c105965b68d0639a6360c5a6bb3b7c98c79b2bee Mon Sep 17 00:00:00 2001 From: Ben Swartz Date: Wed, 8 Mar 2017 11:28:16 -0800 Subject: [PATCH 095/567] Change Header Comment --- faker/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faker/index.d.ts b/faker/index.d.ts index 8c6ea8ec6f..ccca40e51a 100644 --- a/faker/index.d.ts +++ b/faker/index.d.ts @@ -1,4 +1,4 @@ -// Based off type definitions for faker v4.1.0 +// Type definitions for faker v4.1.0 // Project: http://marak.com/faker.js/ // Definitions by: Ben Swartz , Bas Pennings , Yuki Kokubun // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 7275ca875933bc55aa8bef54fd296560ae0ecc7c Mon Sep 17 00:00:00 2001 From: Ben Swartz Date: Wed, 8 Mar 2017 13:52:41 -0800 Subject: [PATCH 096/567] set strictNullChecks to true, add new line at eof --- faker/tsconfig.json | 4 ++-- faker/v3/tsconfig.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/faker/tsconfig.json b/faker/tsconfig.json index c2ce14c941..0589e5dc54 100644 --- a/faker/tsconfig.json +++ b/faker/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,4 +19,4 @@ "index.d.ts", "faker-tests.ts" ] -} \ No newline at end of file +} diff --git a/faker/v3/tsconfig.json b/faker/v3/tsconfig.json index 40af61eba9..052493a9c7 100644 --- a/faker/v3/tsconfig.json +++ b/faker/v3/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From 1b95ed269fbbcb34ec770a212147aed1e5c72f03 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Thu, 9 Mar 2017 01:21:15 +0000 Subject: [PATCH 097/567] Fixed magic quotes. --- openfin/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openfin/index.d.ts b/openfin/index.d.ts index f0803864ae..24f91ab9ca 100644 --- a/openfin/index.d.ts +++ b/openfin/index.d.ts @@ -63,7 +63,7 @@ declare namespace fin { */ close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Retrieves an array of wrapped fin.desktop.Windows for each of the application�s child windows. + * Retrieves an array of wrapped fin.desktop.Windows for each of the application's child windows. */ getChildWindows(callback?: (children: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; /** @@ -99,7 +99,7 @@ declare namespace fin { */ removeEventListener(type: OpenFinApplicationEventType, previouslyRegisteredListener: (event: ApplicationBaseEvent | TrayIconClickedEvent | WindowEvent | WindowAlertRequestedEvent | WindowAuthRequested | WindowNavigationRejectedEvent | WindowEndLoadEvent) => any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Removes the application�s icon from the tray. + * Removes the application's icon from the tray. */ removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1008,7 +1008,7 @@ declare namespace fin { bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Closes the window. - * @param {force} Close will be prevented from closing when force is false and �close-requested� has been subscribed to for application�s main window. + * @param {force} Close will be prevented from closing when force is false and 'close-requested' has been subscribed to for application's main window. */ close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1028,7 +1028,7 @@ declare namespace fin { */ enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Flashes the window�s frame and taskbar icon until the window is activated. + * Flashes the window's frame and taskbar icon until the window is activated. */ flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1125,7 +1125,7 @@ declare namespace fin { setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Shows the window if it is hidden. - * @param {force} Show will be prevented from closing when force is false and �show-requested� has been subscribed to for application�s main window. + * @param {force} Show will be prevented from closing when force is false and 'show-requested' has been subscribed to for application's main window. */ show(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** From 9fc167714de333821347c5ebcb090f9f78457bf2 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Thu, 9 Mar 2017 01:45:36 +0000 Subject: [PATCH 098/567] Fixed magic quotes in v16 too. --- openfin/v16/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openfin/v16/index.d.ts b/openfin/v16/index.d.ts index 0b9f3e16ac..32e980120f 100644 --- a/openfin/v16/index.d.ts +++ b/openfin/v16/index.d.ts @@ -63,7 +63,7 @@ declare namespace fin { */ close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Retrieves an array of wrapped fin.desktop.Windows for each of the application�s child windows. + * Retrieves an array of wrapped fin.desktop.Windows for each of the application's child windows. */ getChildWindows(callback?: (children: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; /** @@ -95,7 +95,7 @@ declare namespace fin { */ removeEventListener(type: OpenFinApplicationEventType, previouslyRegisteredListener: (event: ApplicationBaseEvent | TrayIconClickedEvent | WindowEvent | WindowAlertRequestedEvent | WindowAuthRequested | WindowNavigationRejectedEvent | WindowEndLoadEvent) => any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Removes the application�s icon from the tray. + * Removes the application's icon from the tray. */ removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -989,7 +989,7 @@ declare namespace fin { bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Closes the window. - * @param {force} Close will be prevented from closing when force is false and �close-requested� has been subscribed to for application�s main window. + * @param {force} Close will be prevented from closing when force is false and 'close-requested' has been subscribed to for application's main window. */ close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1009,7 +1009,7 @@ declare namespace fin { */ enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Flashes the window�s frame and taskbar icon until the window is activated. + * Flashes the window's frame and taskbar icon until the window is activated. */ flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1106,7 +1106,7 @@ declare namespace fin { setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Shows the window if it is hidden. - * @param {force} Show will be prevented from closing when force is false and �show-requested� has been subscribed to for application�s main window. + * @param {force} Show will be prevented from closing when force is false and 'show-requested' has been subscribed to for application's main window. */ show(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** From d4864b74edfcd79afc9f120e8b7df33c4665bd50 Mon Sep 17 00:00:00 2001 From: Ricky Blankenaufulland Date: Thu, 9 Mar 2017 14:58:30 +0100 Subject: [PATCH 099/567] fixed how the GridStack object is obtained jQuery plugins return the jQuery object, to get the plugin, also in the case of GridStack 0.2.6 (latest) you use the data() method with the correct name --- gridstack/gridstack-tests.ts | 6 +++++- gridstack/index.d.ts | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gridstack/gridstack-tests.ts b/gridstack/gridstack-tests.ts index 96aa14b19f..02e6c1597f 100644 --- a/gridstack/gridstack-tests.ts +++ b/gridstack/gridstack-tests.ts @@ -10,7 +10,11 @@ var options = { float: true }; -var gridstack:GridStack = $(document).gridstack(options); +var element: JQuery = $(document).gridstack(options); +var gridstack: GridStack = $(document).data("gridstack"); +var gsFromElement: GridStack = element.data("gridstack"); + +if (gridstack !== gsFromElement) throw Error('These should match!'); gridstack.addWidget("test", 1, 2, 3, 4, true); gridstack.batchUpdate(); diff --git a/gridstack/index.d.ts b/gridstack/index.d.ts index 75056999e2..19e4bda280 100644 --- a/gridstack/index.d.ts +++ b/gridstack/index.d.ts @@ -4,7 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface JQuery { - gridstack (options: IGridstackOptions):GridStack + gridstack (options: IGridstackOptions): JQuery; + data(key: "gridstack"): GridStack; } interface GridStack { From bd35ad182875e11c8c70c97d1bc40726a62e08e1 Mon Sep 17 00:00:00 2001 From: Ricky Blankenaufulland Date: Thu, 9 Mar 2017 14:59:27 +0100 Subject: [PATCH 100/567] added ZoolWay to the authors --- gridstack/gridstack-tests.ts | 1 + gridstack/index.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/gridstack/gridstack-tests.ts b/gridstack/gridstack-tests.ts index 02e6c1597f..0546bab506 100644 --- a/gridstack/gridstack-tests.ts +++ b/gridstack/gridstack-tests.ts @@ -5,6 +5,7 @@ // Type definitions for Gridstack // Project: http://troolee.github.io/gridstack.js/ // Definitions by: Pascal Senn +// Definitions by: Ricky Blankenaufulland // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped var options = { diff --git a/gridstack/index.d.ts b/gridstack/index.d.ts index 19e4bda280..7f557f4af6 100644 --- a/gridstack/index.d.ts +++ b/gridstack/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Gridstack // Project: http://troolee.github.io/gridstack.js/ // Definitions by: Pascal Senn +// Definitions by: Ricky Blankenaufulland // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface JQuery { From d57893528cfc43ee257764d0d4986a996fa91ac7 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Thu, 9 Mar 2017 13:07:57 -0500 Subject: [PATCH 101/567] add types for react-day-picker 5.2 --- react-day-picker/index.d.ts | 54 ++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index 1e99e1f48b..be90f72d07 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-day-picker 5.1 +// Type definitions for react-day-picker 5.2 // Project: https://github.com/gpbl/react-day-picker // Definitions by: Giampaolo Bellavite , Jason Killian // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -28,30 +28,34 @@ declare namespace DayPicker { } export interface CaptionElementProps { - date?: Date; - localeUtils?: LocaleUtils; - locale?: string; - onClick?(month: Date, e: React.MouseEvent): void; + date: Date; + classNames: ClassNames, + localeUtils: LocaleUtils; + locale: string; + months: undefined; + onClick?: React.MouseEventHandler; } export interface NavbarElementProps { - className?: string; - previousMonth?: Date; - nextMonth?: Date; - showPreviousButton?: boolean; - showNextButton?: boolean; - onPreviousClick?(): void; - onNextClick?(): void; + className: string; + classNames: ClassNames; + previousMonth: Date; + nextMonth: Date; + showPreviousButton: boolean; + showNextButton: boolean; + onPreviousClick(callback?: () => void): void; + onNextClick(callback?: () => void): void; dir?: string; - localeUtils?: LocaleUtils; - locale?: string; + labels: { previousMonth: string; nextMonth: string; }; + localeUtils: LocaleUtils; + locale: string; } export interface WeekdayElementProps { - weekday?: number; - className?: string; - localeUtils?: LocaleUtils; - locale?: string; + weekday: number; + className: string; + localeUtils: LocaleUtils; + locale: string; } export interface ClassNames { @@ -89,7 +93,7 @@ declare namespace DayPicker { export interface FunctionModifier { (date: Date): boolean; } - export type Modifier = RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; + export type Modifier = Date | RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; export interface Modifiers { today: Modifier | Modifier[]; @@ -99,7 +103,9 @@ declare namespace DayPicker { export interface Props { canChangeMonth?: boolean; - captionElement?: React.ReactElement; + captionElement?: React.ReactElement> | + React.ComponentClass | + React.SFC; className?: string; classNames?: ClassNames; containerProps?: React.HTMLAttributes; @@ -115,7 +121,9 @@ declare namespace DayPicker { modifiers?: Partial; month?: Date; months?: [string, string, string, string, string, string, string, string, string, string, string, string]; - navbarElement?: React.ReactElement; + navbarElement?: React.ReactElement> | + React.ComponentClass | + React.SFC; numberOfMonths?: number; onBlur?(e: React.FocusEvent): void; onCaptionClick?(month: Date, e: React.MouseEvent): void; @@ -133,7 +141,9 @@ declare namespace DayPicker { reverseMonths?: boolean; selectedDays?: Modifier | Modifier[]; toMonth?: Date; - weekdayElement?: React.ReactElement; + weekdayElement?: React.ReactElement> | + React.ComponentClass | + React.SFC; weekdaysLong?: [string, string, string, string, string, string, string]; weekdaysShort?: [string, string, string, string, string, string, string]; } From c0b6319ccf49e2ac3107bfb906456489ab30f9d4 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Thu, 9 Mar 2017 15:22:54 -0500 Subject: [PATCH 102/567] react-day-picker update tests to include new use of Element or React.SFC for captionElement --- react-day-picker/react-day-picker-tests.tsx | 23 ++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/react-day-picker/react-day-picker-tests.tsx b/react-day-picker/react-day-picker-tests.tsx index deecb3e21a..8c2755f9b5 100644 --- a/react-day-picker/react-day-picker-tests.tsx +++ b/react-day-picker/react-day-picker-tests.tsx @@ -8,7 +8,7 @@ function isSunday(day: Date) { function MyComponent() { return ( ); } @@ -26,10 +26,27 @@ class Caption extends React.Component { } return ( -
onClick(date, e) }> +
{ localeUtils.formatMonthTitle(date, locale) }
); } } -}/> + + + +type CaptionElementProps = Partial; +class CaptionElement extends React.Component { + render() { + const { date, locale, localeUtils, onClick } = this.props; + if (!date || !locale || !localeUtils || !onClick) { + return
; + } + return ( +
+ { localeUtils.formatMonthTitle(date, locale) } +
+ ) + } +} + }/> From 3186a2ba273c41c91bde9f4adff3067ae1c901f7 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Thu, 9 Mar 2017 16:52:56 -0800 Subject: [PATCH 103/567] fleshing out the relayProp --- react-relay/index.d.ts | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/react-relay/index.d.ts b/react-relay/index.d.ts index 9c45ed9c7c..8170e03190 100644 --- a/react-relay/index.d.ts +++ b/react-relay/index.d.ts @@ -31,6 +31,24 @@ declare module "react-relay" { response: any } + type RelayMutationStatus = + 'UNCOMMITTED' | // Transaction hasn't yet been sent to the server. Transaction can be committed or rolled back. + 'COMMIT_QUEUED' | // Transaction was committed but another transaction with the same collision key is pending, so the transaction has been queued to send to the server. + 'COLLISION_COMMIT_FAILED' | //Transaction was queued for commit but another transaction with the same collision key failed. All transactions in the collision queue, including this one, have been failed. Transaction can be recommitted or rolled back. + 'COMMITTING' | // Transaction is waiting for the server to respond. + 'COMMIT_FAILED'; + + class RelayMutationTransaction { + applyOptimistic(): RelayMutationTransaction; + commit(): RelayMutationTransaction; + recommit(): void; + rollback(): void; + getError(): Error; + getStatus(): RelayMutationStatus; + getHash(): string; + getID(): string; + } + interface RelayMutationRequest { getQueryString(): string getVariables(): RelayVariables @@ -104,7 +122,7 @@ declare module "react-relay" { renderFailure?(error: Error, retry: Function): JSX.Element } - type ReadyStateEvent = + type ReadyStateEvent = 'ABORT' | 'CACHE_RESTORED_REQUIRED' | 'CACHE_RESTORE_FAILED' | @@ -128,7 +146,12 @@ declare module "react-relay" { } interface RelayProp { - variables: any - setVariables(variables: Object, onReadyStateChange?: OnReadyStateChange): void + route: { name: string; }; // incomplete, also has params and queries + variables: any; + pendingVariables?: any; + setVariables(variables: Object, onReadyStateChange?: OnReadyStateChange): void; + forceFetch(variables: Object, onReadyStateChange?: OnReadyStateChange): void; + hasOptimisticUpdate(record: any): boolean; + getPendingTransactions(record: any): RelayMutationTransaction[]; } } From 4cc74c831a3f186cf42e417a462257f97fa526e3 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Thu, 9 Mar 2017 17:22:18 -0800 Subject: [PATCH 104/567] fixing tests --- react-relay/index.d.ts | 4 ++-- react-relay/react-relay-tests.tsx | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/react-relay/index.d.ts b/react-relay/index.d.ts index 8170e03190..5b40145d18 100644 --- a/react-relay/index.d.ts +++ b/react-relay/index.d.ts @@ -151,7 +151,7 @@ declare module "react-relay" { pendingVariables?: any; setVariables(variables: Object, onReadyStateChange?: OnReadyStateChange): void; forceFetch(variables: Object, onReadyStateChange?: OnReadyStateChange): void; - hasOptimisticUpdate(record: any): boolean; - getPendingTransactions(record: any): RelayMutationTransaction[]; + hasOptimisticUpdate(record?: any): boolean; + getPendingTransactions(record?: any): RelayMutationTransaction[]; } } diff --git a/react-relay/react-relay-tests.tsx b/react-relay/react-relay-tests.tsx index 7160e60b0a..fa27f10c01 100644 --- a/react-relay/react-relay-tests.tsx +++ b/react-relay/react-relay-tests.tsx @@ -74,10 +74,16 @@ class StubbedArtwork extends React.Component { const props = { artwork: { title: "CHAMPAGNE FORMICA FLAG" }, relay: { + route: { + name: "champagne" + }, variables: { artworkID: "champagne-formica-flag", }, setVariables: () => {}, + forceFetch: () => {}, + hasOptimisticUpdate: () => false, + getPendingTransactions: (): Relay.RelayMutationTransaction[] => undefined, } } return From 498bf589489249b77f4259a95fe9dd97a670aab6 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Thu, 9 Mar 2017 17:26:33 -0800 Subject: [PATCH 105/567] adding in commitUpdate while I'm at it --- react-relay/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react-relay/index.d.ts b/react-relay/index.d.ts index 5b40145d18..0f6dbba024 100644 --- a/react-relay/index.d.ts +++ b/react-relay/index.d.ts @@ -153,5 +153,6 @@ declare module "react-relay" { forceFetch(variables: Object, onReadyStateChange?: OnReadyStateChange): void; hasOptimisticUpdate(record?: any): boolean; getPendingTransactions(record?: any): RelayMutationTransaction[]; + commitUpdate?: (mutation: Mutation, callbacks?: StoreUpdateCallbacks) => any; } } From 79388ead2d06c9f7015d21b7ba35d2d754561e9f Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Fri, 10 Mar 2017 16:16:00 +0900 Subject: [PATCH 106/567] Update package version --- redux-persist-transform-encrypt/package.json | 2 +- redux-persist-transform-filter/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/redux-persist-transform-encrypt/package.json b/redux-persist-transform-encrypt/package.json index 058a03ac99..acaf48dde5 100644 --- a/redux-persist-transform-encrypt/package.json +++ b/redux-persist-transform-encrypt/package.json @@ -1,6 +1,6 @@ { "dependencies": { "redux": "^3.6.0", - "redux-persist": "^4.4.1" + "redux-persist": "^4.4.2" } } diff --git a/redux-persist-transform-filter/package.json b/redux-persist-transform-filter/package.json index 058a03ac99..acaf48dde5 100644 --- a/redux-persist-transform-filter/package.json +++ b/redux-persist-transform-filter/package.json @@ -1,6 +1,6 @@ { "dependencies": { "redux": "^3.6.0", - "redux-persist": "^4.4.1" + "redux-persist": "^4.4.2" } } From afb8c9e50ae5a062181b7e705e51900e226a745f Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Fri, 10 Mar 2017 16:37:16 +0900 Subject: [PATCH 107/567] Add boolean to value types (#14874) --- react-select/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react-select/index.d.ts b/react-select/index.d.ts index c011b78e0e..beed5858ff 100644 --- a/react-select/index.d.ts +++ b/react-select/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-select v1.0.0 +// Type definitions for react-select 1.0 // Project: https://github.com/JedWatson/react-select // Definitions by: ESQUIBET Hugo , Gilad Gray , Izaak Baker , Tadas Dailyda , Mark Vujevits , Mike Deverell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -23,7 +23,7 @@ declare namespace ReactSelectClass { /** Text for rendering */ label?: string; /** Value for searching */ - value?: string | number; + value?: string | number | boolean; /** * Allow this option to be cleared * @default true From a971970e9309319a194bad5962a47a526907ee75 Mon Sep 17 00:00:00 2001 From: Umar Nizamani Date: Fri, 10 Mar 2017 08:37:58 +0100 Subject: [PATCH 108/567] Updated Cheerio definitions to 0.22 (#14878) --- cheerio/cheerio-tests.ts | 8 ++++++++ cheerio/index.d.ts | 14 ++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/cheerio/cheerio-tests.ts b/cheerio/cheerio-tests.ts index 5b1f6511ec..1c0848eef7 100644 --- a/cheerio/cheerio-tests.ts +++ b/cheerio/cheerio-tests.ts @@ -55,6 +55,10 @@ var $multiEl = $('selector', 'selector', 'selector'); $el.attr('id'); $el.attr('id', 'favorite').html(); +// props +$el.prop('style') +$el.prop('style', 'none').html() + // data $el.data(); $el.data('apple-color'); @@ -86,6 +90,7 @@ $el.is(() => { */ // serializeArray $('
').serializeArray(); +$('
').serialize(); /** * Traversing @@ -217,6 +222,9 @@ $el.eq(0).addBack('.class').length * Manipulation */ +$('
  • Plum
  • ').appendTo($el) +$el.prependTo($('
  • Plum
  • ')) + // .append( content, [content, ...] ) $el.append('
  • Plum
  • ').html(); $el.append('
  • Plum
  • ', '
  • Plum
  • ').html(); diff --git a/cheerio/index.d.ts b/cheerio/index.d.ts index e94eb1a68c..f3615674f5 100644 --- a/cheerio/index.d.ts +++ b/cheerio/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Cheerio v0.17.0 +// Type definitions for Cheerio v0.22.0 // Project: https://github.com/cheeriojs/cheerio -// Definitions by: Bret Little , VILIC VANE , Wayne Maurer +// Definitions by: Bret Little , VILIC VANE , Wayne Maurer , Umar Nizamani // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface Cheerio { @@ -47,10 +47,11 @@ interface Cheerio { is(func: (index: number, element: CheerioElement) => boolean): boolean; // Form + serialize(): string; serializeArray(): {name: string, value: string}[]; // Traversing - + find(selector: string): Cheerio; find(element: Cheerio): Cheerio; @@ -60,6 +61,9 @@ interface Cheerio { parentsUntil(element: CheerioElement, filter?: string): Cheerio; parentsUntil(element: Cheerio, filter?: string): Cheerio; + prop(name: string): any; + prop(name: string, value: any): Cheerio; + closest(): Cheerio; closest(selector: string): Cheerio; @@ -126,6 +130,8 @@ interface Cheerio { addBack(filter: string):Cheerio; // Manipulation + appendTo(target: Cheerio) : Cheerio + prependTo(target: Cheerio) : Cheerio append(content: string, ...contents: any[]): Cheerio; append(content: Document, ...contents: any[]): Cheerio; @@ -266,4 +272,4 @@ declare var cheerio:CheerioAPI; declare module "cheerio" { export = cheerio; -} +} \ No newline at end of file From 8d1cf56e258d0f4a25f564fc6e82fdd305a3f16a Mon Sep 17 00:00:00 2001 From: Christian Kotzbauer Date: Fri, 10 Mar 2017 08:38:54 +0100 Subject: [PATCH 109/567] updated extended-listbox to 2.0.0 (#14879) --- extended-listbox/extended-listbox-tests.ts | 54 +--------------------- extended-listbox/index.d.ts | 37 +-------------- 2 files changed, 2 insertions(+), 89 deletions(-) diff --git a/extended-listbox/extended-listbox-tests.ts b/extended-listbox/extended-listbox-tests.ts index 0ca2f862b1..dfa51ffebf 100644 --- a/extended-listbox/extended-listbox-tests.ts +++ b/extended-listbox/extended-listbox-tests.ts @@ -1,5 +1,4 @@ - - +/// var $test = $("#test"); @@ -126,54 +125,3 @@ instance.onItemEnterPressed((event: ListboxEvent) => { instance.onItemDoubleClicked((event: ListboxEvent) => { console.log(event.args); }); - - - -/////// LEGACY API /////// - -// Add string item -instance.target.listbox("addItem", "Test2"); - - -// Add item -var item: ListboxItem = {}; -item.selected = true; -item.disabled = false; -item.childItems = ["Test4"]; -item.groupHeader = false; -item.id = "ouetioreit"; -item.index = 0; -item.text = "Test3"; -var id: string = instance.target.listbox("addItem", item); - - -// Remove item -instance.target.listbox("removeItem", id); - - -// Get item -var i: ListboxItem = instance.target.listbox("getItem", id); - - -// Get items -var allItems: ListboxItem[] = instance.target.listbox("getItems"); - - -// Move item up -var newIndex: number = instance.target.listbox("moveItemUp", i.id); - - -// Move item down -newIndex = instance.target.listbox("moveItemDown", i.id); - - -// Clear selection -instance.target.listbox("clearSelection"); - - -// Enable -instance.target.listbox("enable", false); - - -// Destroy -instance.target.listbox("destroy"); diff --git a/extended-listbox/index.d.ts b/extended-listbox/index.d.ts index eb5f0eec04..3f3527b903 100644 --- a/extended-listbox/index.d.ts +++ b/extended-listbox/index.d.ts @@ -1,10 +1,8 @@ -// Type definitions for extended-listbox 1.1.x +// Type definitions for extended-listbox 2.0.x // Project: https://github.com/code-chris/extended-listbox // Definitions by: Christian Kotzbauer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - interface ListboxItem { /** display text */ text?: string; @@ -147,37 +145,4 @@ interface JQuery { /** constructs a new instance of Listbox on the given DOM item */ listbox(options: ListBoxOptions): ExtendedListboxInstance|ExtendedListboxInstance[]; - - /** @deprecated: use method in ExtendedListboxInstance */ - listbox(methodName: 'addItem'): string; - - /** @deprecated: use method in ExtendedListboxInstance */ - listbox(methodName: 'removeItem'): void; - - /** @deprecated: use method in ExtendedListboxInstance */ - listbox(methodName: 'destroy'): void; - - /** @deprecated: use method in ExtendedListboxInstance */ - listbox(methodName: 'getItem'): ListboxItem; - - /** @deprecated: use method in ExtendedListboxInstance */ - listbox(methodName: 'getItems'): ListboxItem[]; - - /** @deprecated: use method in ExtendedListboxInstance */ - listbox(methodName: 'moveItemUp'): number; - - /** @deprecated: use method in ExtendedListboxInstance */ - listbox(methodName: 'moveItemDown'): number; - - /** @deprecated: use method in ExtendedListboxInstance */ - listbox(methodName: 'clearSelection'): void; - - /** @deprecated: use method in ExtendedListboxInstance */ - listbox(methodName: 'enable'): void; - - /** @deprecated: use method in ExtendedListboxInstance */ - listbox(methodName: string): any; - - /** @deprecated: use method in ExtendedListboxInstance */ - listbox(methodName: string, methodParameter: any): any; } From ea797116776923778906e56929b626727e09bdf4 Mon Sep 17 00:00:00 2001 From: Christian Kotzbauer Date: Fri, 10 Mar 2017 08:39:31 +0100 Subject: [PATCH 110/567] Added aurelia-knockout 2.0.0 (#14880) * added aurelia-knockout 2.0.0 * fixed tslint errors in aurelia-knockout --- aurelia-knockout/aurelia-knockout-tests.ts | 11 +++++++++++ aurelia-knockout/index.d.ts | 19 ++++++++++++++++++ aurelia-knockout/tsconfig.json | 23 ++++++++++++++++++++++ aurelia-knockout/tslint.json | 1 + 4 files changed, 54 insertions(+) create mode 100644 aurelia-knockout/aurelia-knockout-tests.ts create mode 100644 aurelia-knockout/index.d.ts create mode 100644 aurelia-knockout/tsconfig.json create mode 100644 aurelia-knockout/tslint.json diff --git a/aurelia-knockout/aurelia-knockout-tests.ts b/aurelia-knockout/aurelia-knockout-tests.ts new file mode 100644 index 0000000000..6944ab5889 --- /dev/null +++ b/aurelia-knockout/aurelia-knockout-tests.ts @@ -0,0 +1,11 @@ + +export class ViewModel { + + constructor(private knockoutBindable: KnockoutBindable) { + } + + activate(settings: any): void { + this.knockoutBindable.applyBindableValues(settings, this); + this.knockoutBindable.applyBindableValues(settings, this, true); + } +} diff --git a/aurelia-knockout/index.d.ts b/aurelia-knockout/index.d.ts new file mode 100644 index 0000000000..2ccec60b46 --- /dev/null +++ b/aurelia-knockout/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for aurelia-knockout 2.0 +// Project: https://github.com/code-chris/aurelia-knockout +// Definitions by: Christian Kotzbauer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare interface KnockoutBindable { + + /** + * Applys all values from a data object (usually the activation data) to the corresponding instance fields + * in the current view model if they are marked as @bindable. By default all matching values from the data object + * are applied. To only apply observable values set the last parameter to `true`. Subscriptions are created + * for all Knockout observables in the data object to update the view-model values respectively. + * + * @param data - the data object + * @param target - the target view model + * @param applyOnlyObservables - `true` if only observable values should be applied, false by default. + */ + applyBindableValues(data: any, target: any, applyOnlyObservables?: boolean): void; +} diff --git a/aurelia-knockout/tsconfig.json b/aurelia-knockout/tsconfig.json new file mode 100644 index 0000000000..aa45dc1157 --- /dev/null +++ b/aurelia-knockout/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "aurelia-knockout-tests.ts" + ] +} diff --git a/aurelia-knockout/tslint.json b/aurelia-knockout/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/aurelia-knockout/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 79246be8c7c62b02adcc42cd88d05f9d2186158f Mon Sep 17 00:00:00 2001 From: Wayne Date: Fri, 10 Mar 2017 02:40:14 -0500 Subject: [PATCH 111/567] Add declaration for csvtojson (#14881) * Added declaration for csvtojson * Updated indent formatting to meet DT standards * Fixed tslint issues * Fixed issue with Converter class incorrectly extending Transform --- csvtojson/csvtojson-tests.ts | 114 +++++++++++++++ csvtojson/index.d.ts | 276 +++++++++++++++++++++++++++++++++++ csvtojson/tsconfig.json | 22 +++ csvtojson/tslint.json | 1 + 4 files changed, 413 insertions(+) create mode 100644 csvtojson/csvtojson-tests.ts create mode 100644 csvtojson/index.d.ts create mode 100644 csvtojson/tsconfig.json create mode 100644 csvtojson/tslint.json diff --git a/csvtojson/csvtojson-tests.ts b/csvtojson/csvtojson-tests.ts new file mode 100644 index 0000000000..4368d00494 --- /dev/null +++ b/csvtojson/csvtojson-tests.ts @@ -0,0 +1,114 @@ +import csv = require('csvtojson'); +import fs = require('fs'); + +// From documentation on project home page -> https://github.com/Keyang/node-csvtojson + +///////////////////////////// +// From CSV String +const csvStr: string = `1,2,3 +4,5,6 +7,8,9`; + +// event emitter version using factory function +csv({ noheader: true }) + .fromString(csvStr) + .on('csv', (csvRow: string[]) => { // this func will be called 3 times + console.log(csvRow); // => [1,2,3] , [4,5,6] , [7,8,9] + }) + .on('done', () => { + //parsing finished + }); + +// event emitter version using Converter class +new csv.Converter({ noheader: true }) + .fromString(csvStr) + .on('csv', (csvRow: string[]) => { // this func will be called 3 times + console.log(csvRow); // => [1,2,3] , [4,5,6] , [7,8,9] + }) + .on('done', () => { + //parsing finished + }); + +// callback version using Converter class +new csv.Converter({ noheader: true }) + .fromString(csvStr, (err, result) => { + console.log(JSON.stringify(result)); + }); + +// callback version using factory function +csv({ noheader: true }) + .fromString(csvStr, (err, result) => { + console.log(JSON.stringify(result)); + }); + +///////////////////////////// +// From CSV File +const filePath = './test.csv'; + +// event emitter version using factory function +csv() + .fromFile(filePath) + .on('json', (jsonObj: any) => { + console.log(JSON.stringify(jsonObj)); + }) + .on('done', (error: any) => { + console.log('end'); + }); + +// event emitter version using Converter class +new csv.Converter() + .fromFile(filePath) + .on('json', (jsonObj: any) => { + console.log(JSON.stringify(jsonObj)); + }) + .on('done', (error: any) => { + console.log('end'); + }); + +// callback version using factory function +csv() + .fromFile(filePath, (err, result) => { + console.log(JSON.stringify(result)); + }); + +// callback version using Converter class +new csv.Converter() + .fromFile(filePath, (err, result) => { + console.log(JSON.stringify(result)); + }); + +///////////////////////////// +// From CSV Stream + +const stream = fs.createReadStream(filePath); + +// event emitter version using factory function +csv().fromStream(stream) + .on('json', (jsonObj: any) => { + console.log(JSON.stringify(jsonObj)); + }) + .on('done', (error: any) => { + console.log('end'); + }); + +// event emitter version using Converter class +new csv.Converter() + .fromStream(stream) + .on('json', (jsonObj: any) => { + console.log(JSON.stringify(jsonObj)); + }) + .on('done', (error: any) => { + console.log('end'); + }); + +// callback version using factory function +csv() + .fromStream(stream, (err, result) => { + console.log(JSON.stringify(result)); + }); + +// callback version using Converter class +new csv.Converter() + .fromStream(stream, (err, result) => { + console.log(JSON.stringify(result)); + }); diff --git a/csvtojson/index.d.ts b/csvtojson/index.d.ts new file mode 100644 index 0000000000..9ba01212c7 --- /dev/null +++ b/csvtojson/index.d.ts @@ -0,0 +1,276 @@ +// Type definitions for csvtojson 1.1 +// Project: https://github.com/Keyang/node-csvtojson +// Definitions by: Eric Byers , Wayne Carson +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as stream from 'stream'; + +declare namespace csvtojson { + + /** + * Stream options + */ + type StreamOptions = stream.TransformOptions; + + /** + * Converter options + */ + interface ConverterOptions { + + /** + * Delimiter used for seperating columns. Use "auto" if delimiter is unknown in advance, + * in this case, delimiter will be auto-detected (by best attempt). Use an array to give + * a list of potential delimiters e.g. [",","|","$"]. (default: ",") + */ + delimiter?: string | string[]; + + /** + * If a column contains delimiter, it is able to use quote character to surround the column + * content. e.g. "hello, world" wont be split into two columns while parsing. Set to "off" + * will ignore all quotes. (default: " (double quote)) + */ + quote?: string; + + /** + * Indicate if parser trim off spaces surrounding column content. e.g. " content " will be + * trimmed to "content". (default: true) + */ + trim?: boolean; + + /** + * This parameter turns on and off whether check field type. (default: true) + */ + checkType?: boolean; + + /** + * Stringify the stream output to JSON array. This is useful when pipe output to a file + * which expects stringified JSON array. (default: false and only stringified JSON (without []) + * will be pushed to downstream) + */ + toArrayString?: boolean; + + /** + * Ignore the empty value in CSV columns. If a column value is not giving, set this to true to + * skip them. (default: false) + */ + ignoreEmpty?: boolean; + + /** + * Number of worker processes. The worker process will use multi-cores to help process CSV data. + * Set to number of cores to improve the performance of processing large CSV file. Keep 1 for + * small csv files. (default: 1) + */ + workerNum?: number; + + /** + * Indicating CSV data has no header row and first row is data row. (default: false) + */ + noheader?: boolean; + + /** + * An array to specify the headers of CSV data. If noheader is false, this value will override + * CSV header row. Example: ["my field","name"] (default: null) + */ + headers?: string[]; + + /** + * Don't interpret dots (.) and square brackets in header fields as nested object or array identifiers + * at all (treat them like regular characters for JSON field identifiers). (default: false) + */ + flatKeys?: boolean; + + /** + * The max character a CSV row could have. 0 means infinite. If max number exceeded, parser will emit + * "error" of "row_exceed". if a possibly corrupted CSV data provided, give it a number like 65535 + * so the parser wont consume memory. (default: 0) + */ + maxRowLength?: number; + + /** + * Whether or not to check if the column number of a row is the same as headers. If column number + * mismatched headers number, an error of "mismatched_column" will be emitted. (default: false) + */ + checkColumn?: boolean; + + /** + * End of line character. If omitted, parser will attempt retrieve it from first chunk of CSV data. + * If no valid eol found, then operation system eol will be used. + */ + eol?: string; + + /** + * Escape character used in quoted column. Default is double quote (") according to RFC4108. Change + * to back slash (\) or other chars for your own case. (default: " (double quote)) + */ + escape?: string; + + /** + * This parameter instructs the parser to include only those columns as specified by an array of + * column indexes. Example: [0,2,3] will parse and include only columns 0, 2, and 3 in the JSON output. + */ + includeColumns?: number[]; + + /** + * This parameter instructs the parser to ignore columns as specified by an array of column indexes. + * Example: [1,3,5] will ignore columns 1, 3, and 5 and will not return them in the JSON output. + */ + ignoreColumns?: number[]; + + /** + * Deprecated. Use workerNum instead. + */ + fork?: number; + } + + /** + * Callback function for handling result of parse. + */ + type ParseResultHandler = (err: any, result: any) => void; + + /** + * Event handler for "json" events. + */ + type JsonEventHandler = (jsonObj: any, rowNumber: number) => void; + + /** + * Event handler for "csv" events. + */ + type CsvEventHandler = (csvRow: string[], rowNumber: number) => void; + + /** + * Event handler for "data" events. + */ + type DataEventHandler = (data: any) => void; + + /** + * Event handler for "error" events. + */ + type ErrorEventHandler = (err: any) => void; + + /** + * Event handler for "record_parsed" events. + */ + type RecordParsedEventHandler = (jsonObj: any, csvRoe: string[], rowNumber: number) => void; + + /** + * Event handler for "end" events. + */ + type EndEventHandler = () => void; + + /** + * Event handler for "end_parsed" events. + */ + type EndParsedEventHandler = (jsonObjArray: any[]) => void; + + /** + * Event handler for "done" events. + */ + type DoneEventHandler = (err: any) => void; + + /** + * Converts provided CSV input to a JSON object. + */ + class Converter extends stream.Transform { + + /** + * Initializes a new instance of a Converter + * @param {ConverterOptions} options converter options + * @param {StreamOptions} streamOptions stream options + */ + constructor(options?: ConverterOptions, streamOptions?: StreamOptions); + + /** + * Reads in a CSV from a string. + * @param {string} str the string to convert + * @return {Converter} returns this object for chaining + */ + fromString(str: string): this + + /** + * Reads in a CSV from a string. + * @param {string} str the string to convert + * @param {ParseResultHandler} callback callback function to handle result or error + */ + fromString(str: string, callback: ParseResultHandler): void; + + /** + * Reads in a CSV from a file. + * @param {string} filePath the path to the CSV file + * @return {Converter} returns this object for chaining + */ + fromFile(filePath: string): this + + /** + * Reads in a CSV from a file. + * @param {string} filePath the path to the CSV file + * @param {ParseResultHandler} callback callback function to handle result or error + */ + fromFile(filePath: string, callback: ParseResultHandler): void; + + /** + * Reads in a CSV from a stream. + * @param {Stream} stream the stream + * @return {Converter} returns this object for chaining + */ + fromStream(stream: NodeJS.ReadableStream): this + + /** + * Reads in a CSV from a stream. + * @param {Stream} stream the stream + * @param {ParseResultHandler} callback callback function to handle result or error + */ + fromStream(stream: stream.Stream, callback: ParseResultHandler): void; + + /** + * Adds a listener function to the end of the listeners array for an event. + * Available events: + * - json + * - csv + * - data + * - error + * - record_parsed + * - end + * - end_parsed + * - done + * @param {Event} event name of event + * @param {Function} listener listener function + * @return {this} returns this object for chaining + */ + // tslint:disable-next-line:forbidden-types + on(event: string, listener: Function | JsonEventHandler | CsvEventHandler | DataEventHandler | ErrorEventHandler + | RecordParsedEventHandler | EndEventHandler | EndParsedEventHandler | DoneEventHandler): this; + + /** + * Transform objects after CSV parsing but before result being emitted or pushed downstream. + * @param {Function} callback transform function + * @return {this} returns this object for chaining + */ + transf(callback: (jsonObj: any, csvRow: string[], rowNumber: number) => void): this; + + /** + * The function in preRawData will be called directly with the string from upper stream. + * @param {Function} callback callback function + * @return {this} returns this object for chaining + */ + preRawData(callback: (csvRawData: string, cb: (newData: any) => void) => void): this; + + /** + * The function is called each time a file line being found in csv stream. + * @param {Function} callback callback function + * @return {this} returns this object for chaining + */ + preFileLine(callback: (line: string, rowNumber: number) => string): this; + } +} + +/** + * Factory function which creates an instance of a Converter object. + * @param {ConverterOptions} options converter options + * @param {StreamOptions} streamOptions stream options + * @return {csvtojson.Converter} Converter object + */ +declare function csvtojson(options?: csvtojson.ConverterOptions, streamOptions?: csvtojson.StreamOptions): csvtojson.Converter; + +export = csvtojson; diff --git a/csvtojson/tsconfig.json b/csvtojson/tsconfig.json new file mode 100644 index 0000000000..81ec6a66a2 --- /dev/null +++ b/csvtojson/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "csvtojson-tests.ts" + ] +} diff --git a/csvtojson/tslint.json b/csvtojson/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/csvtojson/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From b00b86d7197ed3217557fc6e88657c19a8b67f55 Mon Sep 17 00:00:00 2001 From: Anton Kandybo Date: Fri, 10 Mar 2017 09:57:24 +0200 Subject: [PATCH 112/567] Enable dt-header tslint rule --- compression-webpack-plugin/tslint.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/compression-webpack-plugin/tslint.json b/compression-webpack-plugin/tslint.json index 02312e1c7d..70cee1ba88 100644 --- a/compression-webpack-plugin/tslint.json +++ b/compression-webpack-plugin/tslint.json @@ -1,7 +1,4 @@ { - "extends": "../tslint.json", - "rules": { - "dt-header": false - } - } + "extends": "../tslint.json" +} \ No newline at end of file From 7bd7db4a1cb2f71588354a77c9e25161ca0111a8 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Fri, 10 Mar 2017 17:09:20 +0900 Subject: [PATCH 113/567] Add definitions for redux-auth-wrapper --- redux-auth-wrapper/index.d.ts | 32 +++++++++++++++++++ redux-auth-wrapper/package.json | 5 +++ .../redux-auth-wrapper-tests.tsx | 28 ++++++++++++++++ redux-auth-wrapper/tsconfig.json | 26 +++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 redux-auth-wrapper/index.d.ts create mode 100644 redux-auth-wrapper/package.json create mode 100644 redux-auth-wrapper/redux-auth-wrapper-tests.tsx create mode 100644 redux-auth-wrapper/tsconfig.json diff --git a/redux-auth-wrapper/index.d.ts b/redux-auth-wrapper/index.d.ts new file mode 100644 index 0000000000..a5f8d777a5 --- /dev/null +++ b/redux-auth-wrapper/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for redux-auth-wrapper 1.0 +// Project: https://github.com/mjrussell/redux-auth-wrapper +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { ComponentClass, StatelessComponent, ReactType } from "react"; +import { Action } from "redux"; +import { Location } from "history"; + +type ComponentConstructor

    = ComponentClass

    | StatelessComponent

    ; + +interface InjectedProps { + authData?: AuthData; +} + +export interface AuthWrapperConfig { + allowRedirectBack?: boolean | ((location: Location, redirectPath: string) => boolean); + authenticatingSelector?: (state: State, ownProps?: Props) => boolean; + authSelector: (state: State, ownProps?: Props) => AuthData; + FailureComponent?: ReactType; + failureRedirectPath?: string | ((state: State, ownProps?: Props) => string); + LoadingComponent?: ReactType; + redirectQueryParamName?: string; + wrapperDisplayName?: string; + predicate?: (authData: AuthData) => boolean; + propMapper?: (ownProps: Props) => InjectedProps & Props; + redirectAction?: (...args: any[]) => Action; +} + +type AuthDecorator = (component: ComponentConstructor) => ComponentClass; + +export function UserAuthWrapper(config: AuthWrapperConfig): AuthDecorator; diff --git a/redux-auth-wrapper/package.json b/redux-auth-wrapper/package.json new file mode 100644 index 0000000000..36ce503807 --- /dev/null +++ b/redux-auth-wrapper/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "redux": "^3.6.0" + } +} diff --git a/redux-auth-wrapper/redux-auth-wrapper-tests.tsx b/redux-auth-wrapper/redux-auth-wrapper-tests.tsx new file mode 100644 index 0000000000..a6d363dc06 --- /dev/null +++ b/redux-auth-wrapper/redux-auth-wrapper-tests.tsx @@ -0,0 +1,28 @@ +import * as React from "react"; +import { StatelessComponent } from "react"; +import { UserAuthWrapper } from "redux-auth-wrapper"; + +const Auth = UserAuthWrapper({ + allowRedirectBack: true, + authenticatingSelector(state: any) { + return state.auth.loading + }, + authSelector(state: any) { + return state.auth + }, + FailureComponent: () => (

    ), + failureRedirectPath: "/401", + LoadingComponent: () => (
    ), + redirectAction: () => ({ type : "redirect" }), + redirectQueryParamName: "next", + predicate(authData: any) { + return authData.authorized + }, + wrapperDisplayName: "TestAuth" +}); + +export const TestAuthComponent: StatelessComponent = () => { + return (
    ); +}; + +const TestAuth = Auth(TestAuthComponent); diff --git a/redux-auth-wrapper/tsconfig.json b/redux-auth-wrapper/tsconfig.json new file mode 100644 index 0000000000..844f327d0e --- /dev/null +++ b/redux-auth-wrapper/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": ["../"], + "paths": { + "history": ["history/v3"], + "history/*": ["history/v3/*"] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "redux-auth-wrapper-tests.tsx" + ] +} From 9e069e784e7a5bc12f1abacd71b319a9f02f1c8b Mon Sep 17 00:00:00 2001 From: Anton Kandybo Date: Fri, 10 Mar 2017 10:13:16 +0200 Subject: [PATCH 114/567] Using require syntax in tests --- .../compression-webpack-plugin-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compression-webpack-plugin/compression-webpack-plugin-tests.ts b/compression-webpack-plugin/compression-webpack-plugin-tests.ts index 4ee93c78b7..3939bf5847 100644 --- a/compression-webpack-plugin/compression-webpack-plugin-tests.ts +++ b/compression-webpack-plugin/compression-webpack-plugin-tests.ts @@ -1,5 +1,5 @@ -import { Configuration } from 'webpack' -import * as CompressionPlugin from 'compression-webpack-plugin' +import { Configuration } from 'webpack'; +import CompressionPlugin = require('compression-webpack-plugin'); const c: Configuration = { plugins: [ From 911335f7fe972e349f402ce229627095b38ab020 Mon Sep 17 00:00:00 2001 From: Anton Kandybo Date: Fri, 10 Mar 2017 10:14:53 +0200 Subject: [PATCH 115/567] Remove patch version --- compression-webpack-plugin/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compression-webpack-plugin/index.d.ts b/compression-webpack-plugin/index.d.ts index cf65f55300..536a77b8e9 100644 --- a/compression-webpack-plugin/index.d.ts +++ b/compression-webpack-plugin/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for compression-webpack-plugin 0.3.2 +// Type definitions for compression-webpack-plugin 0.3 // Project: https://github.com/webpack-contrib/compression-webpack-plugin // Definitions by: Anton Kandybo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From d0000c9c8c53775069299deed9705886b6fd1d35 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Fri, 10 Mar 2017 17:17:52 +0900 Subject: [PATCH 116/567] Add compiler flag --- redux-auth-wrapper/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/redux-auth-wrapper/index.d.ts b/redux-auth-wrapper/index.d.ts index a5f8d777a5..ffde27da52 100644 --- a/redux-auth-wrapper/index.d.ts +++ b/redux-auth-wrapper/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mjrussell/redux-auth-wrapper // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { ComponentClass, StatelessComponent, ReactType } from "react"; import { Action } from "redux"; From 84a11fea179426c39e5dbd7d577004791f2a957b Mon Sep 17 00:00:00 2001 From: Steven Liekens Date: Fri, 10 Mar 2017 12:42:22 +0100 Subject: [PATCH 117/567] Rename DataTable to Api --- datatables.net-buttons/index.d.ts | 8 +- datatables.net/datatables.net-tests.ts | 12 +- datatables.net/index.d.ts | 152 ++++++++++++------------- 3 files changed, 86 insertions(+), 86 deletions(-) diff --git a/datatables.net-buttons/index.d.ts b/datatables.net-buttons/index.d.ts index b4ed4b0eb5..c405d5093e 100644 --- a/datatables.net-buttons/index.d.ts +++ b/datatables.net-buttons/index.d.ts @@ -86,7 +86,7 @@ declare namespace DataTables { } export interface FunctionButtonAvailable { - (dt: DataTables.DataTable, config: any): boolean + (dt: DataTables.Api, config: any): boolean } export interface ButtonExportOptions { columns?: string; @@ -101,14 +101,14 @@ declare namespace DataTables { } export interface ButtonText { - (dt: DataTables.DataTable, node: JQuery, config: any): string + (dt: DataTables.Api, node: JQuery, config: any): string } export interface FunctionButtonInit { - (dt: DataTables.DataTable, node: JQuery, config: any): void + (dt: DataTables.Api, node: JQuery, config: any): void } // api object? export interface FunctionButtonAction { - (e: any, dt: DataTables.DataTable, node: JQuery, config: any): void + (e: any, dt: DataTables.Api, node: JQuery, config: any): void } export interface FunctionButtonCustomize { diff --git a/datatables.net/datatables.net-tests.ts b/datatables.net/datatables.net-tests.ts index 0134581ee1..72fee9a313 100644 --- a/datatables.net/datatables.net-tests.ts +++ b/datatables.net/datatables.net-tests.ts @@ -324,7 +324,7 @@ $(document).ready(function () { destroy = dt.destroy(true); destroy.$(""); - var draw: DataTables.DataTable = dt.draw(); + var draw: DataTables.Api = dt.draw(); draw = dt.draw(true); draw = dt.draw("page"); draw.$(""); @@ -790,8 +790,8 @@ $(document).ready(function () { var rows_13 = dt.rows.add([{}, {}]); dt.rows().every(function () { }); dt.rows().every(function (rowIdx, tableLoop, rowLoop) { }); - var rows_14: DataTables.DataTable = dt.rows("selector").ids(); - var rows_15: DataTables.DataTable = dt.rows("selector").ids(false); + var rows_14: DataTables.Api = dt.rows("selector").ids(); + var rows_15: DataTables.Api = dt.rows("selector").ids(false); var table3 = $('#example').DataTable(); table3.row.add({ @@ -912,11 +912,11 @@ $(document).ready(function () { var staticFn: DataTables.StaticFunctions; // With boolean parameter type, always returns DataTables.DataTable[]. - var static_1: DataTables.DataTable[] = staticFn.tables(true); + var static_1: DataTables.Api[] = staticFn.tables(true); // With object parameter type, returns DataTables.DataTable[] when "api" property is false. - static_1 = staticFn.tables({ "visible": true, "api": false }); + static_1 = staticFn.tables({ "visible": true, "api": false }); // With object parameter type, returns DataTables.DataTable when "api" property is true. - var static_2: DataTables.DataTable = staticFn.tables({ "visible": true, "api": true }); + var static_2: DataTables.Api = staticFn.tables({ "visible": true, "api": true }); //#endregion "Methods-Static" diff --git a/datatables.net/index.d.ts b/datatables.net/index.d.ts index 2640dbabe6..ab469edf14 100644 --- a/datatables.net/index.d.ts +++ b/datatables.net/index.d.ts @@ -11,7 +11,7 @@ /// interface JQuery { - DataTable(param?: DataTables.Settings): DataTables.DataTable; + DataTable(param?: DataTables.Settings): DataTables.Api; } //TODO: Wrong, as jquery.d.ts has no interface for fn @@ -20,11 +20,11 @@ interface JQuery { //} declare namespace DataTables { - export interface DataTable extends DataTableCore { + export interface Api extends DataTableCore { /** * Get the data for the whole table. */ - data(): DataTable; + data(): Api; /** * Order Methods / Object @@ -128,7 +128,7 @@ declare namespace DataTables { } export interface DataTables extends DataTableCore { - [index: number]: DataTable; + [index: number]: Api; } interface ObjectSelectorModifier { @@ -172,21 +172,21 @@ declare namespace DataTables { /** * Clear the table of all data. */ - clear(): DataTable; + clear(): Api; /** * Destroy the DataTables in the current context. * * @param remove Completely remove the table from the DOM (true) or leave it in the DOM in its original plain un-enhanced HTML state (default, false). */ - destroy(remove?: boolean): DataTable; + destroy(remove?: boolean): Api; /** * Redraw the DataTables in the current context, optionally updating ordering, searching and paging as required. * * @param paging This parameter is used to determine what kind of draw DataTables will perform. */ - draw(paging?: boolean | string): DataTable; + draw(paging?: boolean | string): Api; /* * Look up a language token that was defined in the DataTables' language initialisation object. @@ -210,7 +210,7 @@ declare namespace DataTables { * @param event Event name to remove. * @param callback Specific callback function to remove if you want to unbind a single event listener. */ - off(event: string, callback?: Function): DataTable; + off(event: string, callback?: Function): Api; /** * Table events listener. @@ -218,7 +218,7 @@ declare namespace DataTables { * @param event Event to listen for. * @param callback Specific callback function to remove if you want to unbind a single event listener. */ - on(event: string, callback: Function): DataTable; + on(event: string, callback: Function): Api; /** * Listen for a table event once and then remove the listener. @@ -226,7 +226,7 @@ declare namespace DataTables { * @param event Event to listen for. * @param callback Specific callback function to remove if you want to unbind a single event listener. */ - one(event: string, callback: Function): DataTable; + one(event: string, callback: Function): Api; /** * Page Methods / Object @@ -246,12 +246,12 @@ declare namespace DataTables { * @param smart Perform smart search. * @param caseInsen Do case-insensitive matching (default, true) or not (false). */ - search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): DataTable; + search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api; /** * Obtain the table's settings object */ - settings(): DataTable; + settings(): Api; /** * Page Methods / Object @@ -261,14 +261,14 @@ declare namespace DataTables { //#region "ajax-methods" - interface AjaxMethods extends DataTable { + interface AjaxMethods extends Api { /** * Reload the table data from the Ajax data source. * * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. * @param resetPaging Reset (default action or true) or hold the current paging position (false). */ - load(callback?: Function, resetPaging?: boolean): DataTable; + load(callback?: Function, resetPaging?: boolean): Api; } interface AjaxMethodModel { @@ -288,7 +288,7 @@ declare namespace DataTables { * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. * @param resetPaging Reset (default action or true) or hold the current paging position (false). */ - reload(callback?: Function, resetPaging?: boolean): DataTable; + reload(callback?: Function, resetPaging?: boolean): Api; /** * Reload the table data from the Ajax data source @@ -318,9 +318,9 @@ declare namespace DataTables { * * @param order Order Model */ - (order?: (string | number)[]): DataTable; - (order?: (string | number)[][]): DataTable; - (order: (string | number)[], ...args: any[]): DataTable; + (order?: (string | number)[]): Api; + (order?: (string | number)[][]): Api; + (order: (string | number)[], ...args: any[]): Api; /** * Add an ordering listener to an element, for a given column. @@ -329,7 +329,7 @@ declare namespace DataTables { * @param column Column index * @param callback Callback function */ - listener(node: string | Node | JQuery, column: number, callback: Function): DataTable; + listener(node: string | Node | JQuery, column: number, callback: Function): Api; } //#endregion "order-methods" @@ -346,7 +346,7 @@ declare namespace DataTables { * * @param page Index or 'first', 'next', 'previous', 'last' */ - (page: number | string): DataTable; + (page: number | string): Api; /** * Get paging information about the table @@ -363,7 +363,7 @@ declare namespace DataTables { * * @param length Page length to set. use -1 to show all records. */ - len(length: number): DataTable; + len(length: number): Api; } interface PageMethodeModelInfoReturn { @@ -390,7 +390,7 @@ declare namespace DataTables { /** * Clear the saved state of the table. */ - clear(): DataTable; + clear(): Api; /** * Get the table state that was loaded during initialisation. @@ -400,7 +400,7 @@ declare namespace DataTables { /** * Trigger a state save. */ - save(): DataTable; + save(): Api; } interface StateReturnModel { @@ -435,7 +435,7 @@ declare namespace DataTables { * @param a API instance to concatenate to the initial instance. * @param b Additional API instance(s) to concatenate to the initial instance. */ - concat(a: Object, ...b: Object[]): DataTable; + concat(a: Object, ...b: Object[]): Api; /** * Get the number of entries in an API instance's result set, regardless of multi-table grouping (e.g. any data, selected rows, etc). Since: 1.10.8 @@ -447,26 +447,26 @@ declare namespace DataTables { * * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters */ - each(fn: Function): DataTable; + each(fn: Function): Api; /** * Reduce an Api instance to a single context and result set. * * @param idx Index to select */ - eq(idx: number): DataTable; + eq(idx: number): Api; /** * Iterate over the result set of an API instance and test each item, creating a new instance from those items which pass. * * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. */ - filter(fn: Function): DataTable; + filter(fn: Function): Api; /** * Flatten a 2D array structured API instance to a 1D array structure. */ - flatten(): DataTable; + flatten(): Api; /** * Find the first instance of a value in the API instance's result set. @@ -499,14 +499,14 @@ declare namespace DataTables { * * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. */ - map(fn: Function): DataTable; + map(fn: Function): Api; /** * Iterate over the result set of an API instance, creating a new API instance from the values retrieved from the original elements. * * @param property Object property name to use from the element in the original result set for the new result set. */ - pluck(property: number | string): DataTable; + pluck(property: number | string): Api; /** * Remove the last item from an API instance's result set. @@ -539,7 +539,7 @@ declare namespace DataTables { /** * Reverse the result set of the API instance and return the original array. */ - reverse(): DataTable; + reverse(): Api; /** * Remove the first item from an API instance's result set. @@ -551,7 +551,7 @@ declare namespace DataTables { * * @param fn This is a standard Javascript sort comparison function. It accepts two parameters. */ - sort(fn?: Function): DataTable; + sort(fn?: Function): Api; /** * Modify the contents of an Api instance's result set, adding or removing items from it as required. @@ -580,7 +580,7 @@ declare namespace DataTables { /** * Create a new API instance containing only the unique items from a the elements in an instance's result set. */ - unique(): DataTable; + unique(): Api; /** * Add one or more items to the start of an API instance's result set. @@ -598,7 +598,7 @@ declare namespace DataTables { * * @param t Specify which cache the data should be read from. Can take one of two values: search or order */ - cache(t: string): DataTable; + cache(t: string): Api; } //#region "cell-methods" @@ -609,7 +609,7 @@ declare namespace DataTables { * * @param source Data source to read the new data from. */ - invalidate(source?: string): DataTable; + invalidate(source?: string): Api; /** * Get data for the selected cell @@ -630,7 +630,7 @@ declare namespace DataTables { * * @param data Value to assign to the data for the cell */ - data(data: any): DataTable; + data(data: any): Api; /** * Get index information about the selected cell @@ -653,24 +653,24 @@ declare namespace DataTables { /** * Get data for the selected cells */ - data(): DataTable; + data(): Api; /** * Iterate over each selected cell, with the function context set to be the cell in question. Since: DataTables 1.10.6 * * @param fn Function to execute for every cell selected. */ - every(fn: (cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): DataTable; + every(fn: (cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): Api; /** * Get index information about the selected cells */ - indexes(): DataTable; + indexes(): Api; /** * Get the DOM elements for the selected cells */ - nodes(): DataTable; + nodes(): Api; } //#endregion "cell-methods" @@ -692,7 +692,7 @@ declare namespace DataTables { * * @param direction Direction of sort to apply to the selected column - desc (descending) or asc (ascending). */ - order(direction: string): DataTable; + order(direction: string): Api; /** * Get the visibility of the selected column. @@ -705,7 +705,7 @@ declare namespace DataTables { * @param show Specify if the column should be visible (true) or not (false). * @param redrawCalculations Indicate if DataTables should recalculate the column layout (true - default) or not (false). Typically this would be left as the default value, but it can be useful to disable when using the method in a loop - so the calculations are performed on every call as they can hamper performance. */ - visible(show: boolean, redrawCalculations?: boolean): DataTable; + visible(show: boolean, redrawCalculations?: boolean): Api; } interface ColumnMethodsModel { @@ -730,7 +730,7 @@ declare namespace DataTables { /** * Get the data for the cells in the selected column. */ - data(): DataTable; + data(): Api; /** * Get the data source property for the selected column @@ -742,12 +742,12 @@ declare namespace DataTables { * * @param t Specify if you want to get the column data index (default) or the visible index (visible). */ - index(t?: string): DataTable; + index(t?: string): Api; /** * Obtain the th / td nodes for the selected column */ - nodes(): DataTable[]; + nodes(): Api[]; } interface ColumnsMethodsModel { @@ -769,38 +769,38 @@ declare namespace DataTables { /** * Recalculate the column widths for layout. */ - adjust(): DataTable; + adjust(): Api; } interface ColumnsMethods extends DataTableCore, CommonColumnMethod { /** * Obtain the data for the columns from the selector */ - data(): DataTable; + data(): Api; /** * Get the data source property for the selected columns. */ - dataSrc(): DataTable; + dataSrc(): Api; /** * Iterate over each selected column, with the function context set to be the column in question. Since: DataTables 1.10.6 * * @param fn Function to execute for every column selected. */ - every(fn: (colIdx: number, tableLoop: number, colLoop: number) => void): DataTable; + every(fn: (colIdx: number, tableLoop: number, colLoop: number) => void): Api; /** * Get the column indexes of the selected columns. * * @param t Specify if you want to get the column data index (default) or the visible index (visible). */ - indexes(t?: string): DataTable; + indexes(t?: string): Api; /** * Obtain the th / td nodes for the selected columns */ - nodes(): DataTable[][]; + nodes(): Api[][]; } //#endregion "column-methods" @@ -812,7 +812,7 @@ declare namespace DataTables { * * @param source Data source to read the new data from. Values: 'auto', 'data', 'dom' */ - invalidate(source?: string): DataTable; + invalidate(source?: string): Api; } interface RowChildMethodModel { @@ -839,39 +839,39 @@ declare namespace DataTables { /** * Hide the child row(s) of a parent row */ - hide(): DataTable; + hide(): Api; /** * Check if the child rows of a parent row are visible */ - isShown(): DataTable; + isShown(): Api; /** * Remove child row(s) from display and release any allocated memory */ - remove(): DataTable; + remove(): Api; /** * Show the child row(s) of a parent row */ - show(): DataTable; + show(): Api; } interface RowChildMethods extends DataTableCore { /** * Hide the child row(s) of a parent row */ - hide(): DataTable; + hide(): Api; /** * Remove child row(s) from display and release any allocated memory */ - remove(): DataTable; + remove(): Api; /** * Make newly defined child rows visible */ - show(): DataTable; + show(): Api; } interface RowMethodsModel { @@ -888,7 +888,7 @@ declare namespace DataTables { * * @param data Data to use for the new row. This may be an array, object or Javascript object instance, but must be in the same format as the other data in the table */ - add(data: any[] | Object): DataTable; + add(data: any[] | Object): Api; } interface RowMethods extends DataTableCore, CommonRowMethod { @@ -907,7 +907,7 @@ declare namespace DataTables { * * @param d Data to use for the row. */ - data(d: any[] | Object): DataTable; + data(d: any[] | Object): Api; /** @@ -956,28 +956,28 @@ declare namespace DataTables { * * @param data Array of data elements, with each one describing a new row to be added to the table */ - add(data: any[]): DataTable; + add(data: any[]): Api; } interface RowsMethods extends DataTableCore, CommonRowMethod { /** * Get the data for the rows from the selector */ - data(): DataTable; + data(): Api; /** * Set the data for the selected row * * @param d Data to use for the row. */ - data(d: any[] | Object): DataTable; + data(d: any[] | Object): Api; /** * Iterate over each selected row, with the function context set to be the row in question. Since: DataTables 1.10.6 * * @param fn Function to execute for every row selected. */ - every(fn: (rowIdx: number, tableLoop: number, rowLoop: number) => void): DataTable; + every(fn: (rowIdx: number, tableLoop: number, rowLoop: number) => void): Api; /** * Get the ids of the selected rows. Since: 1.10.8 @@ -986,22 +986,22 @@ declare namespace DataTables { * false - Do not modify the id value. * @returns Api instance with the selected rows in its result set. If a row does not have an id available 'undefined' will be returned as the value. */ - ids(hash?: boolean): DataTable; + ids(hash?: boolean): Api; /** * Get the row indexes of the selected rows. */ - indexes(): DataTable; + indexes(): Api; /** * Obtain the tr nodes for the selected rows */ - nodes(): DataTable; + nodes(): Api; /** * Delete the selected rows from the DataTable. */ - remove(): DataTable; + remove(): Api; } //#endregion "row-methods" @@ -1038,27 +1038,27 @@ declare namespace DataTables { /** * Get the tfoot nodes for the tables in the API's context */ - footer(): DataTable; + footer(): Api; /** * Get the thead nodes for the tables in the API's context */ - header(): DataTable; + header(): Api; /** * Get the tbody nodes for the tables in the API's context */ - body(): DataTable; + body(): Api; /** * Get the div container nodes for the tables in the API's context */ - containers(): DataTable; + containers(): Api; /** * Get the table nodes for the tables in the API's context */ - nodes(): DataTable; + nodes(): Api; } //#endregion "table-methods" @@ -1080,7 +1080,7 @@ declare namespace DataTables { * @param visible As a boolean value this options is used to indicate if you want all tables on the page should be returned (false), or visible tables only (true). * Since 1.10.8 this option can also be given as an object. */ - tables(visible?: boolean | ObjectTablesStatic): DataTables.DataTable[] | DataTables.DataTable; + tables(visible?: boolean | ObjectTablesStatic): DataTables.Api[] | DataTables.Api; /** * Version number compatibility check function @@ -1099,7 +1099,7 @@ declare namespace DataTables { * * @param table Selector string for table */ - Api(selector: string | Node | Node[] | JQuery): DataTables.DataTable; + Api(selector: string | Node | Node[] | JQuery): DataTables.Api; } export interface StaticUtilFunctions { From 2a018135f9670e76c20e37c1e231d4a3090a33a9 Mon Sep 17 00:00:00 2001 From: Steven Liekens Date: Fri, 10 Mar 2017 12:46:24 +0100 Subject: [PATCH 118/567] Rename DataTableCore to CoreMethods --- datatables.net/index.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/datatables.net/index.d.ts b/datatables.net/index.d.ts index ab469edf14..4088c15b1e 100644 --- a/datatables.net/index.d.ts +++ b/datatables.net/index.d.ts @@ -20,7 +20,7 @@ interface JQuery { //} declare namespace DataTables { - export interface Api extends DataTableCore { + export interface Api extends CoreMethods { /** * Get the data for the whole table. */ @@ -127,7 +127,7 @@ declare namespace DataTables { //#endregion "Table/Tables" } - export interface DataTables extends DataTableCore { + export interface DataTables extends CoreMethods { [index: number]: Api; } @@ -155,7 +155,7 @@ declare namespace DataTables { //#region "core-methods" - interface DataTableCore extends UtilityMethods { + interface CoreMethods extends UtilityMethods { /** * Get jquery object */ @@ -619,7 +619,7 @@ declare namespace DataTables { render(t: string): any; } - interface CellMethods extends DataTableCore, CommonCellMethods { + interface CellMethods extends CoreMethods, CommonCellMethods { /** * Get data for the selected cell */ @@ -649,7 +649,7 @@ declare namespace DataTables { columnVisible: number; } - interface CellsMethods extends DataTableCore, CommonCellMethods { + interface CellsMethods extends CoreMethods, CommonCellMethods { /** * Get data for the selected cells */ @@ -726,7 +726,7 @@ declare namespace DataTables { index(t: string, index: number): number; } - interface ColumnMethods extends DataTableCore, CommonColumnMethod { + interface ColumnMethods extends CoreMethods, CommonColumnMethod { /** * Get the data for the cells in the selected column. */ @@ -772,7 +772,7 @@ declare namespace DataTables { adjust(): Api; } - interface ColumnsMethods extends DataTableCore, CommonColumnMethod { + interface ColumnsMethods extends CoreMethods, CommonColumnMethod { /** * Obtain the data for the columns from the selector */ @@ -857,7 +857,7 @@ declare namespace DataTables { show(): Api; } - interface RowChildMethods extends DataTableCore { + interface RowChildMethods extends CoreMethods { /** * Hide the child row(s) of a parent row */ @@ -891,7 +891,7 @@ declare namespace DataTables { add(data: any[] | Object): Api; } - interface RowMethods extends DataTableCore, CommonRowMethod { + interface RowMethods extends CoreMethods, CommonRowMethod { /** * Order Methods / Object */ @@ -959,7 +959,7 @@ declare namespace DataTables { add(data: any[]): Api; } - interface RowsMethods extends DataTableCore, CommonRowMethod { + interface RowsMethods extends CoreMethods, CommonRowMethod { /** * Get the data for the rows from the selector */ @@ -1007,7 +1007,7 @@ declare namespace DataTables { //#region "table-methods" - interface TableMethods extends DataTableCore { + interface TableMethods extends CoreMethods { /** * Get the tfoot node for the table in the API's context */ @@ -1034,7 +1034,7 @@ declare namespace DataTables { node(): Node; } - interface TablesMethods extends DataTableCore { + interface TablesMethods extends CoreMethods { /** * Get the tfoot nodes for the tables in the API's context */ From 443cbaad2cbc1fcfc949ff4801a659d4fd20904a Mon Sep 17 00:00:00 2001 From: Steven Liekens Date: Fri, 10 Mar 2017 12:52:47 +0100 Subject: [PATCH 119/567] Rename constructor argument 'param' to 'opts' --- datatables.net/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datatables.net/index.d.ts b/datatables.net/index.d.ts index 4088c15b1e..c0aaf9cc6c 100644 --- a/datatables.net/index.d.ts +++ b/datatables.net/index.d.ts @@ -11,7 +11,7 @@ /// interface JQuery { - DataTable(param?: DataTables.Settings): DataTables.Api; + DataTable(opts?: DataTables.Settings): DataTables.Api; } //TODO: Wrong, as jquery.d.ts has no interface for fn From 75c72afe968d4df30a27f600183144cb301320f3 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 10 Mar 2017 07:08:34 -0800 Subject: [PATCH 120/567] fine-uploader: Provides its own types (#14983) --- fine-uploader/index.d.ts | 346 ----------------------------- fine-uploader/test/blobs.ts | 9 - fine-uploader/test/callbacks.ts | 59 ----- fine-uploader/test/camera.ts | 14 -- fine-uploader/test/chunking.ts | 26 --- fine-uploader/test/core.ts | 17 -- fine-uploader/test/cors.ts | 13 -- fine-uploader/test/deleteFile.ts | 28 --- fine-uploader/test/extraButtons.ts | 23 -- fine-uploader/test/form.ts | 13 -- fine-uploader/test/message.ts | 21 -- fine-uploader/test/method.ts | 140 ------------ fine-uploader/test/paste.ts | 14 -- fine-uploader/test/request.ts | 32 --- fine-uploader/test/resume.ts | 15 -- fine-uploader/test/retry.ts | 15 -- fine-uploader/test/scaling.ts | 29 --- fine-uploader/test/session.ts | 26 --- fine-uploader/test/text.ts | 13 -- fine-uploader/test/validation.ts | 22 -- fine-uploader/test/workarounds.ts | 13 -- fine-uploader/tsconfig.json | 42 ---- fine-uploader/tslint.json | 1 - notNeededPackages.json | 6 + 24 files changed, 6 insertions(+), 931 deletions(-) delete mode 100644 fine-uploader/index.d.ts delete mode 100644 fine-uploader/test/blobs.ts delete mode 100644 fine-uploader/test/callbacks.ts delete mode 100644 fine-uploader/test/camera.ts delete mode 100644 fine-uploader/test/chunking.ts delete mode 100644 fine-uploader/test/core.ts delete mode 100644 fine-uploader/test/cors.ts delete mode 100644 fine-uploader/test/deleteFile.ts delete mode 100644 fine-uploader/test/extraButtons.ts delete mode 100644 fine-uploader/test/form.ts delete mode 100644 fine-uploader/test/message.ts delete mode 100644 fine-uploader/test/method.ts delete mode 100644 fine-uploader/test/paste.ts delete mode 100644 fine-uploader/test/request.ts delete mode 100644 fine-uploader/test/resume.ts delete mode 100644 fine-uploader/test/retry.ts delete mode 100644 fine-uploader/test/scaling.ts delete mode 100644 fine-uploader/test/session.ts delete mode 100644 fine-uploader/test/text.ts delete mode 100644 fine-uploader/test/validation.ts delete mode 100644 fine-uploader/test/workarounds.ts delete mode 100644 fine-uploader/tsconfig.json delete mode 100644 fine-uploader/tslint.json diff --git a/fine-uploader/index.d.ts b/fine-uploader/index.d.ts deleted file mode 100644 index dab4e720ea..0000000000 --- a/fine-uploader/index.d.ts +++ /dev/null @@ -1,346 +0,0 @@ -// Type definitions for FineUploader for 5.11 -// Project: http://fineuploader.com/ -// Definitions by: Bradford Wagner -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace qq { - interface BlobsOptions { - defaultName?: string; - } - - interface CameraOptions { - button?: HTMLElement; - ios?: boolean; - } - - interface ChunkingOptions { - concurrent?: ChunkingConcurrentOptions; - enabled?: boolean; // default false - mandatory?: boolean; // default false - partSize?: number; // default 2,000,000 - paramNames?: ChunkingParamNames; - success?: ChunkingSuccess; - } - - interface ChunkingConcurrentOptions { - enabled?: boolean; // default false - } - - interface ChunkingParamNames { - chunkSize?: string; // default: qqchunksize - partByteOffset?: string; // default: qqpartbyteoffset - partIndex?: string; // default: qqpartindex - totalParts?: string; // default: qqtotalparts - } - - interface ChunkingSuccess { - endpoint?: string | null; // default: null - } - - interface CorsOptions { - allowXdr?: boolean; // default: false - expected?: boolean; // default: false - sendCredentials: boolean; // default: false - } - - interface DeleteFileOptions { - customHeader?: H; // default: {} - enabled?: boolean; // default false - endpoint?: string; // default: /server/upload - method?: string; // default: DELETE - params?: P; // default: {} - } - - interface ExtraButtonsOptions { - element: HTMLElement | undefined; // default: undefined - fileInputTitle?: string; // default: file input - folders?: boolean; // default: false - multiple?: boolean; // default: true - validation?: V; // default: 'validation' - } - - interface FormOptions { - element?: string | HTMLElement; // default: qq-form - autoUpload?: boolean; // default: false - interceptSubmit?: boolean; // default: true - } - - interface MessagesOptions { - emptyError?: string; // default: {file} is empty, please select files again without it. - maxHeightImageError?: string; // default: Image is too tall. - maxWidthImageError?: string; // default: Image is too wide. - minHeightImageError?: string; // default: Image is not tall enough. - minWidthImageError?: string; // default: Image is not wide enough. - minSizeError?: string; // default: {file} is too small, minimum file size is {minSizeLimit}. - noFilesError?: string; // default: No files to upload. - onLeave?: string; // default: The files are being uploaded, if you leave now the upload will be canceled. - retryFailTooManyItemsError?: string; // default: Too many items ({netItems}) would be uploaded. Item limit is {itemLimit}. - typeError?: string; // default: {file} has an invalid extension. Valid extension(s): {extensions}. - // tslint:disable-next-line:max-line-length - unsupportedBrowserIos8Safari?: string; // default: Unrecoverable error - this browser does not permit file uploading of any kind due to serious bugs in iOS8 Safari. Please use iOS8 Chrome until Apple fixes these issues. - } - - interface PasteOptions { - defaultName?: string; // default: pasted_image - targetElement?: HTMLElement | null; // default: null - } - - interface ResumeOptions { - recordsExpireIn?: number; // default: 7 - enabled?: boolean; // default: false - paramNames?: ResumeParamNameOptions; - } - - interface ResumeParamNameOptions { - resuming: string; // default: qqresume - } - - interface RetryOptions { - autoAttemptDelay?: number; // default: 5 - enableAuto?: boolean; // default: false - maxAutoAttempts?: number; // default: 3 - preventRetryResponseProperty?: string; // default: preventRetry - } - - interface RequestOptions { - customHeaders?: H; // default: {} - endpoint?: string; // default: /server/upload - filenameParam?: string; // default: qqfilename - forceMultipart?: boolean; // default: true - inputName?: string; // default: qqfile - method?: string; // default: POST - params?: P; // default: {} - paramsInBody?: boolean; // default: true - uuid?: string; // default: qquuid - totalFileSizeName?: string; // default: qqtotalfilesize - } - - interface ScalingOptions { - customResizer?: ( - blob: File | Blob, - height: number, - image: HTMLImageElement, - sourceCanvas: HTMLCanvasElement, - targetCanvas: HTMLCanvasElement, - width: number) => Promise | undefined; // default: undefined - defaultQuality?: number; // default: 80 - defaultType?: string | null; // default: null - failureText?: string; // default: Failed to scale - includeExif?: boolean; // default: false - orient?: boolean; // default: true - sendOriginal?: boolean; // default: false - sizes?: Size[]; // default: [] - } - - /** - * From Documentation: - * An array containing size objects that describe scaled versions of each submitted image that should be generated and uploaded. - * A size object should usually contain a name String property (which will be appended to the file name of the scaled file), and must always contain a maxSize integer property. - * A type MIME string property is optional. - */ - interface Size { - name: string; - maxSize: number; - type?: string; - } - - interface SessionOptions { - customHeaders?: H; // default: {} - endpoint?: string | null; // default: null - params?: P; // default: {} - refreshOnReset?: boolean; // default: true - } - - interface TextOptions { - defaultResponseError?: string; // default: Upload failure reason unknown - fileInputTitle?: string; // default: file input - sizeSymbols?: string[]; // default: ['kB', 'MB', 'GB', 'TB', 'PB', 'EB'] - } - - interface ValidationOptions { - acceptFiles?: MimeType[] | null; // default: null - allowedExtensions?: string[]; // default: [] - itemLimit?: number; // default: 0 - minSizeLimit?: number; // default: 0 - sizeLimit?: number; // default: 0 - stopOnFirstInvalidFile?: boolean; // default: true - image?: ValidationImageOptions; - } - - interface ValidationImageOptions { - maxHeight?: number; // default: 0 - maxWidth?: number; // default: 0 - minWidth?: number; // default: 0 - minHeight?: number; // default: 0 - } - - interface WorkaroundOptions { - iosEmptyVideos?: boolean; // default: true - ios8BrowserCrash?: boolean; // default: false - ios8SafariUploads?: boolean; // default: true - } - - interface ChunkData { - partIndex: number; - startByte: number; - endByte: number; - totalParts: number; - } - - interface ValidateMetadata { - name: string; - size?: number; - } - - interface CallbackOptions { - onAutoRetry?: (id: number, name: string, attemptNumber: number) => void; - onCancel?: (id: number, name: string) => void; - onComplete?: (id: number, name: string, responseJSON: T, xhr: XMLHttpRequest) => void; // ignore xhr: XDomainRequest as it is not compatible for all versions of TypeScript - onAllComplete?: (succeeded: number[], failed: number[]) => void; - onDelete?: (id: number) => void; - onDeleteComplete?: (id: number, xhr: XMLHttpRequest, isError: boolean) => void; // ignore xhr: XDomainRequest as it is not compatible for all versions of TypeScript - onError?: (id: number, name: string, errorReason: string, xhr: XMLHttpRequest) => void; // ignore xhr: XDomainRequest as it is not compatible for all versions of TypeScript - onManualRetry?: (id: number, name: string) => boolean; // return false to prevent this and all future retries - onPasteReceived?: (blob: Blob) => void; - onProgress?: (id: number, name: string, uploadedBytes: number, totalBytes: number) => void; - onResume?: (id: number, name: string, chunkData: T) => void; - onSessionRequestComplete?: (response: T[], success: boolean, xhrOrXdr: XMLHttpRequest) => void; // ignore xhr: XDomainRequest as it is not compatible for all versions of TypeScript - onStatusChange?: (id: number, oldStatus: string, newStatus: string) => void; - onSubmit?: (id: number, name: string) => void; - onSubmitDelete?: (id: number) => void; - onSubmitted?: (id: number, name: string) => void; - onTotalProgress?: (totalUploadedBytes: number, totalBytes: number) => void; - onUpload?: (id: number, name: string) => void; - onUploadChunk?: (id: number, name: string, chunkData: ChunkData) => void; - // ignore xhr: XDomainRequest as it is not compatible for all versions of TypeScript - onUploadChunkSuccess?: (id: number, chunkData: ChunkData, responseJSON: T, xhr: XMLHttpRequest) => void; - onValidate?: (data: ValidateMetadata, buttonContainer: HTMLElement) => void; - onValidateBatch?: (fileOrBlobDataArray: ValidateMetadata[], buttomContainer: HTMLElement) => void; - } - - interface BasicOptions { - // core options - autoUpload?: boolean; // default true - button?: HTMLElement; - debug?: boolean; - disableCancelForFormUploads?: boolean; - formatFileName?: (rawFileName: string) => string; // rawFilename to display filename - maxConnections?: number; - multiple?: boolean; - - blobs?: BlobsOptions; - camera?: CameraOptions; - chunking?: ChunkingOptions; - cors?: CorsOptions; - deleteFile?: DeleteFileOptions; - extraButtons?: ExtraButtonsOptions; - form?: FormOptions; - messages?: MessagesOptions; - paste?: PasteOptions; - resume?: ResumeOptions; - retry?: RetryOptions; - request?: RequestOptions; - scaling?: ScalingOptions; - session?: SessionOptions; - text?: TextOptions; - validation?: ValidationOptions; - workarounds?: WorkaroundOptions; - - callbacks?: CallbackOptions; - } - - interface BlobWrapper { - blob: Blob; - name: string; - } - - interface CanvasWrapper { - canvas: HTMLCanvasElement; - name: string; - quality: number; // 1-100 - type: MimeType; - } - - interface ResizeInfo { - blob: File | Blob; - height: number; - image: HTMLImageElement; - sourceCanvas: HTMLCanvasElement; - targetCanvas: HTMLCanvasElement; - width: number; - } - - interface ResumableItem { - name: string; - uuid: string; - partIdx: number; - } - - interface FilterOption { - id?: number; - uuid?: string; - originalName?: string; - name?: string; - status?: string; - size?: number; - } - - interface ScaleImageOptions { - maxSize: number; - orient?: boolean; // default: true - type?: string; // default: type or reference image - quality?: number; // 0-100 - default: 80 - includeExif?: boolean; // default: false - customResizer?: (resizeInfo: ResizeInfo) => Promise; - } - - class FineUploaderBasic { - constructor(options: BasicOptions) - - addFiles(files: File[] | HTMLInputElement[] | Blob[] | BlobWrapper[] | HTMLCanvasElement[] | CanvasWrapper[] | FileList, params: T, endpoint: string): void; - addInitialFiles(initialFiles: T[]): void; - cancel(id: number): void; - cancelAll(): void; - clearStoredFiles(): void; - continueUpload(id: number): boolean; // true if successful - deleteFile(id: number): void; - - /** - * TODO: need someone who has used this to update the returned promise related fields - */ - drawThumbnail(id: number, targetContainer: HTMLElement, maxSize: number, fromServer: boolean, customResizer: (resizeInfo: ResizeInfo) => Promise): Promise - getButton(id: number): HTMLElement; - getFile(id: number): File | Blob; - getInProgress(): number; - getName(id: number): string; - getParentId(scaledFileId: number): number; - getRemainingAllowedItems(): number; - getResumableFilesData(): ResumableItem[]; - getSize(id: number): number; - getUploads(filter: FilterOption): T | T[]; - getUuid(id: number): string; - log(message: string, level: string): void; - pauseUpload(id: number): boolean; // true if successful - reset(): void; - retry(id: number): void; - scaleImage(id: number, options: ScaleImageOptions): Promise; - setCustomHeaders(customHeaders: H, id: number): void; - setEndpoint(path: string, identifier: number | HTMLElement): void; - setDeleteFileCustomHeaders(customHeaders: H, id: number): void; - setDeleteFileEndpoint(path: string, identifier: number | HTMLElement): void; - setDeleteFileParams

    (params: P, id: number): void; - setItemLimit(newItemLimit: number): void; - setForm(formElementOrId: HTMLFormElement | string): void; - setName(id: number, name: string): void; - setParams

    (params: P, id: number): void; - setUuid(id: number, uuid: string): void; - uploadStoredFiles(): void; // throws NoFilesError - - // ui - addExtraDropzone(element: HTMLElement): void; - getDropTarget(id: number): HTMLElement; - getId(element: HTMLElement): number; - getItemByFileId(id: number): HTMLElement; - removeExtraDropzone(element: HTMLElement): void; - } -} diff --git a/fine-uploader/test/blobs.ts b/fine-uploader/test/blobs.ts deleted file mode 100644 index 99e5355460..0000000000 --- a/fine-uploader/test/blobs.ts +++ /dev/null @@ -1,9 +0,0 @@ -function testBlob() { - const config: qq.BasicOptions = { - blobs: { - defaultName: "hi.png" - } - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/callbacks.ts b/fine-uploader/test/callbacks.ts deleted file mode 100644 index eba85ad2a0..0000000000 --- a/fine-uploader/test/callbacks.ts +++ /dev/null @@ -1,59 +0,0 @@ -class CallbacksTest { - constructor(private opts: qq.CallbackOptions) { - - } - - testCallbacks() { - const opts = this.opts; - - interface CustomType { - myTypeOfClass: string; - } - - opts.onAutoRetry = (id, name, attemptNumber) => {}; - - opts.onCancel = (id, name) => {}; - - opts.onComplete = (id: number, name: string, responseJSON: CustomType, xhr: XMLHttpRequest) => {}; - - opts.onAllComplete = (succeeded, failed) => {}; - - opts.onDelete = (id) => {}; - - opts.onDeleteComplete = (id, xhr, isError) => {}; - - opts.onError = (id, name, errorReason, xhr) => {}; - - opts.onManualRetry = (id, name) => { - return true; - }; - - opts.onPasteReceived = (blob) => {}; - - opts.onProgress = (id, name, uploadedBytes, totalBytes) => {}; - - opts.onResume = (id: number, name: string, chunkData: CustomType) => {}; - - opts.onSessionRequestComplete = (response: CustomType[], success: boolean, xhrOrXdr: XMLHttpRequest) => {}; - - opts.onStatusChange = (id, oldStatus, newStatus) => {}; - - opts.onSubmit = (id, name) => {}; - - opts.onSubmitDelete = (id) => {}; - - opts.onSubmitted = (id, name) => {}; - - opts.onTotalProgress = (totalUploadedBytes, totalBytes) => {}; - - opts.onUpload = (id, name) => {}; - - opts.onUploadChunk = (id, name, chunkData) => {}; - - opts.onUploadChunkSuccess = (id: number, chunkData: qq.ChunkData, responseJSON: CustomType, xhr: XMLHttpRequest) => {}; - - opts.onValidate = (data, buttonContainer) => {}; - - opts.onValidateBatch = (fileOrBlobDataArray, buttonContaine) => {}; - } -} diff --git a/fine-uploader/test/camera.ts b/fine-uploader/test/camera.ts deleted file mode 100644 index b42a080778..0000000000 --- a/fine-uploader/test/camera.ts +++ /dev/null @@ -1,14 +0,0 @@ -function cameraTest() { - const cameraButton = new HTMLButtonElement(); - - const cameraOptions: qq.CameraOptions = { - button: cameraButton, - ios: false - }; - - const config: qq.BasicOptions = { - camera: cameraOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/chunking.ts b/fine-uploader/test/chunking.ts deleted file mode 100644 index 386dd67738..0000000000 --- a/fine-uploader/test/chunking.ts +++ /dev/null @@ -1,26 +0,0 @@ -function chunkingTest() { - - const chunkingOptions: qq.ChunkingOptions = { - concurrent: { - enabled: false - }, - enabled: true, - mandatory: true, - partSize: 1000000, - paramNames: { - chunkSize: "chunkSize", - partByteOffset: "partByteOffset", - partIndex: "partIndex", - totalParts: "totalParts" - }, - success: { - endpoint: "/some/web/endpoint/yaySuccesss" - } - }; - - const config: qq.BasicOptions = { - chunking: chunkingOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/core.ts b/fine-uploader/test/core.ts deleted file mode 100644 index dbc06e95d6..0000000000 --- a/fine-uploader/test/core.ts +++ /dev/null @@ -1,17 +0,0 @@ -function testCore() { - const button: HTMLElement = new HTMLButtonElement(); - - const config: qq.BasicOptions = { - autoUpload: true, - button, - debug: true, - disableCancelForFormUploads: true, - formatFileName: (rawFileName: string) => { - return "hi"; - }, - maxConnections: 10, - multiple: true - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/cors.ts b/fine-uploader/test/cors.ts deleted file mode 100644 index 771b210208..0000000000 --- a/fine-uploader/test/cors.ts +++ /dev/null @@ -1,13 +0,0 @@ -function corsTest() { - const corsOptions: qq.CorsOptions = { - allowXdr: true, - expected: true, - sendCredentials: true - }; - - const config: qq.BasicOptions = { - cors: corsOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/deleteFile.ts b/fine-uploader/test/deleteFile.ts deleted file mode 100644 index 49c3e68890..0000000000 --- a/fine-uploader/test/deleteFile.ts +++ /dev/null @@ -1,28 +0,0 @@ -function deleteFileTest() { - interface CustomHeader { - myOption: string; - } - - interface CustomParams { - myParam: string; - } - - const deleteFileOptions: qq.DeleteFileOptions = { - customHeader: { - myOption: "ewwww" - }, - enabled: true, - endpoint: "/my/server/location/delete", - method: "POST", - params: { - myParam: "u" - } - }; - - - const config: qq.BasicOptions = { - deleteFile: deleteFileOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/extraButtons.ts b/fine-uploader/test/extraButtons.ts deleted file mode 100644 index eef709bea8..0000000000 --- a/fine-uploader/test/extraButtons.ts +++ /dev/null @@ -1,23 +0,0 @@ -function extraButtons() { - interface Validation { - myValue: string; - } - - const element: HTMLElement = new HTMLElement(); - - const extraButtonOptions: qq.ExtraButtonsOptions = { - element, - fileInputTitle: "inputTitle", - folders: true, - multiple: false, - validation: { - myValue: "ew" - } - }; - - const config: qq.BasicOptions = { - extraButtons: extraButtonOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/form.ts b/fine-uploader/test/form.ts deleted file mode 100644 index ccc08b69a1..0000000000 --- a/fine-uploader/test/form.ts +++ /dev/null @@ -1,13 +0,0 @@ -function formTest() { - const formOptions: qq.FormOptions = { - element: "qq-form", - autoUpload: true, - interceptSubmit: true - }; - - const config: qq.BasicOptions = { - form: formOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/message.ts b/fine-uploader/test/message.ts deleted file mode 100644 index 726584bf7b..0000000000 --- a/fine-uploader/test/message.ts +++ /dev/null @@ -1,21 +0,0 @@ -function messageTest() { - const messageOptions: qq.MessagesOptions = { - emptyError: "emptyError", - maxHeightImageError: "maxHeightImageError", - maxWidthImageError: "error occurred", - minHeightImageError: "error occurred", - minWidthImageError: "error occurred", - minSizeError: "error occurred", - noFilesError: "error occurred", - onLeave: "error occurred", - retryFailTooManyItemsError: "error occurred", - typeError: "error occurred", - unsupportedBrowserIos8Safari: "error occurred" - }; - - const config: qq.BasicOptions = { - messages: messageOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/method.ts b/fine-uploader/test/method.ts deleted file mode 100644 index 1adb13db81..0000000000 --- a/fine-uploader/test/method.ts +++ /dev/null @@ -1,140 +0,0 @@ -class TestMethods { - constructor(private uploader: qq.FineUploaderBasic) { - } - - testAddFiles() { - interface ParamType { - field: string; - } - - const params: ParamType = { - field: 'hiiiii' - }; - - this.uploader.addFiles( - new FileList(), - params, - "/my/happy/endpoint" - ); - } - - testAddInitialFiles() { - interface InitialFiles { - myField: number; - } - - const initialFiles: InitialFiles[] = [{ - myField: 1324 - }]; - - this.uploader.addInitialFiles(initialFiles); - } - - testDrawThumbnail() { - const promise: Promise = this.uploader.drawThumbnail( - 1234, - new HTMLElement(), - 1234565, - false, - (resizeInfo) => { - return new Promise(() => { - return new Blob(); - }); - } - ); - } - - testGetUploads() { - interface ResponseType { - hi: string; - } - const response: ResponseType | ResponseType[] = this.uploader.getUploads({ - status: "proggresssssssesees" - }); - } - - testSetCustomHeaders() { - interface CustomHeader { - customField: number; - } - - this.uploader.setCustomHeaders({ - customField: 1234 - }, 1234); - } - - testSetDeleteCustomHeaders() { - interface CustomHeader { - customField: number; - } - - this.uploader.setDeleteFileCustomHeaders({ - customField: 1234 - }, 1234); - } - - testSetDeleteFileParams() { - interface CustomParams { - paramField: boolean; - } - this.uploader.setDeleteFileParams({ - paramField: false - }, 1234); - } - - testSetParams() { - interface CustomParams { - customParams: number; - } - - this.uploader.setParams({ - customParams: 1234 - }, 1234); - } - - bulkTests() { - this.uploader.cancel(1); - this.uploader.cancelAll(); - this.uploader.clearStoredFiles(); - const shouldContinue: boolean = this.uploader.continueUpload(1234); - this.uploader.deleteFile(1234); - const elem: HTMLElement = this.uploader.getButton(1234); - const fileOrBlob: File | Blob = this.uploader.getFile(1234); - let num: number = this.uploader.getInProgress(); - let s: string = this.uploader.getName(1234); - num = this.uploader.getParentId(1234); - num = this.uploader.getRemainingAllowedItems(); - const resumables: qq.ResumableItem[] = this.uploader.getResumableFilesData(); - num = this.uploader.getSize(1234); - s = this.uploader.getUuid(1234); - this.uploader.log("why am i doing this?", "info"); - const b: boolean = this.uploader.pauseUpload(1234); - this.uploader.reset(); - this.uploader.retry(1234); - const blobPromise: Promise = this.uploader.scaleImage(1234, { - maxSize: 20, - orient: false, - type: "png", - quality: 10, - includeExif: false, - }); - this.uploader.setEndpoint("/my/path/is/my/own", 1234); - this.uploader.setEndpoint("/my/path/is/my/own", new HTMLElement()); - this.uploader.setDeleteFileEndpoint("/some/path", 1234); - this.uploader.setDeleteFileEndpoint("/some/path", new HTMLElement()); - this.uploader.setItemLimit(1234); - this.uploader.setForm(new HTMLFormElement()); - this.uploader.setForm("myFormElement"); - this.uploader.setName(1234, "myCustomName"); - this.uploader.setUuid(1234, "12341234"); - this.uploader.uploadStoredFiles(); - } - - uiTests() { - this.uploader.addExtraDropzone(new HTMLElement()); - let elem: HTMLElement = this.uploader.getDropTarget(1234); - const n: number = this.uploader.getId(elem); - elem = this.uploader.getItemByFileId(n); - this.uploader.removeExtraDropzone(elem); - } -} diff --git a/fine-uploader/test/paste.ts b/fine-uploader/test/paste.ts deleted file mode 100644 index 9b3c7d9007..0000000000 --- a/fine-uploader/test/paste.ts +++ /dev/null @@ -1,14 +0,0 @@ -function pasteTest() { - const targetElement: HTMLElement = new HTMLElement(); - - const pasteOptions: qq.PasteOptions = { - defaultName: "pasted_image", - targetElement - }; - - const config: qq.BasicOptions = { - paste: pasteOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/request.ts b/fine-uploader/test/request.ts deleted file mode 100644 index 54b29c9be9..0000000000 --- a/fine-uploader/test/request.ts +++ /dev/null @@ -1,32 +0,0 @@ -function requestTest() { - interface CustomHeader { - customHeader: string; - } - - interface CustomParam { - customParam: boolean; - } - - const requestOptions: qq.RequestOptions = { - customHeaders: { - customHeader: "my custom header hehehehee" - }, - endpoint: "/my/custom/endpoint", - filenameParam: "newFilenameParam", - forceMultipart: true, - inputName: "filenameParamMapping", - method: "POST", - params: { - customParam: false - }, - paramsInBody: false, - uuid: "asdf123456", - totalFileSizeName: "totalFileSize" - }; - - const config: qq.BasicOptions = { - request: requestOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} \ No newline at end of file diff --git a/fine-uploader/test/resume.ts b/fine-uploader/test/resume.ts deleted file mode 100644 index dc588d19f5..0000000000 --- a/fine-uploader/test/resume.ts +++ /dev/null @@ -1,15 +0,0 @@ -function resumeTest() { - const resumeOptions: qq.ResumeOptions = { - recordsExpireIn: 10, - enabled: true, - paramNames: { - resuming: "ew you" - } - }; - - const config: qq.BasicOptions = { - resume: resumeOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/retry.ts b/fine-uploader/test/retry.ts deleted file mode 100644 index 85c9f71af3..0000000000 --- a/fine-uploader/test/retry.ts +++ /dev/null @@ -1,15 +0,0 @@ -function retryTest() { - - const retryOptions: qq.RetryOptions = { - autoAttemptDelay: 1, - enableAuto: true, - maxAutoAttempts: 32, - preventRetryResponseProperty: "preventRetry" - }; - - const config: qq.BasicOptions = { - retry: retryOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} \ No newline at end of file diff --git a/fine-uploader/test/scaling.ts b/fine-uploader/test/scaling.ts deleted file mode 100644 index 5e8ff3dc51..0000000000 --- a/fine-uploader/test/scaling.ts +++ /dev/null @@ -1,29 +0,0 @@ -function scalingTest() { - const scalingOptions: qq.ScalingOptions = { - customResizer: (blob, height, image, sourceCanvas, targetCanvas, width) => { - const promise = new Promise(() => { - return blob; - }); - return promise; - }, - defaultQuality: 10, - defaultType: "JPEG", - failureText: "you have failed me for the last time", - includeExif: true, - orient: false, - sendOriginal: true, - sizes: [ - { - maxSize: 10, - name: "i am added to name", - type: "mime type" - } - ] - }; - - const config: qq.BasicOptions = { - scaling: scalingOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/session.ts b/fine-uploader/test/session.ts deleted file mode 100644 index 7d8d6069b9..0000000000 --- a/fine-uploader/test/session.ts +++ /dev/null @@ -1,26 +0,0 @@ -function sessionTest() { - interface CustomHeader { - customHeader: string; - } - - interface CustomParam { - customParam: boolean; - } - - const sessionOptions: qq.SessionOptions = { - customHeaders: { - customHeader: "customHeader" - }, - endpoint: "/mysession/endpoint", - params: { - customParam: false - }, - refreshOnReset: false - }; - - const config: qq.BasicOptions = { - session: sessionOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/text.ts b/fine-uploader/test/text.ts deleted file mode 100644 index e83ddb4bcf..0000000000 --- a/fine-uploader/test/text.ts +++ /dev/null @@ -1,13 +0,0 @@ -function textTest() { - const textOptions: qq.TextOptions = { - defaultResponseError: "you have failed me for the last time", - fileInputTitle: "file input title", - sizeSymbols: ['kb'] - }; - - const config: qq.BasicOptions = { - text: textOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/validation.ts b/fine-uploader/test/validation.ts deleted file mode 100644 index 60324157f9..0000000000 --- a/fine-uploader/test/validation.ts +++ /dev/null @@ -1,22 +0,0 @@ -function validationTest() { - - const validationOptions: qq.ValidationOptions = { - acceptFiles: [new MimeType()], - allowedExtensions: ['csv, xls'], - itemLimit: 5, - sizeLimit: 10000000, - stopOnFirstInvalidFile: false, - image: { - maxHeight: 10, - maxWidth: 10, - minHeight: 1, - minWidth: 1 - } - }; - - const config: qq.BasicOptions = { - validation: validationOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/test/workarounds.ts b/fine-uploader/test/workarounds.ts deleted file mode 100644 index 42fa5ceee7..0000000000 --- a/fine-uploader/test/workarounds.ts +++ /dev/null @@ -1,13 +0,0 @@ -function workaroundsTest() { - const workaroundOptions: qq.WorkaroundOptions = { - iosEmptyVideos: false, - ios8BrowserCrash: false, - ios8SafariUploads: false - }; - - const config: qq.BasicOptions = { - workarounds: workaroundOptions - }; - - const uploader = new qq.FineUploaderBasic(config); -} diff --git a/fine-uploader/tsconfig.json b/fine-uploader/tsconfig.json deleted file mode 100644 index c02e485091..0000000000 --- a/fine-uploader/tsconfig.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "files": [ - "index.d.ts", - "test/blobs.ts", - "test/camera.ts", - "test/chunking.ts", - "test/core.ts", - "test/cors.ts", - "test/deleteFile.ts", - "test/extraButtons.ts", - "test/form.ts", - "test/message.ts", - "test/paste.ts", - "test/resume.ts", - "test/retry.ts", - "test/request.ts", - "test/scaling.ts", - "test/session.ts", - "test/text.ts", - "test/validation.ts", - "test/workarounds.ts", - "test/method.ts", - "test/callbacks.ts" - ], - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - } -} \ No newline at end of file diff --git a/fine-uploader/tslint.json b/fine-uploader/tslint.json deleted file mode 100644 index 377cc837d4..0000000000 --- a/fine-uploader/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "../tslint.json" } diff --git a/notNeededPackages.json b/notNeededPackages.json index c8b59ea072..fce0ef50f0 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -323,6 +323,12 @@ "typingsPackageName": "antd", "sourceRepoURL": "https://github.com/ant-design/ant-design", "asOfVersion": "1.0.0" + }, + { + "libraryName": "FineUploader", + "typingsPackageName": "fine-uploader", + "sourceRepoURL": "http://fineuploader.com/", + "asOfVersion": "5.14.0" } ] } \ No newline at end of file From 1c2f3aec5d538a64d980bd94b71913467ad4dde8 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 10 Mar 2017 07:23:35 -0800 Subject: [PATCH 121/567] Fix chai-enzyme tests (#15106) --- chai-enzyme/chai-enzyme-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chai-enzyme/chai-enzyme-tests.tsx b/chai-enzyme/chai-enzyme-tests.tsx index 7e7ef027ed..a75e99c756 100644 --- a/chai-enzyme/chai-enzyme-tests.tsx +++ b/chai-enzyme/chai-enzyme-tests.tsx @@ -34,7 +34,7 @@ expect(wrapper).to.have.ref("test"); expect(wrapper).to.be.selected(); expect(wrapper).to.have.tagName("div"); expect(wrapper).to.have.text(""); -expect(wrapper).to.have.Type(Test); +expect(wrapper).to.have.type(Test); expect(wrapper).to.have.value("test"); expect(wrapper).to.have.attr("test", "test"); expect(wrapper).to.have.data("test", "Test"); From 51b64c3c15bdcc72c124b940f9dd6792da992116 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 10 Mar 2017 07:46:20 -0800 Subject: [PATCH 122/567] Remove unnecessary references in test files. (#14900) --- acorn/acorn-tests.ts | 2 - amplify/amplify-tests.ts | 3 - .../angular-bootstrap-calendar-tests.ts | 3 - .../angular-feature-flags-tests.ts | 2 - angular-hotkeys/angular-hotkeys-tests.ts | 2 - angular-jwt/angular-jwt-tests.ts | 2 - angular-modal/angular-modal-tests.ts | 2 - archiver/archiver-tests.ts | 3 - atom/atom-tests.ts | 1 - auth0/auth0-tests.ts | 2 - autosize/autosize-tests.ts | 2 - aws-lambda/aws-lambda-tests.ts | 2 - babel-template/babel-template-tests.ts | 3 - babel-traverse/babel-traverse-tests.ts | 2 - babylon/babylon-tests.ts | 5 - .../backbone.layoutmanager-tests.ts | 4 +- backbone/backbone-tests.ts | 2 - bardjs/bardjs-tests.ts | 3 - batch-stream/batch-stream-tests.ts | 2 - .../bazinga-translator-tests.ts | 2 - bezier-js/bezier-js-tests.ts | 2 - bingmaps/bingmaps-tests.ts | 7 - bit-array/bit-array-tests.ts | 2 - blob-stream/blob-stream-tests.ts | 3 - blue-tape/blue-tape-tests.ts | 1 - bluebird-retry/bluebird-retry-tests.ts | 2 - bootpag/bootpag-tests.ts | 2 - .../bootstrap-datepicker-tests.ts | 1 - .../bootstrap-maxlength-tests.ts | 2 - bootstrap-notify/bootstrap-notify-tests.ts | 3 - bootstrap-select/bootstrap-select-tests.ts | 2 - bootstrap-slider/bootstrap-slider-tests.ts | 3 - bootstrap-switch/bootstrap-switch-tests.ts | 7 +- .../bootstrap-touchspin-tests.ts | 5 +- .../bootstrap-validator-tests.ts | 2 - .../bootstrap.v3.datetimepicker-tests.ts | 2 - bootstrap/bootstrap-tests.ts | 3 - browser-resolve/browser-resolve-tests.ts | 2 - .../business-rules-engine-tests.ts | 1 - cachefactory/cachefactory-tests.ts | 2 - cal-heatmap/cal-heatmap-tests.ts | 2 - cassandra-driver/cassandra-driver-tests.ts | 2 - cbor/cbor-tests.ts | 2 - chai-as-promised/chai-as-promised-tests.ts | 2 - chai-enzyme/chai-enzyme-tests.tsx | 4 - chai-spies/chai-spies-tests.ts | 3 - chocolatechipjs/chocolatechipjs-tests.ts | 15 +- cliff/cliff-tests.ts | 1 - co-body/co-body-tests.ts | 3 - coinstring/coinstring-tests.ts | 3 - connect-redis/connect-redis-tests.ts | 2 - cookies/cookies-tests.ts | 2 - .../cordova-plugin-battery-status-tests.ts | 2 - .../cordova-plugin-camera-tests.ts | 2 - .../cordova-plugin-contacts-tests.ts | 2 - .../cordova-plugin-device-motion-tests.ts | 2 - ...cordova-plugin-device-orientation-tests.ts | 2 - .../cordova-plugin-device-tests.ts | 2 - .../cordova-plugin-dialogs-tests.ts | 2 - .../cordova-plugin-file-transfer-tests.ts | 2 - .../cordova-plugin-file-tests.ts | 1 - .../cordova-plugin-globalization-tests.ts | 2 - .../cordova-plugin-inappbrowser-tests.ts | 2 - .../cordova-plugin-keyboard-tests.ts | 2 - .../cordova-plugin-media-capture-tests.ts | 2 - .../cordova-plugin-media-tests.ts | 2 - ...ordova-plugin-network-information-tests.ts | 2 - .../cordova-plugin-splashscreen-tests.ts | 2 - .../cordova-plugin-statusbar-tests.ts | 3 - .../cordova-plugin-vibration-tests.ts | 2 - .../cordova-plugin-websql-tests.ts | 3 - cryptojs/test/md5-tests.ts | 3 - .../css-modules-require-hook-tests.ts | 1 - csv-stringify/csv-stringify-tests.ts | 2 - cybozulabs-md5/cybozulabs-md5-tests.ts | 2 - d3.cloud.layout/d3.cloud.layout-tests.ts | 78 ++++---- d3kit/d3kit-tests.ts | 6 +- d3kit/v1/d3kit-tests.ts | 3 - .../datatables.net-buttons-tests.ts | 4 - .../datatables.net-fixedheader-tests.ts | 3 - .../datatables.net-select-tests.ts | 3 - datatables.net/datatables.net-tests.ts | 3 - dw-bxslider-4/dw-bxslider-4-tests.ts | 3 - dynatable/dynatable-tests.ts | 2 - ecurve/ecurve-tests.ts | 2 - ej.web.all/ej.web.all-tests.ts | 178 +++++++++--------- ej.web.all/index.d.ts | 2 +- .../electron-devtools-installer-tests.ts | 2 - ember/v1/ember-tests.ts | 3 - esprima/esprima-tests.ts | 3 - falcor-express/falcor-express-tests.ts | 4 - fancybox/fancybox-tests.ts | 3 - featherlight/featherlight-tests.ts | 2 - fixed-data-table/fixed-data-table-tests.tsx | 3 - flickity/flickity-tests.ts | 8 +- foundation-sites/foundation-sites-tests.ts | 8 - foundation/foundation-tests.ts | 3 - from/from-tests.ts | 3 - fs-ext/fs-ext-tests.ts | 9 +- .../fs-extra-promise-es6-tests.ts | 4 +- fs-extra-promise/fs-extra-promise-tests.ts | 3 - fs-extra/fs-extra-tests.ts | 3 - ftp/ftp-tests.ts | 9 +- fullcalendar/fullcalendar-tests.ts | 3 +- fullcalendar/v1/fullcalendar-tests.ts | 4 +- gijgo/gijgo-tests.ts | 1 - gldatepicker/gldatepicker-tests.ts | 2 - gm/gm-tests.ts | 3 - .../gregorian-calendar-tests.ts | 3 - gridfs-stream/gridfs-stream-tests.ts | 4 - gulp-babel/gulp-babel-tests.ts | 2 - gulp-cheerio/gulp-cheerio-tests.ts | 4 - gulp-dtsm/gulp-dtsm-tests.ts | 3 - gulp-help/gulp-help-tests.ts | 4 - gulp-html-replace/gulp-html-replace-tests.ts | 4 - gulp-useref/gulp-useref-tests.ts | 2 - hammerjs/v1/hammerjs-tests.ts | 3 - hystrixjs/hystrixjs-tests.ts | 3 - .../i18next-browser-languagedetector-tests.ts | 2 - .../i18next-xhr-backend-tests.ts | 3 - ibm-mobilefirst/ibm-mobilefirst-tests.ts | 4 +- .../imagemagick-native-tests.ts | 3 - imagemagick/imagemagick-tests.ts | 3 - jasmine-expect/jasmine-expect-tests.ts | 3 - jasmine-jquery/jasmine-jquery-tests.ts | 4 - jasmine-matchers/jasmine-matchers-tests.ts | 3 - joi/v6/joi-tests.ts | 1 - jqgrid/jqgrid-tests.ts | 2 - jqrangeslider/jqrangeslider-tests.ts | 6 +- jquery-ajax-chain/jquery-ajax-chain-tests.ts | 5 +- jquery-alertable/jquery-alertable-tests.ts | 3 - .../jquery-backstretch-tests.ts | 2 - jquery-cropbox/jquery-cropbox-tests.ts | 8 +- .../jquery-easy-loading-tests.ts | 3 - .../jquery-handsontable-tests.ts | 3 - .../jquery-jsonrpcclient-tests.ts | 2 - jquery-mockjax/jquery-mockjax-tests.ts | 1 - jquery-steps/index.d.ts | 5 +- jquery-steps/jquery-steps-tests.ts | 3 - jquery-timeentry/jquery-timeentry-tests.ts | 2 - jquery-urlparam/jquery-urlparam-tests.ts | 3 - jquery.ajaxfile/jquery.ajaxfile-tests.ts | 4 - .../jquery.are-you-sure-tests.ts | 7 - jquery.base64/jquery.base64-tests.ts | 3 - jquery.cleditor/jquery.cleditor-tests.ts | 2 - jquery.color/jquery.color-tests.ts | 2 - jquery.colorbox/jquery.colorbox-tests.ts | 2 - jquery.cookie/jquery.cookie-tests.ts | 2 - .../jquery.customselect-tests.ts | 3 - jquery.cycle/jquery.cycle-tests.ts | 8 +- jquery.cycle2/jquery.cycle2-tests.ts | 2 - jquery.finger/jquery.finger-tests.ts | 2 - jquery.flagstrap/jquery.flagstrap-tests.ts | 15 +- jquery.form/jquery.form-tests.ts | 152 ++++++++------- jquery.jnotify/jquery.jnotify-tests.ts | 2 - jquery.joyride/jquery.joyride-tests.ts | 3 - jquery.jsignature/jquery.jsignature-tests.ts | 6 +- jquery.leanmodal/jquery.leanmodal-tests.ts | 3 - .../jquery.livestampjs-tests.ts | 1 - jquery.menuaim/jquery.menuaim-tests.ts | 2 - jquery.mmenu/jquery.mmenu-tests.ts | 4 - jquery.payment/index.d.ts | 2 + jquery.payment/jquery.payment-tests.ts | 3 - .../jquery.pjax.falsandtru-tests.ts | 3 - jquery.pjax/jquery.pjax-tests.ts | 3 - .../jquery.placeholder-tests.ts | 2 - jquery.pnotify/jquery.pnotify-tests.ts | 3 - .../jquery.prettyphoto-tests.ts | 5 - jquery.qrcode/jquery.qrcode-tests.ts | 2 - jquery.rowgrid/jquery.rowgrid-tests.ts | 6 +- jquery.scrollto/jquery.scrollto-tests.ts | 2 - .../jquery.simplemodal-tests.ts | 2 - .../jquery.simplepagination-tests.ts | 2 - jquery.slimscroll/jquery.slimscroll-tests.ts | 2 - .../jquery.tagsmanager-tests.ts | 3 - jquery.timeago/jquery.timeago-tests.ts | 2 - jquery.timepicker/jquery.timepicker-tests.ts | 2 - jquery.timer/jquery.timer-tests.ts | 51 +++-- jquery.tipsy/jquery.tipsy-tests.ts | 2 - jquery.tools/jquery.tools-tests.ts | 2 - .../jquery.total-storage-tests.ts | 7 - jquery.transit/jquery.transit-tests.ts | 2 - .../jquery.ui.datetimepicker-tests.ts | 5 +- jquery.validation/jquery.validation-tests.ts | 5 +- jquery.watermark/jquery.watermark-tests.ts | 2 - jquery.window/jquery.window-tests.ts | 8 +- jquerymobile/jquerymobile-tests.ts | 3 - jqueryui/jqueryui-tests.ts | 3 - jsonwebtoken/jsonwebtoken-tests.ts | 12 +- jsrender/jsrender-tests.ts | 2 - jsx-chai/jsx-chai-tests.ts | 2 - kendo-ui/kendo-ui-tests.ts | 3 - klaw/klaw-tests.ts | 3 - .../knockout-amd-helpers-tests.ts | 3 - .../knockout-transformations-tests.ts | 3 - knockout.kogrid/knockout.kogrid-tests.ts | 52 +++-- knockout.mapping/knockout.mapping-tests.ts | 3 - .../knockout.projections-tests.ts | 5 - knockout.punches/knockout.punches-tests.ts | 3 - knockstrap/knockstrap-tests.ts | 6 - ko.plus/ko.plus-tests.ts | 29 +-- koa-logger/koa-logger-tests.ts | 2 - kolite/kolite-tests.ts | 3 - kue/kue-tests.ts | 2 - leaflet-curve/leaflet-curve-tests.ts | 2 - leaflet-draw/leaflet-draw-tests.ts | 2 - libpq/libpq-tests.ts | 1 - magicsuggest/magicsuggest-tests.ts | 2 - mailcheck/mailcheck-tests.ts | 2 - markitup/markitup-tests.ts | 3 - maskedinput/maskedinput-tests.ts | 7 - material-ui/material-ui-tests.tsx | 5 - mcustomscrollbar/mcustomscrollbar-tests.ts | 3 - md5/md5-tests.ts | 10 +- meteor-roles/meteor-roles-tests.ts | 3 - metismenu/metismenu-tests.ts | 2 - mssql/mssql-tests.ts | 2 - mu2/mu2-tests.ts | 3 - multiparty/multiparty-tests.ts | 2 - mz/mz-tests.ts | 3 - n3/n3-tests.ts | 4 +- ng-command/ng-command-tests.ts | 2 - ng-dialog/ng-dialog-tests.ts | 1 - ng-grid/ng-grid-tests.ts | 2 - ng-notify/ng-notify-tests.ts | 2 - ngprogress-lite/ngprogress-lite-tests.ts | 3 - node-hue-api/node-hue-api-tests.ts | 2 - node-int64/node-int64-tests.ts | 4 - .../node-mysql-wrapper-tests.ts | 4 - nouislider/v7/nouislider-tests.ts | 3 - npm/npm-tests.ts | 3 - on-finished/on-finished-tests.ts | 2 - onoff/onoff-tests.ts | 2 - openui5/openui5-tests.ts | 4 - oracledb/oracledb-tests.ts | 2 - owlcarousel/owlcarousel-tests.ts | 3 - passport-beam/passport-beam-tests.ts | 2 - passport-http/passport-http-tests.ts | 2 - paymentrequest/paymentrequest-tests.ts | 2 - peerjs/peerjs-tests.ts | 2 - phantomcss/index.d.ts | 2 +- phantomcss/phantomcss-tests.ts | 10 +- phonon/phonon-tests.ts | 2 - piwik-tracker/piwik-tracker-tests.ts | 20 +- pkcs11js/pkcs11js-tests.ts | 2 - pouchdb-find/pouchdb-find-tests.ts | 2 - .../pouchdb-replication-tests.ts | 2 - project-oxford/project-oxford-tests.ts | 3 - promised-temp/promised-temp-tests.ts | 3 - promptly/promptly-tests.ts | 2 - radius/radius-tests.ts | 3 - rangyinputs/rangyinputs-tests.ts | 2 - raty/raty-tests.ts | 4 - rc-select/rc-select-tests.ts | 9 +- react-bootstrap/react-bootstrap-tests.tsx | 6 - react-datagrid/react-datagrid-tests.tsx | 3 - .../react-dnd-html5-backend-tests.ts | 2 - react-dnd/UNUSED_FILES.txt | 1 - react-dnd/react-dnd-test-backend.d.ts | 20 -- react-dnd/react-dnd-tests.ts | 15 +- react-dropzone/react-dropzone-tests.tsx | 2 - react-helmet/react-helmet-tests.tsx | 3 - react-infinite/react-infinite-tests.tsx | 3 - .../react-input-calendar-tests.tsx | 3 - react-intl/react-intl-tests.tsx | 2 - react-intl/v1/react-intl-tests.tsx | 2 - react-mixin/react-mixin-tests.tsx | 3 - react-native/test/animated.tsx | 2 - react-native/test/index.tsx | 11 +- .../react-onclickoutside-tests.tsx | 5 - .../react-props-decorators-tests.ts | 3 - .../react-router-bootstrap-tests.tsx | 10 +- react-scroll/react-scroll-tests.tsx | 2 - react-spinkit/react-spinkit-tests.tsx | 3 - react-tabs/react-tabs-tests.ts | 4 - react-tagcloud/react-tagcloud-tests.tsx | 5 - react-widgets/react-widgets-tests.tsx | 9 +- readdir-stream/readdir-stream-tests.ts | 3 - redux-debounced/redux-debounced-tests.ts | 2 - .../redux-devtools-dock-monitor-tests.tsx | 2 - .../redux-devtools-log-monitor-tests.tsx | 2 - redux-devtools/redux-devtools-tests.tsx | 3 - resolve/resolve-tests.ts | 2 - rx.wamp/rx.wamp-tests.ts | 3 - s3-upload-stream/s3-upload-stream-tests.ts | 3 - sax/sax-tests.ts | 2 - seamless/seamless-tests.ts | 2 - select2/select2-tests.ts | 3 - selectize/selectize-tests.ts | 3 - shelljs/shelljs-tests.ts | 6 - sinon-as-promised/sinon-as-promised-tests.ts | 2 - sinon-mongoose/sinon-mongoose-tests.ts | 2 - slick-carousel/slick-carousel-tests.ts | 4 - slickgrid/test/index.ts | 3 - socket.io-redis/socket.io-redis-tests.ts | 2 - socket.io.users/socket.io.users-tests.ts | 4 - source-list-map/source-list-map-tests.ts | 1 - spectrum/spectrum-tests.ts | 3 - split/split-tests.ts | 3 - sql.js/sql.js-tests.ts | 3 - ss-utils/ss-utils-tests.ts | 15 +- static-eval/static-eval-tests.ts | 2 - stream-to-array/stream-to-array-tests.ts | 3 - stylus/stylus-tests.ts | 10 +- superagent/superagent-tests.ts | 3 - .../supertest-as-promised-tests.ts | 6 +- tapable/tapable-tests.ts | 2 - tape/tape-tests.ts | 3 - tar/tar-tests.ts | 2 - tether-drop/tether-drop-tests.ts | 1 - .../test/canvas/canvas_camera_orthographic.ts | 3 - three/test/canvas/canvas_geometry_cube.ts | 3 - .../canvas/canvas_interactive_cubes_tween.ts | 2 - .../test/canvas/canvas_lights_pointlights.ts | 3 - three/test/canvas/canvas_materials.ts | 3 - three/test/canvas/canvas_particles_floor.ts | 3 - three/test/css3d/css3d_periodictable.ts | 2 - three/test/css3d/css3d_sprites.ts | 2 - three/test/examples/controls/vrcontrols.ts | 2 - three/test/examples/ctm/ctmloader.ts | 2 - three/test/examples/detector.ts | 4 - three/test/examples/effects/vreffect.ts | 2 - three/test/examples/octree.ts | 2 - three/test/math/test_unit_math.ts | 3 - three/test/webgl/webgl_animation_cloth.ts | 3 - .../webgl/webgl_animation_skinning_morph.ts | 3 - three/test/webgl/webgl_buffergeometry.ts | 3 - three/test/webgl/webgl_camera.ts | 3 - three/test/webgl/webgl_custom_attributes.ts | 3 - three/test/webgl/webgl_geometries.ts | 3 - three/test/webgl/webgl_helpers.ts | 3 - three/test/webgl/webgl_interactive_cubes.ts | 3 - .../webgl_interactive_raycasting_points.ts | 3 - three/test/webgl/webgl_lensflares.ts | 3 - three/test/webgl/webgl_lights_hemisphere.ts | 3 - three/test/webgl/webgl_lines_colors.ts | 3 - three/test/webgl/webgl_loader_awd.ts | 3 - three/test/webgl/webgl_materials.ts | 3 - three/test/webgl/webgl_morphtargets.ts | 3 - three/test/webgl/webgl_points_billboards.ts | 3 - three/test/webgl/webgl_postprocessing.ts | 3 - three/test/webgl/webgl_shader.ts | 3 - three/test/webgl/webgl_sprites.ts | 3 - through2/through2-tests.ts | 3 - through2/v0/through2-tests.ts | 3 - typeahead/typeahead-tests.ts | 2 - uuid-1345/uuid-1345-tests.ts | 3 - valerie/valerie-tests.ts | 12 -- validator/validator-tests.ts | 3 - vex-js/vex-js-tests.ts | 1 - vinyl/vinyl-tests.ts | 4 - voronoi-diagram/voronoi-diagram-tests.ts | 2 - wake_on_lan/wake_on_lan-tests.ts | 3 - webgme/webgme-tests.ts | 72 ++++--- webpack-sources/webpack-sources-tests.ts | 2 - x-editable/x-editable-tests.ts | 7 - xmlpoke/xmlpoke-tests.ts | 4 - xrm/v7/xrm-tests.ts | 2 - 358 files changed, 392 insertions(+), 1381 deletions(-) delete mode 100644 react-dnd/UNUSED_FILES.txt delete mode 100644 react-dnd/react-dnd-test-backend.d.ts diff --git a/acorn/acorn-tests.ts b/acorn/acorn-tests.ts index bda6844c84..72ca71d2f6 100644 --- a/acorn/acorn-tests.ts +++ b/acorn/acorn-tests.ts @@ -1,5 +1,3 @@ -/// - import acorn = require('acorn'); import * as ESTree from 'estree'; diff --git a/amplify/amplify-tests.ts b/amplify/amplify-tests.ts index edf2988122..b4f98ccd5b 100644 --- a/amplify/amplify-tests.ts +++ b/amplify/amplify-tests.ts @@ -1,6 +1,3 @@ - -/// - import amplify = require("amplify"); // Copied examples directly from AmplifyJs site diff --git a/angular-bootstrap-calendar/angular-bootstrap-calendar-tests.ts b/angular-bootstrap-calendar/angular-bootstrap-calendar-tests.ts index 4ff5b4cf19..1efc5d0391 100644 --- a/angular-bootstrap-calendar/angular-bootstrap-calendar-tests.ts +++ b/angular-bootstrap-calendar/angular-bootstrap-calendar-tests.ts @@ -1,6 +1,3 @@ -/// -/// - var myApp = angular.module('testModule'); interface MyAppScope extends ng.IScope { diff --git a/angular-feature-flags/angular-feature-flags-tests.ts b/angular-feature-flags/angular-feature-flags-tests.ts index 8ca17e4962..ac956dd657 100644 --- a/angular-feature-flags/angular-feature-flags-tests.ts +++ b/angular-feature-flags/angular-feature-flags-tests.ts @@ -1,5 +1,3 @@ -/// - import * as angular from "angular"; let myApp = angular.module('myApp', ['feature-flags']); diff --git a/angular-hotkeys/angular-hotkeys-tests.ts b/angular-hotkeys/angular-hotkeys-tests.ts index 1f87ecefdf..c0bd9b974d 100644 --- a/angular-hotkeys/angular-hotkeys-tests.ts +++ b/angular-hotkeys/angular-hotkeys-tests.ts @@ -1,5 +1,3 @@ -/// - var scope: ng.IScope; var hotkeyProvider: ng.hotkeys.HotkeysProvider; var hotkeyObj: ng.hotkeys.Hotkey; diff --git a/angular-jwt/angular-jwt-tests.ts b/angular-jwt/angular-jwt-tests.ts index b20b2eea9d..88b177ba74 100644 --- a/angular-jwt/angular-jwt-tests.ts +++ b/angular-jwt/angular-jwt-tests.ts @@ -1,5 +1,3 @@ -/// - var app = angular.module("angular-jwt-tests", ["angular-jwt"]); var $jwtHelper: ng.jwt.IJwtHelper; diff --git a/angular-modal/angular-modal-tests.ts b/angular-modal/angular-modal-tests.ts index 5be313840b..edb4d7e6ef 100644 --- a/angular-modal/angular-modal-tests.ts +++ b/angular-modal/angular-modal-tests.ts @@ -1,5 +1,3 @@ -/// - var btfModal: angularModal.AngularModalFactory; // Using template URL diff --git a/archiver/archiver-tests.ts b/archiver/archiver-tests.ts index d79b29f079..f186fb9bcb 100644 --- a/archiver/archiver-tests.ts +++ b/archiver/archiver-tests.ts @@ -1,6 +1,3 @@ - -/// - import Archiver = require('archiver'); import FS = require('fs'); diff --git a/atom/atom-tests.ts b/atom/atom-tests.ts index 37b2fb314c..1b141fb492 100644 --- a/atom/atom-tests.ts +++ b/atom/atom-tests.ts @@ -1,5 +1,4 @@ /// -/// import path = require("path"); import _atom = require("atom"); diff --git a/auth0/auth0-tests.ts b/auth0/auth0-tests.ts index 502a72eec1..24a4aad87d 100644 --- a/auth0/auth0-tests.ts +++ b/auth0/auth0-tests.ts @@ -1,5 +1,3 @@ -/// - import * as auth0 from 'auth0'; const management = new auth0.ManagementClient({ diff --git a/autosize/autosize-tests.ts b/autosize/autosize-tests.ts index a7eea57a62..fa0988be24 100644 --- a/autosize/autosize-tests.ts +++ b/autosize/autosize-tests.ts @@ -1,5 +1,3 @@ -/// - // from a NodeList autosize(document.querySelectorAll('textarea')); diff --git a/aws-lambda/aws-lambda-tests.ts b/aws-lambda/aws-lambda-tests.ts index fb09beda8a..7b0fe45180 100644 --- a/aws-lambda/aws-lambda-tests.ts +++ b/aws-lambda/aws-lambda-tests.ts @@ -1,5 +1,3 @@ -/// - var str: string = "any string"; var date: Date = new Date(); var anyObj: any = { abc: 123 }; diff --git a/babel-template/babel-template-tests.ts b/babel-template/babel-template-tests.ts index b5d4547188..31e3bd44d9 100644 --- a/babel-template/babel-template-tests.ts +++ b/babel-template/babel-template-tests.ts @@ -1,7 +1,4 @@ - /// -/// - // Example from https://github.com/babel/babel/tree/master/packages/babel-template import template = require('babel-template'); diff --git a/babel-traverse/babel-traverse-tests.ts b/babel-traverse/babel-traverse-tests.ts index 3779852c5f..98afbbc0a7 100644 --- a/babel-traverse/babel-traverse-tests.ts +++ b/babel-traverse/babel-traverse-tests.ts @@ -1,5 +1,3 @@ - -/// /// diff --git a/babylon/babylon-tests.ts b/babylon/babylon-tests.ts index bb95625935..769d635e89 100644 --- a/babylon/babylon-tests.ts +++ b/babylon/babylon-tests.ts @@ -1,8 +1,3 @@ - -/// -/// - - // Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babylon import * as babylon from "babylon"; declare function assert(expr: boolean): void; diff --git a/backbone.layoutmanager/backbone.layoutmanager-tests.ts b/backbone.layoutmanager/backbone.layoutmanager-tests.ts index fe11ce9b18..edddb8352b 100644 --- a/backbone.layoutmanager/backbone.layoutmanager-tests.ts +++ b/backbone.layoutmanager/backbone.layoutmanager-tests.ts @@ -1,5 +1,3 @@ -/// - import * as Backbone from 'backbone'; // Example code. @@ -26,7 +24,7 @@ class View extends Backbone.Layout { "mouseleave": "removeElement" } } - + wrapElement(): void { this.$el.wrap(""); } diff --git a/backbone/backbone-tests.ts b/backbone/backbone-tests.ts index accdb93979..c074ac57e5 100644 --- a/backbone/backbone-tests.ts +++ b/backbone/backbone-tests.ts @@ -1,5 +1,3 @@ -/// - function test_events() { var object = new Backbone.Events(); diff --git a/bardjs/bardjs-tests.ts b/bardjs/bardjs-tests.ts index 2d312634ca..91172b7255 100644 --- a/bardjs/bardjs-tests.ts +++ b/bardjs/bardjs-tests.ts @@ -1,6 +1,3 @@ -/// -/// - import * as angular from 'angular'; import 'angular-mocks'; diff --git a/batch-stream/batch-stream-tests.ts b/batch-stream/batch-stream-tests.ts index d3195466e8..4554530072 100644 --- a/batch-stream/batch-stream-tests.ts +++ b/batch-stream/batch-stream-tests.ts @@ -1,5 +1,3 @@ -/// - import fs = require('fs'); import BatchStream = require('batch-stream'); diff --git a/bazinga-translator/bazinga-translator-tests.ts b/bazinga-translator/bazinga-translator-tests.ts index 8c5d1dafa8..3856ff22a1 100644 --- a/bazinga-translator/bazinga-translator-tests.ts +++ b/bazinga-translator/bazinga-translator-tests.ts @@ -1,5 +1,3 @@ -/// - Translator.fallback = 'en'; Translator.defaultDomain = 'messages'; diff --git a/bezier-js/bezier-js-tests.ts b/bezier-js/bezier-js-tests.ts index f5fba4d947..003b6e1c45 100644 --- a/bezier-js/bezier-js-tests.ts +++ b/bezier-js/bezier-js-tests.ts @@ -1,5 +1,3 @@ -/// - function test() { var bezierjs: typeof BezierJs; diff --git a/bingmaps/bingmaps-tests.ts b/bingmaps/bingmaps-tests.ts index 239e33094a..e83ff89aba 100644 --- a/bingmaps/bingmaps-tests.ts +++ b/bingmaps/bingmaps-tests.ts @@ -1,10 +1,3 @@ -/// -/// -/// -/// -/// -/// - namespace BingMapsTests { // An interactive set of Bing Maps AJAX control usages can be found at http://www.bingmapsportal.com/isdk/ajaxv7 diff --git a/bit-array/bit-array-tests.ts b/bit-array/bit-array-tests.ts index 7c1ff57b1b..7d50de143c 100644 --- a/bit-array/bit-array-tests.ts +++ b/bit-array/bit-array-tests.ts @@ -1,5 +1,3 @@ -/// - import BitArray = require("bit-array"); const a = new BitArray(32); diff --git a/blob-stream/blob-stream-tests.ts b/blob-stream/blob-stream-tests.ts index b9174859f9..40f9888788 100644 --- a/blob-stream/blob-stream-tests.ts +++ b/blob-stream/blob-stream-tests.ts @@ -1,6 +1,3 @@ - -/// - var bl = require('blob-stream'); var blob = bl.toBlob(); diff --git a/blue-tape/blue-tape-tests.ts b/blue-tape/blue-tape-tests.ts index 92b2641115..c34bc6e32c 100644 --- a/blue-tape/blue-tape-tests.ts +++ b/blue-tape/blue-tape-tests.ts @@ -1,4 +1,3 @@ -/// /// import tape = require('blue-tape'); diff --git a/bluebird-retry/bluebird-retry-tests.ts b/bluebird-retry/bluebird-retry-tests.ts index b63b360160..eb3260a007 100644 --- a/bluebird-retry/bluebird-retry-tests.ts +++ b/bluebird-retry/bluebird-retry-tests.ts @@ -1,5 +1,3 @@ - -/// import Promise = require('bluebird'); import retry = require('bluebird-retry'); diff --git a/bootpag/bootpag-tests.ts b/bootpag/bootpag-tests.ts index 6a5503f9f8..a0a2a78cc3 100644 --- a/bootpag/bootpag-tests.ts +++ b/bootpag/bootpag-tests.ts @@ -1,5 +1,3 @@ -/// - var pagerSelector = ".bootpager"; var $pager = $(pagerSelector); diff --git a/bootstrap-datepicker/bootstrap-datepicker-tests.ts b/bootstrap-datepicker/bootstrap-datepicker-tests.ts index cedc28c93c..372967ec21 100644 --- a/bootstrap-datepicker/bootstrap-datepicker-tests.ts +++ b/bootstrap-datepicker/bootstrap-datepicker-tests.ts @@ -1,4 +1,3 @@ -/// function tests_simple() { $('#datepicker').datepicker(); $('#datepicker').datepicker({ diff --git a/bootstrap-maxlength/bootstrap-maxlength-tests.ts b/bootstrap-maxlength/bootstrap-maxlength-tests.ts index 32255bc66b..92c3f1b57e 100644 --- a/bootstrap-maxlength/bootstrap-maxlength-tests.ts +++ b/bootstrap-maxlength/bootstrap-maxlength-tests.ts @@ -1,5 +1,3 @@ -/// - // Examples from the projects github page $('input[maxlength]').maxlength(); diff --git a/bootstrap-notify/bootstrap-notify-tests.ts b/bootstrap-notify/bootstrap-notify-tests.ts index 5ae4f2ffc1..2977d39abf 100644 --- a/bootstrap-notify/bootstrap-notify-tests.ts +++ b/bootstrap-notify/bootstrap-notify-tests.ts @@ -1,6 +1,3 @@ - -/// - //Test for bootstrap-notify v3.1.3 //Copied example directly from Bootstrap-notify site diff --git a/bootstrap-select/bootstrap-select-tests.ts b/bootstrap-select/bootstrap-select-tests.ts index e2e8c88560..55900b3ab7 100644 --- a/bootstrap-select/bootstrap-select-tests.ts +++ b/bootstrap-select/bootstrap-select-tests.ts @@ -1,5 +1,3 @@ -/// - $(".selectpicker").selectpicker({ actionsBox: true, container: "body", diff --git a/bootstrap-slider/bootstrap-slider-tests.ts b/bootstrap-slider/bootstrap-slider-tests.ts index 98701cedc3..df143d4c72 100644 --- a/bootstrap-slider/bootstrap-slider-tests.ts +++ b/bootstrap-slider/bootstrap-slider-tests.ts @@ -1,6 +1,3 @@ -/// - - $(function() { // examples from http://seiyria.github.io/bootstrap-slider/ diff --git a/bootstrap-switch/bootstrap-switch-tests.ts b/bootstrap-switch/bootstrap-switch-tests.ts index 539399a78e..65fafff2e9 100644 --- a/bootstrap-switch/bootstrap-switch-tests.ts +++ b/bootstrap-switch/bootstrap-switch-tests.ts @@ -1,9 +1,6 @@ -/// - - function test_cases() { $('#switch').bootstrapSwitch(); - + $('#switch').bootstrapSwitch({ state: false }); @@ -15,7 +12,7 @@ function test_cases() { //var mySwitch = $('#switch').get(0); //mySwitch.toggleAnimate(); - + $('#switch').bootstrapSwitch('state', true, true); $('#switch').bootstrapSwitch('state') === true; diff --git a/bootstrap-touchspin/bootstrap-touchspin-tests.ts b/bootstrap-touchspin/bootstrap-touchspin-tests.ts index c8a6a713f9..7d1ea73437 100644 --- a/bootstrap-touchspin/bootstrap-touchspin-tests.ts +++ b/bootstrap-touchspin/bootstrap-touchspin-tests.ts @@ -1,6 +1,3 @@ -/// - - $(function () { // Example 1 from http://www.virtuosoft.eu/code/bootstrap-touchspin/ $("input[name='demo1']").TouchSpin({ @@ -26,7 +23,7 @@ $(function () { $("input[name='demo_vertical']").TouchSpin({ verticalbuttons: true }); - + // Example 4 from http://www.virtuosoft.eu/code/bootstrap-touchspin/ $("input[name='demo_vertical2']").TouchSpin({ verticalbuttons: true, diff --git a/bootstrap-validator/bootstrap-validator-tests.ts b/bootstrap-validator/bootstrap-validator-tests.ts index 07d4753ed1..e43a094184 100644 --- a/bootstrap-validator/bootstrap-validator-tests.ts +++ b/bootstrap-validator/bootstrap-validator-tests.ts @@ -1,5 +1,3 @@ -/// - $('#myForm').validator(); $('#myForm').validator('update'); $('#myForm').validator('validate'); diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts index 3373bdb9e8..575f72b7cb 100644 --- a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts @@ -1,5 +1,3 @@ -/// - import * as moment from "moment"; const dp = $("#picker").datetimepicker().data("DateTimePicker"); diff --git a/bootstrap/bootstrap-tests.ts b/bootstrap/bootstrap-tests.ts index cef85d5d42..cd786b41a7 100644 --- a/bootstrap/bootstrap-tests.ts +++ b/bootstrap/bootstrap-tests.ts @@ -1,6 +1,3 @@ -/// - - $('body').off('.data-api'); $('body').off('.alert.data-api'); diff --git a/browser-resolve/browser-resolve-tests.ts b/browser-resolve/browser-resolve-tests.ts index 2225f7754c..7d08de726f 100644 --- a/browser-resolve/browser-resolve-tests.ts +++ b/browser-resolve/browser-resolve-tests.ts @@ -1,5 +1,3 @@ -/// - import * as browserResolve from 'browser-resolve'; function basic_test_async(callback: (err?: Error, resolved?: string) => void) { diff --git a/business-rules-engine/business-rules-engine-tests.ts b/business-rules-engine/business-rules-engine-tests.ts index 3ffbe2948c..4ae31155f2 100644 --- a/business-rules-engine/business-rules-engine-tests.ts +++ b/business-rules-engine/business-rules-engine-tests.ts @@ -1,4 +1,3 @@ -/// import * as Validators from 'business-rules-engine/node-validators'; import Validation = require("business-rules-engine"); diff --git a/cachefactory/cachefactory-tests.ts b/cachefactory/cachefactory-tests.ts index 73397dd8bf..32eeb63257 100644 --- a/cachefactory/cachefactory-tests.ts +++ b/cachefactory/cachefactory-tests.ts @@ -1,5 +1,3 @@ -/// - CacheFactory.get('test'); CacheFactory.createCache('test', { diff --git a/cal-heatmap/cal-heatmap-tests.ts b/cal-heatmap/cal-heatmap-tests.ts index 47020b811c..ff0e3c0d06 100644 --- a/cal-heatmap/cal-heatmap-tests.ts +++ b/cal-heatmap/cal-heatmap-tests.ts @@ -1,6 +1,4 @@ - /// -/// var cal = new CalHeatMap(); cal.init(); diff --git a/cassandra-driver/cassandra-driver-tests.ts b/cassandra-driver/cassandra-driver-tests.ts index 9feee249ac..e5d8f2ab60 100644 --- a/cassandra-driver/cassandra-driver-tests.ts +++ b/cassandra-driver/cassandra-driver-tests.ts @@ -1,5 +1,3 @@ -/// - import * as cassandra from 'cassandra-driver'; import * as util from 'util'; diff --git a/cbor/cbor-tests.ts b/cbor/cbor-tests.ts index e1a7abb9cf..eb84201b97 100644 --- a/cbor/cbor-tests.ts +++ b/cbor/cbor-tests.ts @@ -1,5 +1,3 @@ -/// - import cbor = require('cbor'); import assert = require('assert'); import fs = require('fs'); diff --git a/chai-as-promised/chai-as-promised-tests.ts b/chai-as-promised/chai-as-promised-tests.ts index 7e22c575aa..d9f681769b 100644 --- a/chai-as-promised/chai-as-promised-tests.ts +++ b/chai-as-promised/chai-as-promised-tests.ts @@ -1,5 +1,3 @@ -/// - import chai = require('chai'); import chaiAsPromised = require('chai-as-promised'); import Q = require('q'); diff --git a/chai-enzyme/chai-enzyme-tests.tsx b/chai-enzyme/chai-enzyme-tests.tsx index a75e99c756..8fc64e2711 100644 --- a/chai-enzyme/chai-enzyme-tests.tsx +++ b/chai-enzyme/chai-enzyme-tests.tsx @@ -1,7 +1,3 @@ -/// -/// -/// - import * as React from "react"; import * as chaiEnzyme from "chai-enzyme"; import { expect } from "chai"; diff --git a/chai-spies/chai-spies-tests.ts b/chai-spies/chai-spies-tests.ts index 7ac0610e4d..326b1e0137 100644 --- a/chai-spies/chai-spies-tests.ts +++ b/chai-spies/chai-spies-tests.ts @@ -1,6 +1,3 @@ -/// -/// - import * as chai from 'chai'; import * as spies from 'chai-spies'; import * as Mocha from 'mocha'; diff --git a/chocolatechipjs/chocolatechipjs-tests.ts b/chocolatechipjs/chocolatechipjs-tests.ts index 465ea2b0a9..7036358aed 100644 --- a/chocolatechipjs/chocolatechipjs-tests.ts +++ b/chocolatechipjs/chocolatechipjs-tests.ts @@ -1,4 +1,3 @@ -/// // ChocolateChipStatic -- DOM creation, etc. $(function() { alert('Ready to do stuff!'); @@ -282,7 +281,7 @@ fetch('../controllers/php-post.php', { }, body: formData }) -.then($.json) +.then($.json) .then(function(data: any): any { if(data.email_check == "valid"){ $("#message_ajax").html("

    " + data.email + " is a valid e-mail address. Thank you, " + data.name + ".
    "); @@ -300,12 +299,12 @@ interface putData { var putData = $('#fileText').val(); fetch('../controllers/php-put.php', { method: 'put', - headers: { - "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" + headers: { + "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" }, body: putData }) -.then($.json) +.then($.json) .then(function(data:any): any { console.dir(data.base); $("#message_ajax").append('

    ' + data.result + '

    '); @@ -324,12 +323,12 @@ interface deleteData { var file = $('#fileName').val(); fetch('../controllers/php-delete.php', { method: 'delete', - headers: { - "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" + headers: { + "Content-type": "application/x-www-form-urlencoded; charset=UTF-8" }, body: file }) -.then($.json) +.then($.json) .then(function(data: any): any { $("#message_ajax").html("
    DELETE was sent to the server successfully.
    "); $("#message_ajax").append('

    ' + data.result + '

    '); diff --git a/cliff/cliff-tests.ts b/cliff/cliff-tests.ts index 9217d9a38a..e69de29bb2 100644 --- a/cliff/cliff-tests.ts +++ b/cliff/cliff-tests.ts @@ -1 +0,0 @@ -/// \ No newline at end of file diff --git a/co-body/co-body-tests.ts b/co-body/co-body-tests.ts index 6011632399..944cadd394 100644 --- a/co-body/co-body-tests.ts +++ b/co-body/co-body-tests.ts @@ -1,6 +1,3 @@ -/// -/// - import * as koa from 'koa'; import * as parse from 'co-body'; diff --git a/coinstring/coinstring-tests.ts b/coinstring/coinstring-tests.ts index ab11a44fb7..1cc3fb9a42 100644 --- a/coinstring/coinstring-tests.ts +++ b/coinstring/coinstring-tests.ts @@ -1,8 +1,5 @@ -/// - import cs = require('coinstring'); - var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd"; var privateKeyHexBuf = new Buffer(privateKeyHex, 'hex'); var version = 0x80; // Bitcoin private key diff --git a/connect-redis/connect-redis-tests.ts b/connect-redis/connect-redis-tests.ts index ed21f3b4be..3c50074117 100644 --- a/connect-redis/connect-redis-tests.ts +++ b/connect-redis/connect-redis-tests.ts @@ -1,5 +1,3 @@ -/// - import * as connectRedis from "connect-redis"; import * as session from "express-session"; diff --git a/cookies/cookies-tests.ts b/cookies/cookies-tests.ts index 30e07d3000..5a2ad1e4a7 100644 --- a/cookies/cookies-tests.ts +++ b/cookies/cookies-tests.ts @@ -1,5 +1,3 @@ -/// - import * as Cookies from 'cookies'; import * as http from 'http'; diff --git a/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts b/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts index 4dafa2e966..1c62521293 100644 --- a/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts +++ b/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts @@ -1,5 +1,3 @@ -/// - window.addEventListener('batterystatus', (ev: BatteryStatusEvent) => { console.log('Battery level is ' + ev.level); }); diff --git a/cordova-plugin-camera/cordova-plugin-camera-tests.ts b/cordova-plugin-camera/cordova-plugin-camera-tests.ts index 00edf02b0a..2f1b661775 100644 --- a/cordova-plugin-camera/cordova-plugin-camera-tests.ts +++ b/cordova-plugin-camera/cordova-plugin-camera-tests.ts @@ -1,5 +1,3 @@ -/// - navigator.camera.getPicture( (data: string) => { alert('Got photo!'); }, (message: string)=> { alert('Failed!: ' + message); }, diff --git a/cordova-plugin-contacts/cordova-plugin-contacts-tests.ts b/cordova-plugin-contacts/cordova-plugin-contacts-tests.ts index c50912c3ba..26243ab43a 100644 --- a/cordova-plugin-contacts/cordova-plugin-contacts-tests.ts +++ b/cordova-plugin-contacts/cordova-plugin-contacts-tests.ts @@ -1,5 +1,3 @@ -/// - var contact: Contact = navigator.contacts.create({ nickname: 'John Smith', displayName: 'John Smith', diff --git a/cordova-plugin-device-motion/cordova-plugin-device-motion-tests.ts b/cordova-plugin-device-motion/cordova-plugin-device-motion-tests.ts index 17b1e49930..1b335beaf7 100644 --- a/cordova-plugin-device-motion/cordova-plugin-device-motion-tests.ts +++ b/cordova-plugin-device-motion/cordova-plugin-device-motion-tests.ts @@ -1,5 +1,3 @@ -/// - navigator.accelerometer.getCurrentAcceleration( (acc: Acceleration) => { console.log('X: ' + acc.x + 'Y: ' + acc.y + 'Z: ' + acc.z); }, () => { alert('Error!'); }); diff --git a/cordova-plugin-device-orientation/cordova-plugin-device-orientation-tests.ts b/cordova-plugin-device-orientation/cordova-plugin-device-orientation-tests.ts index 097a66e99e..ab025d5fbf 100644 --- a/cordova-plugin-device-orientation/cordova-plugin-device-orientation-tests.ts +++ b/cordova-plugin-device-orientation/cordova-plugin-device-orientation-tests.ts @@ -1,5 +1,3 @@ -/// - navigator.compass.getCurrentHeading( (heading: CompassHeading)=> { console.log('Got heading to ' + heading.magneticHeading); }, (error: CompassError)=> { alert('Error! ' + error.code); }, diff --git a/cordova-plugin-device/cordova-plugin-device-tests.ts b/cordova-plugin-device/cordova-plugin-device-tests.ts index 450eadb1f0..cb894785c2 100644 --- a/cordova-plugin-device/cordova-plugin-device-tests.ts +++ b/cordova-plugin-device/cordova-plugin-device-tests.ts @@ -1,3 +1 @@ -/// - console.log(JSON.stringify(device)); \ No newline at end of file diff --git a/cordova-plugin-dialogs/cordova-plugin-dialogs-tests.ts b/cordova-plugin-dialogs/cordova-plugin-dialogs-tests.ts index dd9396f36f..498d7d1000 100644 --- a/cordova-plugin-dialogs/cordova-plugin-dialogs-tests.ts +++ b/cordova-plugin-dialogs/cordova-plugin-dialogs-tests.ts @@ -1,4 +1,2 @@ -/// - navigator.notification.alert('Alert!', () => { alert('You\'re alerted'); }, 'Alert', 'Ok'); navigator.notification.confirm('Are you ok?', (choice: number) => { alert('Your choice is ' + choice); }); diff --git a/cordova-plugin-file-transfer/cordova-plugin-file-transfer-tests.ts b/cordova-plugin-file-transfer/cordova-plugin-file-transfer-tests.ts index 4050b2c4aa..eec24db2e0 100644 --- a/cordova-plugin-file-transfer/cordova-plugin-file-transfer-tests.ts +++ b/cordova-plugin-file-transfer/cordova-plugin-file-transfer-tests.ts @@ -1,5 +1,3 @@ -/// - var file = new FileTransfer(); file.onprogress = (ev: ProgressEvent) => { diff --git a/cordova-plugin-file/cordova-plugin-file-tests.ts b/cordova-plugin-file/cordova-plugin-file-tests.ts index bd9d7de672..37538434e3 100644 --- a/cordova-plugin-file/cordova-plugin-file-tests.ts +++ b/cordova-plugin-file/cordova-plugin-file-tests.ts @@ -1,5 +1,4 @@ /// -/// function fsaccessor(fs: FileSystem) { console.log('FS root is: ' + fs.root.name); diff --git a/cordova-plugin-globalization/cordova-plugin-globalization-tests.ts b/cordova-plugin-globalization/cordova-plugin-globalization-tests.ts index 0a58703a32..4b80f2ff72 100644 --- a/cordova-plugin-globalization/cordova-plugin-globalization-tests.ts +++ b/cordova-plugin-globalization/cordova-plugin-globalization-tests.ts @@ -1,5 +1,3 @@ -/// - navigator.globalization.dateToString(new Date(), (date) => { console.log(JSON.stringify(date)); }, (error) => { alert(error.message); }, diff --git a/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts b/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts index 43b0d28153..cef288c921 100644 --- a/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts +++ b/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts @@ -1,5 +1,3 @@ -/// - // InAppBrowser plugin //---------------------------------------------------------------------- diff --git a/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts b/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts index 3dce2776bf..767eaa6ed2 100644 --- a/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts +++ b/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts @@ -1,5 +1,3 @@ -/// - Keyboard.shrinkView(true); Keyboard.shrinkView(false); Keyboard.hideFormAccessoryBar(true); diff --git a/cordova-plugin-media-capture/cordova-plugin-media-capture-tests.ts b/cordova-plugin-media-capture/cordova-plugin-media-capture-tests.ts index 8bd56c714f..91fdefa74f 100644 --- a/cordova-plugin-media-capture/cordova-plugin-media-capture-tests.ts +++ b/cordova-plugin-media-capture/cordova-plugin-media-capture-tests.ts @@ -1,5 +1,3 @@ -/// - console.log('Supported audio modes are: ' + JSON.stringify(navigator.device.capture.supportedAudioModes)); navigator.device.capture.captureAudio( diff --git a/cordova-plugin-media/cordova-plugin-media-tests.ts b/cordova-plugin-media/cordova-plugin-media-tests.ts index 76e39c8d7b..1c00c850e5 100644 --- a/cordova-plugin-media/cordova-plugin-media-tests.ts +++ b/cordova-plugin-media/cordova-plugin-media-tests.ts @@ -1,5 +1,3 @@ -/// - // Media and Media Capture //---------------------------------------------------------------------- diff --git a/cordova-plugin-network-information/cordova-plugin-network-information-tests.ts b/cordova-plugin-network-information/cordova-plugin-network-information-tests.ts index 702aeb5714..0c4bfd7a2d 100644 --- a/cordova-plugin-network-information/cordova-plugin-network-information-tests.ts +++ b/cordova-plugin-network-information/cordova-plugin-network-information-tests.ts @@ -1,5 +1,3 @@ -/// - var connType = navigator.connection.type; if (connType == Connection.WIFI) { console.log('Congratulations, you\'re with fast Internet!'); diff --git a/cordova-plugin-splashscreen/cordova-plugin-splashscreen-tests.ts b/cordova-plugin-splashscreen/cordova-plugin-splashscreen-tests.ts index d24720eb1d..5938396ad4 100644 --- a/cordova-plugin-splashscreen/cordova-plugin-splashscreen-tests.ts +++ b/cordova-plugin-splashscreen/cordova-plugin-splashscreen-tests.ts @@ -1,4 +1,2 @@ -/// - navigator.splashscreen.show(); navigator.splashscreen.hide(); \ No newline at end of file diff --git a/cordova-plugin-statusbar/cordova-plugin-statusbar-tests.ts b/cordova-plugin-statusbar/cordova-plugin-statusbar-tests.ts index 9d22ca912c..623211d6c6 100644 --- a/cordova-plugin-statusbar/cordova-plugin-statusbar-tests.ts +++ b/cordova-plugin-statusbar/cordova-plugin-statusbar-tests.ts @@ -1,6 +1,3 @@ -/// - - var statusBar: StatusBar = window.StatusBar; statusBar.overlaysWebView(true); statusBar.overlaysWebView(false); diff --git a/cordova-plugin-vibration/cordova-plugin-vibration-tests.ts b/cordova-plugin-vibration/cordova-plugin-vibration-tests.ts index b34cd23675..33cdb43436 100644 --- a/cordova-plugin-vibration/cordova-plugin-vibration-tests.ts +++ b/cordova-plugin-vibration/cordova-plugin-vibration-tests.ts @@ -1,5 +1,3 @@ -/// - var notification: Notification; notification.vibrate(100); diff --git a/cordova-plugin-websql/cordova-plugin-websql-tests.ts b/cordova-plugin-websql/cordova-plugin-websql-tests.ts index 8679b3d5c3..c6299a489c 100644 --- a/cordova-plugin-websql/cordova-plugin-websql-tests.ts +++ b/cordova-plugin-websql/cordova-plugin-websql-tests.ts @@ -1,6 +1,3 @@ -/// - - var db = window.openDatabase('Test', '0.1', 'test', 1024 * 1024 * 5); db.transaction( (tx: SqlTransaction) => { diff --git a/cryptojs/test/md5-tests.ts b/cryptojs/test/md5-tests.ts index d44496aae5..4063750d7d 100644 --- a/cryptojs/test/md5-tests.ts +++ b/cryptojs/test/md5-tests.ts @@ -1,6 +1,3 @@ -/// - - YUI.add('algo-md5-test', function (Y) { var C = CryptoJS; diff --git a/css-modules-require-hook/css-modules-require-hook-tests.ts b/css-modules-require-hook/css-modules-require-hook-tests.ts index 0e2e366f96..ea80474dc5 100644 --- a/css-modules-require-hook/css-modules-require-hook-tests.ts +++ b/css-modules-require-hook/css-modules-require-hook-tests.ts @@ -1,4 +1,3 @@ -/// /// import * as hook from 'css-modules-require-hook'; diff --git a/csv-stringify/csv-stringify-tests.ts b/csv-stringify/csv-stringify-tests.ts index bd6873affb..a05f35d368 100644 --- a/csv-stringify/csv-stringify-tests.ts +++ b/csv-stringify/csv-stringify-tests.ts @@ -1,5 +1,3 @@ -/// - import stringify = require("csv-stringify"); let stream: stringify.Stringifier; diff --git a/cybozulabs-md5/cybozulabs-md5-tests.ts b/cybozulabs-md5/cybozulabs-md5-tests.ts index 7572ed9124..2163b6e8c9 100644 --- a/cybozulabs-md5/cybozulabs-md5-tests.ts +++ b/cybozulabs-md5/cybozulabs-md5-tests.ts @@ -1,5 +1,3 @@ -/// - var hash: string; hash = CybozuLabs.MD5.calc("abc"); hash = CybozuLabs.MD5.calc("abc", CybozuLabs.MD5.BY_ASCII); diff --git a/d3.cloud.layout/d3.cloud.layout-tests.ts b/d3.cloud.layout/d3.cloud.layout-tests.ts index b2e0349cd4..862b7f0d82 100644 --- a/d3.cloud.layout/d3.cloud.layout-tests.ts +++ b/d3.cloud.layout/d3.cloud.layout-tests.ts @@ -1,42 +1,40 @@ -/// +interface ICompTextSize{ + text:string; + size:number; + x?:number; + y?:number; + rotate?:number; +} - interface ICompTextSize{ - text:string; - size:number; - x?:number; - y?:number; - rotate?:number; - } +var fill = d3.scale.category20(); +d3.layout.cloud().size([300, 300]) + .words([ + "Hello", "world", "normally", "you", "want", "more", "words", + "than", "this"].map(function(d:string) { + return {text: d, size: 10 + Math.random() * 90}; + })) + .padding(5) + .rotate(function() { return ~~(Math.random() * 2) * 90; }) + .font("Impact") + .fontSize(function(d:ICompTextSize) { return d.size; }) + .on("end", draw) + .start(); - - var fill = d3.scale.category20(); - d3.layout.cloud().size([300, 300]) - .words([ - "Hello", "world", "normally", "you", "want", "more", "words", - "than", "this"].map(function(d:string) { - return {text: d, size: 10 + Math.random() * 90}; - })) - .padding(5) - .rotate(function() { return ~~(Math.random() * 2) * 90; }) - .font("Impact") - .fontSize(function(d:ICompTextSize) { return d.size; }) - .on("end", draw) - .start(); - function draw(words:ICompTextSize[]) { - d3.select("body").append("svg") - .attr("width", 300) - .attr("height", 300) - .append("g") - .attr("transform", "translate(150,150)") - .selectAll("text") - .data(words) - .enter().append("text") - .style("font-size", function(d:ICompTextSize) { return d.size + "px"; }) - .style("font-family", "Impact") - .style("fill", function(d:ICompTextSize, i:number) { return fill(i); }) - .attr("text-anchor", "middle") - .attr("transform", function(d:ICompTextSize) { - return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")"; - }) - .text(function(d:ICompTextSize) { return d.text; }); - } +function draw(words:ICompTextSize[]) { + d3.select("body").append("svg") + .attr("width", 300) + .attr("height", 300) + .append("g") + .attr("transform", "translate(150,150)") + .selectAll("text") + .data(words) + .enter().append("text") + .style("font-size", function(d:ICompTextSize) { return d.size + "px"; }) + .style("font-family", "Impact") + .style("fill", function(d:ICompTextSize, i:number) { return fill(i); }) + .attr("text-anchor", "middle") + .attr("transform", function(d:ICompTextSize) { + return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")"; + }) + .text(function(d:ICompTextSize) { return d.text; }); +} diff --git a/d3kit/d3kit-tests.ts b/d3kit/d3kit-tests.ts index c8a447ecda..e1a92d41b9 100644 --- a/d3kit/d3kit-tests.ts +++ b/d3kit/d3kit-tests.ts @@ -1,5 +1,3 @@ -/// - function test_abstract_chart() { let el: Element, chart: d3kit.AbstractChart, @@ -86,8 +84,8 @@ function test_svgchart() { options: d3kit.ChartOptions, margins: d3kit.ChartMargin, offsets: [number, number], - svg: d3.Selection, - rootg: d3.Selection, + svg: d3.Selection, + rootg: d3.Selection, layers: d3kit.LayerOrganizer; // create a div, append to body, return Node as type Element diff --git a/d3kit/v1/d3kit-tests.ts b/d3kit/v1/d3kit-tests.ts index d49891822b..9ffb7ca2ba 100644 --- a/d3kit/v1/d3kit-tests.ts +++ b/d3kit/v1/d3kit-tests.ts @@ -1,9 +1,6 @@ -/// /// /// -/* jshint expr: true */ - var expect = chai.expect; describe('Skeleton', function(){ var element: Element, $element: d3.Selection, $svg: d3.Selection, skeleton: d3kit.Skeleton; diff --git a/datatables.net-buttons/datatables.net-buttons-tests.ts b/datatables.net-buttons/datatables.net-buttons-tests.ts index 2dcdd26ff4..6acbbeaf8a 100644 --- a/datatables.net-buttons/datatables.net-buttons-tests.ts +++ b/datatables.net-buttons/datatables.net-buttons-tests.ts @@ -1,7 +1,3 @@ -/// -/// - - $(document).ready(function () { var config: DataTables.Settings = diff --git a/datatables.net-fixedheader/datatables.net-fixedheader-tests.ts b/datatables.net-fixedheader/datatables.net-fixedheader-tests.ts index 949bca825c..561b968ba9 100644 --- a/datatables.net-fixedheader/datatables.net-fixedheader-tests.ts +++ b/datatables.net-fixedheader/datatables.net-fixedheader-tests.ts @@ -1,6 +1,3 @@ -/// -/// - $(document).ready(() => { var config: DataTables.Settings = { // FixedHeader extension options diff --git a/datatables.net-select/datatables.net-select-tests.ts b/datatables.net-select/datatables.net-select-tests.ts index aa1851931c..5d8fdd8dc6 100644 --- a/datatables.net-select/datatables.net-select-tests.ts +++ b/datatables.net-select/datatables.net-select-tests.ts @@ -1,6 +1,3 @@ -/// -/// - $(document).ready(() => { var config: DataTables.Settings = { // Select extension options diff --git a/datatables.net/datatables.net-tests.ts b/datatables.net/datatables.net-tests.ts index 0134581ee1..c4a8fcaf3e 100644 --- a/datatables.net/datatables.net-tests.ts +++ b/datatables.net/datatables.net-tests.ts @@ -1,6 +1,3 @@ -/// - - $(document).ready(function () { //#region "Language" diff --git a/dw-bxslider-4/dw-bxslider-4-tests.ts b/dw-bxslider-4/dw-bxslider-4-tests.ts index e20f748a5d..57092d642f 100644 --- a/dw-bxslider-4/dw-bxslider-4-tests.ts +++ b/dw-bxslider-4/dw-bxslider-4-tests.ts @@ -1,6 +1,3 @@ -/// - - // examples from http://bxslider.com/examples $(document).ready(function() { diff --git a/dynatable/dynatable-tests.ts b/dynatable/dynatable-tests.ts index acba41092a..e727c209c1 100644 --- a/dynatable/dynatable-tests.ts +++ b/dynatable/dynatable-tests.ts @@ -1,5 +1,3 @@ -/// - // Using the global setup option // ============================= $.dynatableSetup({ features: { pushState: false }, dataset: { perPageDefault: 5, perPageOptions: [2, 5, 10] } }); diff --git a/ecurve/ecurve-tests.ts b/ecurve/ecurve-tests.ts index c2214c6905..ced84ef8aa 100644 --- a/ecurve/ecurve-tests.ts +++ b/ecurve/ecurve-tests.ts @@ -1,5 +1,3 @@ -/// - import ecurve = require('ecurve'); import crypto = require('crypto'); diff --git a/ej.web.all/ej.web.all-tests.ts b/ej.web.all/ej.web.all-tests.ts index 63928f47cc..eaf6c2b4e3 100644 --- a/ej.web.all/ej.web.all-tests.ts +++ b/ej.web.all/ej.web.all-tests.ts @@ -1,7 +1,3 @@ -/// -/// - - /* tslint:disable */ module AccordionComponent { @@ -24,7 +20,7 @@ module AccordionComponent { }); } - + module AutocompleteComponent{ var carList = [ @@ -48,15 +44,15 @@ module AutocompleteComponent{ "Triumph Spitfire", "Toyota 2000GT", "Volvo P1800", "Volkswagen Shirako" ]; - $(function () { - var autocompleteInstance =new ej.Autocomplete($("#selectCar"), { + $(function () { + var autocompleteInstance =new ej.Autocomplete($("#selectCar"), { width: "100%", watermarkText: "Select a car", dataSource: carList, enableAutoFill: true, showPopupButton: true, multiSelectMode: "delimiter" - }); + }); }); } @@ -154,7 +150,7 @@ module ButtonComponent { }); }); } - + @@ -170,7 +166,7 @@ module ChartComponent { range: { min: 25, max: 50, interval: 5 }, labelFormat: "{value}%", title: { text: "Efficiency" }, - + }, commonSeriesOptions: { @@ -185,28 +181,28 @@ module ChartComponent { }, visible: true }, - border : {width: 2} - }, - series: + border : {width: 2} + }, + series: [ { - points: [{ x: 2005, y: 28 }, { x: 2006, y: 25 },{ x: 2007, y: 26 }, { x: 2008, y: 27 }, - { x: 2009, y: 32 }, { x: 2010, y: 35 }, { x: 2011, y: 30 }], + points: [{ x: 2005, y: 28 }, { x: 2006, y: 25 },{ x: 2007, y: 26 }, { x: 2008, y: 27 }, + { x: 2009, y: 32 }, { x: 2010, y: 35 }, { x: 2011, y: 30 }], name: 'India' - }, + }, { - points: [{ x: 2005, y: 31 }, { x: 2006, y: 28 },{ x: 2007, y: 30 }, { x: 2008, y: 36 }, - { x: 2009, y: 36 }, { x: 2010, y: 39 }, { x: 2011, y: 37 }], + points: [{ x: 2005, y: 31 }, { x: 2006, y: 28 },{ x: 2007, y: 30 }, { x: 2008, y: 36 }, + { x: 2009, y: 36 }, { x: 2010, y: 39 }, { x: 2011, y: 37 }], name: 'Germany' }, { - points: [{ x: 2005, y: 36 }, { x: 2006, y: 32 },{ x: 2007, y: 34 }, { x: 2008, y: 41 }, - { x: 2009, y: 42 }, { x: 2010, y: 42 }, { x: 2011, y: 43 }], + points: [{ x: 2005, y: 36 }, { x: 2006, y: 32 },{ x: 2007, y: 34 }, { x: 2008, y: 41 }, + { x: 2009, y: 42 }, { x: 2010, y: 42 }, { x: 2011, y: 43 }], name: 'England' - }, + }, { - points: [{ x: 2005, y: 39 }, { x: 2006, y: 36 },{ x: 2007, y: 40 }, { x: 2008, y: 44 }, - { x: 2009, y: 45 }, { x: 2010, y: 48 }, { x: 2011, y: 46 }], + points: [{ x: 2005, y: 39 }, { x: 2006, y: 36 },{ x: 2007, y: 40 }, { x: 2008, y: 44 }, + { x: 2009, y: 45 }, { x: 2010, y: 48 }, { x: 2011, y: 46 }], name: 'France' } ], @@ -294,7 +290,7 @@ module circulargaugecomponent { backgroundColor: "#f5b43f", border: { color: "#f5b43f" } }] - }] + }] }); }); } @@ -381,7 +377,7 @@ $(function () { createConnector({ name: "connector6", sourceNode: "Project", targetNode: "Resources", labels: [createLabel({ "text": "No" })] }) ] }); - + }); function createNode(option: ej.datavisualization.Diagram.Node) { @@ -406,7 +402,7 @@ function createLabel(options : any) { return options; } - + module DialogComponent { $(function () { @@ -456,7 +452,7 @@ module digitalgaugecomponent { } - + @@ -476,12 +472,12 @@ module DropDownListComponent { enableFilterSearch: true, caseSensitiveSearch: true, enableIncrementalSearch: true, - enablePopupResize: true, + enablePopupResize: true, delimiterChar: ";", multiSelectMode: ej.MultiSelectMode.Delimiter, maxPopupHeight: "300px", - minPopupHeight: "150px", - maxPopupWidth: "500px", + minPopupHeight: "150px", + maxPopupWidth: "500px", minPopupWidth: "350px", showCheckbox: true, showRoundedCorner: true @@ -517,7 +513,7 @@ module GanttComponent { dataSource: (window).projectData, allowColumnResize: true, allowSorting: true, - allowSelection: true, + allowSelection: true, enableContextMenu: true, taskIdMapping: "taskID", allowDragAndDrop: true, @@ -558,7 +554,7 @@ module GanttComponent { treeColumnIndex: 1, isResponsive: true, }); -}); +}); } @@ -674,7 +670,7 @@ module KanbanComponent { }); } - + module lineargaugecomponent { @@ -700,14 +696,14 @@ module lineargaugecomponent { backgroundColor: "#E94649", border: { color: "#E94649" }, startWidth: 4, endWidth: 4 }] - }] + }] }); }); } - - + + module ListBoxComponent { $(function () { @@ -717,12 +713,12 @@ module ListBoxComponent { }); } - + module ListviewComponent { $(function () { var listviewInstance = new ej.ListView($("#defaultlistview"), { - enableCheckMark: true, + enableCheckMark: true, width: 400 }); }); @@ -987,7 +983,7 @@ module MenuComponent { - + module NavigationDrawerComponent { $(function () { @@ -1027,7 +1023,7 @@ module PivotChartOlap { $(function () { var sample = new ej.PivotChart($("#PivotChart"),{ dataSource: { - data: "http://bi.syncfusion.com/olap/msmdpump.dll", + data: "http://bi.syncfusion.com/olap/msmdpump.dll", catalog: "Adventure Works DW 2008 SE", cube: "Adventure Works", rows: [ @@ -1195,7 +1191,7 @@ module PivotGaugeOlap { length: 120, width: 7 }, - { + { type: "marker", markerType: "diamond", distanceFromScale: 5, @@ -1224,7 +1220,7 @@ module PivotGaugeOlap { distanceFromScale: -5, backgroundColor: "#fc0606", border: { color: "#fc0606" } - }, + }, { distanceFromScale: -5 }], @@ -1242,7 +1238,7 @@ module PivotGaugeOlap { }] }] }); - }); + }); } @@ -1316,7 +1312,7 @@ module PivotGaugeRelational { length: 120, width: 7 }, - { + { type: "marker", markerType: "diamond", distanceFromScale: 5, @@ -1345,7 +1341,7 @@ module PivotGaugeRelational { distanceFromScale: -5, backgroundColor: "#fc0606", border: { color: "#fc0606" } - }, + }, { distanceFromScale: -5 }], @@ -1363,7 +1359,7 @@ module PivotGaugeRelational { }] }] }); - }); + }); } @@ -1398,7 +1394,7 @@ module PivotGridOlap { ], filters:[] }, - enableGroupingBar: true, + enableGroupingBar: true, pivotTableFieldListID:"PivotSchemaDesigner" }); $("#PivotSchemaDesigner").ejPivotSchemaDesigner(); @@ -1449,7 +1445,7 @@ module PivotGridRelational { fieldCaption: "State" } ], - columns: + columns: [{ fieldName: "Product", fieldCaption: "Product" @@ -1467,10 +1463,10 @@ module PivotGridRelational { ], filters:[] }, - enableGroupingBar: true, + enableGroupingBar: true, pivotTableFieldListID:"PivotSchemaDesigner" }); - $("#PivotSchemaDesigner").ejPivotSchemaDesigner(); + $("#PivotSchemaDesigner").ejPivotSchemaDesigner(); }); } @@ -1611,7 +1607,7 @@ function redo(e: any) { } - + module RadialSliderComponent { $(function () { @@ -1644,7 +1640,7 @@ module rangecomponent { fill: '#69D2E7' } ]; - } + } }); }); @@ -1696,7 +1692,7 @@ module RatingComponent { shapeWidth: 25, showTooltip: true }); - + var sample2 = new ej.Rating($("#halfRating"),{ precision: ej.Rating.Precision.Half, value: 3.5, @@ -1727,7 +1723,7 @@ module RatingComponent { shapeHeight: 25, shapeWidth: 25, showTooltip: true - }); + }); }); } @@ -1760,7 +1756,7 @@ module RibbonComponent { toolTip: "Pin the Ribbon" }, applicationTab: { - type: ej.Ribbon.ApplicationTabType.Menu, menuItemID: "ribbonmenu", menuSettings: { openOnClick: false } + type: ej.Ribbon.ApplicationTabType.Menu, menuItemID: "ribbonmenu", menuSettings: { openOnClick: false } }, tabs: [{ id: "home", text: "HOME", groups: [{ @@ -1837,7 +1833,7 @@ module RibbonComponent { width: 60, isBig: false } - }] + }] }, { text: "Font", alignType: "rows", content: [{ @@ -2116,7 +2112,7 @@ module RibbonComponent { groups: [{ id: "zoomin", text: "Zoom In", - toolTip: "Zoom In", + toolTip: "Zoom In", buttonSettings: { width: 58, contentType: ej.ContentType.TextAndImage, @@ -2127,7 +2123,7 @@ module RibbonComponent { { id: "zoomout", text: "Zoom Out", - toolTip: "Zoom Out", + toolTip: "Zoom Out", buttonSettings: { width: 70, contentType: ej.ContentType.TextAndImage, @@ -2138,7 +2134,7 @@ module RibbonComponent { { id: "fullscreen", text: "Full Screen", - toolTip: "Full Screen", + toolTip: "Full Screen", buttonSettings: { width: 73, contentType: ej.ContentType.TextAndImage, @@ -2367,7 +2363,7 @@ module RibbonComponent { } ] } - ], + ], create: function createControl(args) { var ribbon = $("#defaultRibbon").data("ejRibbon"); $("#fontcolor").ejColorPicker({ value: "#FFFF00", modelType: "palette", cssClass: "e-ribbon", toolIcon: "e-fontcoloricon", select: colorHandler }); @@ -2383,7 +2379,7 @@ function colorHandler(args:any) { - + module RotatorComponent { $(function () { @@ -2546,7 +2542,7 @@ module ScheduleComponent { } }); }); -} +} @@ -2729,9 +2725,9 @@ module piesparkline4 { }); } - - + + module SplitterComponent { @@ -2766,7 +2762,7 @@ $(function () { pdfUrl: (window).baseurl + "api/Spreadsheet/PdfExport" }, sheets: [{ rangeSettings: [{ dataSource: (window).defaultData, startCell: "A1" }] }], - loadComplete: () => { + loadComplete: () => { var spreadsheet = $("#basicSpreadsheet").data("ejSpreadsheet"), xlFormat = spreadsheet.XLFormat; if (!(spreadsheet).isImport) { spreadsheet.setWidthToColumns([140, 128, 105, 100, 100, 110, 120, 120, 100]); @@ -2790,13 +2786,13 @@ var default_data: Array = [ { Category : "Employees", Country : "USA", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 70 }, { Category : "Employees", Country : "USA", JobDescription : "Management", EmployeesCount : 40 }, { Category : "Employees", Country : "USA", JobDescription : "Accounts", EmployeesCount : 60 }, - + { Category : "Employees", Country : "India", JobDescription : "Technical", JobGroup : "Testers", EmployeesCount : 43 }, { Category : "Employees", Country : "India", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Windows", EmployeesCount : 125}, { Category : "Employees", Country : "India", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 60 }, { Category : "Employees", Country : "India", JobDescription : "HR Executives", EmployeesCount : 70 }, { Category : "Employees", Country : "India", JobDescription : "Accounts", EmployeesCount : 45 }, - + { Category : "Employees", Country : "Germany", JobDescription : "Sales", JobGroup : "Executive", EmployeesCount : 30 }, { Category : "Employees", Country : "Germany", JobDescription : "Sales", JobGroup : "Analyst", EmployeesCount : 40 }, { Category : "Employees", Country : "Germany", JobDescription : "Marketing", EmployeesCount : 50 }, @@ -2805,13 +2801,13 @@ var default_data: Array = [ { Category : "Employees", Country : "Germany", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 27 }, { Category : "Employees", Country : "Germany", JobDescription : "Management", EmployeesCount : 33 }, { Category : "Employees", Country : "Germany", JobDescription : "Accounts", EmployeesCount : 55 }, - + { Category : "Employees", Country : "UK", JobDescription : "Technical", JobGroup : "Testers", EmployeesCount : 45 }, { Category : "Employees", Country : "UK", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Windows", EmployeesCount : 96 }, { Category : "Employees", Country : "UK", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 55 }, { Category : "Employees", Country : "UK", JobDescription : "HR Executives", EmployeesCount : 60 }, { Category : "Employees", Country : "UK", JobDescription: "Accounts", EmployeesCount: 30 }, - + { Category : "Employees", Country : "France", JobDescription : "Technical", JobGroup : "Testers", EmployeesCount : 40 }, { Category : "Employees", Country : "France", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Windows", EmployeesCount : 65 }, { Category : "Employees", Country : "France", JobDescription : "Technical", JobGroup : "Developers", JobRole : "Web", EmployeesCount : 27 }, @@ -2821,7 +2817,7 @@ var default_data: Array = [ module sunburstcomponent { $(function () { var sunburstsample = new ej.SunburstChart($("#Sunburst"), { - valueMemberPath: "EmployeesCount", + valueMemberPath: "EmployeesCount", levels: [ {groupMemberPath: "Country"}, {groupMemberPath: "JobDescription"}, @@ -2860,8 +2856,8 @@ module TabComponent { module TagCloudComponent { - - + + var websiteCollection = [ { text: "Google", url: "http://www.google.com", frequency: 12 }, { text: "All Things Digital", url: "http://allthingsd.com/", frequency: 3 }, @@ -2892,7 +2888,7 @@ module TagCloudComponent { text: "text", url: "url", frequency: "frequency" } }); - + }); } @@ -2932,7 +2928,7 @@ module EditorComponent { - + module TileViewComponent { $(function () { @@ -2943,38 +2939,38 @@ module TileViewComponent { imageUrl:'content/images/tile/windows/people_1.png' }); var tile2 = new ej.Tile($("#tile2"), { - imagePosition:"center", + imagePosition:"center", tileSize:"small", - imageUrl:'content/images/tile/windows/alerts.png', - + imageUrl:'content/images/tile/windows/alerts.png', + }); var tile3 = new ej.Tile($("#tile3"), { - imagePosition:"center", + imagePosition:"center", tileSize:"small", - imageUrl:'content/images/tile/windows/bing.png', + imageUrl:'content/images/tile/windows/bing.png', }); var tile4 = new ej.Tile($("#tile4"), { tileSize:"small", - imageUrl:'content/images/tile/windows/camera.png', + imageUrl:'content/images/tile/windows/camera.png', }); var tile5 = new ej.Tile($("#tile5"), { - imagePosition:"center", + imagePosition:"center", tileSize:"small", - imageUrl:'content/images/tile/windows/messages.png', + imageUrl:'content/images/tile/windows/messages.png', }); var tile6 = new ej.Tile($("#tile6"), { - imagePosition:"center", + imagePosition:"center", tileSize:"medium", - imageUrl:'content/images/tile/windows/games.png', + imageUrl:'content/images/tile/windows/games.png', caption:{text:"Play"} }); - var tile7 = new ej.Tile($("#tile7"), { + var tile7 = new ej.Tile($("#tile7"), { tileSize:"medium", imageUrl:'content/images/tile/windows/map.png', caption:{text:"Maps"} }); var tile8 = new ej.Tile($("#tile8"), { - imagePosition:"fill", + imagePosition:"fill", tileSize:"wide", imageUrl:'content/images/tile/windows/sports.png', caption:{text:"Sports"} @@ -3026,7 +3022,7 @@ module TimePickerComponent { module ToolbarComponent { - + $(function () { var sample = new ej.Toolbar($("#editingToolbar"),{ width: "100%", @@ -3045,7 +3041,7 @@ module ToolbarComponent { module TooltipComponent { - + $(function () { var sample1 = new ej.Tooltip($("#link1"),{ @@ -3140,7 +3136,7 @@ module TreeGridComponent { isResponsive: true, }); }); -} +} @@ -3185,7 +3181,7 @@ module treemapcomponent { - + module TreeViewComponent { $(function () { @@ -3202,7 +3198,7 @@ module TreeViewComponent { module UploadboxComponent { - + $(function () { var sample = new ej.Uploadbox($("#UploadDefault"),{ saveUrl: "uploadbox/saveFiles.ashx", diff --git a/ej.web.all/index.d.ts b/ej.web.all/index.d.ts index 356eb6af40..5d3a48af93 100644 --- a/ej.web.all/index.d.ts +++ b/ej.web.all/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Syncfusion // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /*! * filename: ej.web.all.d.ts diff --git a/electron-devtools-installer/electron-devtools-installer-tests.ts b/electron-devtools-installer/electron-devtools-installer-tests.ts index a923e2b20e..a453221698 100644 --- a/electron-devtools-installer/electron-devtools-installer-tests.ts +++ b/electron-devtools-installer/electron-devtools-installer-tests.ts @@ -1,5 +1,3 @@ -/// - import installExtension, { EMBER_INSPECTOR, REACT_DEVELOPER_TOOLS, BACKBONE_DEBUGGER, JQUERY_DEBUGGER, diff --git a/ember/v1/ember-tests.ts b/ember/v1/ember-tests.ts index 25ca3e3cc5..103fb0146e 100644 --- a/ember/v1/ember-tests.ts +++ b/ember/v1/ember-tests.ts @@ -1,6 +1,3 @@ -/// - - var App : any; App = Em.Application.create(); diff --git a/esprima/esprima-tests.ts b/esprima/esprima-tests.ts index d7c748d3b8..60b54e0679 100644 --- a/esprima/esprima-tests.ts +++ b/esprima/esprima-tests.ts @@ -1,6 +1,3 @@ -/// - - import esprima = require('esprima'); import * as ESTree from 'estree'; diff --git a/falcor-express/falcor-express-tests.ts b/falcor-express/falcor-express-tests.ts index f4a4ed8b52..c76a61f901 100644 --- a/falcor-express/falcor-express-tests.ts +++ b/falcor-express/falcor-express-tests.ts @@ -1,7 +1,3 @@ - -/// -/// - import express = require('express'); import Router = require('falcor-router'); import falcorExpress = require('falcor-express') diff --git a/fancybox/fancybox-tests.ts b/fancybox/fancybox-tests.ts index 2d5743c950..eac3f31771 100644 --- a/fancybox/fancybox-tests.ts +++ b/fancybox/fancybox-tests.ts @@ -1,6 +1,3 @@ -/// - - $('.fancybox').fancybox(); $('.fancybox').fancybox({ padding: 0, diff --git a/featherlight/featherlight-tests.ts b/featherlight/featherlight-tests.ts index 4d609d3475..e241a30990 100644 --- a/featherlight/featherlight-tests.ts +++ b/featherlight/featherlight-tests.ts @@ -1,7 +1,5 @@ // Tests by: Kaur Kuut -/// - // Every option as default var defaultOptions = { namespace: 'featherlight', diff --git a/fixed-data-table/fixed-data-table-tests.tsx b/fixed-data-table/fixed-data-table-tests.tsx index 7dfac22230..f57ff3d946 100644 --- a/fixed-data-table/fixed-data-table-tests.tsx +++ b/fixed-data-table/fixed-data-table-tests.tsx @@ -1,6 +1,3 @@ - -/// - import * as React from "react"; import {Table, Cell, Column, CellProps} from "fixed-data-table"; diff --git a/flickity/flickity-tests.ts b/flickity/flickity-tests.ts index b98315285f..b4ecf51997 100644 --- a/flickity/flickity-tests.ts +++ b/flickity/flickity-tests.ts @@ -4,11 +4,9 @@ // Definitions: https://github.com/clmcgrath/ /// -/// //jQuery tests - var $flickity: JQuery = $("#flickity-selector").flickity( { initialIndex: 0, @@ -105,15 +103,15 @@ flikty2.destroy(); flikty2.reloadCells(); //event handlers -flikty2.on(FlickityEvents.cellSelect, (evt, ele) => { +flikty2.on("cellSelect", (evt, ele) => { //do something }); -flikty2.off(FlickityEvents.cellSelect, (evt, ele, pntr, vctr) => { +flikty2.off("cellSelect", (evt, ele, pntr, vctr) => { //do something }); -flikty2.once(FlickityEvents.cellSelect, (evt, ele, pntr) => { +flikty2.once("cellSelect", (evt, ele, pntr) => { //do something }); diff --git a/foundation-sites/foundation-sites-tests.ts b/foundation-sites/foundation-sites-tests.ts index 4932f01624..2e90071c7d 100644 --- a/foundation-sites/foundation-sites-tests.ts +++ b/foundation-sites/foundation-sites-tests.ts @@ -1,11 +1,3 @@ -// Tests for type definitions for Foundation Sites v6.0.4 -// Project: http://foundation.zurb.com/ -// Definitions by: Sam Vloeberghs -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - - $(document).foundation(); $(document).foundation('method5'); $(document).foundation(['method', 'method2']); diff --git a/foundation/foundation-tests.ts b/foundation/foundation-tests.ts index 913bd0ee1b..33f8530589 100644 --- a/foundation/foundation-tests.ts +++ b/foundation/foundation-tests.ts @@ -1,6 +1,3 @@ -/// - - function empty_callback() : void {} function plugin_list() { diff --git a/from/from-tests.ts b/from/from-tests.ts index b46bdf66f1..e73a4915a0 100644 --- a/from/from-tests.ts +++ b/from/from-tests.ts @@ -1,6 +1,3 @@ - -/// - import from = require('from'); var rs: NodeJS.ReadableStream; diff --git a/fs-ext/fs-ext-tests.ts b/fs-ext/fs-ext-tests.ts index baba88f092..0c774589bc 100644 --- a/fs-ext/fs-ext-tests.ts +++ b/fs-ext/fs-ext-tests.ts @@ -1,19 +1,16 @@ - -/// - import fs = require('fs-ext'); var num:number; var str:string; -//from node.js 'fs' module +//from node.js 'fs' module fs.appendFileSync(str, "data"); -fs.flock(num, str, (err)=>{ +fs.flock(num, str, (err)=>{ }); fs.flockSync(num, str); -fs.fcntl(num, str, num, (err, res)=>{ +fs.fcntl(num, str, num, (err, res)=>{ }); fs.fcntl(num, str, (err, res)=>{ }); diff --git a/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts b/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts index 12623c54b1..46e623207a 100644 --- a/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts +++ b/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts @@ -1,5 +1,3 @@ -/// - import fs = require('fs-extra-promise-es6'); import stream = require('stream'); @@ -145,7 +143,7 @@ strArr = fs.readdirSync(path); fs.close(fd, errorCallback); fs.closeSync(fd); fs.open(path, flags, modeStr, (err: Error, fd: number) => { - + }); num = fs.openSync(path, flags, modeStr); fs.utimes(path, atime, mtime, errorCallback); diff --git a/fs-extra-promise/fs-extra-promise-tests.ts b/fs-extra-promise/fs-extra-promise-tests.ts index 112a27109c..28bdd26120 100644 --- a/fs-extra-promise/fs-extra-promise-tests.ts +++ b/fs-extra-promise/fs-extra-promise-tests.ts @@ -1,6 +1,3 @@ - -/// - import fs = require('fs-extra-promise'); import stream = require('stream'); diff --git a/fs-extra/fs-extra-tests.ts b/fs-extra/fs-extra-tests.ts index 896d6411f7..f06ec098a8 100644 --- a/fs-extra/fs-extra-tests.ts +++ b/fs-extra/fs-extra-tests.ts @@ -1,6 +1,3 @@ - -/// - import fs = require('fs-extra'); import * as Path from 'path' diff --git a/ftp/ftp-tests.ts b/ftp/ftp-tests.ts index 6e5e7d37a9..4d78104940 100644 --- a/ftp/ftp-tests.ts +++ b/ftp/ftp-tests.ts @@ -1,6 +1,3 @@ - -/// - import Client = require("ftp"); import fs = require("fs"); @@ -8,8 +5,8 @@ var c = new Client(); c.on('ready', (): void => { c.get('foo.txt', function(err: Error, stream: NodeJS.ReadableStream): void { if (err) throw err; - stream.once('close', function(): void { - c.end(); + stream.once('close', function(): void { + c.end(); }); stream.pipe(fs.createWriteStream('foo.local-copy.txt')); }); @@ -25,4 +22,4 @@ c.connect({ }); - + diff --git a/fullcalendar/fullcalendar-tests.ts b/fullcalendar/fullcalendar-tests.ts index 7640c85db6..63328a9cef 100644 --- a/fullcalendar/fullcalendar-tests.ts +++ b/fullcalendar/fullcalendar-tests.ts @@ -1,5 +1,4 @@ -/// -/// +/// import * as FullCalendar from 'fullcalendar'; import * as moment from 'moment'; diff --git a/fullcalendar/v1/fullcalendar-tests.ts b/fullcalendar/v1/fullcalendar-tests.ts index 56a9eb0024..ede55bc0b1 100644 --- a/fullcalendar/v1/fullcalendar-tests.ts +++ b/fullcalendar/v1/fullcalendar-tests.ts @@ -1,6 +1,4 @@ -/// -/// -/// +/// // All examples from http://arshaw.com/fullcalendar/docs/ diff --git a/gijgo/gijgo-tests.ts b/gijgo/gijgo-tests.ts index 5731732295..6e624ad4f6 100644 --- a/gijgo/gijgo-tests.ts +++ b/gijgo/gijgo-tests.ts @@ -1,5 +1,4 @@ /// -/// // Grid $(() => { diff --git a/gldatepicker/gldatepicker-tests.ts b/gldatepicker/gldatepicker-tests.ts index d133a5f823..974c1da8a7 100644 --- a/gldatepicker/gldatepicker-tests.ts +++ b/gldatepicker/gldatepicker-tests.ts @@ -1,5 +1,3 @@ -/// - $('input').glDatePicker(); $('#example2').glDatePicker( { diff --git a/gm/gm-tests.ts b/gm/gm-tests.ts index 2189d9064d..e8bf5787cd 100644 --- a/gm/gm-tests.ts +++ b/gm/gm-tests.ts @@ -1,6 +1,3 @@ - -/// - import gm = require('gm'); import stream = require('stream'); diff --git a/gregorian-calendar/gregorian-calendar-tests.ts b/gregorian-calendar/gregorian-calendar-tests.ts index a7b11cf21d..096933ed2b 100644 --- a/gregorian-calendar/gregorian-calendar-tests.ts +++ b/gregorian-calendar/gregorian-calendar-tests.ts @@ -1,9 +1,6 @@ -/// - import GregorianCalendar = require('gregorian-calendar'); import GregorianCalendarFormat = require('gregorian-calendar-format'); - let cal = new GregorianCalendar(); cal.set(2016, 7, 27, 0, 0, 0, 0); diff --git a/gridfs-stream/gridfs-stream-tests.ts b/gridfs-stream/gridfs-stream-tests.ts index 1ed4e97006..8086245722 100644 --- a/gridfs-stream/gridfs-stream-tests.ts +++ b/gridfs-stream/gridfs-stream-tests.ts @@ -1,7 +1,3 @@ - - -/// - // Samples from: // https://github.com/aheckmann/gridfs-stream diff --git a/gulp-babel/gulp-babel-tests.ts b/gulp-babel/gulp-babel-tests.ts index b705c68850..4cd6ff0467 100644 --- a/gulp-babel/gulp-babel-tests.ts +++ b/gulp-babel/gulp-babel-tests.ts @@ -1,5 +1,3 @@ -/// - import babel = require('gulp-babel'); var x: NodeJS.ReadWriteStream = babel(); diff --git a/gulp-cheerio/gulp-cheerio-tests.ts b/gulp-cheerio/gulp-cheerio-tests.ts index 464abccead..e2d3bfe267 100644 --- a/gulp-cheerio/gulp-cheerio-tests.ts +++ b/gulp-cheerio/gulp-cheerio-tests.ts @@ -1,7 +1,3 @@ - - -/// - import cheerio = require('gulp-cheerio'); import gulp = require('gulp'); import Vinyl = require('vinyl'); diff --git a/gulp-dtsm/gulp-dtsm-tests.ts b/gulp-dtsm/gulp-dtsm-tests.ts index 54e12eff6a..dafc6b3468 100644 --- a/gulp-dtsm/gulp-dtsm-tests.ts +++ b/gulp-dtsm/gulp-dtsm-tests.ts @@ -1,6 +1,3 @@ - -/// - import * as dtsm from 'gulp-dtsm'; import * as gulp from 'gulp'; diff --git a/gulp-help/gulp-help-tests.ts b/gulp-help/gulp-help-tests.ts index 5d11bc23b7..ae7d0846e7 100644 --- a/gulp-help/gulp-help-tests.ts +++ b/gulp-help/gulp-help-tests.ts @@ -1,7 +1,3 @@ -/// - -'use strict'; - import gulpHelp = require('gulp-help'); var gulp = gulpHelp(require('gulp')); diff --git a/gulp-html-replace/gulp-html-replace-tests.ts b/gulp-html-replace/gulp-html-replace-tests.ts index 568fb481fd..9a21a53b84 100644 --- a/gulp-html-replace/gulp-html-replace-tests.ts +++ b/gulp-html-replace/gulp-html-replace-tests.ts @@ -1,7 +1,3 @@ - - -/// - import * as gulp from 'gulp'; import * as htmlreplace from 'gulp-html-replace'; diff --git a/gulp-useref/gulp-useref-tests.ts b/gulp-useref/gulp-useref-tests.ts index 1f1a152be0..9f2bd409d5 100644 --- a/gulp-useref/gulp-useref-tests.ts +++ b/gulp-useref/gulp-useref-tests.ts @@ -1,5 +1,3 @@ -/// - import * as gulp from 'gulp'; import * as useref from 'gulp-useref'; diff --git a/hammerjs/v1/hammerjs-tests.ts b/hammerjs/v1/hammerjs-tests.ts index bb006241fe..60d990c0bd 100644 --- a/hammerjs/v1/hammerjs-tests.ts +++ b/hammerjs/v1/hammerjs-tests.ts @@ -1,6 +1,3 @@ -/// - - // plugin check if (!Hammer.HAS_TOUCHEVENTS && !Hammer.HAS_POINTEREVENTS) { Hammer.plugins.fakeMultitouch(); diff --git a/hystrixjs/hystrixjs-tests.ts b/hystrixjs/hystrixjs-tests.ts index b7f10a27d8..676015be06 100644 --- a/hystrixjs/hystrixjs-tests.ts +++ b/hystrixjs/hystrixjs-tests.ts @@ -1,6 +1,3 @@ - -/// - import hystrixjs = require('hystrixjs'); import q = require('q'); diff --git a/i18next-browser-languagedetector/i18next-browser-languagedetector-tests.ts b/i18next-browser-languagedetector/i18next-browser-languagedetector-tests.ts index bca7aee3b7..9f36a7d538 100644 --- a/i18next-browser-languagedetector/i18next-browser-languagedetector-tests.ts +++ b/i18next-browser-languagedetector/i18next-browser-languagedetector-tests.ts @@ -1,5 +1,3 @@ -/// - import * as i18next from 'i18next'; import LngDetector from 'i18next-browser-languagedetector'; diff --git a/i18next-xhr-backend/i18next-xhr-backend-tests.ts b/i18next-xhr-backend/i18next-xhr-backend-tests.ts index b4e71467f1..9c12809271 100644 --- a/i18next-xhr-backend/i18next-xhr-backend-tests.ts +++ b/i18next-xhr-backend/i18next-xhr-backend-tests.ts @@ -1,6 +1,3 @@ -/// -/// - import * as i18next from 'i18next'; import XHR from 'i18next-xhr-backend'; diff --git a/ibm-mobilefirst/ibm-mobilefirst-tests.ts b/ibm-mobilefirst/ibm-mobilefirst-tests.ts index 92dbee824d..498c9c3d7f 100644 --- a/ibm-mobilefirst/ibm-mobilefirst-tests.ts +++ b/ibm-mobilefirst/ibm-mobilefirst-tests.ts @@ -1,5 +1,3 @@ -/// - // Tests // Test WL.Client @@ -126,7 +124,7 @@ WL.SimpleDialog.show( WL.Logger.debug("First button pressed"); } }]); - + // Test WL.TabBar // iOS var creditTab = WL.TabBar.addItem("CREDIT", function() { diff --git a/imagemagick-native/imagemagick-native-tests.ts b/imagemagick-native/imagemagick-native-tests.ts index c872634ab2..94d8fd05bb 100644 --- a/imagemagick-native/imagemagick-native-tests.ts +++ b/imagemagick-native/imagemagick-native-tests.ts @@ -1,6 +1,3 @@ - -/// - import imagemagick = require('imagemagick-native'); import fs = require('fs'); diff --git a/imagemagick/imagemagick-tests.ts b/imagemagick/imagemagick-tests.ts index 87ead6307a..5bc9d9cc93 100644 --- a/imagemagick/imagemagick-tests.ts +++ b/imagemagick/imagemagick-tests.ts @@ -1,6 +1,3 @@ - -/// - import imagemagick = require('imagemagick'); import child_process = require('child_process'); diff --git a/jasmine-expect/jasmine-expect-tests.ts b/jasmine-expect/jasmine-expect-tests.ts index 7753cc7381..e64f9198bf 100644 --- a/jasmine-expect/jasmine-expect-tests.ts +++ b/jasmine-expect/jasmine-expect-tests.ts @@ -1,6 +1,3 @@ -/// - - // Taken directly from the test directory of the original repo declare var describeWhenNotArray: (arr: string) => void; diff --git a/jasmine-jquery/jasmine-jquery-tests.ts b/jasmine-jquery/jasmine-jquery-tests.ts index 67b349d45e..2e507d85fd 100644 --- a/jasmine-jquery/jasmine-jquery-tests.ts +++ b/jasmine-jquery/jasmine-jquery-tests.ts @@ -1,7 +1,3 @@ -/// -/// - - describe("Jasmine jQuery extension", () => { it("Adds jQuery matchers", () => { expect($('
    ')).toBe('div'); diff --git a/jasmine-matchers/jasmine-matchers-tests.ts b/jasmine-matchers/jasmine-matchers-tests.ts index dc92e809dc..4ef032062d 100644 --- a/jasmine-matchers/jasmine-matchers-tests.ts +++ b/jasmine-matchers/jasmine-matchers-tests.ts @@ -14,9 +14,6 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/// - - describe('toBeArray', function () { describe('matches', function () { it('should pass for []', function () { diff --git a/joi/v6/joi-tests.ts b/joi/v6/joi-tests.ts index 265bbd045c..03ca5ffac0 100644 --- a/joi/v6/joi-tests.ts +++ b/joi/v6/joi-tests.ts @@ -1,4 +1,3 @@ -/// /// import Joi = require('joi'); diff --git a/jqgrid/jqgrid-tests.ts b/jqgrid/jqgrid-tests.ts index 7354f527dc..832a94d909 100644 --- a/jqgrid/jqgrid-tests.ts +++ b/jqgrid/jqgrid-tests.ts @@ -2,8 +2,6 @@ // Definitions by: Lokesh Peta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - var mydata: any[] = []; $('#jqGrid') diff --git a/jqrangeslider/jqrangeslider-tests.ts b/jqrangeslider/jqrangeslider-tests.ts index 1af815806f..cb6b417656 100644 --- a/jqrangeslider/jqrangeslider-tests.ts +++ b/jqrangeslider/jqrangeslider-tests.ts @@ -1,5 +1,3 @@ -/// - // Arrows $("#arrowsExample").rangeSlider({ arrows: false }); $("#arrowsExample").editRangeSlider({ arrows: false }); @@ -133,7 +131,7 @@ $("#rulersExample").rangeSlider({ next: function(val){ return val + 10; }, stop: function(val){ return false; }, label: function(val){ return val; }, - format: function(tickContainer, tickStart, tickEnd){ + format: function(tickContainer, tickStart, tickEnd){ tickContainer.addClass("myCustomClass"); } }, @@ -179,7 +177,7 @@ $("#rangeExample").dateRangeSlider({ // Symmetric Positionning $("#symmetricExample").rangeSlider({ symmetricPositionning: true, - range: {min: 0} + range: {min: 0} }); // Type $("#typeExample").editRangeSlider({type: "number"}); diff --git a/jquery-ajax-chain/jquery-ajax-chain-tests.ts b/jquery-ajax-chain/jquery-ajax-chain-tests.ts index e5cbb8a26f..56ea354543 100644 --- a/jquery-ajax-chain/jquery-ajax-chain-tests.ts +++ b/jquery-ajax-chain/jquery-ajax-chain-tests.ts @@ -1,6 +1,3 @@ -/// -/// - function test_public_methods(): void { let ajaxChain: ajaxChain.JQueryAjaxChain, @@ -171,7 +168,7 @@ function test_optional_parameters(): void { }, hasCache: function (xmlResponse): XMLDocument { - + let $tempXmlResponse: JQuery, itemId: String; diff --git a/jquery-alertable/jquery-alertable-tests.ts b/jquery-alertable/jquery-alertable-tests.ts index a61dca01b4..61d6e2c06c 100644 --- a/jquery-alertable/jquery-alertable-tests.ts +++ b/jquery-alertable/jquery-alertable-tests.ts @@ -1,6 +1,3 @@ -/// -/// - // // Examples from https://github.com/claviska/jquery-alertable // diff --git a/jquery-backstretch/jquery-backstretch-tests.ts b/jquery-backstretch/jquery-backstretch-tests.ts index 7220458769..22835b4e43 100644 --- a/jquery-backstretch/jquery-backstretch-tests.ts +++ b/jquery-backstretch/jquery-backstretch-tests.ts @@ -1,5 +1,3 @@ -/// - var backstretch = jQuery.backstretch(['image.png'], { centeredX: false, centeredY: false, diff --git a/jquery-cropbox/jquery-cropbox-tests.ts b/jquery-cropbox/jquery-cropbox-tests.ts index ddc5389625..eadb754088 100644 --- a/jquery-cropbox/jquery-cropbox-tests.ts +++ b/jquery-cropbox/jquery-cropbox-tests.ts @@ -1,5 +1,3 @@ -/// - var cropboxWithDefaultSettings = $("#element").cropbox(); var cropboxOptions: jQueryCropBox.CropboxOptions = { @@ -38,7 +36,7 @@ cropboxWithOptions.getBlob(); cropboxWithOptions.remove(); cropboxWithOptions.on("cropbox",(e: Event, data: any, img: jQueryCropBox.Cropbox) => { - - //DoStuff - + + //DoStuff + }); diff --git a/jquery-easy-loading/jquery-easy-loading-tests.ts b/jquery-easy-loading/jquery-easy-loading-tests.ts index 7a59d3d617..ece98fd6d0 100644 --- a/jquery-easy-loading/jquery-easy-loading-tests.ts +++ b/jquery-easy-loading/jquery-easy-loading-tests.ts @@ -1,6 +1,3 @@ - -/// - function test_options() { const jqElement: JQuery = $("body").loading({ diff --git a/jquery-handsontable/jquery-handsontable-tests.ts b/jquery-handsontable/jquery-handsontable-tests.ts index 267ab30d8a..a2e10b4827 100644 --- a/jquery-handsontable/jquery-handsontable-tests.ts +++ b/jquery-handsontable/jquery-handsontable-tests.ts @@ -1,6 +1,3 @@ -/// - - var data = [ ["", "Maserati", "Mazda", "Mercedes", "Mini", "Mitsubishi"], ["2009", 0, 2941, 4303, 354, 5814], diff --git a/jquery-jsonrpcclient/jquery-jsonrpcclient-tests.ts b/jquery-jsonrpcclient/jquery-jsonrpcclient-tests.ts index f680dbb688..0e42508202 100644 --- a/jquery-jsonrpcclient/jquery-jsonrpcclient-tests.ts +++ b/jquery-jsonrpcclient/jquery-jsonrpcclient-tests.ts @@ -1,5 +1,3 @@ -/// - var foo = new $.JsonRpcClient({ ajaxUrl: '/backend/jsonrpc' }); foo.call( 'bar', ['A parameter', 'B parameter'], diff --git a/jquery-mockjax/jquery-mockjax-tests.ts b/jquery-mockjax/jquery-mockjax-tests.ts index 7688645f8e..3090a1c3cc 100644 --- a/jquery-mockjax/jquery-mockjax-tests.ts +++ b/jquery-mockjax/jquery-mockjax-tests.ts @@ -1,4 +1,3 @@ -/// /// class Tests { diff --git a/jquery-steps/index.d.ts b/jquery-steps/index.d.ts index 6abe640417..7670245480 100644 --- a/jquery-steps/index.d.ts +++ b/jquery-steps/index.d.ts @@ -1,8 +1,9 @@ // Type definitions for jQuery Steps v1.1.1 // Project: http://www.jquery-steps.com/ -// Definitions by: Joseph Blank +// Definitions by: Joseph Blank , Nicholas Wong // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Updated by: Nicholas Wong + +/// interface JQuery { steps(param?: JQuerySteps.Settings): JQuerySteps.JQuerySteps; diff --git a/jquery-steps/jquery-steps-tests.ts b/jquery-steps/jquery-steps-tests.ts index 35346d1f7b..6659212e20 100644 --- a/jquery-steps/jquery-steps-tests.ts +++ b/jquery-steps/jquery-steps-tests.ts @@ -1,6 +1,3 @@ -/// -/// - var labels: JQuerySteps.LabelSettings = { cancel: 'Cancel', current: 'Current:', diff --git a/jquery-timeentry/jquery-timeentry-tests.ts b/jquery-timeentry/jquery-timeentry-tests.ts index ccfe0794a3..8910487c65 100644 --- a/jquery-timeentry/jquery-timeentry-tests.ts +++ b/jquery-timeentry/jquery-timeentry-tests.ts @@ -1,5 +1,3 @@ -/// - var selector = '#example'; // basic diff --git a/jquery-urlparam/jquery-urlparam-tests.ts b/jquery-urlparam/jquery-urlparam-tests.ts index a8ca144bb3..8d855e0e35 100644 --- a/jquery-urlparam/jquery-urlparam-tests.ts +++ b/jquery-urlparam/jquery-urlparam-tests.ts @@ -1,4 +1 @@ -/// - - console.log($.urlParam('variable')); diff --git a/jquery.ajaxfile/jquery.ajaxfile-tests.ts b/jquery.ajaxfile/jquery.ajaxfile-tests.ts index 364220325a..73bc6662dc 100644 --- a/jquery.ajaxfile/jquery.ajaxfile-tests.ts +++ b/jquery.ajaxfile/jquery.ajaxfile-tests.ts @@ -1,7 +1,3 @@ - -/// -/// - function testRawApi(){ var inputElement:HTMLInputElement = null; var resultPromise = AjaxFile.send({ diff --git a/jquery.are-you-sure/jquery.are-you-sure-tests.ts b/jquery.are-you-sure/jquery.are-you-sure-tests.ts index cd400f90c1..37cb487602 100644 --- a/jquery.are-you-sure/jquery.are-you-sure-tests.ts +++ b/jquery.are-you-sure/jquery.are-you-sure-tests.ts @@ -1,10 +1,3 @@ -// Type definitions for jquery.are-you-sure.js -// Project: https://github.com/codedance/jquery.AreYouSure -// Definitions by: Jon Egerton -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - //Use defaults $("test").areYouSure(); diff --git a/jquery.base64/jquery.base64-tests.ts b/jquery.base64/jquery.base64-tests.ts index 447a917620..c9c6955716 100644 --- a/jquery.base64/jquery.base64-tests.ts +++ b/jquery.base64/jquery.base64-tests.ts @@ -1,6 +1,3 @@ -/// - - var encoded = $.base64.encode(""); $.base64.decode(encoded); diff --git a/jquery.cleditor/jquery.cleditor-tests.ts b/jquery.cleditor/jquery.cleditor-tests.ts index 7fe997c4c5..b4f4917551 100644 --- a/jquery.cleditor/jquery.cleditor-tests.ts +++ b/jquery.cleditor/jquery.cleditor-tests.ts @@ -1,5 +1,3 @@ -/// - // cribbed from http://premiumsoftware.net/CLEditor/GettingStarted $(document).ready(function () { $("#input").cleditor(); }); diff --git a/jquery.color/jquery.color-tests.ts b/jquery.color/jquery.color-tests.ts index c94a1cffed..e1439f4cd4 100644 --- a/jquery.color/jquery.color-tests.ts +++ b/jquery.color/jquery.color-tests.ts @@ -1,5 +1,3 @@ -/// - var color = $.Color("rgba(255, 255, 255, 0.4)"); var color1 = $.Color({red: 255, green: 255, blue: 255}); var color2 = $.Color({hue: 359, saturation: 0.5, lightness: 0.5}); diff --git a/jquery.colorbox/jquery.colorbox-tests.ts b/jquery.colorbox/jquery.colorbox-tests.ts index 66d54240db..3c05f213c9 100644 --- a/jquery.colorbox/jquery.colorbox-tests.ts +++ b/jquery.colorbox/jquery.colorbox-tests.ts @@ -1,5 +1,3 @@ -/// - //Image gallery var gallery : JQuery = $('a.gallery').colorbox({ rel: 'gal' }); diff --git a/jquery.cookie/jquery.cookie-tests.ts b/jquery.cookie/jquery.cookie-tests.ts index e93d29110c..998d7bf2df 100644 --- a/jquery.cookie/jquery.cookie-tests.ts +++ b/jquery.cookie/jquery.cookie-tests.ts @@ -1,5 +1,3 @@ -/// - class TestObject { text: string; value: number; diff --git a/jquery.customselect/jquery.customselect-tests.ts b/jquery.customselect/jquery.customselect-tests.ts index b0dc9554a9..5cb28a9f05 100644 --- a/jquery.customselect/jquery.customselect-tests.ts +++ b/jquery.customselect/jquery.customselect-tests.ts @@ -1,6 +1,3 @@ -/// - - class CustomSelectOptions implements JQueryCustomSelectOption { "customClass": string; "mapClass": boolean; diff --git a/jquery.cycle/jquery.cycle-tests.ts b/jquery.cycle/jquery.cycle-tests.ts index e93be101f6..df8ed24b22 100644 --- a/jquery.cycle/jquery.cycle-tests.ts +++ b/jquery.cycle/jquery.cycle-tests.ts @@ -1,5 +1,3 @@ -/// - // As basic as it can be $('#element').cycle(); @@ -284,7 +282,7 @@ $('#s2').cycle({ $('#slideshow2').cycle({ fx: 'scrollLeft,scrollDown,scrollRight,scrollUp', randomizeEffects: false, - easing: 'easeInBack' // easing supported via the easing plugin + easing: 'easeInBack' // easing supported via the easing plugin }); // Another Advanced "pager" Demo @@ -294,7 +292,7 @@ $('#slideshow').cycle({ timeout: 0, pager: '#nav', pagerAnchorBuilder: function (idx, slide) { - // return selector string for existing anchor + // return selector string for existing anchor return '#nav li:eq(' + idx + ') a'; } }); @@ -304,7 +302,7 @@ $('#slideshow').cycle({ slideExpr: 'img' }); // Defeating IE's ClearType bug $('#slideshow').cycle({ - cleartype: false // disable cleartype corrections + cleartype: false // disable cleartype corrections }); // Using the 'nowrap' option (manual slideshow) diff --git a/jquery.cycle2/jquery.cycle2-tests.ts b/jquery.cycle2/jquery.cycle2-tests.ts index 0e16629a3e..9d88e92532 100644 --- a/jquery.cycle2/jquery.cycle2-tests.ts +++ b/jquery.cycle2/jquery.cycle2-tests.ts @@ -1,5 +1,3 @@ -/// - // basic $('#element').cycle(); diff --git a/jquery.finger/jquery.finger-tests.ts b/jquery.finger/jquery.finger-tests.ts index 3f35e7322c..c4734610b2 100644 --- a/jquery.finger/jquery.finger-tests.ts +++ b/jquery.finger/jquery.finger-tests.ts @@ -1,5 +1,3 @@ -/// - $.Finger.doubleTapInterval = 400; $.Finger.flickDuration = 250; $.Finger.pressDuration = 100; diff --git a/jquery.flagstrap/jquery.flagstrap-tests.ts b/jquery.flagstrap/jquery.flagstrap-tests.ts index 3bfcf0294e..6d262dc17f 100644 --- a/jquery.flagstrap/jquery.flagstrap-tests.ts +++ b/jquery.flagstrap/jquery.flagstrap-tests.ts @@ -1,14 +1,11 @@ -/// -/// - class TestObject { - + } $(function () { - // basic test - // written in according to basic example from documentation - var htmlSelect = '
    ' + + // basic test + // written in according to basic example from documentation + var htmlSelect = '' + '
    ' + '
    ' + '
    ' + @@ -21,7 +18,7 @@ $(function () { console.log('characters count: ' + $('#flagstrap').html().length + '\n' + $('#flagstrap').html()); // options test - // options -> data attributes + // options -> data attributes // written in according to options -> data attributes example from documentation htmlSelect = '' + '
    ' + @@ -42,7 +39,7 @@ $(function () { console.log('\n\ncharacters count: ' + $('#flagstrap2').html().length + '\n' + $('#flagstrap2').html()); // options test - // options -> instance options + // options -> instance options // written in according to options -> instance options example from documentation htmlSelect = '' + '
    ' + diff --git a/jquery.form/jquery.form-tests.ts b/jquery.form/jquery.form-tests.ts index f115a97f57..c4d3d636bf 100644 --- a/jquery.form/jquery.form-tests.ts +++ b/jquery.form/jquery.form-tests.ts @@ -1,5 +1,3 @@ -/// - // Basic usage jQuery('#myFormId').ajaxForm(); @@ -30,112 +28,112 @@ jQuery.fn.ajaxSubmit.debug = true; // ajaxForm -// bind form using 'ajaxForm' +// bind form using 'ajaxForm' $('#myForm1').ajaxForm({ - target: '#output1', // target element(s) to be updated with server response + target: '#output1', // target element(s) to be updated with server response beforeSubmit: function (formData, jqForm, options) { // pre-submit callback - // formData is an array; here we use $.param to convert it to a string to display it - // but the form plugin does this for you automatically when it submits the data + // formData is an array; here we use $.param to convert it to a string to display it + // but the form plugin does this for you automatically when it submits the data var queryString = $.param(formData); - // jqForm is a jQuery object encapsulating the form element. To access the - // DOM element for the form do this: - // var formElement = jqForm[0]; + // jqForm is a jQuery object encapsulating the form element. To access the + // DOM element for the form do this: + // var formElement = jqForm[0]; alert('About to submit: \n\n' + queryString); - // here we could return false to prevent the form from being submitted; - // returning anything other than false will allow the form submit to continue + // here we could return false to prevent the form from being submitted; + // returning anything other than false will allow the form submit to continue return true; }, success: function (responseText, statusText, xhr) { // post-submit callback - // for normal html responses, the first argument to the success callback - // is the XMLHttpRequest object's responseText property - - // if the ajaxForm method was passed an Options Object with the dataType - // property set to 'xml' then the first argument to the success callback - // is the XMLHttpRequest object's responseXML property - - // if the ajaxForm method was passed an Options Object with the dataType - // property set to 'json' then the first argument to the success callback - // is the json data object returned by the server - + // for normal html responses, the first argument to the success callback + // is the XMLHttpRequest object's responseText property + + // if the ajaxForm method was passed an Options Object with the dataType + // property set to 'xml' then the first argument to the success callback + // is the XMLHttpRequest object's responseXML property + + // if the ajaxForm method was passed an Options Object with the dataType + // property set to 'json' then the first argument to the success callback + // is the json data object returned by the server + alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + '\n\nThe output div should have already been updated with the responseText.'); } - // other available options: - //url: url // override for form's 'action' attribute - //type: type // 'get' or 'post', override for form's 'method' attribute - //dataType: null // 'xml', 'script', or 'json' (expected server response type) - //clearForm: true // clear all form fields after successful submit - //resetForm: true // reset the form after successful submit + // other available options: + //url: url // override for form's 'action' attribute + //type: type // 'get' or 'post', override for form's 'method' attribute + //dataType: null // 'xml', 'script', or 'json' (expected server response type) + //clearForm: true // clear all form fields after successful submit + //resetForm: true // reset the form after successful submit - // $.ajax options can be used here too, for example: - //timeout: 3000 + // $.ajax options can be used here too, for example: + //timeout: 3000 }); // ajaxSubmit $('#myForm2').ajaxSubmit({ - target: '#output2', // target element(s) to be updated with server response + target: '#output2', // target element(s) to be updated with server response beforeSubmit: function (formData, jqForm, options) { // pre-submit callback - // formData is an array; here we use $.param to convert it to a string to display it - // but the form plugin does this for you automatically when it submits the data + // formData is an array; here we use $.param to convert it to a string to display it + // but the form plugin does this for you automatically when it submits the data var queryString = $.param(formData); - // jqForm is a jQuery object encapsulating the form element. To access the - // DOM element for the form do this: - // var formElement = jqForm[0]; + // jqForm is a jQuery object encapsulating the form element. To access the + // DOM element for the form do this: + // var formElement = jqForm[0]; alert('About to submit: \n\n' + queryString); - // here we could return false to prevent the form from being submitted; - // returning anything other than false will allow the form submit to continue + // here we could return false to prevent the form from being submitted; + // returning anything other than false will allow the form submit to continue return true; }, success: function showResponse(responseText, statusText, xhr) { // post-submit callback - // for normal html responses, the first argument to the success callback - // is the XMLHttpRequest object's responseText property + // for normal html responses, the first argument to the success callback + // is the XMLHttpRequest object's responseText property - // if the ajaxSubmit method was passed an Options Object with the dataType - // property set to 'xml' then the first argument to the success callback - // is the XMLHttpRequest object's responseXML property + // if the ajaxSubmit method was passed an Options Object with the dataType + // property set to 'xml' then the first argument to the success callback + // is the XMLHttpRequest object's responseXML property - // if the ajaxSubmit method was passed an Options Object with the dataType - // property set to 'json' then the first argument to the success callback - // is the json data object returned by the server + // if the ajaxSubmit method was passed an Options Object with the dataType + // property set to 'json' then the first argument to the success callback + // is the json data object returned by the server alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + '\n\nThe output div should have already been updated with the responseText.'); } - // other available options: - //url: url // override for form's 'action' attribute - //type: type // 'get' or 'post', override for form's 'method' attribute - //dataType: null // 'xml', 'script', or 'json' (expected server response type) - //clearForm: true // clear all form fields after successful submit - //resetForm: true // reset the form after successful submit + // other available options: + //url: url // override for form's 'action' attribute + //type: type // 'get' or 'post', override for form's 'method' attribute + //dataType: null // 'xml', 'script', or 'json' (expected server response type) + //clearForm: true // clear all form fields after successful submit + //resetForm: true // reset the form after successful submit - // $.ajax options can be used here too, for example: - //timeout: 3000 + // $.ajax options can be used here too, for example: + //timeout: 3000 }); // Validation $('#myForm2').ajaxForm({ beforeSubmit: function (formData, jqForm, options) { - // formData is an array of objects representing the name and value of each field - // that will be sent to the server; it takes the following form: - // - // [ - // { name: username, value: valueOfUsernameInput }, - // { name: password, value: valueOfPasswordInput } - // ] - // - // To validate, we can examine the contents of this array to see if the - // username and password fields have values. If either value evaluates - // to false then we return false from this method. + // formData is an array of objects representing the name and value of each field + // that will be sent to the server; it takes the following form: + // + // [ + // { name: username, value: valueOfUsernameInput }, + // { name: password, value: valueOfPasswordInput } + // ] + // + // To validate, we can examine the contents of this array to see if the + // username and password fields have values. If either value evaluates + // to false then we return false from this method. for (var i = 0; i < formData.length; i++) { if (!formData[i].value) { @@ -150,13 +148,13 @@ $('#myForm2').ajaxForm({ // JSON $('#jsonForm').ajaxForm({ - // dataType identifies the expected content type of the server response + // dataType identifies the expected content type of the server response dataType: 'json', - // success identifies the function to invoke when the server response - // has been received + // success identifies the function to invoke when the server response + // has been received success: function (data) { - // 'data' is the json object returned from the server + // 'data' is the json object returned from the server alert(data.message); } }); @@ -164,14 +162,14 @@ $('#jsonForm').ajaxForm({ // XML $('#xmlForm').ajaxForm({ - // dataType identifies the expected content type of the server response + // dataType identifies the expected content type of the server response dataType: 'xml', - // success identifies the function to invoke when the server response - // has been received + // success identifies the function to invoke when the server response + // has been received success: function (responseXML) { - // 'responseXML' is the XML document returned by the server; we use - // jQuery to extract the content of the message node from the XML doc + // 'responseXML' is the XML document returned by the server; we use + // jQuery to extract the content of the message node from the XML doc var message = $('message', responseXML).text(); alert(message); } @@ -180,11 +178,11 @@ $('#xmlForm').ajaxForm({ // HTML $('#htmlForm').ajaxForm({ - // target identifies the element(s) to update with the server response + // target identifies the element(s) to update with the server response target: '#htmlExampleTarget', - // success identifies the function to invoke when the server response - // has been received; here we apply a fade-in effect to the new content + // success identifies the function to invoke when the server response + // has been received; here we apply a fade-in effect to the new content success: function () { $('#htmlExampleTarget').fadeIn('slow'); } diff --git a/jquery.jnotify/jquery.jnotify-tests.ts b/jquery.jnotify/jquery.jnotify-tests.ts index b5ad3927e2..f38a99760a 100644 --- a/jquery.jnotify/jquery.jnotify-tests.ts +++ b/jquery.jnotify/jquery.jnotify-tests.ts @@ -1,5 +1,3 @@ -/// - $(document).ready(function () { $('#StatusBar').jnotifyInizialize({ oneAtTime: true diff --git a/jquery.joyride/jquery.joyride-tests.ts b/jquery.joyride/jquery.joyride-tests.ts index f0a51b5270..c7324dd6c9 100644 --- a/jquery.joyride/jquery.joyride-tests.ts +++ b/jquery.joyride/jquery.joyride-tests.ts @@ -1,6 +1,3 @@ -/// - - var options: JoyrideOptions; options.autoStart = true; options.postStepCallback = (index, tip)=> { diff --git a/jquery.jsignature/jquery.jsignature-tests.ts b/jquery.jsignature/jquery.jsignature-tests.ts index 5ec4bc486d..58d73fe24b 100644 --- a/jquery.jsignature/jquery.jsignature-tests.ts +++ b/jquery.jsignature/jquery.jsignature-tests.ts @@ -1,8 +1,6 @@ -/// - /* * Taken from the tests section on jSignature - */ + */ $(document).ready(function () { var $sigdiv = $('#signature'); @@ -10,7 +8,7 @@ $(document).ready(function () { $sigdiv.jSignature(); $sigdiv.jSignature("reset"); - + var data = $sigdiv.jSignature("getData", "svgbase64"); $sigdiv.jSignature("setData", "data:" + data); diff --git a/jquery.leanmodal/jquery.leanmodal-tests.ts b/jquery.leanmodal/jquery.leanmodal-tests.ts index fb6c4ae344..1884cb25d9 100644 --- a/jquery.leanmodal/jquery.leanmodal-tests.ts +++ b/jquery.leanmodal/jquery.leanmodal-tests.ts @@ -1,6 +1,3 @@ -/// - - class LeanModalOptions implements JQueryLeanModalOption { top : number; overlay : number; diff --git a/jquery.livestampjs/jquery.livestampjs-tests.ts b/jquery.livestampjs/jquery.livestampjs-tests.ts index dc713819c9..6b5bd01835 100644 --- a/jquery.livestampjs/jquery.livestampjs-tests.ts +++ b/jquery.livestampjs/jquery.livestampjs-tests.ts @@ -1,4 +1,3 @@ -/// import * as moment from 'moment'; $('#test1').livestamp(new Date('June 18, 1987')); diff --git a/jquery.menuaim/jquery.menuaim-tests.ts b/jquery.menuaim/jquery.menuaim-tests.ts index e2a1b36aff..01baa59e03 100644 --- a/jquery.menuaim/jquery.menuaim-tests.ts +++ b/jquery.menuaim/jquery.menuaim-tests.ts @@ -1,5 +1,3 @@ -/// - $('div').menuAim({ activate: function () { }, deactivate: function () { }, diff --git a/jquery.mmenu/jquery.mmenu-tests.ts b/jquery.mmenu/jquery.mmenu-tests.ts index 385f479507..a08f4371ec 100644 --- a/jquery.mmenu/jquery.mmenu-tests.ts +++ b/jquery.mmenu/jquery.mmenu-tests.ts @@ -1,7 +1,3 @@ -/// -/// - - // -------------------------------------------------------- // ---------------- TEST DEFAULT OPTIONS ------------------ // -------------------------------------------------------- diff --git a/jquery.payment/index.d.ts b/jquery.payment/index.d.ts index 341e695a9a..88ecd255a5 100644 --- a/jquery.payment/index.d.ts +++ b/jquery.payment/index.d.ts @@ -3,6 +3,8 @@ // Definitions by: Eric J. Smith , John Rutherford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + declare namespace JQueryPayment { interface Payment { diff --git a/jquery.payment/jquery.payment-tests.ts b/jquery.payment/jquery.payment-tests.ts index db02b96d90..9eaad853cb 100644 --- a/jquery.payment/jquery.payment-tests.ts +++ b/jquery.payment/jquery.payment-tests.ts @@ -1,6 +1,3 @@ -/// -/// - $.payment.cards.push({ // Card type, as returned by $.payment.cardType. type: 'mastercard', diff --git a/jquery.pjax.falsandtru/jquery.pjax.falsandtru-tests.ts b/jquery.pjax.falsandtru/jquery.pjax.falsandtru-tests.ts index 8bfb91a27e..b215b02b35 100644 --- a/jquery.pjax.falsandtru/jquery.pjax.falsandtru-tests.ts +++ b/jquery.pjax.falsandtru/jquery.pjax.falsandtru-tests.ts @@ -1,6 +1,3 @@ - -/// - function test_pjax() { $.pjax(); } diff --git a/jquery.pjax/jquery.pjax-tests.ts b/jquery.pjax/jquery.pjax-tests.ts index 25422922d8..91cc9391a2 100644 --- a/jquery.pjax/jquery.pjax-tests.ts +++ b/jquery.pjax/jquery.pjax-tests.ts @@ -1,6 +1,3 @@ - -/// - function test_fn_pjax() { $(document).pjax("a"); $(document).pjax("a", "#pjax-container"); diff --git a/jquery.placeholder/jquery.placeholder-tests.ts b/jquery.placeholder/jquery.placeholder-tests.ts index edaf3ea111..04c526b352 100644 --- a/jquery.placeholder/jquery.placeholder-tests.ts +++ b/jquery.placeholder/jquery.placeholder-tests.ts @@ -1,5 +1,3 @@ -/// - $('input').placeholder(); // specify custom class diff --git a/jquery.pnotify/jquery.pnotify-tests.ts b/jquery.pnotify/jquery.pnotify-tests.ts index 41cd7d3fda..f1b8ffb73e 100644 --- a/jquery.pnotify/jquery.pnotify-tests.ts +++ b/jquery.pnotify/jquery.pnotify-tests.ts @@ -1,6 +1,3 @@ -/// - - function test_pnotify() { diff --git a/jquery.prettyphoto/jquery.prettyphoto-tests.ts b/jquery.prettyphoto/jquery.prettyphoto-tests.ts index 4fcbf9ecdf..888d68ada4 100644 --- a/jquery.prettyphoto/jquery.prettyphoto-tests.ts +++ b/jquery.prettyphoto/jquery.prettyphoto-tests.ts @@ -1,8 +1,3 @@ -// Tests for prettyPhoto library - -/// - - // JQUERY $('#id').prettyPhoto(); diff --git a/jquery.qrcode/jquery.qrcode-tests.ts b/jquery.qrcode/jquery.qrcode-tests.ts index a634bd6f07..d007b203da 100644 --- a/jquery.qrcode/jquery.qrcode-tests.ts +++ b/jquery.qrcode/jquery.qrcode-tests.ts @@ -1,5 +1,3 @@ -/// - // Examples from website (note: the examples use color instead of fill, which is not supported) $('.container').qrcode(); diff --git a/jquery.rowgrid/jquery.rowgrid-tests.ts b/jquery.rowgrid/jquery.rowgrid-tests.ts index ba3e5f822d..3f1427c94a 100644 --- a/jquery.rowgrid/jquery.rowgrid-tests.ts +++ b/jquery.rowgrid/jquery.rowgrid-tests.ts @@ -1,12 +1,10 @@ -/// - /* * Test different options */ var options = { - minMargin: 10, - maxMargin: 35, + minMargin: 10, + maxMargin: 35, itemSelector: ".item" }; diff --git a/jquery.scrollto/jquery.scrollto-tests.ts b/jquery.scrollto/jquery.scrollto-tests.ts index 303ce0cd01..fcdc2f50bb 100644 --- a/jquery.scrollto/jquery.scrollto-tests.ts +++ b/jquery.scrollto/jquery.scrollto-tests.ts @@ -1,5 +1,3 @@ -/// - $('div').scrollTo(340); $('div').scrollTo('+=340px', { axis: 'y' }); diff --git a/jquery.simplemodal/jquery.simplemodal-tests.ts b/jquery.simplemodal/jquery.simplemodal-tests.ts index 8e73e057cc..0784f0eeeb 100644 --- a/jquery.simplemodal/jquery.simplemodal-tests.ts +++ b/jquery.simplemodal/jquery.simplemodal-tests.ts @@ -1,7 +1,5 @@ // Tests taken from documentation: http://www.ericmmartin.com/projects/simplemodal/ -/// - // Chained call with no options $("#sample").modal(); diff --git a/jquery.simplepagination/jquery.simplepagination-tests.ts b/jquery.simplepagination/jquery.simplepagination-tests.ts index b35a6f42a0..075fe02628 100644 --- a/jquery.simplepagination/jquery.simplepagination-tests.ts +++ b/jquery.simplepagination/jquery.simplepagination-tests.ts @@ -1,5 +1,3 @@ -/// - var selector = '#elementId'; $(function () { diff --git a/jquery.slimscroll/jquery.slimscroll-tests.ts b/jquery.slimscroll/jquery.slimscroll-tests.ts index 0d4be5af94..a0368d07e9 100644 --- a/jquery.slimscroll/jquery.slimscroll-tests.ts +++ b/jquery.slimscroll/jquery.slimscroll-tests.ts @@ -1,5 +1,3 @@ -/// - $("div").slimScroll(); $("div").slimScroll({ diff --git a/jquery.tagsmanager/jquery.tagsmanager-tests.ts b/jquery.tagsmanager/jquery.tagsmanager-tests.ts index 33af6a8b7b..26a75e8310 100644 --- a/jquery.tagsmanager/jquery.tagsmanager-tests.ts +++ b/jquery.tagsmanager/jquery.tagsmanager-tests.ts @@ -1,6 +1,3 @@ -/// - - var options: ITagsManagerOptions = { prefilled: ["Pisa", "Rome"], CapitalizeFirstLetter: true, diff --git a/jquery.timeago/jquery.timeago-tests.ts b/jquery.timeago/jquery.timeago-tests.ts index 2a852331be..f77b40b121 100644 --- a/jquery.timeago/jquery.timeago-tests.ts +++ b/jquery.timeago/jquery.timeago-tests.ts @@ -1,5 +1,3 @@ -/// - // Basic usage var jQueryElement: JQuery = jQuery("abbr.timeago").timeago(); diff --git a/jquery.timepicker/jquery.timepicker-tests.ts b/jquery.timepicker/jquery.timepicker-tests.ts index cbb14dfe7c..52329cf11a 100644 --- a/jquery.timepicker/jquery.timepicker-tests.ts +++ b/jquery.timepicker/jquery.timepicker-tests.ts @@ -1,5 +1,3 @@ -/// - var beforeShowCallback, onSelectCallback, onCloseCallback, onHourShow, onMinuteShow; $('#timepicker').timepicker({ timeSeparator: ':', diff --git a/jquery.timer/jquery.timer-tests.ts b/jquery.timer/jquery.timer-tests.ts index e5d1cdaa3a..1c6653bfdb 100644 --- a/jquery.timer/jquery.timer-tests.ts +++ b/jquery.timer/jquery.timer-tests.ts @@ -1,31 +1,28 @@ -/// +// Create the timer +$("body").timer( + function () { + console.log("This function just got called"); + }, 10000, true +); +$("body").timer.set({ time: 5000 }); // Change the time from 10000 millseconds to 5000 milliseconds +$("body").timer.toggle(false); // Reset the timer +$("body").timer.stop(); // Stop the timer +$("body").timer.play(); // Start / play the timer - // Create the timer - $("body").timer( - function () { - console.log("This function just got called"); - }, 10000, true - ); +// #region Outputting if timer is active or not +var isTimerActive = $("body").timer.isActive; // Define boolean isActive as isTimerActive +if (isTimerActive == true){ + console.log("Timer is active!"); +} +else{ + console.log("Timer is not active!"); +} +// #endregion - $("body").timer.set({ time: 5000 }); // Change the time from 10000 millseconds to 5000 milliseconds - $("body").timer.toggle(false); // Reset the timer - $("body").timer.stop(); // Stop the timer - $("body").timer.play(); // Start / play the timer +// #region Get time remaining +console.log("Time remaining on timer: " + $("body").timer.remaining.toString); +// #endregion - // #region Outputting if timer is active or not - var isTimerActive = $("body").timer.isActive; // Define boolean isActive as isTimerActive - if (isTimerActive == true){ - console.log("Timer is active!"); - } - else{ - console.log("Timer is not active!"); - } - // #endregion - - // #region Get time remaining - console.log("Time remaining on timer: " + $("body").timer.remaining.toString); - // #endregion - - $("body").timer.stop(); // Stop the timer once more for the purpose of the tests (to test once()) - $("body").timer.once(1000); // Run the timer ONCE in 1 second \ No newline at end of file +$("body").timer.stop(); // Stop the timer once more for the purpose of the tests (to test once()) +$("body").timer.once(1000); // Run the timer ONCE in 1 second \ No newline at end of file diff --git a/jquery.tipsy/jquery.tipsy-tests.ts b/jquery.tipsy/jquery.tipsy-tests.ts index e307e5d364..09ba7f2d68 100644 --- a/jquery.tipsy/jquery.tipsy-tests.ts +++ b/jquery.tipsy/jquery.tipsy-tests.ts @@ -1,5 +1,3 @@ -/// - // basic $('#example-1').tipsy(); diff --git a/jquery.tools/jquery.tools-tests.ts b/jquery.tools/jquery.tools-tests.ts index 0a435ccf02..443425e76b 100644 --- a/jquery.tools/jquery.tools-tests.ts +++ b/jquery.tools/jquery.tools-tests.ts @@ -1,5 +1,3 @@ -/// - /* from documentation at http://jquerytools.github.io/documentation/overlay/index.html */ $("img[rel]").overlay(); diff --git a/jquery.total-storage/jquery.total-storage-tests.ts b/jquery.total-storage/jquery.total-storage-tests.ts index 0a23dd67cf..37ebb1ca73 100644 --- a/jquery.total-storage/jquery.total-storage-tests.ts +++ b/jquery.total-storage/jquery.total-storage-tests.ts @@ -1,10 +1,3 @@ -// Type definitions for jQueryTotalStorage 1.1.2 -// Project: https://github.com/Upstatement/jquery-total-storage -// Definitions by: Jeremy Brooks -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - //direct call $.totalStorage("test_key1", "test_value"); var val1:string = $.totalStorage("test_key"); diff --git a/jquery.transit/jquery.transit-tests.ts b/jquery.transit/jquery.transit-tests.ts index 2a672ec979..4f3b41f228 100644 --- a/jquery.transit/jquery.transit-tests.ts +++ b/jquery.transit/jquery.transit-tests.ts @@ -1,5 +1,3 @@ -/// - class TransitOptions implements JQueryTransitOptions { opacity: number; duration: number; diff --git a/jquery.ui.datetimepicker/jquery.ui.datetimepicker-tests.ts b/jquery.ui.datetimepicker/jquery.ui.datetimepicker-tests.ts index 44996637da..00ba4fe297 100644 --- a/jquery.ui.datetimepicker/jquery.ui.datetimepicker-tests.ts +++ b/jquery.ui.datetimepicker/jquery.ui.datetimepicker-tests.ts @@ -1,9 +1,6 @@ -/// - - // basic no options $('#datetimepicker').datetimepicker({ - + }); // basic with some options diff --git a/jquery.validation/jquery.validation-tests.ts b/jquery.validation/jquery.validation-tests.ts index 0b2de520f2..68062d6e1c 100644 --- a/jquery.validation/jquery.validation-tests.ts +++ b/jquery.validation/jquery.validation-tests.ts @@ -1,6 +1,4 @@ -/// -/// - +/// function test_validate() { $("#commentForm").validate(); @@ -264,4 +262,3 @@ function test_static_methods() { jQuery.validator.format('{0} {1}', 'a', 2); jQuery.validator.format('{0} {1}', ['a', 2]); } - \ No newline at end of file diff --git a/jquery.watermark/jquery.watermark-tests.ts b/jquery.watermark/jquery.watermark-tests.ts index 225ba0a482..e92ec0df11 100644 --- a/jquery.watermark/jquery.watermark-tests.ts +++ b/jquery.watermark/jquery.watermark-tests.ts @@ -1,5 +1,3 @@ -/// - $('#inputId').watermark('Required information'); $('#inputId').watermark('Required information', { className: 'myClassName' }); $('#inputId').watermark('Search', { useNative: false }); diff --git a/jquery.window/jquery.window-tests.ts b/jquery.window/jquery.window-tests.ts index 4b1b9b6eb2..15021cad7d 100644 --- a/jquery.window/jquery.window-tests.ts +++ b/jquery.window/jquery.window-tests.ts @@ -1,5 +1,3 @@ -/// - function example_1() { $.window({ title: "Cyclops Studio", @@ -20,13 +18,13 @@ function example_2() { function example_3() { // prepare customerized static attributes, see static attributes - // Note: you should call this method before starting to create window instances, or windows might display wrong. + // Note: you should call this method before starting to create window instances, or windows might display wrong. $.window.prepare({ dock: 'bottom', // change the dock direction: 'left', 'right', 'top', 'bottom' animationSpeed: 200, // set animation speed minWinLong: 180 // set minimized window long dimension width in pixel }); - + // limit window within body $.window({ icon: 'http://www.fstoke.me/favicon.ico', @@ -51,7 +49,7 @@ function example_3() { x: 80, y: 80 }); - + // assign the dock area $.window.prepare({ dock: 'bottom', // change the dock direction: 'left', 'right', 'top', 'bottom' diff --git a/jquerymobile/jquerymobile-tests.ts b/jquerymobile/jquerymobile-tests.ts index 105edc3f88..e7fbf3bfff 100644 --- a/jquerymobile/jquerymobile-tests.ts +++ b/jquerymobile/jquerymobile-tests.ts @@ -1,6 +1,3 @@ -/// - - function test_api() { $.mobile.changePage("about/us.html", { transition: "slideup" }); $.mobile.changePage("searchresults.php", { diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index 2cce742f86..5755738622 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1,6 +1,3 @@ -/// - - function test_draggable() { $("#draggable").draggable({ axis: "y" }); diff --git a/jsonwebtoken/jsonwebtoken-tests.ts b/jsonwebtoken/jsonwebtoken-tests.ts index 4a939becbc..e591f31159 100644 --- a/jsonwebtoken/jsonwebtoken-tests.ts +++ b/jsonwebtoken/jsonwebtoken-tests.ts @@ -1,10 +1,8 @@ -/** - * Test suite created by Maxime LUCE - * +/** + * Test suite created by Maxime LUCE + * * Created by using code samples from https://github.com/auth0/node-jsonwebtoken. - */ - -/// + */ import jwt = require("jsonwebtoken"); import fs = require("fs"); @@ -49,7 +47,7 @@ jwt.verify(token, 'shhhhh', function(err, decoded) { // invalid token jwt.verify(token, 'wrong-secret', function(err, decoded) { - // err + // err // decoded undefined }); diff --git a/jsrender/jsrender-tests.ts b/jsrender/jsrender-tests.ts index d728f968ae..7b5bf5a525 100644 --- a/jsrender/jsrender-tests.ts +++ b/jsrender/jsrender-tests.ts @@ -1,5 +1,3 @@ -/// - $.views.converters("upper", function(val) { return val.toUpperCase(); }); diff --git a/jsx-chai/jsx-chai-tests.ts b/jsx-chai/jsx-chai-tests.ts index d421ae0874..48c49e7b25 100644 --- a/jsx-chai/jsx-chai-tests.ts +++ b/jsx-chai/jsx-chai-tests.ts @@ -1,5 +1,3 @@ -/// - import chai = require('chai'); import jsxChai = require('jsx-chai'); diff --git a/kendo-ui/kendo-ui-tests.ts b/kendo-ui/kendo-ui-tests.ts index d1cc528edb..0b79f87954 100644 --- a/kendo-ui/kendo-ui-tests.ts +++ b/kendo-ui/kendo-ui-tests.ts @@ -1,6 +1,3 @@ -/// - - var is = { string: (msg: string) => { return true; diff --git a/klaw/klaw-tests.ts b/klaw/klaw-tests.ts index 312af220ff..acd8b2fcbf 100644 --- a/klaw/klaw-tests.ts +++ b/klaw/klaw-tests.ts @@ -1,6 +1,3 @@ -/// -/// - import * as klaw from "klaw"; const path = require('path'); diff --git a/knockout-amd-helpers/knockout-amd-helpers-tests.ts b/knockout-amd-helpers/knockout-amd-helpers-tests.ts index d2773dee12..5b9c2983b5 100644 --- a/knockout-amd-helpers/knockout-amd-helpers-tests.ts +++ b/knockout-amd-helpers/knockout-amd-helpers-tests.ts @@ -1,8 +1,5 @@ // Tests for knockout.projections.d.ts -/// - - //The baseDir is used in building the path to use in the require statement. If your modules live in the modules directory, then you can specify it globally here. ko.bindingHandlers.module.baseDir = "blub"; diff --git a/knockout-transformations/knockout-transformations-tests.ts b/knockout-transformations/knockout-transformations-tests.ts index c8e93fc20e..6725f4f209 100644 --- a/knockout-transformations/knockout-transformations-tests.ts +++ b/knockout-transformations/knockout-transformations-tests.ts @@ -1,6 +1,3 @@ -/// - - // Test map var sourceItems: KnockoutObservableArray = ko.observableArray([1, 2, 3, 4, 5]); var squares: KnockoutObservableArray = sourceItems.map(function (x) { return x * x; }); diff --git a/knockout.kogrid/knockout.kogrid-tests.ts b/knockout.kogrid/knockout.kogrid-tests.ts index 8abe83d36d..ba36e78e9f 100644 --- a/knockout.kogrid/knockout.kogrid-tests.ts +++ b/knockout.kogrid/knockout.kogrid-tests.ts @@ -1,33 +1,27 @@ -/// +export interface IGridItem { + name: string; +} +export class Tests { + public items: KnockoutObservableArray; + public selectedItems: KnockoutObservableArray; + public gridOptionsAlarms: kg.GridOptions; -namespace KoGridTests -{ - export interface IGridItem { - name: string; - } + constructor() { + this.items = ko.observableArray(); + this.selectedItems = ko.observableArray(); + this.gridOptionsAlarms = this.createDefaultGridOptions(this.items, this.selectedItems); + } - export class Tests { - public items: KnockoutObservableArray; - public selectedItems: KnockoutObservableArray; - public gridOptionsAlarms: kg.GridOptions; - - constructor() { - this.items = ko.observableArray(); - this.selectedItems = ko.observableArray(); - this.gridOptionsAlarms = this.createDefaultGridOptions(this.items, this.selectedItems); - } - - public createDefaultGridOptions(dataArray: KnockoutObservableArray, selectedItems: KnockoutObservableArray): kg.GridOptions { - return { - data: dataArray, - displaySelectionCheckbox: false, - footerVisible: false, - multiSelect: false, - showColumnMenu: false, - plugins: null, - selectedItems: selectedItems - }; - } - } + public createDefaultGridOptions(dataArray: KnockoutObservableArray, selectedItems: KnockoutObservableArray): kg.GridOptions { + return { + data: dataArray, + displaySelectionCheckbox: false, + footerVisible: false, + multiSelect: false, + showColumnMenu: false, + plugins: null, + selectedItems: selectedItems + }; + } } diff --git a/knockout.mapping/knockout.mapping-tests.ts b/knockout.mapping/knockout.mapping-tests.ts index 7b1a9aca8d..6262f36275 100644 --- a/knockout.mapping/knockout.mapping-tests.ts +++ b/knockout.mapping/knockout.mapping-tests.ts @@ -1,6 +1,3 @@ - -/// - var inputJSON = '{ name: "foo" }'; var inputData = { name: 'foo' }; var inputModel = { name: 'bar' }; diff --git a/knockout.projections/knockout.projections-tests.ts b/knockout.projections/knockout.projections-tests.ts index c0899c81ee..bc8a505484 100644 --- a/knockout.projections/knockout.projections-tests.ts +++ b/knockout.projections/knockout.projections-tests.ts @@ -1,8 +1,3 @@ -// Tests for knockout.projections.d.ts - -/// - - // Test map var sourceItems = ko.observableArray([1, 2, 3, 4, 5]); var squares = sourceItems.map(function (x) { return x * x; }); diff --git a/knockout.punches/knockout.punches-tests.ts b/knockout.punches/knockout.punches-tests.ts index 1de89ca570..2eccd25d37 100644 --- a/knockout.punches/knockout.punches-tests.ts +++ b/knockout.punches/knockout.punches-tests.ts @@ -1,6 +1,3 @@ -/// - - function test_enable() { ko.punches.enableAll(); } diff --git a/knockstrap/knockstrap-tests.ts b/knockstrap/knockstrap-tests.ts index 2033252de2..2fb58fbaf7 100644 --- a/knockstrap/knockstrap-tests.ts +++ b/knockstrap/knockstrap-tests.ts @@ -1,9 +1,3 @@ -/// -/// -/// - - - // test unique id var adaskoUnitqueId: string = ko.utils.uniqueId('adaskothebeast'); diff --git a/ko.plus/ko.plus-tests.ts b/ko.plus/ko.plus-tests.ts index cbb86d3122..d3472c0d82 100644 --- a/ko.plus/ko.plus-tests.ts +++ b/ko.plus/ko.plus-tests.ts @@ -1,30 +1,9 @@ - -/// - -// Tests for ko.plus.d.ts -// Project: https://github.com/stevegreatrex/ko.plus -// Definitions by: Howard Richards -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/* - Version 1.0 - initial commit - - Version 1.1 - added test for makeEditable - - Version 1.2 - amended callback on commmand.fail() method - accepts response, - status and message values - - Note: Typescript version 1.4 or higher is required for union types - and type declarations -*/ - function CommandTests() { - // initalize command with an execute method var cmd1 = ko.command(() => { return "Hello cmd1"; }); - + // initialize command and add done and fail callbacks var cmd2 = ko.command(() => { return "Hello cmd2"; @@ -56,7 +35,7 @@ function CommandTests() { // test execute the command cmd1(); - + // test properties of the commmand var isRunning = cmd1.isRunning(); var failed = cmd1.failed(); @@ -75,7 +54,7 @@ function EditableTests() { var edit3 = ko.editable({ test: true }); // with anything var edit4 = ko.editable(1); // with union types - var edit5 = ko.editable("test"); + var edit5 = ko.editable("test"); ko.editable.makeEditable(this); @@ -119,7 +98,7 @@ function EditableArrayTests() { function SortableTests() { - // sorting is added via an extender, there are no .d.ts + // sorting is added via an extender, there are no .d.ts // types for this at present var sort1 = ko.observableArray([1, 2, 3]).extend({ sortable: true }); diff --git a/koa-logger/koa-logger-tests.ts b/koa-logger/koa-logger-tests.ts index f2d17ba090..502c33255d 100644 --- a/koa-logger/koa-logger-tests.ts +++ b/koa-logger/koa-logger-tests.ts @@ -1,5 +1,3 @@ -/// - import * as koa from 'koa'; import * as logger from 'koa-logger'; diff --git a/kolite/kolite-tests.ts b/kolite/kolite-tests.ts index 539c284861..2ce3cbd0f0 100644 --- a/kolite/kolite-tests.ts +++ b/kolite/kolite-tests.ts @@ -1,6 +1,3 @@ -/// -/// - function test_activityDefaults() { ko.bindingHandlers.activity.defaultOptions = { activityClass: 'fa fa-spinner fa-spin', diff --git a/kue/kue-tests.ts b/kue/kue-tests.ts index a66dc4384c..aa61ff2f6a 100644 --- a/kue/kue-tests.ts +++ b/kue/kue-tests.ts @@ -1,5 +1,3 @@ -/// - import kue = require('kue'); // create our job queue diff --git a/leaflet-curve/leaflet-curve-tests.ts b/leaflet-curve/leaflet-curve-tests.ts index ec2461cbd2..3d8b319e63 100644 --- a/leaflet-curve/leaflet-curve-tests.ts +++ b/leaflet-curve/leaflet-curve-tests.ts @@ -1,5 +1,3 @@ -/// - var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmAttrib = '© OpenStreetMap contributors', osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}), diff --git a/leaflet-draw/leaflet-draw-tests.ts b/leaflet-draw/leaflet-draw-tests.ts index 4260eac263..6373687a03 100644 --- a/leaflet-draw/leaflet-draw-tests.ts +++ b/leaflet-draw/leaflet-draw-tests.ts @@ -1,5 +1,3 @@ -/// - var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmAttrib = '© OpenStreetMap contributors', osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}), diff --git a/libpq/libpq-tests.ts b/libpq/libpq-tests.ts index 8a9aced3c3..5736577e67 100644 --- a/libpq/libpq-tests.ts +++ b/libpq/libpq-tests.ts @@ -1,4 +1,3 @@ -/// /// import {Buffer} from 'buffer'; diff --git a/magicsuggest/magicsuggest-tests.ts b/magicsuggest/magicsuggest-tests.ts index 46cb799d25..96a513a7b9 100644 --- a/magicsuggest/magicsuggest-tests.ts +++ b/magicsuggest/magicsuggest-tests.ts @@ -1,5 +1,3 @@ -/// - function basicTest() { $('#magicSuggest').magicSuggest(); } diff --git a/mailcheck/mailcheck-tests.ts b/mailcheck/mailcheck-tests.ts index 07fc473893..971ecf8218 100644 --- a/mailcheck/mailcheck-tests.ts +++ b/mailcheck/mailcheck-tests.ts @@ -1,5 +1,3 @@ -/// - import MC = require('mailcheck'); var domains = ['gmail.com', 'aol.com']; diff --git a/markitup/markitup-tests.ts b/markitup/markitup-tests.ts index f8b12d3c00..b8a7675529 100644 --- a/markitup/markitup-tests.ts +++ b/markitup/markitup-tests.ts @@ -1,6 +1,3 @@ -/// - - // https://github.com/markitup/1.x/blob/master/markitup/sets/default/set.js var mySettings = { onShiftEnter: { diff --git a/maskedinput/maskedinput-tests.ts b/maskedinput/maskedinput-tests.ts index 6d620ce1b9..99c1ecb8bb 100644 --- a/maskedinput/maskedinput-tests.ts +++ b/maskedinput/maskedinput-tests.ts @@ -1,10 +1,3 @@ -// Type definitions for Masked Input plugin for jQuery -// Project: http://digitalbush.com/projects/masked-input-plugin -// Definitions by: Lokesh Peta -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - $("#test").mask("9:000"); $("#test").mask("9:000", { numeric: true }); diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index 06f75abe9a..0ea5a72352 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -1,8 +1,3 @@ -/// -/// -/// -/// - import * as React from 'react'; import {Component, PropTypes} from 'react'; import * as ReactDOM from 'react-dom'; diff --git a/mcustomscrollbar/mcustomscrollbar-tests.ts b/mcustomscrollbar/mcustomscrollbar-tests.ts index aecb236286..f00cd5a491 100644 --- a/mcustomscrollbar/mcustomscrollbar-tests.ts +++ b/mcustomscrollbar/mcustomscrollbar-tests.ts @@ -1,6 +1,3 @@ -/// - - class SimpleTest { element: JQuery; diff --git a/md5/md5-tests.ts b/md5/md5-tests.ts index 427a93486a..924c9b8d91 100644 --- a/md5/md5-tests.ts +++ b/md5/md5-tests.ts @@ -1,5 +1,3 @@ -/// - import fs = require("fs"); import md5 = require("md5"); /** @@ -7,7 +5,7 @@ import md5 = require("md5"); * md5(message) * message -- String or Buffer * returns String - * + * * Usage **************************************************** * var md5 = require('md5'); * @@ -15,10 +13,10 @@ import md5 = require("md5"); **************************************************** * This will print the following * 78e731027d8fd50ed642340b7c9a63b3 - * + * * It supports buffers, too - **************************************************** - * var fs = require('fs'); * + **************************************************** + * var fs = require('fs'); * * var md5 = require('md5'); * * * * fs.readFile('example.txt', function(err, buf) { * diff --git a/meteor-roles/meteor-roles-tests.ts b/meteor-roles/meteor-roles-tests.ts index 8f73f13208..50552c82ff 100644 --- a/meteor-roles/meteor-roles-tests.ts +++ b/meteor-roles/meteor-roles-tests.ts @@ -1,6 +1,3 @@ -/// - - import * as _ from 'underscore'; /** diff --git a/metismenu/metismenu-tests.ts b/metismenu/metismenu-tests.ts index eb17270021..64aa809cf7 100644 --- a/metismenu/metismenu-tests.ts +++ b/metismenu/metismenu-tests.ts @@ -1,5 +1,3 @@ -/// - $('#menu').metisMenu(); $('.metismenu').metisMenu({toggle: false}); diff --git a/mssql/mssql-tests.ts b/mssql/mssql-tests.ts index 52ae6f953c..764f6da8e1 100644 --- a/mssql/mssql-tests.ts +++ b/mssql/mssql-tests.ts @@ -1,5 +1,3 @@ -/// - import sql = require('mssql'); interface Entity{ diff --git a/mu2/mu2-tests.ts b/mu2/mu2-tests.ts index dc960f20d7..d85e1463b9 100644 --- a/mu2/mu2-tests.ts +++ b/mu2/mu2-tests.ts @@ -1,6 +1,3 @@ - -/// - import mu2 = require('mu2'); import stream = require('stream'); diff --git a/multiparty/multiparty-tests.ts b/multiparty/multiparty-tests.ts index be49092189..839ca92882 100644 --- a/multiparty/multiparty-tests.ts +++ b/multiparty/multiparty-tests.ts @@ -1,5 +1,3 @@ - -/// import multiparty = require('multiparty'); import http = require('http'); import util = require('util'); diff --git a/mz/mz-tests.ts b/mz/mz-tests.ts index 8246eecbab..7eda9f28bf 100644 --- a/mz/mz-tests.ts +++ b/mz/mz-tests.ts @@ -1,7 +1,4 @@ /// -/// - - import assert = require('assert') import fs = require('mz/fs') diff --git a/n3/n3-tests.ts b/n3/n3-tests.ts index a7e529bc7d..13247dfdb2 100644 --- a/n3/n3-tests.ts +++ b/n3/n3-tests.ts @@ -1,5 +1,3 @@ -/// - import * as N3 from "n3"; import * as fs from "fs"; import * as stream from "stream"; @@ -26,7 +24,7 @@ function test_serialize() { }); } -/** +/** The following tests are taken from ... https://github.com/RubenVerborgh/N3.js/blob/master/README.md */ diff --git a/ng-command/ng-command-tests.ts b/ng-command/ng-command-tests.ts index c6eb344ed7..32f9bef158 100644 --- a/ng-command/ng-command-tests.ts +++ b/ng-command/ng-command-tests.ts @@ -1,5 +1,3 @@ -/// - var app = angular.module('testModule', ['ng-command']); class CommandTestController { diff --git a/ng-dialog/ng-dialog-tests.ts b/ng-dialog/ng-dialog-tests.ts index 6c867f422d..b66ed173b7 100644 --- a/ng-dialog/ng-dialog-tests.ts +++ b/ng-dialog/ng-dialog-tests.ts @@ -1,4 +1,3 @@ -/// import * as angular from 'angular'; var app = angular.module('testModule', ['ngDialog']); diff --git a/ng-grid/ng-grid-tests.ts b/ng-grid/ng-grid-tests.ts index f14e9cb540..c6331fdc15 100644 --- a/ng-grid/ng-grid-tests.ts +++ b/ng-grid/ng-grid-tests.ts @@ -1,5 +1,3 @@ -/// - var options1: ngGrid.IGridOptions = { data: [{ 'Name': 'Bob' }, { 'Name': 'Jane' }] }; diff --git a/ng-notify/ng-notify-tests.ts b/ng-notify/ng-notify-tests.ts index e140cb6130..9f81d25e87 100644 --- a/ng-notify/ng-notify-tests.ts +++ b/ng-notify/ng-notify-tests.ts @@ -1,5 +1,3 @@ -/// - class NgNotifyTestController { static $inject = ['$scope', 'ngNotify']; diff --git a/ngprogress-lite/ngprogress-lite-tests.ts b/ngprogress-lite/ngprogress-lite-tests.ts index c7df7f9b6b..c4b903d78b 100644 --- a/ngprogress-lite/ngprogress-lite-tests.ts +++ b/ngprogress-lite/ngprogress-lite-tests.ts @@ -1,6 +1,3 @@ -/// - - var app = angular.module('testApp', ['ngProgressLite']); app.config( diff --git a/node-hue-api/node-hue-api-tests.ts b/node-hue-api/node-hue-api-tests.ts index 44903fa4da..44e24da9b1 100644 --- a/node-hue-api/node-hue-api-tests.ts +++ b/node-hue-api/node-hue-api-tests.ts @@ -1,5 +1,3 @@ -/// - import hue = require('node-hue-api'); hue.nupnpSearch().then(function (bridges) { diff --git a/node-int64/node-int64-tests.ts b/node-int64/node-int64-tests.ts index 16df3a00ca..3235efa3d8 100644 --- a/node-int64/node-int64-tests.ts +++ b/node-int64/node-int64-tests.ts @@ -1,9 +1,5 @@ -/// - // Play example copy - - // First, let's illustrate the problem ... (0x123456789).toString(16); //!! '123456789' // <- what we expect. diff --git a/node-mysql-wrapper/node-mysql-wrapper-tests.ts b/node-mysql-wrapper/node-mysql-wrapper-tests.ts index 5b67969ffe..2811292fe6 100644 --- a/node-mysql-wrapper/node-mysql-wrapper-tests.ts +++ b/node-mysql-wrapper/node-mysql-wrapper-tests.ts @@ -1,7 +1,3 @@ - -/// -/// - var express = require('express'); var app = express(); var server = require('http').createServer(app); diff --git a/nouislider/v7/nouislider-tests.ts b/nouislider/v7/nouislider-tests.ts index 0bb6023774..08f9ebd74d 100644 --- a/nouislider/v7/nouislider-tests.ts +++ b/nouislider/v7/nouislider-tests.ts @@ -1,6 +1,3 @@ - -/// - //basic var basicSlider = $("
    ").noUiSlider({ start: 80, diff --git a/npm/npm-tests.ts b/npm/npm-tests.ts index ccebbdb35a..8ca5f01887 100644 --- a/npm/npm-tests.ts +++ b/npm/npm-tests.ts @@ -4,9 +4,6 @@ * Created by using code samples from https://github.com/npm/npm#using-npm-programmatically. */ -/// - - import npm = require("npm"); npm.load({}, function (er) { diff --git a/on-finished/on-finished-tests.ts b/on-finished/on-finished-tests.ts index 57040531fc..081e2cd37b 100644 --- a/on-finished/on-finished-tests.ts +++ b/on-finished/on-finished-tests.ts @@ -1,5 +1,3 @@ -/// - import events = require('events'); import onFinished = require('on-finished'); diff --git a/onoff/onoff-tests.ts b/onoff/onoff-tests.ts index cd39dc4a8d..21b47e7f99 100644 --- a/onoff/onoff-tests.ts +++ b/onoff/onoff-tests.ts @@ -1,5 +1,3 @@ - -/// import * as onoff from 'onoff'; var led:onoff.Gpio = new onoff.Gpio(17, 'out'); diff --git a/openui5/openui5-tests.ts b/openui5/openui5-tests.ts index 8dc19922ee..bb411a9a1e 100644 --- a/openui5/openui5-tests.ts +++ b/openui5/openui5-tests.ts @@ -1,7 +1,3 @@ -/// -/// -/// - sap.ui.getCore().attachInit(function () { new sap.m.Text({ text: "Hello World" diff --git a/oracledb/oracledb-tests.ts b/oracledb/oracledb-tests.ts index 15446df243..b4d1cf5fe9 100644 --- a/oracledb/oracledb-tests.ts +++ b/oracledb/oracledb-tests.ts @@ -1,5 +1,3 @@ -/// - import * as OracleDB from 'oracledb'; OracleDB.getConnection( diff --git a/owlcarousel/owlcarousel-tests.ts b/owlcarousel/owlcarousel-tests.ts index 3d9ed9a69b..0d2e1b6118 100644 --- a/owlcarousel/owlcarousel-tests.ts +++ b/owlcarousel/owlcarousel-tests.ts @@ -1,6 +1,3 @@ -/// - - $(".className").owlCarousel(); $(".className").owlCarousel({ diff --git a/passport-beam/passport-beam-tests.ts b/passport-beam/passport-beam-tests.ts index edfa3f1396..4448dad045 100644 --- a/passport-beam/passport-beam-tests.ts +++ b/passport-beam/passport-beam-tests.ts @@ -1,5 +1,3 @@ -/// - /** * Created by AtlasDev on 4/10/2016. */ diff --git a/passport-http/passport-http-tests.ts b/passport-http/passport-http-tests.ts index 22a486e6ec..4a70d30b89 100644 --- a/passport-http/passport-http-tests.ts +++ b/passport-http/passport-http-tests.ts @@ -1,5 +1,3 @@ -/// - /** * Created by Christophe Vidal */ diff --git a/paymentrequest/paymentrequest-tests.ts b/paymentrequest/paymentrequest-tests.ts index 62c2721bfb..c8772b115c 100644 --- a/paymentrequest/paymentrequest-tests.ts +++ b/paymentrequest/paymentrequest-tests.ts @@ -1,5 +1,3 @@ -/// - /// Code examples derived from /// https://developers.google.com/web/fundamentals/discovery-and-monetization/payment-request/ diff --git a/peerjs/peerjs-tests.ts b/peerjs/peerjs-tests.ts index 373df3ba2f..2246e6a8fd 100644 --- a/peerjs/peerjs-tests.ts +++ b/peerjs/peerjs-tests.ts @@ -1,5 +1,3 @@ -/// - var peerByOption: PeerJs.Peer = new Peer({ key: 'peerKey', debug: 3, diff --git a/phantomcss/index.d.ts b/phantomcss/index.d.ts index 451c250372..688c706199 100644 --- a/phantomcss/index.d.ts +++ b/phantomcss/index.d.ts @@ -3,8 +3,8 @@ // Definitions by: Amaury Bauzac // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { Casper } from 'casperjs'; /// +import { Casper } from 'casperjs'; declare global { namespace PhantomCSS { diff --git a/phantomcss/phantomcss-tests.ts b/phantomcss/phantomcss-tests.ts index 8478bbd323..ee16832fae 100644 --- a/phantomcss/phantomcss-tests.ts +++ b/phantomcss/phantomcss-tests.ts @@ -1,7 +1,3 @@ - -/// -/// - // phantomCSS 0.11.1 is based on resemblejs 1.2.1, phantomJS 1.9.2 , casperJS 1.1.0-DEV var options: PhantomCSS.PhantomCSSOptions = { @@ -39,8 +35,8 @@ var options: PhantomCSS.PhantomCSSOptions = { }); }, - fileNameGetter: function(root:string,filename:string){ - + fileNameGetter: function(root:string,filename:string){ + return root+filename; }, @@ -65,7 +61,7 @@ declare var phantomcss:PhantomCSS.PhantomCSS; phantomcss.turnOffAnimations(); phantomcss.init(options); -phantomcss.compareAll('exclude.test'); +phantomcss.compareAll('exclude.test'); phantomcss.compareMatched('include.test', 'exclude.test'); phantomcss.compareMatched( new RegExp('include.test'), new RegExp('exclude.test')); phantomcss.compareSession(); diff --git a/phonon/phonon-tests.ts b/phonon/phonon-tests.ts index b817fef45b..6b9851b642 100644 --- a/phonon/phonon-tests.ts +++ b/phonon/phonon-tests.ts @@ -1,5 +1,3 @@ -/// - // Code examples from http://phonon.quarkdev.com/docs/navigator phonon.options({ navigator: { diff --git a/piwik-tracker/piwik-tracker-tests.ts b/piwik-tracker/piwik-tracker-tests.ts index 3e7506d5fd..f1545a843a 100644 --- a/piwik-tracker/piwik-tracker-tests.ts +++ b/piwik-tracker/piwik-tracker-tests.ts @@ -1,22 +1,20 @@ -/// - // Example code taken from https://www.npmjs.com/package/piwik-tracker var PiwikTracker = require('piwik-tracker'); - -// Initialize with your site ID and Piwik URL + +// Initialize with your site ID and Piwik URL var piwik = new PiwikTracker(1, 'http://mywebsite.com/piwik.php'); - -// Optional: Respond to tracking errors + +// Optional: Respond to tracking errors piwik.on('error', function(err : Error) { console.log('error tracking request: ', err) }) - -// Track a request URL: -// Either as a simple string … + +// Track a request URL: +// Either as a simple string … piwik.track('http://example.com/track/this/url'); - -// … or provide further options: + +// … or provide further options: piwik.track({ url: 'http://example.com/track/this/url', action_name: 'This will be shown in your dashboard', diff --git a/pkcs11js/pkcs11js-tests.ts b/pkcs11js/pkcs11js-tests.ts index 52ffd4e8f8..30501be11f 100644 --- a/pkcs11js/pkcs11js-tests.ts +++ b/pkcs11js/pkcs11js-tests.ts @@ -1,5 +1,3 @@ -/// - import * as pkcs11js from "pkcs11js"; const libPath = "C:\\tmp\\rtpkcs11ecp.dll"; diff --git a/pouchdb-find/pouchdb-find-tests.ts b/pouchdb-find/pouchdb-find-tests.ts index 8d677276fc..bebdc58cc1 100644 --- a/pouchdb-find/pouchdb-find-tests.ts +++ b/pouchdb-find/pouchdb-find-tests.ts @@ -1,5 +1,3 @@ -/// - namespace PouchDBFindTests { function testFind() { diff --git a/pouchdb-replication/pouchdb-replication-tests.ts b/pouchdb-replication/pouchdb-replication-tests.ts index 6ff426bd0c..3cb6d6bc17 100644 --- a/pouchdb-replication/pouchdb-replication-tests.ts +++ b/pouchdb-replication/pouchdb-replication-tests.ts @@ -1,5 +1,3 @@ -/// - namespace PouchDBReplicationTests { /** @todo make some real tests */ diff --git a/project-oxford/project-oxford-tests.ts b/project-oxford/project-oxford-tests.ts index d04a77a762..ea2849d986 100644 --- a/project-oxford/project-oxford-tests.ts +++ b/project-oxford/project-oxford-tests.ts @@ -1,6 +1,3 @@ - -/// -/// /// import oxford = require("project-oxford"); diff --git a/promised-temp/promised-temp-tests.ts b/promised-temp/promised-temp-tests.ts index ebe0a51517..ec14855d8b 100644 --- a/promised-temp/promised-temp-tests.ts +++ b/promised-temp/promised-temp-tests.ts @@ -1,6 +1,3 @@ - -/// - import * as fs from "fs"; import temp from 'promised-temp'; import { AffixOptions, OpenFile, Stats } from "promised-temp"; diff --git a/promptly/promptly-tests.ts b/promptly/promptly-tests.ts index 05b8bf70ed..fbd1fd5bb7 100644 --- a/promptly/promptly-tests.ts +++ b/promptly/promptly-tests.ts @@ -1,5 +1,3 @@ -/// - import promptly = require('promptly'); process.stdin diff --git a/radius/radius-tests.ts b/radius/radius-tests.ts index c3b50db8ec..36e9ea618d 100644 --- a/radius/radius-tests.ts +++ b/radius/radius-tests.ts @@ -1,6 +1,3 @@ - -/// - import radius = require('radius'); var radius_secret: string = "shhhh" diff --git a/rangyinputs/rangyinputs-tests.ts b/rangyinputs/rangyinputs-tests.ts index cb627d85b1..14f769a9fe 100644 --- a/rangyinputs/rangyinputs-tests.ts +++ b/rangyinputs/rangyinputs-tests.ts @@ -1,5 +1,3 @@ -/// - let $obj: JQuery = $('meh'); let selection: RangyInputs.Selection = $obj.getSelection(); diff --git a/raty/raty-tests.ts b/raty/raty-tests.ts index bb2f731038..51b510b0a3 100644 --- a/raty/raty-tests.ts +++ b/raty/raty-tests.ts @@ -1,7 +1,3 @@ -/// - - - var $element: JQuery = $('
    '); $element.raty(); diff --git a/rc-select/rc-select-tests.ts b/rc-select/rc-select-tests.ts index f2ec85ae09..976d789c2c 100644 --- a/rc-select/rc-select-tests.ts +++ b/rc-select/rc-select-tests.ts @@ -1,10 +1,7 @@ - -/// - import React = require('react'); import RcSelect = require('rc-select'); -class Component extends React.Component { +class Component extends React.Component { private onChange(value: any) { console.log('selected', value); @@ -54,7 +51,7 @@ class Component extends React.Component { className: "option", disabled: true, key: "option-0", - value: "option-0" + value: "option-0" }; private createOptions(count: number) { @@ -75,7 +72,7 @@ class Component extends React.Component { let options = this.createOptions(10); - let optionGroup = React.createElement(RcSelect.OptGroup, this.defaultOptGroupProps, options); + let optionGroup = React.createElement(RcSelect.OptGroup, this.defaultOptGroupProps, options); let select = React.createElement(RcSelect.default, this.defaultSelectProps, optionGroup); diff --git a/react-bootstrap/react-bootstrap-tests.tsx b/react-bootstrap/react-bootstrap-tests.tsx index 987203fbf8..432636559b 100644 --- a/react-bootstrap/react-bootstrap-tests.tsx +++ b/react-bootstrap/react-bootstrap-tests.tsx @@ -1,9 +1,3 @@ -// React-Bootstrap Test -// ================================================================================ -/// - -// Imports -// -------------------------------------------------------------------------------- import * as React from 'react'; import { Component, CSSProperties } from 'react'; import { diff --git a/react-datagrid/react-datagrid-tests.tsx b/react-datagrid/react-datagrid-tests.tsx index 061be471f4..bdbca39f01 100644 --- a/react-datagrid/react-datagrid-tests.tsx +++ b/react-datagrid/react-datagrid-tests.tsx @@ -1,6 +1,3 @@ - -/// - import * as React from "react"; import ReactDataGrid = require("react-datagrid"); diff --git a/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts b/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts index 83ee1bc9ba..68703d062d 100644 --- a/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts +++ b/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts @@ -1,5 +1,3 @@ -"use strict"; - // Test adapted from the ReactDnD chess game tutorial: // http://gaearon.github.io/react-dnd/docs-tutorial.html diff --git a/react-dnd/UNUSED_FILES.txt b/react-dnd/UNUSED_FILES.txt deleted file mode 100644 index ff694923a2..0000000000 --- a/react-dnd/UNUSED_FILES.txt +++ /dev/null @@ -1 +0,0 @@ -react-dnd-test-backend.d.ts \ No newline at end of file diff --git a/react-dnd/react-dnd-test-backend.d.ts b/react-dnd/react-dnd-test-backend.d.ts deleted file mode 100644 index 095c890483..0000000000 --- a/react-dnd/react-dnd-test-backend.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Type definitions for React DnD HTML 5 Backend v2.0.0 -// Project: https://github.com/gaearon/react-dnd -// Definitions by: Asana -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module "react-dnd-test-backend" { - class TestBackend { - setup(): void; - teardown(): void; - connectDragSource(): void; - connectDropTarget(): void; - simulateBeginDrag(sourceIds: __ReactDnd.Identifier[], options?: {}): void; - simulatePublishDragSource(): void; - simulateHover(targetIds: __ReactDnd.Identifier[], options?: {}): void; - simulateDrop(): void; - simulateEndDrag(): void; - } - - export { TestBackend as default }; -} diff --git a/react-dnd/react-dnd-tests.ts b/react-dnd/react-dnd-tests.ts index fdef2b727c..0aabefd26e 100644 --- a/react-dnd/react-dnd-tests.ts +++ b/react-dnd/react-dnd-tests.ts @@ -1,6 +1,3 @@ -/// -"use strict"; - // Test adapted from the ReactDnD chess game tutorial: // http://gaearon.github.io/react-dnd/docs-tutorial.html @@ -14,7 +11,17 @@ import DropTarget = ReactDnd.DropTarget; import DragLayer = ReactDnd.DragLayer; import DragDropContext = ReactDnd.DragDropContext; import HTML5Backend, { getEmptyImage, NativeTypes } from "react-dnd-html5-backend"; -import TestBackend from "react-dnd-test-backend"; +declare class TestBackend { + setup(): void; + teardown(): void; + connectDragSource(): void; + connectDropTarget(): void; + simulateBeginDrag(sourceIds: __ReactDnd.Identifier[], options?: {}): void; + simulatePublishDragSource(): void; + simulateHover(targetIds: __ReactDnd.Identifier[], options?: {}): void; + simulateDrop(): void; + simulateEndDrag(): void; +} // Game Component // ---------------------------------------------------------------------- diff --git a/react-dropzone/react-dropzone-tests.tsx b/react-dropzone/react-dropzone-tests.tsx index 322fd82e8c..ec6d5fa763 100644 --- a/react-dropzone/react-dropzone-tests.tsx +++ b/react-dropzone/react-dropzone-tests.tsx @@ -1,5 +1,3 @@ -/// -/// import * as React from 'react'; import * as Dropzone from 'react-dropzone'; diff --git a/react-helmet/react-helmet-tests.tsx b/react-helmet/react-helmet-tests.tsx index 3a4a3f09d7..e6b78955b3 100644 --- a/react-helmet/react-helmet-tests.tsx +++ b/react-helmet/react-helmet-tests.tsx @@ -1,6 +1,3 @@ - -/// - import * as React from 'react'; import * as Helmet from 'react-helmet'; diff --git a/react-infinite/react-infinite-tests.tsx b/react-infinite/react-infinite-tests.tsx index 807fc67498..ea68999afc 100644 --- a/react-infinite/react-infinite-tests.tsx +++ b/react-infinite/react-infinite-tests.tsx @@ -1,6 +1,3 @@ -/// -/// - import * as React from 'react'; import Infinite = require('react-infinite'); diff --git a/react-input-calendar/react-input-calendar-tests.tsx b/react-input-calendar/react-input-calendar-tests.tsx index aaab1dc398..4cd465d9c5 100644 --- a/react-input-calendar/react-input-calendar-tests.tsx +++ b/react-input-calendar/react-input-calendar-tests.tsx @@ -1,6 +1,3 @@ -/// -/// - import * as ReactInputCalendar from 'react-input-calendar'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; diff --git a/react-intl/react-intl-tests.tsx b/react-intl/react-intl-tests.tsx index 400879677f..d3477aaa11 100644 --- a/react-intl/react-intl-tests.tsx +++ b/react-intl/react-intl-tests.tsx @@ -3,8 +3,6 @@ * Updated by Fedor Nezhivoi */ -/// - import * as React from "react" import * as reactMixin from "react-mixin" diff --git a/react-intl/v1/react-intl-tests.tsx b/react-intl/v1/react-intl-tests.tsx index 6abebe36cd..c7834b6583 100644 --- a/react-intl/v1/react-intl-tests.tsx +++ b/react-intl/v1/react-intl-tests.tsx @@ -2,8 +2,6 @@ * Created by Bruno Grieder */ -/// - import * as React from 'react' import * as reactMixin from 'react-mixin' diff --git a/react-mixin/react-mixin-tests.tsx b/react-mixin/react-mixin-tests.tsx index 04f6f4b202..f275869a9e 100644 --- a/react-mixin/react-mixin-tests.tsx +++ b/react-mixin/react-mixin-tests.tsx @@ -1,6 +1,3 @@ - -/// - import reactMixin = require('react-mixin'); import * as React from 'react'; diff --git a/react-native/test/animated.tsx b/react-native/test/animated.tsx index 632f2c0151..3b3457384c 100644 --- a/react-native/test/animated.tsx +++ b/react-native/test/animated.tsx @@ -1,5 +1,3 @@ -/// - import * as React from 'react-native' import { diff --git a/react-native/test/index.tsx b/react-native/test/index.tsx index 6e05cdeabe..32bcbe931b 100644 --- a/react-native/test/index.tsx +++ b/react-native/test/index.tsx @@ -1,8 +1,4 @@ - /* - -Note: This must be compiled with the target set to ES6 - The content of index.io.js could be something like 'use strict'; @@ -12,13 +8,8 @@ The content of index.io.js could be something like AppRegistry.registerComponent('MopNative', () => Welcome); - For a list of complete Typescript examples: check https://github.com/bgrieder/RNTSExplorer - - */ - -/// - +*/ import * as React from 'react-native' import { diff --git a/react-onclickoutside/react-onclickoutside-tests.tsx b/react-onclickoutside/react-onclickoutside-tests.tsx index dabba332b1..fc782bb68c 100644 --- a/react-onclickoutside/react-onclickoutside-tests.tsx +++ b/react-onclickoutside/react-onclickoutside-tests.tsx @@ -1,8 +1,3 @@ -// React onClickOutside Test -// ================================================================================ - -// Imports -// -------------------------------------------------------------------------------- import * as React from "react" import { Component, StatelessComponent, MouseEvent } from "react" import { render } from "react-dom" diff --git a/react-props-decorators/react-props-decorators-tests.ts b/react-props-decorators/react-props-decorators-tests.ts index 562d4f3d12..654c2df98f 100644 --- a/react-props-decorators/react-props-decorators-tests.ts +++ b/react-props-decorators/react-props-decorators-tests.ts @@ -1,6 +1,3 @@ - -/// - import * as React from 'react'; import { propTypes, defaultProps } from 'react-props-decorators'; diff --git a/react-router-bootstrap/react-router-bootstrap-tests.tsx b/react-router-bootstrap/react-router-bootstrap-tests.tsx index d4f8733c03..7816933fe6 100644 --- a/react-router-bootstrap/react-router-bootstrap-tests.tsx +++ b/react-router-bootstrap/react-router-bootstrap-tests.tsx @@ -1,16 +1,8 @@ -// React-Router-Bootstrap Test -// ================================================================================ -/// -/// - -// Imports -// -------------------------------------------------------------------------------- import * as React from 'react'; import { Component, CSSProperties } from 'react'; import { Button } from 'react-bootstrap'; import { LinkContainer, IndexLinkContainer } from 'react-router-bootstrap' - export class ReactRouterBootstrapTest extends Component { callback() { alert('Callback: ' + JSON.stringify(arguments)); @@ -20,7 +12,7 @@ export class ReactRouterBootstrapTest extends Component { let style: CSSProperties = { padding: '50px' }; return (
    - +
    diff --git a/react-scroll/react-scroll-tests.tsx b/react-scroll/react-scroll-tests.tsx index b5d2fb2245..63db573722 100644 --- a/react-scroll/react-scroll-tests.tsx +++ b/react-scroll/react-scroll-tests.tsx @@ -1,5 +1,3 @@ -/// - import * as React from 'react'; import { Link, Element, scroller } from 'react-scroll'; diff --git a/react-spinkit/react-spinkit-tests.tsx b/react-spinkit/react-spinkit-tests.tsx index a163400601..8ceb7b0a89 100644 --- a/react-spinkit/react-spinkit-tests.tsx +++ b/react-spinkit/react-spinkit-tests.tsx @@ -1,6 +1,3 @@ - -/// - import * as Spinner from 'react-spinkit'; import * as React from 'react'; diff --git a/react-tabs/react-tabs-tests.ts b/react-tabs/react-tabs-tests.ts index b067987518..9998bcafbd 100644 --- a/react-tabs/react-tabs-tests.ts +++ b/react-tabs/react-tabs-tests.ts @@ -1,7 +1,3 @@ - -/// -/// - import React = require("react"); import ReactDOM = require("react-dom"); import { Tabs, TabList, Tab, TabPanel } from "react-tabs"; diff --git a/react-tagcloud/react-tagcloud-tests.tsx b/react-tagcloud/react-tagcloud-tests.tsx index d0594314bc..552cc20e2d 100644 --- a/react-tagcloud/react-tagcloud-tests.tsx +++ b/react-tagcloud/react-tagcloud-tests.tsx @@ -1,8 +1,3 @@ -/// -/// - - - // simple cloud import * as React from "react"; import * as ReactDOM from "react-dom"; diff --git a/react-widgets/react-widgets-tests.tsx b/react-widgets/react-widgets-tests.tsx index a108d8e513..0f66458c36 100644 --- a/react-widgets/react-widgets-tests.tsx +++ b/react-widgets/react-widgets-tests.tsx @@ -1,8 +1,3 @@ - -/// -/// - - import * as React from "react" import * as ReactDOM from "react-dom" @@ -45,10 +40,10 @@ class Test extends React.Component, {}> { itemComponent={itemComponent} />
    diff --git a/readdir-stream/readdir-stream-tests.ts b/readdir-stream/readdir-stream-tests.ts index f0a2dba78b..d808bc5b6d 100644 --- a/readdir-stream/readdir-stream-tests.ts +++ b/readdir-stream/readdir-stream-tests.ts @@ -1,6 +1,3 @@ - -/// - import readdir = require('readdir-stream'); var rs: NodeJS.ReadableStream; diff --git a/redux-debounced/redux-debounced-tests.ts b/redux-debounced/redux-debounced-tests.ts index f33050e394..ad83e40bc5 100644 --- a/redux-debounced/redux-debounced-tests.ts +++ b/redux-debounced/redux-debounced-tests.ts @@ -1,5 +1,3 @@ -/// - import { applyMiddleware } from 'redux'; import createDebounce from 'redux-debounced'; diff --git a/redux-devtools-dock-monitor/redux-devtools-dock-monitor-tests.tsx b/redux-devtools-dock-monitor/redux-devtools-dock-monitor-tests.tsx index 5a99ba665a..7e33588a41 100644 --- a/redux-devtools-dock-monitor/redux-devtools-dock-monitor-tests.tsx +++ b/redux-devtools-dock-monitor/redux-devtools-dock-monitor-tests.tsx @@ -1,5 +1,3 @@ -/// - import * as React from 'react' import DockMonitor from 'redux-devtools-dock-monitor' diff --git a/redux-devtools-log-monitor/redux-devtools-log-monitor-tests.tsx b/redux-devtools-log-monitor/redux-devtools-log-monitor-tests.tsx index 48a655bea2..477f4bbc55 100644 --- a/redux-devtools-log-monitor/redux-devtools-log-monitor-tests.tsx +++ b/redux-devtools-log-monitor/redux-devtools-log-monitor-tests.tsx @@ -1,5 +1,3 @@ -/// - import * as React from 'react' import LogMonitor from 'redux-devtools-log-monitor' diff --git a/redux-devtools/redux-devtools-tests.tsx b/redux-devtools/redux-devtools-tests.tsx index 10e20b7e87..695fbe60ff 100644 --- a/redux-devtools/redux-devtools-tests.tsx +++ b/redux-devtools/redux-devtools-tests.tsx @@ -1,6 +1,3 @@ -/// -/// - import * as React from 'react' import { compose, createStore, Reducer, Store, StoreEnhancerStoreCreator } from 'redux' import { Provider } from 'react-redux' diff --git a/resolve/resolve-tests.ts b/resolve/resolve-tests.ts index 3cac830c58..1f9f50b5ee 100644 --- a/resolve/resolve-tests.ts +++ b/resolve/resolve-tests.ts @@ -1,5 +1,3 @@ -/// - import * as fs from 'fs'; import * as resolve from 'resolve'; diff --git a/rx.wamp/rx.wamp-tests.ts b/rx.wamp/rx.wamp-tests.ts index 2b6d4c95bc..3bd6ddbffb 100644 --- a/rx.wamp/rx.wamp-tests.ts +++ b/rx.wamp/rx.wamp-tests.ts @@ -1,6 +1,3 @@ - -/// - import * as autobahn from "autobahn"; import {IWampEvent} from "rx.wamp"; diff --git a/s3-upload-stream/s3-upload-stream-tests.ts b/s3-upload-stream/s3-upload-stream-tests.ts index ef03000ad2..0f02beb63f 100644 --- a/s3-upload-stream/s3-upload-stream-tests.ts +++ b/s3-upload-stream/s3-upload-stream-tests.ts @@ -1,6 +1,3 @@ -/// -/// - import * as fs from 'fs'; import * as S3Stream from 's3-upload-stream'; import * as AWS from 'aws-sdk'; diff --git a/sax/sax-tests.ts b/sax/sax-tests.ts index 4d9a90293d..5b11ab425e 100644 --- a/sax/sax-tests.ts +++ b/sax/sax-tests.ts @@ -1,5 +1,3 @@ -/// - import sax = require("sax"); import fs = require("fs"); diff --git a/seamless/seamless-tests.ts b/seamless/seamless-tests.ts index 4aa1ab3aba..40ba1868be 100644 --- a/seamless/seamless-tests.ts +++ b/seamless/seamless-tests.ts @@ -1,5 +1,3 @@ -/// - /* Create Parent Seamless IFrame */ $('#myiframe').seamless(); $('#myiframe').seamless({ diff --git a/select2/select2-tests.ts b/select2/select2-tests.ts index ade378ee71..c10b482cab 100644 --- a/select2/select2-tests.ts +++ b/select2/select2-tests.ts @@ -1,6 +1,3 @@ -/// - - $("#e9").select2(); $("#e2").select2({ placeholder: "Select a State", diff --git a/selectize/selectize-tests.ts b/selectize/selectize-tests.ts index b2ec9e0a29..10b12c91f2 100644 --- a/selectize/selectize-tests.ts +++ b/selectize/selectize-tests.ts @@ -1,6 +1,3 @@ -/// - - var $input = $(".test-input").selectize(); var testApi = $input[0].selectize; diff --git a/shelljs/shelljs-tests.ts b/shelljs/shelljs-tests.ts index 6c155e5aee..03f439af02 100644 --- a/shelljs/shelljs-tests.ts +++ b/shelljs/shelljs-tests.ts @@ -1,11 +1,5 @@ -// Tests for shelljs.d.ts -// Project: http://shelljs.org -// Definitions by: Niklas Mollenhauer -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Tests taken from documentation samples. -/// - import shell = require("shelljs"); if (!shell.which("git")) diff --git a/sinon-as-promised/sinon-as-promised-tests.ts b/sinon-as-promised/sinon-as-promised-tests.ts index 10602a3e8d..4663c1df12 100644 --- a/sinon-as-promised/sinon-as-promised-tests.ts +++ b/sinon-as-promised/sinon-as-promised-tests.ts @@ -1,5 +1,3 @@ -/// - function testResolve() { sinon.stub().resolves('test val'); } diff --git a/sinon-mongoose/sinon-mongoose-tests.ts b/sinon-mongoose/sinon-mongoose-tests.ts index b58a4e5e58..c64030240e 100644 --- a/sinon-mongoose/sinon-mongoose-tests.ts +++ b/sinon-mongoose/sinon-mongoose-tests.ts @@ -1,5 +1,3 @@ -/// - function testChain() { sinon.stub().chain('exec'); } diff --git a/slick-carousel/slick-carousel-tests.ts b/slick-carousel/slick-carousel-tests.ts index 5cb75a619d..3cf05a2e0c 100644 --- a/slick-carousel/slick-carousel-tests.ts +++ b/slick-carousel/slick-carousel-tests.ts @@ -1,7 +1,3 @@ -/// -/// - - // -------------------------------------------------------- // ------------------- WEBSITE EXAMPLE -------------------- // ---------- http://kenwheeler.github.io/slick/ ---------- diff --git a/slickgrid/test/index.ts b/slickgrid/test/index.ts index e6570c2985..d87bc2240c 100644 --- a/slickgrid/test/index.ts +++ b/slickgrid/test/index.ts @@ -1,6 +1,3 @@ -/// - - interface MyData extends Slick.SlickData { title: string; duration: string; diff --git a/socket.io-redis/socket.io-redis-tests.ts b/socket.io-redis/socket.io-redis-tests.ts index 28b0f9873f..6ced0b31de 100644 --- a/socket.io-redis/socket.io-redis-tests.ts +++ b/socket.io-redis/socket.io-redis-tests.ts @@ -1,5 +1,3 @@ -/// - import socketIO = require('socket.io'); import ioRedis = require('socket.io-redis'); import redis = require('redis'); diff --git a/socket.io.users/socket.io.users-tests.ts b/socket.io.users/socket.io.users-tests.ts index 565f6a7d7b..24557ef6c5 100644 --- a/socket.io.users/socket.io.users-tests.ts +++ b/socket.io.users/socket.io.users-tests.ts @@ -1,7 +1,3 @@ -/// - -/// - var express = require('express'); var app = express(); var httpServer = require('http').createServer(app); diff --git a/source-list-map/source-list-map-tests.ts b/source-list-map/source-list-map-tests.ts index 5fe932efc5..8c367d582c 100644 --- a/source-list-map/source-list-map-tests.ts +++ b/source-list-map/source-list-map-tests.ts @@ -1,4 +1,3 @@ -/// import * as slm from 'source-list-map'; const node = new slm.CodeNode('hello'); diff --git a/spectrum/spectrum-tests.ts b/spectrum/spectrum-tests.ts index e9bf388bbe..e52bd36ce9 100644 --- a/spectrum/spectrum-tests.ts +++ b/spectrum/spectrum-tests.ts @@ -1,6 +1,3 @@ -/// - - $("#picker").spectrum(); $("#picker").spectrum({ diff --git a/split/split-tests.ts b/split/split-tests.ts index 204a044b68..98308fbc10 100644 --- a/split/split-tests.ts +++ b/split/split-tests.ts @@ -1,6 +1,3 @@ - -/// - import stream = require("stream"); import split = require("split"); diff --git a/sql.js/sql.js-tests.ts b/sql.js/sql.js-tests.ts index 0829f7692a..52f44c7438 100644 --- a/sql.js/sql.js-tests.ts +++ b/sql.js/sql.js-tests.ts @@ -1,6 +1,3 @@ -/// - - import fs = require("fs"); import * as SQL from "sql.js"; diff --git a/ss-utils/ss-utils-tests.ts b/ss-utils/ss-utils-tests.ts index 71934fed54..9bbd30da9a 100644 --- a/ss-utils/ss-utils-tests.ts +++ b/ss-utils/ss-utils-tests.ts @@ -1,6 +1,3 @@ -/// - - declare var EventSource : ssutils.IEventSourceStatic; function test_ssutils() { @@ -13,7 +10,7 @@ function test_ssutils() { onHeartbeat: function(msg:ssutils.SSEHeartbeat, e:MessageEvent){}, onJoin: function(msg:ssutils.SSEJoin) {}, onLeave: function(msg:ssutils.SSELeave) {}, - onUpdate: function(msg:ssutils.SSEUpdate) {} + onUpdate: function(msg:ssutils.SSEUpdate) {} }, receivers: { tv: { @@ -26,7 +23,7 @@ function test_ssutils() { announce: function (msg:string) {} }) .on('customEvent', function (e, msg, msgEvent) { }); - + $.ss.handlers["changeChannel"]("home"); } @@ -39,7 +36,7 @@ function test_jQuery_functions(){ overrideMessages: true, messages: {"NotFound": "Not Found"}, errorFilter: function(errorMsg, errorCode, type){} - }); + }); $("form").applyValues({ "Key": "Value" }); @@ -58,8 +55,8 @@ function test_ssutils_Static(){ dateFmt = $.ss.dfmt(new Date(2001,1,1)); dateFmt = $.ss.dfmthm(new Date(2001,1,1)); dateFmt = $.ss.tfmt12(new Date(2001,1,1)); - var parts:string[] = $.ss.splitOnFirst("A;B;C",";"); - parts = $.ss.splitOnLast("A;B;C", ";"); + var parts:string[] = $.ss.splitOnFirst("A;B;C",";"); + parts = $.ss.splitOnLast("A;B;C", ";"); var selectedText = $.ss.getSelection(); var qs:{ [index: string]: string } = $.ss.queryString("http://google.com?a=b&c=d"); var relativePath = $.ss.createUrl("/path/to/{File}", {File:"file.js"}); @@ -69,7 +66,7 @@ function test_ssutils_Static(){ $.ss.normalize({"AA":1,"bB":2,"C":{"A":11,"B":22},"D":[1,2],"E":[{"A":111,"B":222}]}, true); $.ss.parseResponseStatus('{"message":"test"}'); $.ss.postJSON("/path/to/url", {json:"data"}, function(r:any) {}); - + $.ss.listenOn = "click onmousedown"; $.ss.eventReceivers = { "document": document }; $.ss.handlers["changeChannel"]("home"); diff --git a/static-eval/static-eval-tests.ts b/static-eval/static-eval-tests.ts index d4307c50f4..bfe30f723f 100644 --- a/static-eval/static-eval-tests.ts +++ b/static-eval/static-eval-tests.ts @@ -1,5 +1,3 @@ -/// - import evaluate = require('static-eval'); import esprima = require('esprima'); import * as ESTree from 'estree'; diff --git a/stream-to-array/stream-to-array-tests.ts b/stream-to-array/stream-to-array-tests.ts index c011f3e542..6b3ccc84fb 100644 --- a/stream-to-array/stream-to-array-tests.ts +++ b/stream-to-array/stream-to-array-tests.ts @@ -1,6 +1,3 @@ - -/// - import toArray = require('stream-to-array'); var rs: NodeJS.ReadableStream; diff --git a/stylus/stylus-tests.ts b/stylus/stylus-tests.ts index 7c5a8b1e45..248b6a9a04 100644 --- a/stylus/stylus-tests.ts +++ b/stylus/stylus-tests.ts @@ -1,13 +1,9 @@ -/** - * Test suite created by Maxime LUCE - * +/** + * Test suite created by Maxime LUCE + * * Created by using code samples from https://github.com/LearnBoost/stylus/blob/master/docs/js.md. */ -/// - - - import stylus = require("stylus"); var str = "This is a stylus test"; diff --git a/superagent/superagent-tests.ts b/superagent/superagent-tests.ts index 3252b01c96..3b8539ffe5 100644 --- a/superagent/superagent-tests.ts +++ b/superagent/superagent-tests.ts @@ -1,6 +1,3 @@ - -/// - // via: http://visionmedia.github.io/superagent/ import * as request from 'superagent'; diff --git a/supertest-as-promised/supertest-as-promised-tests.ts b/supertest-as-promised/supertest-as-promised-tests.ts index 35cbc68388..23e47ee319 100644 --- a/supertest-as-promised/supertest-as-promised-tests.ts +++ b/supertest-as-promised/supertest-as-promised-tests.ts @@ -29,12 +29,8 @@ request(app) // ... }); -describe("GET /kittens", () => { - it("should work", () => { - return request(app).get("/kittens").expect(200); - }); -}); +request(app).get("/kittens").expect(200); // Agents var agent = request.agent(app); diff --git a/tapable/tapable-tests.ts b/tapable/tapable-tests.ts index fce410defa..60e299b4a0 100644 --- a/tapable/tapable-tests.ts +++ b/tapable/tapable-tests.ts @@ -1,5 +1,3 @@ -/// - import Tapable = require('tapable'); class DllPlugin { diff --git a/tape/tape-tests.ts b/tape/tape-tests.ts index cc51d27ba1..9884ece458 100644 --- a/tape/tape-tests.ts +++ b/tape/tape-tests.ts @@ -1,6 +1,3 @@ - -/// - import tape = require("tape"); var name: string; diff --git a/tar/tar-tests.ts b/tar/tar-tests.ts index 08f304add9..d80e068ace 100644 --- a/tar/tar-tests.ts +++ b/tar/tar-tests.ts @@ -4,8 +4,6 @@ * Created by using code samples from https://github.com/npm/node-tar. */ -/// - import tar = require("tar"); import fs = require("fs"); diff --git a/tether-drop/tether-drop-tests.ts b/tether-drop/tether-drop-tests.ts index b6069bc76b..91df27a484 100644 --- a/tether-drop/tether-drop-tests.ts +++ b/tether-drop/tether-drop-tests.ts @@ -1,4 +1,3 @@ -/// import Drop = require("tether-drop"); var yellowBox = document.querySelector(".yellow"); diff --git a/three/test/canvas/canvas_camera_orthographic.ts b/three/test/canvas/canvas_camera_orthographic.ts index 78476a95b5..2beabf21f9 100644 --- a/three/test/canvas/canvas_camera_orthographic.ts +++ b/three/test/canvas/canvas_camera_orthographic.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/canvas_camera_orthographic.html () => { diff --git a/three/test/canvas/canvas_geometry_cube.ts b/three/test/canvas/canvas_geometry_cube.ts index 46f26b10c5..767ece34b0 100644 --- a/three/test/canvas/canvas_geometry_cube.ts +++ b/three/test/canvas/canvas_geometry_cube.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/canvas_geometry_cube.html () => { diff --git a/three/test/canvas/canvas_interactive_cubes_tween.ts b/three/test/canvas/canvas_interactive_cubes_tween.ts index 6d4cd3fce1..c7427cb07b 100644 --- a/three/test/canvas/canvas_interactive_cubes_tween.ts +++ b/three/test/canvas/canvas_interactive_cubes_tween.ts @@ -1,5 +1,3 @@ -/// -/// /// // https://github.com/mrdoob/three.js/blob/master/examples/canvas_interactive_cubes_tween.html diff --git a/three/test/canvas/canvas_lights_pointlights.ts b/three/test/canvas/canvas_lights_pointlights.ts index 6c028abcf8..55e91d27c8 100644 --- a/three/test/canvas/canvas_lights_pointlights.ts +++ b/three/test/canvas/canvas_lights_pointlights.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/canvas_lights_pointlights.html () => { diff --git a/three/test/canvas/canvas_materials.ts b/three/test/canvas/canvas_materials.ts index 21ca2b3ee1..9af83aff5d 100644 --- a/three/test/canvas/canvas_materials.ts +++ b/three/test/canvas/canvas_materials.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/canvas_materials.html () => { diff --git a/three/test/canvas/canvas_particles_floor.ts b/three/test/canvas/canvas_particles_floor.ts index 71e121e8d0..00d97b8e30 100644 --- a/three/test/canvas/canvas_particles_floor.ts +++ b/three/test/canvas/canvas_particles_floor.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/canvas_particles_floor.html () => { diff --git a/three/test/css3d/css3d_periodictable.ts b/three/test/css3d/css3d_periodictable.ts index 342455ff48..2d68cd2f53 100644 --- a/three/test/css3d/css3d_periodictable.ts +++ b/three/test/css3d/css3d_periodictable.ts @@ -1,6 +1,4 @@ -/// /// -/// // https://github.com/mrdoob/three.js/blob/master/examples/css3d_periodictable.html diff --git a/three/test/css3d/css3d_sprites.ts b/three/test/css3d/css3d_sprites.ts index 49177a9453..41cf22ad47 100644 --- a/three/test/css3d/css3d_sprites.ts +++ b/three/test/css3d/css3d_sprites.ts @@ -1,5 +1,3 @@ -/// -/// /// // https://github.com/mrdoob/three.js/blob/master/examples/css3d_sprites.html diff --git a/three/test/examples/controls/vrcontrols.ts b/three/test/examples/controls/vrcontrols.ts index 1d6e932a0e..2dbc5817da 100644 --- a/three/test/examples/controls/vrcontrols.ts +++ b/three/test/examples/controls/vrcontrols.ts @@ -1,5 +1,3 @@ -/// - var _vrControls = new THREE.VRControls(new THREE.Camera()); _vrControls.update(); diff --git a/three/test/examples/ctm/ctmloader.ts b/three/test/examples/ctm/ctmloader.ts index e35cffb6a4..68e4e28fc0 100644 --- a/three/test/examples/ctm/ctmloader.ts +++ b/three/test/examples/ctm/ctmloader.ts @@ -1,5 +1,3 @@ -/// - let _ctmloader = new THREE.CTMLoader(); _ctmloader.load('https://github.com/mrdoob/three.js/blob/master/examples/models/ctm/ben.ctm', (geo: any) => { console.log(geo.position); diff --git a/three/test/examples/detector.ts b/three/test/examples/detector.ts index b0960c723c..6260f34300 100644 --- a/three/test/examples/detector.ts +++ b/three/test/examples/detector.ts @@ -1,7 +1,3 @@ -/// -/// - - () => { if ( !Detector.canvas || !Detector.webgl || !Detector.workers || !Detector.fileapi ){ var errorElement = Detector.getWebGLErrorMessage(); diff --git a/three/test/examples/effects/vreffect.ts b/three/test/examples/effects/vreffect.ts index 67917a94ae..454d15fdf7 100644 --- a/three/test/examples/effects/vreffect.ts +++ b/three/test/examples/effects/vreffect.ts @@ -1,5 +1,3 @@ -/// - var _vrEffect: THREE.VREffect; _vrEffect = new THREE.VREffect(new THREE.WebGLRenderer({antialias: true}), (error) => { diff --git a/three/test/examples/octree.ts b/three/test/examples/octree.ts index de7de86ac7..d37ef7ba75 100644 --- a/three/test/examples/octree.ts +++ b/three/test/examples/octree.ts @@ -1,5 +1,3 @@ -/// - let _octree = new THREE.Octree({ underferred: false, depthMax: Infinity, diff --git a/three/test/math/test_unit_math.ts b/three/test/math/test_unit_math.ts index c70868b3d8..4a8e0a8c14 100644 --- a/three/test/math/test_unit_math.ts +++ b/three/test/math/test_unit_math.ts @@ -1,6 +1,3 @@ -/// -/// - declare function test(desc: string, body: () => void): void; declare function ok(cond: any, desc?: string): void; declare function deepEqual(a: T, b: T, desc?: string): void; diff --git a/three/test/webgl/webgl_animation_cloth.ts b/three/test/webgl/webgl_animation_cloth.ts index fff733c9c0..0c0ec76ace 100644 --- a/three/test/webgl/webgl_animation_cloth.ts +++ b/three/test/webgl/webgl_animation_cloth.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_animation_cloth.html () => { diff --git a/three/test/webgl/webgl_animation_skinning_morph.ts b/three/test/webgl/webgl_animation_skinning_morph.ts index df085e9ac4..fcea4bba08 100644 --- a/three/test/webgl/webgl_animation_skinning_morph.ts +++ b/three/test/webgl/webgl_animation_skinning_morph.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_sprites.html () => { diff --git a/three/test/webgl/webgl_buffergeometry.ts b/three/test/webgl/webgl_buffergeometry.ts index a747a17d50..0d4f1ee5dd 100644 --- a/three/test/webgl/webgl_buffergeometry.ts +++ b/three/test/webgl/webgl_buffergeometry.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_buffergeometry.html () => { diff --git a/three/test/webgl/webgl_camera.ts b/three/test/webgl/webgl_camera.ts index 66b60a7826..804aba771f 100644 --- a/three/test/webgl/webgl_camera.ts +++ b/three/test/webgl/webgl_camera.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_camera.html () => { diff --git a/three/test/webgl/webgl_custom_attributes.ts b/three/test/webgl/webgl_custom_attributes.ts index 89c25e62cf..c3a5bc6a36 100644 --- a/three/test/webgl/webgl_custom_attributes.ts +++ b/three/test/webgl/webgl_custom_attributes.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_custom_attributes.html () => { diff --git a/three/test/webgl/webgl_geometries.ts b/three/test/webgl/webgl_geometries.ts index 9b23dcfa1f..89e0af480c 100644 --- a/three/test/webgl/webgl_geometries.ts +++ b/three/test/webgl/webgl_geometries.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_geometries.html () => { diff --git a/three/test/webgl/webgl_helpers.ts b/three/test/webgl/webgl_helpers.ts index db8cba89a7..6b955968f4 100644 --- a/three/test/webgl/webgl_helpers.ts +++ b/three/test/webgl/webgl_helpers.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_helpers.html () => { diff --git a/three/test/webgl/webgl_interactive_cubes.ts b/three/test/webgl/webgl_interactive_cubes.ts index 74493a5285..87a9796813 100644 --- a/three/test/webgl/webgl_interactive_cubes.ts +++ b/three/test/webgl/webgl_interactive_cubes.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_interactive_cubes.html () => { diff --git a/three/test/webgl/webgl_interactive_raycasting_points.ts b/three/test/webgl/webgl_interactive_raycasting_points.ts index 6fdb24b6cc..ced8feb6c6 100644 --- a/three/test/webgl/webgl_interactive_raycasting_points.ts +++ b/three/test/webgl/webgl_interactive_raycasting_points.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_sprites.html () => { diff --git a/three/test/webgl/webgl_lensflares.ts b/three/test/webgl/webgl_lensflares.ts index 1d100507a0..1d42762571 100644 --- a/three/test/webgl/webgl_lensflares.ts +++ b/three/test/webgl/webgl_lensflares.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_lensflares.html () => { diff --git a/three/test/webgl/webgl_lights_hemisphere.ts b/three/test/webgl/webgl_lights_hemisphere.ts index 46dd9f7157..108419f4ad 100644 --- a/three/test/webgl/webgl_lights_hemisphere.ts +++ b/three/test/webgl/webgl_lights_hemisphere.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_lights_hemisphere.html () => { diff --git a/three/test/webgl/webgl_lines_colors.ts b/three/test/webgl/webgl_lines_colors.ts index 6b359b2d65..c7d68849f2 100644 --- a/three/test/webgl/webgl_lines_colors.ts +++ b/three/test/webgl/webgl_lines_colors.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_lines_colors.html () => { diff --git a/three/test/webgl/webgl_loader_awd.ts b/three/test/webgl/webgl_loader_awd.ts index 01f21a985e..d1752056fa 100644 --- a/three/test/webgl/webgl_loader_awd.ts +++ b/three/test/webgl/webgl_loader_awd.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_awd.html () => { diff --git a/three/test/webgl/webgl_materials.ts b/three/test/webgl/webgl_materials.ts index f60da797ce..94f91b2fef 100644 --- a/three/test/webgl/webgl_materials.ts +++ b/three/test/webgl/webgl_materials.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_materials.html () => { diff --git a/three/test/webgl/webgl_morphtargets.ts b/three/test/webgl/webgl_morphtargets.ts index 5368dccb91..4dda732da7 100644 --- a/three/test/webgl/webgl_morphtargets.ts +++ b/three/test/webgl/webgl_morphtargets.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_morphtargets.html () => { diff --git a/three/test/webgl/webgl_points_billboards.ts b/three/test/webgl/webgl_points_billboards.ts index 11aa04270b..06fefa6744 100644 --- a/three/test/webgl/webgl_points_billboards.ts +++ b/three/test/webgl/webgl_points_billboards.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_particles_billboards.html () => { diff --git a/three/test/webgl/webgl_postprocessing.ts b/three/test/webgl/webgl_postprocessing.ts index 8c298d66a6..0c768eccea 100644 --- a/three/test/webgl/webgl_postprocessing.ts +++ b/three/test/webgl/webgl_postprocessing.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_postprocessing.html () => { diff --git a/three/test/webgl/webgl_shader.ts b/three/test/webgl/webgl_shader.ts index 249851d534..4a954d36ac 100644 --- a/three/test/webgl/webgl_shader.ts +++ b/three/test/webgl/webgl_shader.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_shader.html () => { diff --git a/three/test/webgl/webgl_sprites.ts b/three/test/webgl/webgl_sprites.ts index 8e71285fac..103d3065c3 100644 --- a/three/test/webgl/webgl_sprites.ts +++ b/three/test/webgl/webgl_sprites.ts @@ -1,6 +1,3 @@ -/// -/// - // https://github.com/mrdoob/three.js/blob/master/examples/webgl_sprites.html () => { diff --git a/through2/through2-tests.ts b/through2/through2-tests.ts index 0cc698d1d3..70a66e4b0e 100644 --- a/through2/through2-tests.ts +++ b/through2/through2-tests.ts @@ -1,6 +1,3 @@ - -/// - import stream = require('stream'); import through2 = require('through2'); diff --git a/through2/v0/through2-tests.ts b/through2/v0/through2-tests.ts index 9308908648..ae1c43a135 100644 --- a/through2/v0/through2-tests.ts +++ b/through2/v0/through2-tests.ts @@ -1,6 +1,3 @@ - -/// - import through2 = require('through2'); var rws: NodeJS.ReadWriteStream; diff --git a/typeahead/typeahead-tests.ts b/typeahead/typeahead-tests.ts index 4f50cb57e2..61d48b6aa9 100644 --- a/typeahead/typeahead-tests.ts +++ b/typeahead/typeahead-tests.ts @@ -1,5 +1,3 @@ -/// - function test_typeahead() { var options: Twitter.Typeahead.Options = {}; var dataset: Twitter.Typeahead.Dataset = { source: null }; diff --git a/uuid-1345/uuid-1345-tests.ts b/uuid-1345/uuid-1345-tests.ts index e3eef2c939..da0876de89 100644 --- a/uuid-1345/uuid-1345-tests.ts +++ b/uuid-1345/uuid-1345-tests.ts @@ -1,6 +1,3 @@ -/// - -'use strict'; import * as UUID from 'uuid-1345'; var uuid:string; diff --git a/valerie/valerie-tests.ts b/valerie/valerie-tests.ts index 227afc246b..b4f6efcdc9 100644 --- a/valerie/valerie-tests.ts +++ b/valerie/valerie-tests.ts @@ -1,15 +1,3 @@ - -/// - -// Tests for valerie.d.ts -// Project: https://github.com/davewatts/valerie -// Definitions by: Howard Richards -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/* - Checks the .d.ts definition work. Not a fully comprehensive set of tests yet. -*/ - /** * Simple enum for enum test */ diff --git a/validator/validator-tests.ts b/validator/validator-tests.ts index c4cee64661..48621f1acd 100644 --- a/validator/validator-tests.ts +++ b/validator/validator-tests.ts @@ -1,8 +1,5 @@ -/// - import * as validator from 'validator'; - /************************************************ * * * IMPORT TESTS * diff --git a/vex-js/vex-js-tests.ts b/vex-js/vex-js-tests.ts index d4af6e9e6a..2f89745157 100644 --- a/vex-js/vex-js-tests.ts +++ b/vex-js/vex-js-tests.ts @@ -1,4 +1,3 @@ -/// import vex = require("vex-js"); var vexContent = vex.open({ diff --git a/vinyl/vinyl-tests.ts b/vinyl/vinyl-tests.ts index bb705b7b2b..f9e71dd532 100644 --- a/vinyl/vinyl-tests.ts +++ b/vinyl/vinyl-tests.ts @@ -1,8 +1,4 @@ /// -/// -/// - -'use strict'; import * as fs from 'fs'; import * as path from 'path'; diff --git a/voronoi-diagram/voronoi-diagram-tests.ts b/voronoi-diagram/voronoi-diagram-tests.ts index 31b261e1ce..97f04a37de 100644 --- a/voronoi-diagram/voronoi-diagram-tests.ts +++ b/voronoi-diagram/voronoi-diagram-tests.ts @@ -1,5 +1,3 @@ -/// - import voronoi = require("voronoi-diagram"); const x: voronoi.Point = [1, 2]; diff --git a/wake_on_lan/wake_on_lan-tests.ts b/wake_on_lan/wake_on_lan-tests.ts index 3403d5c9fe..e8391a5765 100644 --- a/wake_on_lan/wake_on_lan-tests.ts +++ b/wake_on_lan/wake_on_lan-tests.ts @@ -1,6 +1,3 @@ - -/// - import wol = require('wake_on_lan'); wol.wake("20:DE:20:DE:20:DE"); diff --git a/webgme/webgme-tests.ts b/webgme/webgme-tests.ts index d009e936e4..e6f315a3ef 100644 --- a/webgme/webgme-tests.ts +++ b/webgme/webgme-tests.ts @@ -1,13 +1,9 @@ - -/// -/// - /** * In actual usage the MetaDataStr would most likely * be initialized with an import... - * + * import MetaDataStr = require("text!metadata.json"); - * + * * Which would require a declaration, like... * `text.d.ts` * @@ -26,7 +22,7 @@ import * as fs from "fs"; import * as stream from "stream"; import * as Common from "webgme/common"; -/** +/** * The following items are not created directly by the * plugin driver. * @@ -41,14 +37,14 @@ let destinationNode = new Common.Node(); /** * These tests are derived from... * https://github.com/webgme/webgme/wiki/GME-Core-API - * - * Nearly all core functions takes a CoreNode as its first argument. - * When using the Core API externally each CoreNode corresponds - * to one node/model in the project tree. - * To access data from the node the Core API should be used - * and the properties on the CoreNode itself should + * + * Nearly all core functions takes a CoreNode as its first argument. + * When using the Core API externally each CoreNode corresponds + * to one node/model in the project tree. + * To access data from the node the Core API should be used + * and the properties on the CoreNode itself should * not be accessed or modified directly. - * + * * Below follows a handpicked selection of basic core functions. */ @@ -111,7 +107,7 @@ function test_core_containment_traversal() { }); } -/** +/** * https://github.com/webgme/webgme/wiki/GME-Core-API#containment-methods */ function test_core_containment_methods() { @@ -158,7 +154,7 @@ function test_core_containment_methods() { // Here we have access to the node. }); - // Loading an entire sub-tree of nodes + // Loading an entire sub-tree of nodes // N.B. this requires all nodes to be loaded at the same time. // For larger models core.traverse is preferred. self.core.loadSubTree(node, (err, nodes) => { @@ -176,7 +172,7 @@ function test_core_containment_methods() { function test_core_pointers_connections() { - // + // let isConn = self.core.isConnection(connNode); // Get the path of the node that is pointed to, via 'src', from connNode. @@ -215,16 +211,16 @@ function test_core_pointers_connections() { /** * https://github.com/webgme/webgme/wiki/GME-Blob-Storage-API - * - * File-like objects/artifacts - * (which are neither a meta archetype model, nor an instance model) - * are stored separately from the WebGME meta-models and models. - * An example of such an artifact would be a resource - * file that is associated with a model + * + * File-like objects/artifacts + * (which are neither a meta archetype model, nor an instance model) + * are stored separately from the WebGME meta-models and models. + * An example of such an artifact would be a resource + * file that is associated with a model * (e.g., data for an instance model, or a generated artifact from analyzing a model). - * - * One reason for treating these objects differently is that they do not conform to the data model, - * and they might not be well-suited for storage in a database + * + * One reason for treating these objects differently is that they do not conform to the data model, + * and they might not be well-suited for storage in a database * (the Blob is suited to handle binary objects of any size and structure). */ @@ -242,22 +238,22 @@ function test_client_creating_an_instance() { /** * https://github.com/webgme/webgme/wiki/GME-Blob-Storage-API - * - * File-like objects/artifacts - * (which are neither a meta archetype model, nor an instance model) - * are stored separately from the WebGME meta-models and models. - * An example of such an artifact would be a resource - * file that is associated with a model + * + * File-like objects/artifacts + * (which are neither a meta archetype model, nor an instance model) + * are stored separately from the WebGME meta-models and models. + * An example of such an artifact would be a resource + * file that is associated with a model * (e.g., data for an instance model, or a generated artifact from analyzing a model). - * - * One reason for treating these objects differently is that they do not conform to the data model, - * and they might not be well-suited for storage in a database + * + * One reason for treating these objects differently is that they do not conform to the data model, + * and they might not be well-suited for storage in a database * (the Blob is suited to handle binary objects of any size and structure). */ -/** +/** * The following items are not created directly by the * plugin driver. * @@ -338,7 +334,7 @@ type DictionaryAny = { [key: string]: any }; /** * Visit the node and perform the function. * Related example using traverse. -* https://github.com/webgme/xmi-tools/blob/master/src/plugins/XMIExporter/XMIExporter.js#L430 +* https://github.com/webgme/xmi-tools/blob/master/src/plugins/XMIExporter/XMIExporter.js#L430 */ function test_core_containment_traversal_complete() { const BLANK = ""; @@ -382,7 +378,7 @@ function test_core_containment_traversal_complete() { /** * A filter mechanism to effectively eliminate containment branches. - * Any path included in the prune-list will be the root of a + * Any path included in the prune-list will be the root of a * pruned subtree. */ let pruneList: string[] = []; diff --git a/webpack-sources/webpack-sources-tests.ts b/webpack-sources/webpack-sources-tests.ts index 622f12cb8e..16c915516b 100644 --- a/webpack-sources/webpack-sources-tests.ts +++ b/webpack-sources/webpack-sources-tests.ts @@ -1,5 +1,3 @@ -/// - import { CachedSource, ConcatSource, diff --git a/x-editable/x-editable-tests.ts b/x-editable/x-editable-tests.ts index c4c03a46be..3c121b8528 100644 --- a/x-editable/x-editable-tests.ts +++ b/x-editable/x-editable-tests.ts @@ -1,10 +1,3 @@ -// Type definitions for X-Editable v1.5.1 -// Project: http://vitalets.github.io/x-editable/index.html -// Definitions by: Chris Kirby -// Definitions: https://github.com/sirkirby/DefinitelyTyped - -/// - // server post and response $('#username').editable({ success: function(response : any, newValue : any) { diff --git a/xmlpoke/xmlpoke-tests.ts b/xmlpoke/xmlpoke-tests.ts index 3c82b846a6..aba04c0962 100644 --- a/xmlpoke/xmlpoke-tests.ts +++ b/xmlpoke/xmlpoke-tests.ts @@ -1,7 +1,3 @@ -/// - -// tsc xmlpoke-tests.ts && node xmlpoke-tests.js - import * as xmlpoke from 'xmlpoke'; import * as assert from 'assert'; diff --git a/xrm/v7/xrm-tests.ts b/xrm/v7/xrm-tests.ts index 1b82805648..1c8288fae4 100644 --- a/xrm/v7/xrm-tests.ts +++ b/xrm/v7/xrm-tests.ts @@ -1,5 +1,3 @@ -/// - /// Demonstrate usage in the browser's window object window.Xrm.Utility.alertDialog( "message", () => {} ); From f0b18c41f7d00a0c7cc09541e7337c40f1381478 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 10 Mar 2017 07:56:11 -0800 Subject: [PATCH 123/567] mobservable provides its own types (#14776) --- mendixmodelsdk/index.d.ts | 182 ++++++++++++++++++++++++++++++- mobservable/index.d.ts | 178 ------------------------------ mobservable/mobservable-tests.ts | 56 ---------- mobservable/tsconfig.json | 25 ----- mobservable/tslint.json | 6 - notNeededPackages.json | 6 + 6 files changed, 187 insertions(+), 266 deletions(-) delete mode 100644 mobservable/index.d.ts delete mode 100644 mobservable/mobservable-tests.ts delete mode 100644 mobservable/tsconfig.json delete mode 100644 mobservable/tslint.json diff --git a/mendixmodelsdk/index.d.ts b/mendixmodelsdk/index.d.ts index 29192f4bc4..d75cdb97aa 100644 --- a/mendixmodelsdk/index.d.ts +++ b/mendixmodelsdk/index.d.ts @@ -207,8 +207,188 @@ limitations under the License. */ +// Outdated mobservable typings. +// TODO: Use the types bundled with mobservable. Or use mobx. + +interface _IMobservableStatic { + /** + * Turns an object, array or function into a reactive structure. + * @param value the value which should become observable. + */ + makeReactive: IMakeReactive; + + /** + * Extends an object with reactive capabilities. + * @param target the object to which reactive properties should be added + * @param properties the properties that should be added and made reactive + * @returns targer + */ + extendReactive(target: Object, properties: Object):Object; + + /** + * Returns true if the provided value is reactive. + * @param value object, function or array + * @param propertyName if propertyName is specified, checkes whether value.propertyName is reactive. + */ + isReactive(value: any, propertyName?:string): boolean; + + /** + * Can be used in combination with makeReactive / extendReactive. + * Enforces that a reference to 'value' is stored as property, + * but that 'value' itself is not turned into something reactive. + * Future assignments to the same property will inherit this behavior. + * @param value initial value of the reactive property that is being defined. + */ + asReference(value: any):{value:T}; + + /** + * ES6 / Typescript decorator which can to make class properties and getter functions reactive. + */ + observable(target: Object, key: string):any; // decorator / annotation + + /** + * Creates a reactive view and keeps it alive, so that the view is always + * updated if one of the dependencies changes, even when the view is not further used by something else. + * @param func The reactive view + * @param scope (optional) + * @returns disposer function, which can be used to stop the view from being updated in the future. + */ + observe(func: Mobservable.Lambda, scope?: any): Mobservable.Lambda; + + /** + * Deprecated, use mobservable.observe instead. + */ + sideEffect(func: Mobservable.Lambda, scope?: any): Mobservable.Lambda; + + /** + * Similar to 'observer', observes the given predicate until it returns true. + * Once it returns true, the 'effect' function is invoked an the observation is cancelled. + * @param predicate + * @param effect + * @param scope (optional) + * @returns disposer function to prematurely end the observer. + */ + observeUntil(predicate: ()=>boolean, effect: Mobservable.Lambda, scope?: any): Mobservable.Lambda; + + /** + * During a transaction no views are updated until the end of the transaction. + * The transaction will be run synchronously nonetheless. + * @param action a function that updates some reactive state + * @returns any value that was returned by the 'action' parameter. + */ + transaction(action: ()=>T): T; + + /** + * Converts a reactive structure into a non-reactive structure. + * Basically a deep-clone. + */ + toJSON(value: T): T; + + /** + * Sets the reporting level Defaults to 1. Use 0 for production or 2 for increased verbosity. + */ + logLevel: number; // 0 = production, 1 = development, 2 = debugging + + extras: { + getDependencyTree(thing:any, property?:string): Mobservable.IDependencyTree; + + getObserverTree(thing:any, property?:string): Mobservable.IObserverTree; + + trackTransitions(extensive?:boolean, onReport?:(lines:Mobservable.ITransitionEvent) => void) : Mobservable.Lambda; + } +} + +interface IMakeReactive { + (value: T[], opts?: Mobservable.IMakeReactiveOptions): Mobservable.IObservableArray; + (value: ()=>T, opts?: Mobservable.IMakeReactiveOptions): Mobservable.IObservableValue; + (value: T, opts?: Mobservable.IMakeReactiveOptions): Mobservable.IObservableValue; + (value: Object, opts?: Mobservable.IMakeReactiveOptions): T; +} + +interface IMobservableStatic extends _IMobservableStatic, IMakeReactive { +} + +declare namespace Mobservable { + interface IMakeReactiveOptions { + as?: string /* "auto" | "reference" | TODO: see #8 "structure" */ + scope?: Object, + context?: Object, + recurse?: boolean; + name?: string; + // protected: boolean TODO: see #9 + } + + export interface IContextInfoStruct { + object: Object; + name: string; + } + + export type IContextInfo = IContextInfoStruct | string; + + interface Lambda { + (): void; + name?: string; + } + + interface IObservable { + observe(callback: (...args: any[])=>void, fireImmediately?: boolean): Lambda; + } + + interface IObservableValue extends IObservable { + (): T; + (value: T):void; + observe(callback: (newValue: T, oldValue: T)=>void, fireImmediately?: boolean): Lambda; + } + + interface IObservableArray extends IObservable, Array { + spliceWithArray(index: number, deleteCount?: number, newItems?: T[]): T[]; + observe(listener: (changeData: IArrayChange|IArraySplice)=>void, fireImmediately?: boolean): Lambda; + clear(): T[]; + replace(newItems: T[]): T[]; + find(predicate: (item: T,index: number,array: IObservableArray)=>boolean,thisArg?: any,fromIndex?: number): T; + remove(value: T): boolean; + } + + interface IArrayChange { + type: string; // Always: 'update' + object: IObservableArray; + index: number; + oldValue: T; + } + + interface IArraySplice { + type: string; // Always: 'splice' + object: IObservableArray; + index: number; + removed: T[]; + addedCount: number; + } + + interface IDependencyTree { + id: number; + name: string; + context: any; + dependencies?: IDependencyTree[]; + } + + interface IObserverTree { + id: number; + name: string; + context: any; + observers?: IObserverTree[]; + listeners?: number; // amount of functions manually attached using an .observe method + } + + interface ITransitionEvent { + id: number; + name: string; + context: Object; + state: string; + changed: boolean; + newValue: string; + } +} -/// declare module "mendixmodelsdk" { namespace sdk { namespace internal { diff --git a/mobservable/index.d.ts b/mobservable/index.d.ts deleted file mode 100644 index 719eddaf31..0000000000 --- a/mobservable/index.d.ts +++ /dev/null @@ -1,178 +0,0 @@ -// Type definitions for mobservable 0.6 -// Project: https://mweststrate.github.io/mobservable -// Definitions by: Michel Weststrate -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace Mobservable { - interface Static extends MakeReactive { - /** - * Turns an object, array or function into a reactive structure. - * @param value the value which should become observable. - */ - makeReactive: MakeReactive; - - /** - * Extends an object with reactive capabilities. - * @param target the object to which reactive properties should be added - * @param properties the properties that should be added and made reactive - * @returns targer - */ - extendReactive(target: Object, properties: Object): Object; - - /** - * Returns true if the provided value is reactive. - * @param value object, function or array - * @param propertyName if propertyName is specified, checkes whether value.propertyName is reactive. - */ - isReactive(value: any, propertyName?: string): boolean; - - /** - * Can be used in combination with makeReactive / extendReactive. - * Enforces that a reference to 'value' is stored as property, - * but that 'value' itself is not turned into something reactive. - * Future assignments to the same property will inherit this behavior. - * @param value initial value of the reactive property that is being defined. - */ - asReference(value: any): {value: T}; - - /** - * ES6 / Typescript decorator which can to make class properties and getter functions reactive. - */ - observable(target: Object, key: string): any; // decorator / annotation - - /** - * Creates a reactive view and keeps it alive, so that the view is always - * updated if one of the dependencies changes, even when the view is not further used by something else. - * @param func The reactive view - * @param scope (optional) - * @returns disposer function, which can be used to stop the view from being updated in the future. - */ - observe(func: Mobservable.Lambda, scope?: any): Mobservable.Lambda; - - /** - * Deprecated, use mobservable.observe instead. - */ - sideEffect(func: Mobservable.Lambda, scope?: any): Mobservable.Lambda; - - /** - * Similar to 'observer', observes the given predicate until it returns true. - * Once it returns true, the 'effect' function is invoked an the observation is cancelled. - * @param predicate - * @param effect - * @param scope (optional) - * @returns disposer function to prematurely end the observer. - */ - observeUntil(predicate: () => boolean, effect: Mobservable.Lambda, scope?: any): Mobservable.Lambda; - - /** - * During a transaction no views are updated until the end of the transaction. - * The transaction will be run synchronously nonetheless. - * @param action a function that updates some reactive state - * @returns any value that was returned by the 'action' parameter. - */ - transaction(action: () => T): T; - - /** - * Converts a reactive structure into a non-reactive structure. - * Basically a deep-clone. - */ - toJSON(value: T): T; - - /** - * Sets the reporting level Defaults to 1. Use 0 for production or 2 for increased verbosity. - */ - logLevel: number; // 0 = production, 1 = development, 2 = debugging - - extras: { - getDependencyTree(thing: any, property?: string): Mobservable.DependencyTree; - - getObserverTree(thing: any, property?: string): Mobservable.ObserverTree; - - trackTransitions(extensive?: boolean, onReport?: (lines: Mobservable.TransitionEvent) => void): Mobservable.Lambda; - }; - } - - interface MakeReactive { - (value: T[], opts?: Mobservable.MakeReactiveOptions): Mobservable.ObservableArray; - (value: () => T, opts?: Mobservable.MakeReactiveOptions): Mobservable.ObservableValue; - (value: T, opts?: Mobservable.MakeReactiveOptions): Mobservable.ObservableValue; - (value: Object, opts?: Mobservable.MakeReactiveOptions): T; - } - - interface MakeReactiveOptions { - as?: string; /* "auto" | "reference" | TODO: see #8 "structure" */ - scope?: Object; - context?: Object; - recurse?: boolean; - name?: string; - // protected: boolean TODO: see #9 - } - - type ContextInfo = { object: Object; name: string } | string; - - interface Lambda { - (): void; - name?: string; - } - - interface Observable { - observe(callback: (...args: any[]) => void, fireImmediately?: boolean): Lambda; - } - - interface ObservableValue extends Observable { - (): T; - (value: T): void; - observe(callback: (newValue: T, oldValue: T) => void, fireImmediately?: boolean): Lambda; - } - - interface ObservableArray extends Observable, Array { - spliceWithArray(index: number, deleteCount?: number, newItems?: T[]): T[]; - observe(listener: (changeData: ArrayChange|ArraySplice) => void, fireImmediately?: boolean): Lambda; - clear(): T[]; - replace(newItems: T[]): T[]; - find(predicate: (item: T, index: number, array: ObservableArray) => boolean, thisArg?: any, fromIndex?: number): T; - remove(value: T): boolean; - } - - interface ArrayChange { - type: string; // Always: 'update' - object: ObservableArray; - index: number; - oldValue: T; - } - - interface ArraySplice { - type: string; // Always: 'splice' - object: ObservableArray; - index: number; - removed: T[]; - addedCount: number; - } - - interface DependencyTree { - id: number; - name: string; - context: any; - dependencies?: DependencyTree[]; - } - - interface ObserverTree { - id: number; - name: string; - context: any; - observers?: ObserverTree[]; - listeners?: number; // amount of functions manually attached using an .observe method - } - - interface TransitionEvent { - id: number; - name: string; - context: Object; - state: string; - changed: boolean; - newValue: string; - } -} - -declare const Mobservable: Mobservable.Static; -export = Mobservable; diff --git a/mobservable/mobservable-tests.ts b/mobservable/mobservable-tests.ts deleted file mode 100644 index 060f0d14b3..0000000000 --- a/mobservable/mobservable-tests.ts +++ /dev/null @@ -1,56 +0,0 @@ -import mobservable = require('mobservable'); -import {observable} from "mobservable"; - -var v = mobservable(3); -v.observe(() => {}); - -var a = mobservable([1, 2, 3]); - -class Order { - @observable price: number = 3; - @observable amount: number = 2; - @observable orders: string[] = []; - - @observable get total() { - return this.amount * this.price * (1 + this.orders.length); - } -} - -export function testObservable() { - var a = mobservable(3); - var b = mobservable(() => a() * 2); -} - -export function testAnnotations() { - var order1totals: number[] = []; - var order1 = new Order(); - var order2 = new Order(); - - var disposer = mobservable.observe(() => { - order1totals.push(order1.total); - }); - - order2.price = 4; - order1.amount = 1; - - order2.orders.push('bla'); - - order1.orders.splice(0, 0, 'boe', 'hoi'); - - disposer(); - order1.orders.pop(); -}; - -export function testTyping() { - var ar: mobservable.ObservableArray = mobservable.makeReactive([1, 2]); - ar.observe((d: mobservable.ArrayChange | mobservable.ArraySplice) => { - console.log(d.type); - }); - - var ar2: mobservable.ObservableArray = mobservable([1, 2]); - ar2.observe((d: mobservable.ArrayChange | mobservable.ArraySplice) => { - console.log(d.type); - }); - - var x: mobservable.ObservableValue = mobservable(3); -} \ No newline at end of file diff --git a/mobservable/tsconfig.json b/mobservable/tsconfig.json deleted file mode 100644 index cee6db4b01..0000000000 --- a/mobservable/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "experimentalDecorators": true, - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "mobservable-tests.ts" - ] -} \ No newline at end of file diff --git a/mobservable/tslint.json b/mobservable/tslint.json deleted file mode 100644 index f05741c59b..0000000000 --- a/mobservable/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "../tslint.json", - "rules": { - "forbidden-types": false - } -} diff --git a/notNeededPackages.json b/notNeededPackages.json index fce0ef50f0..f0619f8e79 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -329,6 +329,12 @@ "typingsPackageName": "fine-uploader", "sourceRepoURL": "http://fineuploader.com/", "asOfVersion": "5.14.0" + }, + { + "libraryName": "mobservable", + "typingsPackageName": "mobservable", + "sourceRepoURL": "github.com/mweststrate/mobservable", + "asOfVersion": "1.2.5" } ] } \ No newline at end of file From e466571159287b9cbab031fc0b4f919a95694c12 Mon Sep 17 00:00:00 2001 From: voxmatt Date: Fri, 10 Mar 2017 10:29:12 -0800 Subject: [PATCH 124/567] a bunch of updates in response to code review --- react-relay/index.d.ts | 16 +++++++++------- react-relay/react-relay-tests.tsx | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/react-relay/index.d.ts b/react-relay/index.d.ts index 0f6dbba024..961acbccc2 100644 --- a/react-relay/index.d.ts +++ b/react-relay/index.d.ts @@ -7,6 +7,8 @@ declare module "react-relay" { import * as React from "react"; + type ClientMutationID = string; + /** Fragments are a hash of functions */ interface Fragments { [query: string]: ((variables?: RelayVariables) => string) @@ -40,13 +42,13 @@ declare module "react-relay" { class RelayMutationTransaction { applyOptimistic(): RelayMutationTransaction; - commit(): RelayMutationTransaction; + commit(): RelayMutationTransaction | null; recommit(): void; rollback(): void; getError(): Error; getStatus(): RelayMutationStatus; getHash(): string; - getID(): string; + getID(): ClientMutationID; } interface RelayMutationRequest { @@ -147,12 +149,12 @@ declare module "react-relay" { interface RelayProp { route: { name: string; }; // incomplete, also has params and queries - variables: any; - pendingVariables?: any; + variables: Object; + pendingVariables?: Object | null; setVariables(variables: Object, onReadyStateChange?: OnReadyStateChange): void; forceFetch(variables: Object, onReadyStateChange?: OnReadyStateChange): void; - hasOptimisticUpdate(record?: any): boolean; - getPendingTransactions(record?: any): RelayMutationTransaction[]; - commitUpdate?: (mutation: Mutation, callbacks?: StoreUpdateCallbacks) => any; + hasOptimisticUpdate(record: Object): boolean; + getPendingTransactions(record: Object): RelayMutationTransaction[]; + commitUpdate: (mutation: Mutation, callbacks?: StoreUpdateCallbacks) => any; } } diff --git a/react-relay/react-relay-tests.tsx b/react-relay/react-relay-tests.tsx index fa27f10c01..091909cabd 100644 --- a/react-relay/react-relay-tests.tsx +++ b/react-relay/react-relay-tests.tsx @@ -84,6 +84,7 @@ class StubbedArtwork extends React.Component { forceFetch: () => {}, hasOptimisticUpdate: () => false, getPendingTransactions: (): Relay.RelayMutationTransaction[] => undefined, + commitUpdate: () => {}, } } return From e31e8a857b42de4d54fd27780b12431cc1e7c92c Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Fri, 10 Mar 2017 14:14:59 -0800 Subject: [PATCH 125/567] Fix the `cookie` module definition (#15111) --- cookie/cookie-tests.ts | 4 +- cookie/index.d.ts | 118 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 106 insertions(+), 16 deletions(-) diff --git a/cookie/cookie-tests.ts b/cookie/cookie-tests.ts index 2581a5c372..dd5be0f850 100644 --- a/cookie/cookie-tests.ts +++ b/cookie/cookie-tests.ts @@ -17,7 +17,7 @@ function test_parse(): void { } function test_options(): void { - var serializeOptions: CookieSerializeOptions = { + var serializeOptions: cookie.CookieSerializeOptions = { encode: (x: string) => x, path: '/', expires: new Date(), @@ -27,7 +27,7 @@ function test_options(): void { httpOnly: false }; - var parseOptios: CookieParseOptions = { + var parseOptios: cookie.CookieParseOptions = { decode: (x: string) => x }; } diff --git a/cookie/index.d.ts b/cookie/index.d.ts index 950796fa22..507eaee01d 100644 --- a/cookie/index.d.ts +++ b/cookie/index.d.ts @@ -1,28 +1,118 @@ -// Type definitions for cookie v0.1.2 +// Type definitions for cookie v0.3.0 // Project: https://github.com/jshttp/cookie // Definitions by: Pine Mizune // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface CookieSerializeOptions { - encode?: (val: string) => string; - path?: string; - expires?: Date; - maxAge?: number; + /** + * Specifies the value for the Domain Set-Cookie attribute. By default, no + * domain is set, and most clients will consider the cookie to apply to only + * the current domain. + */ domain?: string; - secure?: boolean; + /** + * Specifies a function that will be used to encode a cookie's value. Since + * value of a cookie has a limited character set (and must be a simple + * string), this function can be used to encode a value into a string suited + * for a cookie's value. + * + * The default function is the global `encodeURIComponent`, which will + * encode a JavaScript string into UTF-8 byte sequences and then URL-encode + * any that fall outside of the cookie range. + */ + encode?: (val: string) => string; + /** + * Specifies the `Date` object to be the value for the `Expires` + * `Set-Cookie` attribute. By default, no expiration is set, and most + * clients will consider this a "non-persistent cookie" and will delete it + * on a condition like exiting a web browser application. + * + * *Note* the cookie storage model specification states that if both + * `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is + * possible not all clients by obey this, so if both are set, they should + * point to the same date and time. + */ + expires?: Date; + /** + * Specifies the boolean value for the `HttpOnly` `Set-Cookie` attribute. + * When truthy, the `HttpOnly` attribute is set, otherwise it is not. By + * default, the `HttpOnly` attribute is not set. + * + * *Note* be careful when setting this to true, as compliant clients will + * not allow client-side JavaScript to see the cookie in `document.cookie`. + */ httpOnly?: boolean; + /** + * Specifies the number (in seconds) to be the value for the `Max-Age` + * `Set-Cookie` attribute. The given number will be converted to an integer + * by rounding down. By default, no maximum age is set. + * + * *Note* the cookie storage model specification states that if both + * `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is + * possible not all clients by obey this, so if both are set, they should + * point to the same date and time. + */ + maxAge?: number; + /** + * Specifies the value for the `Path` `Set-Cookie` attribute. By default, + * the path is considered the "default path". + */ + path?: string; + /** + * Specifies the boolean or string to be the value for the `SameSite` + * `Set-Cookie` attribute. + * + * - `true` will set the `SameSite` attribute to `Strict` for strict same + * site enforcement. + * - `false` will not set the `SameSite` attribute. + * - `'lax'` will set the `SameSite` attribute to Lax for lax same site + * enforcement. + * - `'strict'` will set the `SameSite` attribute to Strict for strict same + * site enforcement. + */ + sameSite?: boolean | 'lax' | 'strict'; + /** + * Specifies the boolean value for the `Secure` `Set-Cookie` attribute. When + * truthy, the `Secure` attribute is set, otherwise it is not. By default, + * the `Secure` attribute is not set. + * + * *Note* be careful when setting this to `true`, as compliant clients will + * not send the cookie back to the server in the future if the browser does + * not have an HTTPS connection. + */ + secure?: boolean; } interface CookieParseOptions { + /** + * Specifies a function that will be used to decode a cookie's value. Since + * the value of a cookie has a limited character set (and must be a simple + * string), this function can be used to decode a previously-encoded cookie + * value into a JavaScript string or other object. + * + * The default function is the global `decodeURIComponent`, which will decode + * any URL-encoded sequences into their byte representations. + * + * *Note* if an error is thrown from this function, the original, non-decoded + * cookie value will be returned as the cookie's value. + */ decode?: (val: string) => string; } -interface CookieStatic { - serialize(name: string, val: string, options?: CookieSerializeOptions): string; - parse(str: string, options?: CookieParseOptions): { [key: string]: string }; -} +/** + * Parse an HTTP Cookie header string and returning an object of all cookie + * name-value pairs. + * + * @param str the string representing a `Cookie` header value + * @param options object containing parsing options + */ +export function parse(str: string, options?: CookieParseOptions): { [key: string]: string }; -declare module "cookie" { - var cookie: CookieStatic; - export = cookie; -} +/** + * Serialize a cookie name-value pair into a `Set-Cookie` header string. + * + * @param name the name for the cookie + * @param val value to set the cookie to + * @param options object containing serialization options + */ +export function serialize(name: string, val: string, options?: CookieSerializeOptions): string; From 8dd753de5a1e97fe75d9d25df3d78c227c409309 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 10 Mar 2017 14:16:40 -0800 Subject: [PATCH 126/567] core-js: Lint and use "lib" to eliminate unnecessary code. (#15108) --- core-js/core-js-tests.ts | 10 +- core-js/index.d.ts | 937 ++------------------------------------- core-js/tsconfig.json | 5 +- core-js/tslint.json | 6 + 4 files changed, 56 insertions(+), 902 deletions(-) create mode 100644 core-js/tslint.json diff --git a/core-js/core-js-tests.ts b/core-js/core-js-tests.ts index 42cd770b86..0614b117b9 100644 --- a/core-js/core-js-tests.ts +++ b/core-js/core-js-tests.ts @@ -8,7 +8,7 @@ let s: string; let i: number; let b: boolean; let f: () => void; -let o: Object; +let o: {}; let r: RegExp; let sym: symbol; let e: Error; @@ -21,7 +21,7 @@ let arrayOfPoint3D: Point3D[]; let arrayOfSymbol: symbol[]; let arrayOfPropertyKey: PropertyKey[]; let arrayOfAny: any[]; -let arrayOfStringAny: [string, any][]; +let arrayOfStringAny: Array<[string, any]>; let arrayLikeOfAny: ArrayLike; let iterableOfPoint: Iterable; let iterableOfStringPoint: Iterable<[string, Point]>; @@ -57,7 +57,7 @@ let dictOfAny: Dict; // ############################################################################################# // ECMAScript 6: Object & Function -// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of, +// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of, // es6.object.to-string, es6.function.name and es6.function.has-instance. // ############################################################################################# @@ -88,8 +88,8 @@ arrayOfPoint = Array.of(point, point); // ############################################################################################# // ECMAScript 6: String & RegExp -// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at, -// es6.string.ends-with, es6.string.includes, es6.string.repeat, +// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at, +// es6.string.ends-with, es6.string.includes, es6.string.repeat, // es6.string.starts-with, and es6.regexp // ############################################################################################# diff --git a/core-js/index.d.ts b/core-js/index.d.ts index a0a10708d9..4191cd11aa 100644 --- a/core-js/index.d.ts +++ b/core-js/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for core-js v0.9.7 +// Type definitions for core-js 0.9 // Project: https://github.com/zloirock/core-js/ // Definitions by: Ron Buckton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /* ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. @@ -18,539 +19,12 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -declare type PropertyKey = string | number | symbol; - -// ############################################################################################# -// ECMAScript 6: Object & Function -// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of, -// es6.object.to-string, es6.function.name and es6.function.has-instance. -// ############################################################################################# - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - * @remarks Requires `__proto__` support. - */ - setPrototypeOf(o: any, proto: any): any; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - name: string; - - /** - * Determines if a constructor object recognizes an object as one of the - * constructor’s instances. - * @param value The object to test. - */ - [Symbol.hasInstance](value: any): boolean; -} - -// ############################################################################################# -// ECMAScript 6: Array -// Modules: es6.array.from, es6.array.of, es6.array.copy-within, es6.array.fill, es6.array.find, -// and es6.array.find-index -// ############################################################################################# - -interface Array { - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): T[]; - - [Symbol.unscopables]: any; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -// ############################################################################################# -// ECMAScript 6: String & RegExp -// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at, -// es6.string.ends-with, es6.string.includes, es6.string.repeat, -// es6.string.starts-with, and es6.regexp -// ############################################################################################# - -interface String { - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} - -interface RegExp { - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - flags: string; -} - -// ############################################################################################# -// ECMAScript 6: Number & Math -// Modules: es6.number.constructor, es6.number.statics, and es6.math -// ############################################################################################# - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[]): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; -} - // ############################################################################################# // ECMAScript 6: Symbols // Modules: es6.symbol // ############################################################################################# -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - [Symbol.toStringTag]: string; -} - interface SymbolConstructor { - /** - * A reference to the prototype. - */ - prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string; - - // Well-known Symbols - - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - isConcatSpreadable: symbol; - - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - iterator: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - split: symbol; - - /** - * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive - * abstract operation. - */ - toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the with - * environment bindings of the associated objects. - */ - unscopables: symbol; - /** * Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill */ @@ -562,193 +36,6 @@ interface SymbolConstructor { userSetter(): void; } -declare var Symbol: SymbolConstructor; - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript - * object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface Math { - [Symbol.toStringTag]: string; -} - -interface JSON { - [Symbol.toStringTag]: string; -} - -// ############################################################################################# -// ECMAScript 6: Collections -// Modules: es6.map, es6.set, es6.weak-map, and es6.weak-set -// ############################################################################################# - -interface Map { - clear(): void; - delete(key: K): boolean; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): Map; - size: number; -} - -interface MapConstructor { - new (): Map; - new (iterable: Iterable<[K, V]>): Map; - prototype: Map; -} - -declare var Map: MapConstructor; - -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - size: number; -} - -interface SetConstructor { - new (): Set; - new (iterable: Iterable): Set; - prototype: Set; -} - -declare var Set: SetConstructor; - -interface WeakMap { - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (iterable: Iterable<[K, V]>): WeakMap; - prototype: WeakMap; -} - -declare var WeakMap: WeakMapConstructor; - -interface WeakSet { - add(value: T): WeakSet; - delete(value: T): boolean; - has(value: T): boolean; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (iterable: Iterable): WeakSet; - prototype: WeakSet; -} - -declare var WeakSet: WeakSetConstructor; - -// ############################################################################################# -// ECMAScript 6: Iterators -// Modules: es6.string.iterator, es6.array.iterator, es6.map, es6.set, web.dom.iterable -// ############################################################################################# - -interface IteratorResult { - done: boolean; - value?: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; -} - -interface Map { - entries(): IterableIterator<[K, V]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[K, V]>; -} - -interface Set { - entries(): IterableIterator<[T, T]>; - keys(): IterableIterator; - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; -} - -interface NodeList { - [Symbol.iterator](): IterableIterator; -} - interface $for extends IterableIterator { of(callbackfn: (value: T, key: any) => void, thisArg?: any): void; array(): T[]; @@ -759,135 +46,6 @@ interface $for extends IterableIterator { declare function $for(iterable: Iterable): $for; -// ############################################################################################# -// ECMAScript 6: Promises -// Modules: es6.promise -// ############################################################################################# - -interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} - -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: (reason: any) => T | PromiseLike): Promise; - catch(onrejected?: (reason: any) => void): Promise; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - prototype: Promise; - - /** - * 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 (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; -} - -declare var Promise: PromiseConstructor; - -// ############################################################################################# -// ECMAScript 6: Reflect -// Modules: es6.reflect -// ############################################################################################# - -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): IterableIterator; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: PropertyKey): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} - // ############################################################################################# // ECMAScript 7 // Modules: es7.array.includes, es7.string.at, es7.string.pad-start, es7.string.pad-end, @@ -895,19 +53,11 @@ declare namespace Reflect { // es7.map.to-json, and es7.set.to-json // ############################################################################################# -interface Array { - includes(value: T, fromIndex?: number): boolean; -} - interface String { at(index: number): string; - padStart(length: number, fillStr?: string): string; - padEnd(length: number, fillStr?: string): string; } -interface ObjectConstructor { - values(object: any): any[]; - entries(object: any): [string, any][]; +interface Object { getOwnPropertyDescriptors(object: any): PropertyDescriptorMap; } @@ -942,7 +92,7 @@ interface ArrayConstructor { * Combines two or more arrays. * @param items Additional items to add to the end of array1. */ - concat(array: ArrayLike, ...items: (T[]| T)[]): T[]; + concat(array: ArrayLike, ...items: Array): T[]; /** * Adds all the elements of an array separated by the specified separator string. * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. @@ -969,19 +119,13 @@ interface ArrayConstructor { */ sort(array: ArrayLike, compareFn?: (a: T, b: T) => number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(array: ArrayLike, start: number): T[]; - /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. * @param deleteCount The number of elements to remove. * @param items Elements to insert into the array in place of the deleted elements. */ - splice(array: ArrayLike, start: number, deleteCount: number, ...items: T[]): T[]; + splice(array: ArrayLike, start: number, deleteCount?: number, ...items: T[]): T[]; /** * Inserts new elements at the start of an array. @@ -1005,14 +149,16 @@ interface ArrayConstructor { /** * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param callbackfn A function that accepts up to three arguments. + * The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ every(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; /** * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param callbackfn A function that accepts up to three arguments. + * The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. */ some(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; @@ -1039,30 +185,38 @@ interface ArrayConstructor { filter(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * Calls the specified callback function for all the elements in an array. + * The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. + * The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduce(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * Calls the specified callback function for all the elements in an array. + * The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. + * The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduce(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. + * The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. + * The first call to the callbackfn function provides this value as an argument instead of an array value. */ reduceRight(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; @@ -1090,7 +244,7 @@ interface ArrayConstructor { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(array: ArrayLike, predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + find(array: ArrayLike, predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -1125,8 +279,8 @@ interface ArrayConstructor { copyWithin(array: ArrayLike, target: number, start: number, end?: number): T[]; includes(array: ArrayLike, value: T, fromIndex?: number): boolean; - turn(array: ArrayLike, callbackfn: (memo: U, value: T, index: number, array: Array) => void, memo?: U): U; - turn(array: ArrayLike, callbackfn: (memo: Array, value: T, index: number, array: Array) => void, memo?: Array): Array; + turn(array: ArrayLike, callbackfn: (memo: U, value: T, index: number, array: T[]) => void, memo?: U): U; + turn(array: ArrayLike, callbackfn: (memo: T[], value: T, index: number, array: T[]) => void, memo?: T[]): T[]; } // ############################################################################################# @@ -1180,7 +334,7 @@ declare var log: Log; interface Dict { [key: string]: T; [key: number]: T; - //[key: symbol]: T; + // [key: symbol]: T; } interface DictConstructor { @@ -1257,12 +411,12 @@ interface Array { /** * Non-standard. */ - turn(callbackfn: (memo: U, value: T, index: number, array: Array) => void, memo?: U): U; + turn(callbackfn: (memo: U, value: T, index: number, array: T[]) => void, memo?: U): U; /** * Non-standard. */ - turn(callbackfn: (memo: Array, value: T, index: number, array: Array) => void, memo?: Array): Array; + turn(callbackfn: (memo: T[], value: T, index: number, array: T[]) => void, memo?: T[]): T[]; } // ############################################################################################# @@ -1313,10 +467,9 @@ declare namespace core { function get(target: any, propertyKey: PropertyKey, receiver?: any): any; function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: string): boolean; - function has(target: any, propertyKey: symbol): boolean; + function has(target: any, propertyKey: string | symbol): boolean; function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; + function ownKeys(target: any): PropertyKey[]; function preventExtensions(target: any): boolean; function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; function setPrototypeOf(target: any, proto: any): boolean; @@ -1324,10 +477,8 @@ declare namespace core { var Object: { getPrototypeOf(o: any): any; - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; defineProperties(o: any, properties: PropertyDescriptorMap): any; seal(o: T): T; freeze(o: T): T; @@ -1357,21 +508,18 @@ declare namespace core { }; var Array: { - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - from(arrayLike: ArrayLike): Array; - from(iterable: Iterable): Array; - of(...items: T[]): Array; + from(arrayLike: ArrayLike | Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; + from(arrayLike: ArrayLike | Iterable): T[]; + of(...items: T[]): T[]; push(array: ArrayLike, ...items: T[]): number; pop(array: ArrayLike): T; - concat(array: ArrayLike, ...items: (T[]| T)[]): T[]; + concat(array: ArrayLike, ...items: Array): T[]; join(array: ArrayLike, separator?: string): string; reverse(array: ArrayLike): T[]; shift(array: ArrayLike): T; slice(array: ArrayLike, start?: number, end?: number): T[]; sort(array: ArrayLike, compareFn?: (a: T, b: T) => number): T[]; - splice(array: ArrayLike, start: number): T[]; - splice(array: ArrayLike, start: number, deleteCount: number, ...items: T[]): T[]; + splice(array: ArrayLike, start: number, deleteCount?: number, ...items: T[]): T[]; unshift(array: ArrayLike, ...items: T[]): number; indexOf(array: ArrayLike, searchElement: T, fromIndex?: number): number; lastIndexOf(array: ArrayLike, earchElement: T, fromIndex?: number): number; @@ -1387,13 +535,13 @@ declare namespace core { entries(array: ArrayLike): IterableIterator<[number, T]>; keys(array: ArrayLike): IterableIterator; values(array: ArrayLike): IterableIterator; - find(array: ArrayLike, predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + find(array: ArrayLike, predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T; findIndex(array: ArrayLike, predicate: (value: T) => boolean, thisArg?: any): number; fill(array: ArrayLike, value: T, start?: number, end?: number): T[]; copyWithin(array: ArrayLike, target: number, start: number, end?: number): T[]; includes(array: ArrayLike, value: T, fromIndex?: number): boolean; - turn(array: ArrayLike, callbackfn: (memo: Array, value: T, index: number, array: Array) => void, memo?: Array): Array; - turn(array: ArrayLike, callbackfn: (memo: U, value: T, index: number, array: Array) => void, memo?: U): U; + turn(array: ArrayLike, callbackfn: (memo: T[], value: T, index: number, array: T[]) => void, memo?: T[]): T[]; + turn(array: ArrayLike, callbackfn: (memo: U, value: T, index: number, array: T[]) => void, memo?: U): U; }; var String: { @@ -1782,8 +930,7 @@ declare module "core-js/fn/function/has-instance" { var hasInstance: (value: any) => boolean; export = hasInstance; } -declare module "core-js/fn/function/name" -{ +declare module "core-js/fn/function/name" { } declare module "core-js/fn/function/part" { var part: typeof core.Function.part; diff --git a/core-js/tsconfig.json b/core-js/tsconfig.json index b37502a626..8c7007b563 100644 --- a/core-js/tsconfig.json +++ b/core-js/tsconfig.json @@ -2,8 +2,9 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "dom" + "es2017", + "dom", + "dom.iterable" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/core-js/tslint.json b/core-js/tslint.json new file mode 100644 index 0000000000..0f47deabb4 --- /dev/null +++ b/core-js/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "forbidden-types": false + } +} \ No newline at end of file From 468026989e4bfb7ce52b708c9cdb6cca0b9c589c Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 10 Mar 2017 14:16:54 -0800 Subject: [PATCH 127/567] openfin: Remove BOM (#15107) --- openfin/openfin-tests.ts | 2 +- openfin/v15/openfin-tests.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/openfin/openfin-tests.ts b/openfin/openfin-tests.ts index 63a53f7cb5..cb08f60a62 100644 --- a/openfin/openfin-tests.ts +++ b/openfin/openfin-tests.ts @@ -1,4 +1,4 @@ -function test_application() { +function test_application() { let application: fin.OpenFinApplication; // constructor application = new fin.desktop.Application({ diff --git a/openfin/v15/openfin-tests.ts b/openfin/v15/openfin-tests.ts index 69b024ce90..c3c1ef1cc6 100644 --- a/openfin/v15/openfin-tests.ts +++ b/openfin/v15/openfin-tests.ts @@ -1,4 +1,3 @@ - function test_application() { let application: fin.OpenFinApplication; // constructor From f4fdcaca9c94f90442dcedb0c8a84399c47e731f Mon Sep 17 00:00:00 2001 From: denisname Date: Fri, 10 Mar 2017 23:21:11 +0100 Subject: [PATCH 128/567] jQuery improve typing (#15102) * jQuery improve typing Each callback returns nothing or boolean Each return its first argument isArray, isFunction and isWindow as type guards type has a more strict return type make unique generic functions * Add libs in angular-oauth2 tsconfig * Linting angular-oauth2 --- angular-oauth2/angular-oauth2-tests.ts | 2 +- angular-oauth2/tsconfig.json | 4 ++ jquery/index.d.ts | 35 +++++++------ jquery/jquery-tests.ts | 70 ++++++++++++++++++++------ 4 files changed, 78 insertions(+), 33 deletions(-) diff --git a/angular-oauth2/angular-oauth2-tests.ts b/angular-oauth2/angular-oauth2-tests.ts index 2b2328d5ee..042fe537aa 100644 --- a/angular-oauth2/angular-oauth2-tests.ts +++ b/angular-oauth2/angular-oauth2-tests.ts @@ -1,7 +1,7 @@ import * as angular from 'angular'; angular.module('angular-oauth2-test', ['angular-oauth2']) - .config(['OAuthProvider', function(OAuthProvider:angular.oauth2.OAuthProvider){ + .config(['OAuthProvider', (OAuthProvider: angular.oauth2.OAuthProvider) => { OAuthProvider.configure({ baseUrl: 'https://api.website.com', clientId: 'CLIENT_ID', diff --git a/angular-oauth2/tsconfig.json b/angular-oauth2/tsconfig.json index 717721bf79..e8a5250748 100644 --- a/angular-oauth2/tsconfig.json +++ b/angular-oauth2/tsconfig.json @@ -2,6 +2,10 @@ "compilerOptions": { "module": "commonjs", "target": "es6", + "lib": [ + "es6", + "dom" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/jquery/index.d.ts b/jquery/index.d.ts index 3a785530aa..0a47546193 100644 --- a/jquery/index.d.ts +++ b/jquery/index.d.ts @@ -1166,25 +1166,28 @@ interface JQueryStatic { * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. * * @param collection The object or array to iterate over. - * @param callback The function that will be executed on every object. + * @param callback The function that will be executed on every object. Will break the loop by returning false. + * @returns the first argument, the object that is iterated. * @see {@link https://api.jquery.com/jQuery.each/#jQuery-each-array-callback} */ each( collection: T[], - callback: (indexInArray: number, valueOfElement: T) => any - ): any; + callback: (indexInArray: number, valueOfElement: T) => boolean | void + ): T[]; /** * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. * * @param collection The object or array to iterate over. - * @param callback The function that will be executed on every object. + * @param callback The function that will be executed on every object. Will break the loop by returning false. + * @returns the first argument, the object that is iterated. * @see {@link https://api.jquery.com/jQuery.each/#jQuery-each-object-callback} */ - each( - collection: any, - callback: (indexInArray: any, valueOfElement: any) => any - ): any; + each( + collection: T, + // TODO: `(keyInObject: keyof T, valueOfElement: T[keyof T])`, when TypeScript 2.1 allowed in repository + callback: (keyInObject: string, valueOfElement: any) => boolean | void + ): T; /** * Merge the contents of two or more objects together into the first object. @@ -1240,7 +1243,7 @@ interface JQueryStatic { * @param obj Object to test whether or not it is an array. * @see {@link https://api.jquery.com/jQuery.isArray/} */ - isArray(obj: any): boolean; + isArray(obj: any): obj is Array; /** * Check to see if an object is empty (contains no enumerable properties). * @@ -1254,7 +1257,7 @@ interface JQueryStatic { * @param obj Object to test whether or not it is a function. * @see {@link https://api.jquery.com/jQuery.isFunction/} */ - isFunction(obj: any): boolean; + isFunction(obj: any): obj is Function; /** * Determines whether its argument is a number. * @@ -1275,7 +1278,7 @@ interface JQueryStatic { * @param obj Object to test whether or not it is a window. * @see {@link https://api.jquery.com/jQuery.isWindow/} */ - isWindow(obj: any): boolean; + isWindow(obj: any): obj is Window; /** * Check to see if a DOM node is within an XML document (or is an XML document). * @@ -1360,7 +1363,7 @@ interface JQueryStatic { * @param obj Object to get the internal JavaScript [[Class]] of. * @see {@link https://api.jquery.com/jQuery.type/} */ - type(obj: any): string; + type(obj: any): "array" | "boolean" | "date" | "error" | "function" | "null" | "number" | "object" | "regexp" | "string" | "symbol" | "undefined"; /** * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. @@ -1368,7 +1371,7 @@ interface JQueryStatic { * @param array The Array of DOM elements. * @see {@link https://api.jquery.com/jQuery.unique/} */ - unique(array: Element[]): Element[]; + unique(array: T[]): T[]; /** * Parses a string into an array of DOM nodes. @@ -3301,10 +3304,10 @@ interface JQuery { /** * Iterate over a jQuery object, executing a function for each matched element. * - * @param func A function to execute for each matched element. + * @param func A function to execute for each matched element. Can stop the loop by returning false. * @see {@link https://api.jquery.com/each/} */ - each(func: (index: number, elem: Element) => any): JQuery; + each(func: (index: number, elem: Element) => boolean | void): JQuery; /** * Retrieve one of the elements matched by the jQuery object. @@ -3457,7 +3460,7 @@ interface JQuery { * @param func A function used as a test for each element in the set. this is the current DOM element. * @see {@link https://api.jquery.com/filter/#filter-function} */ - filter(func: (index: number, element: Element) => any): JQuery; + filter(func: (index: number, element: Element) => boolean): JQuery; /** * Reduce the set of matched elements to those that match the selector or pass the function's test. * diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index e11a8b806f..d2d58aa2a2 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -100,16 +100,18 @@ function test_ajax() { if (getAllResponseHeaders()) { return getAllResponseHeaders(); } - var allHeaders = ""; - $(["Cache-Control", "Content-Language", "Content-Type", - "Expires", "Last-Modified", "Pragma"]).each(function (i, header_name) { - if (xhr.getResponseHeader(header_name)) { - allHeaders += header_name + ": " + xhr.getResponseHeader(header_name) + "\n"; - } - return allHeaders; - }); + var allHeaders = ""; + var headersFieldNames = ["Cache-Control", "Content-Language", "Content-Type", + "Expires", "Last-Modified", "Pragma"]; + $(headersFieldNames).each(function (i, header_name) { + if (xhr.getResponseHeader(header_name)) { + allHeaders += header_name + ": " + xhr.getResponseHeader(header_name) + "\n"; + } + }); + return allHeaders; }; + return xhr; }; $.ajax({ @@ -1392,9 +1394,24 @@ function test_detach() { } function test_each() { - $.each([52, 97], function (index, value) { + var numArray: number[]; + numArray = $.each([1, 2, 3, 4], function (index: number, value: number) { alert(index + ': ' + value); }); + numArray = $.each([1, 2, 3, 4], function (index: number, value: number) { + alert(index + ': ' + value); + return value < 2; + }); + + var res: {one: number, 2: string}; + res = $.each({ one: 1, 2: "two" }, function(key: string, value: any) { + alert(key + ': ' + value); + }); + res = $.each({ one: 1, 2: "two" }, function(key: string, value: any) { + alert(key + ': ' + value); + return key === "2"; + }); + var map = { 'flammable': 'inflammable', 'duh': 'no duh' @@ -1404,8 +1421,7 @@ function test_each() { }); var arr = ["one", "two", "three", "four", "five"]; var obj = { one: 1, two: 2, three: 3, four: 4, five: 5 }; - // TODO: Should not need explicit type annotation https://github.com/Microsoft/TypeScript/issues/10072 - jQuery.each(arr, function () { + jQuery.each(arr, function () { $("#" + this).text("Mine is " + this + "."); return (this != "three"); }); @@ -1482,9 +1498,10 @@ function test_error() { $(this).hide(); }) .attr("src", "missing.png"); + jQuery.error("Oups"); jQuery.error = (message?: string) => { console.error(message); return this; - } + }; } function test_eventParams() { @@ -1516,7 +1533,7 @@ function test_eventParams() { function propStopped(e) { var msg = ""; if (e.isPropagationStopped()) { - msg = "called" + msg = "called"; } else { msg = "not called"; } @@ -1703,11 +1720,11 @@ function test_fadeToggle() { function test_filter() { $('li').filter(':even').css('background-color', 'red'); $('li').filter(function (index) { - return index % 3 == 2; + return index % 3 === 2; }).css('background-color', 'red'); $("div").css("background", "#b4b0da") .filter(function (index) { - return index == 1 || $(this).attr("id") == "fourth"; + return index === 1 || $(this).attr("id") === "fourth"; }) .css("border", "3px double red"); $("div").filter(document.getElementById("unique")); @@ -1879,7 +1896,7 @@ function test_getJSON() { function (data) { $.each(data.items, function (i, item) { $("").attr("src", item.media.m).appendTo("#images"); - if (i == 3) return false; + if (i === "3") return false; }); }); $.getJSON("test.js", function (json) { @@ -2524,6 +2541,17 @@ function test_is() { }); } +function test_isTypeGuards() { + var foo: number[] | ((x: string) => number) | Window; + if (jQuery.isArray(foo)) { + foo.push(1515); + } else if (jQuery.isWindow(foo)) { + foo.close(); + } else if (jQuery.isFunction(foo)) { + foo("hello world"); + } +} + function test_isArray() { $("b").append("" + $.isArray([])); } @@ -2582,6 +2610,16 @@ function test_isXMLDoc() { jQuery.isXMLDoc(document.body); } +function test_unique() { + jQuery.unique($('div.foo, div.bar').get()); + jQuery.unique($('div.foo, div.bar').toArray()); + + var divs: HTMLDivElement[]; + var unique: HTMLDivElement[]; + unique = jQuery.unique(divs); + unique = jQuery.unique(divs); +} + function test_jQuery() { $('div.foo'); $('div.foo').click(function () { From fdffd336315881eefd466a6524ddc66e637a42c6 Mon Sep 17 00:00:00 2001 From: Conrad Wahlen Date: Fri, 10 Mar 2017 23:21:43 +0100 Subject: [PATCH 129/567] setFromSpherical return type corrected (#15101) --- three/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/three/index.d.ts b/three/index.d.ts index 46975498c3..ff962d17b7 100644 --- a/three/index.d.ts +++ b/three/index.d.ts @@ -4240,7 +4240,7 @@ declare namespace THREE { distanceToSquared(v: Vector3): number; distanceToManhattan(v: Vector3): number; - setFromSpherical(s: Spherical): Matrix3; + setFromSpherical(s: Spherical): Vector3; setFromMatrixPosition(m: Matrix4): Vector3; setFromMatrixScale(m: Matrix4): Vector3; setFromMatrixColumn(matrix: Matrix4, index: number): Vector3; From 0a5c482bc7b4a830644c6103640d391749517fae Mon Sep 17 00:00:00 2001 From: voxmatt Date: Fri, 10 Mar 2017 14:23:33 -0800 Subject: [PATCH 130/567] fixing tests and removing Object references --- react-relay/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/react-relay/index.d.ts b/react-relay/index.d.ts index 961acbccc2..a693527e3e 100644 --- a/react-relay/index.d.ts +++ b/react-relay/index.d.ts @@ -15,7 +15,7 @@ declare module "react-relay" { } interface CreateContainerOpts { - initialVariables?: Object + initialVariables?: any fragments: Fragments prepareVariables?(prevVariables: RelayVariables): RelayVariables } @@ -148,13 +148,13 @@ declare module "react-relay" { } interface RelayProp { - route: { name: string; }; // incomplete, also has params and queries - variables: Object; - pendingVariables?: Object | null; - setVariables(variables: Object, onReadyStateChange?: OnReadyStateChange): void; - forceFetch(variables: Object, onReadyStateChange?: OnReadyStateChange): void; - hasOptimisticUpdate(record: Object): boolean; - getPendingTransactions(record: Object): RelayMutationTransaction[]; + readonly route: { name: string; }; // incomplete, also has params and queries + readonly variables: any; + readonly pendingVariables?: any | null; + setVariables(variables: any, onReadyStateChange?: OnReadyStateChange): void; + forceFetch(variables: any, onReadyStateChange?: OnReadyStateChange): void; + hasOptimisticUpdate(record: any): boolean; + getPendingTransactions(record: any): RelayMutationTransaction[]; commitUpdate: (mutation: Mutation, callbacks?: StoreUpdateCallbacks) => any; } } From 5383957c388e0c7b69e72bed7b4ac935d2a00a3e Mon Sep 17 00:00:00 2001 From: Knuddels Date: Fri, 10 Mar 2017 23:30:12 +0100 Subject: [PATCH 131/567] fixed missing static modifier (#15098) --- knuddels-userapps-api/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knuddels-userapps-api/index.d.ts b/knuddels-userapps-api/index.d.ts index b388301f68..52183f832f 100644 --- a/knuddels-userapps-api/index.d.ts +++ b/knuddels-userapps-api/index.d.ts @@ -1541,7 +1541,7 @@ declare class KnuddelsServer { * Liefert ein ExternalServerAccess-Objekt, mit dem * andere Server angesteuert werden können. */ - getExternalServerAccess(): ExternalServerAccess; + static getExternalServerAccess(): ExternalServerAccess; /** * Aktualisiert die Liste der genutzten Hooks. Werden zur Laufzeit chatCommands oder App-Hooks (wie mayJoinChannel) dynamisch erzeugt oder gelöscht, so muss danach refreshHooks() * aufgerufen werden, damit diese Änderung wirksam wird. From 4b0194180f145b06c30ea76f36fb31ae06974fbb Mon Sep 17 00:00:00 2001 From: Andrey Kurdyumov Date: Sat, 11 Mar 2017 04:43:27 +0600 Subject: [PATCH 132/567] Add fitlers paramters to react-bootstrap-table (#14861) --- react-bootstrap-table/index.d.ts | 27 ++++++++- .../react-bootstrap-table-tests.tsx | 55 ++++++++++++++++++- 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/react-bootstrap-table/index.d.ts b/react-bootstrap-table/index.d.ts index 566019ab94..82384f0d9f 100644 --- a/react-bootstrap-table/index.d.ts +++ b/react-bootstrap-table/index.d.ts @@ -356,7 +356,7 @@ export interface Options { /** Background color on expanded rows. */ - expandRowBgColor?: string; + expandRowBgColor?: string; /** Assign a callback function which will be called when mouse enter into the table. */ @@ -568,6 +568,11 @@ export interface Editable { cols?: number; rows?: number; } +export type SetFilterCallback = (targetValue: any) => boolean; +export interface ApplyFilterParameter { + callback: SetFilterCallback; +} + export type FilterType = 'TextFilter' | 'RegexFilter' | 'SelectFilter' | 'NumberFilter' | 'DateFilter' | 'CustomFilter'; export interface Filter { /** @@ -590,6 +595,26 @@ export interface Filter { * Only work on NumberFilter. Accept an array which conatin the filter condition, like: ['<','>','='] */ numberComparators?: string[]; + + /** + * Options for the filter. + */ + options?: any; + + /** + * Comparison condition for the NumberFilter + */ + condition?: string; + + /** + * Get element which represent filter. + */ + getElement?: (filterHandler: (parameters?: ApplyFilterParameter) => void, filterParameters: any) => JSX.Element; + + /** + * Parameters for custom filter + */ + customFilterParameters?: any; } export interface TableHeaderColumn extends ComponentClass { } diff --git a/react-bootstrap-table/react-bootstrap-table-tests.tsx b/react-bootstrap-table/react-bootstrap-table-tests.tsx index 47682dd36a..2151f14c78 100644 --- a/react-bootstrap-table/react-bootstrap-table-tests.tsx +++ b/react-bootstrap-table/react-bootstrap-table-tests.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { render } from 'react-dom'; -import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table'; +import { BootstrapTable, TableHeaderColumn, ApplyFilterParameter } from 'react-bootstrap-table'; var products = [{ id: 1, @@ -27,3 +27,56 @@ render( , document.getElementById("app") ); + +const qualityType = { + 0: 'good', + 1: 'bad', + 2: 'unknown' +}; + +function enumFormatter(cell: any, row: any, enumObject: any) { + return enumObject[cell]; +} + +class SelectFilterWithDefaultValue extends React.Component { + render() { + return ( + + Product ID + Product Name + Product Quality + + ); + } +} + +class TextFilterWithCondition extends React.Component { + render() { + return ( + + Product ID + Product Name + Product Price + + ); + } +} + +function getCustomFilter(filterHandler: (parameters?: ApplyFilterParameter) => void, customFilterParameters: any) { + return ( +
    + ); +} + +class CustomFilter extends React.Component { + render() { + return ( + + Product ID + Product Name + Product Is In Stock + + ); + } +} From 62fdb1966ea605cf9a670d27f28c6d91f684e12d Mon Sep 17 00:00:00 2001 From: Michael McMullin Date: Fri, 10 Mar 2017 22:45:32 +0000 Subject: [PATCH 133/567] Add support for PlaceResult.opening_hours (#14859) --- googlemaps/index.d.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/googlemaps/index.d.ts b/googlemaps/index.d.ts index 60e0a92dfc..765b974bf6 100644 --- a/googlemaps/index.d.ts +++ b/googlemaps/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Google Maps JavaScript API 3.26 // Project: https://developers.google.com/maps/ -// Definitions by: Folia A/S , Chris Wrench , Kiarash Ghiaseddin , Grant Hutchins , Denis Atyasov +// Definitions by: Folia A/S , Chris Wrench , Kiarash Ghiaseddin , Grant Hutchins , Denis Atyasov , Michael McMullin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* @@ -2224,6 +2224,22 @@ declare namespace google.maps { types: string[]; } + export interface OpeningHours { + open_now: boolean, + periods: OpeningPeriod[], + weekday_text: string[] + } + + export interface OpeningPeriod { + open: OpeningHoursTime, + close?: OpeningHoursTime + } + + export interface OpeningHoursTime { + day: number, + time: string + } + export interface PredictionTerm { offset: number; value: string; @@ -2290,6 +2306,7 @@ declare namespace google.maps { icon: string; international_phone_number: string; name: string; + opening_hours: OpeningHours; permanently_closed: boolean; photos: PlacePhoto[]; place_id: string; From 565751df4d8dcbf0af8a2fc40ce0fdd1526bdd9f Mon Sep 17 00:00:00 2001 From: Rich Buggy Date: Sat, 11 Mar 2017 09:46:22 +1100 Subject: [PATCH 134/567] Added SNS Message event and allow boolean/number vaues in Proxy Lambda header response (#14858) --- aws-lambda/aws-lambda-tests.ts | 35 ++++++++++++++++++++++++++++- aws-lambda/index.d.ts | 41 +++++++++++++++++++++++++++++++--- 2 files changed, 72 insertions(+), 4 deletions(-) diff --git a/aws-lambda/aws-lambda-tests.ts b/aws-lambda/aws-lambda-tests.ts index 7b0fe45180..1ffdb2980b 100644 --- a/aws-lambda/aws-lambda-tests.ts +++ b/aws-lambda/aws-lambda-tests.ts @@ -11,6 +11,12 @@ var clientContextClient: AWSLambda.ClientContextClient; var context: AWSLambda.Context; var identity: AWSLambda.CognitoIdentity; var proxyResult: AWSLambda.ProxyResult; +var snsEvt: AWSLambda.SNSEvent; +var snsEvtRecs: Array; +var snsEvtRec: AWSLambda.SNSEventRecord; +var snsMsg: AWSLambda.SNSMessage; +var snsMsgAttr: AWSLambda.SNSMessageAttribute; +var snsMsgAttrs: AWSLambda.SNSMessageAttributes; /* API Gateway Event */ str = apiGwEvt.body; @@ -42,9 +48,36 @@ str = apiGwEvt.requestContext.resourceId; str = apiGwEvt.requestContext.resourcePath; str = apiGwEvt.resource; +/* SNS Event */ +snsEvtRecs = snsEvt.Records; + +str = snsEvtRec.EventSource; +str = snsEvtRec.EventSubscriptionArn; +str = snsEvtRec.EventVersion; +snsMsg = snsEvtRec.Sns; + +str = snsMsg.SignatureVersion; +str = snsMsg.Timestamp; +str = snsMsg.Signature; +str = snsMsg.SigningCertUrl; +str = snsMsg.MessageId; +str = snsMsg.Message; +snsMsgAttrs = snsMsg.MessageAttributes; +str = snsMsg.Type; +str = snsMsg.UnsubscribeUrl; +str = snsMsg.TopicArn; +str = snsMsg.Subject; + +snsMsgAttrs["example"] = snsMsgAttr; + +str = snsMsgAttr.Type; +str = snsMsgAttr.Value; + /* Lambda Proxy Result */ num = proxyResult.statusCode; -str = proxyResult.headers["example"]; +proxyResult.headers["example"] = str; +proxyResult.headers["example"] = b; +proxyResult.headers["example"] = num; str = proxyResult.body /* Context */ diff --git a/aws-lambda/index.d.ts b/aws-lambda/index.d.ts index e8b70db7bd..83579b4d0d 100644 --- a/aws-lambda/index.d.ts +++ b/aws-lambda/index.d.ts @@ -39,6 +39,41 @@ interface APIGatewayEvent { resource: string; } +// SNS "event" +interface SNSMessageAttribute { + Type: string; + Value: string; +} + +interface SNSMessageAttributes { + [name: string]: SNSMessageAttribute; +} + +interface SNSMessage { + SignatureVersion: string; + Timestamp: string; + Signature: string; + SigningCertUrl: string; + MessageId: string; + Message: string; + MessageAttributes: SNSMessageAttributes; + Type: string; + UnsubscribeUrl: string; + TopicArn: string; + Subject: string; +} + +interface SNSEventRecord { + EventVersion: string; + EventSubscriptionArn: string; + EventSource: string; + Sns: SNSMessage; +} + +interface SNSEvent { + Records: Array; +} + // Context // http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html interface Context { @@ -97,7 +132,7 @@ interface ClientContextEnv { interface ProxyResult { statusCode: number; headers?: { - [header: string]: string; + [header: string]: boolean | number | string; }, body: string; } @@ -110,8 +145,8 @@ interface ProxyResult { * @param context – runtime information of the Lambda function that is executing. * @param callback – optional callback to return information to the caller, otherwise return value is null. */ -export type Handler = (event: any, context: Context, callback?: Callback) => void; -export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: ProxyCallback) => void; +export type Handler = (event: any, context: Context, callback?: Callback) => void; +export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: ProxyCallback) => void; /** * Optional callback parameter. From ade29a018c3115f2898fbe643290cf958c9f6f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Marenco?= Date: Fri, 10 Mar 2017 17:46:52 -0500 Subject: [PATCH 135/567] Add customEditor property (#14857) Hi! I was having this issue while using the library: ``` ERROR in [at-loader] frontend/src/components/modals/Upload.tsx:538:40 TS2339: Property 'customEditor' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes>...'. ``` It seems it is missing from the Definition file, so I just added it :). Hope it helps! --- react-bootstrap-table/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/react-bootstrap-table/index.d.ts b/react-bootstrap-table/index.d.ts index 82384f0d9f..9adfacf8c8 100644 --- a/react-bootstrap-table/index.d.ts +++ b/react-bootstrap-table/index.d.ts @@ -475,6 +475,13 @@ export interface TableHeaderColumnProps extends Props { This function taking one arguments: order which present the sort order currently. */ caretRender?: Function; + /** + Give an Object like following to able to customize your own editing component. + This Object should contain these two property: + getElement(REQUIRED): Accept a callback function and take two arguments: onUpdate and props. + customEditorParameters: Another extra data for custom cell edit component. + */ + customEditor?: {getElement: (onUpdate: any, props: any) => ReactElement, customEditorParameters?: Object} ; /** To customize the column. This callback function should return a String or a React Component. In addition, this function taking two argument: cell and row. From 20b7ef9c56451b7acec11bb261e191a8e0777f8a Mon Sep 17 00:00:00 2001 From: Derek Finlinson Date: Fri, 10 Mar 2017 15:47:39 -0700 Subject: [PATCH 136/567] Add setVisible to iFrame control (#14855) --- xrm/index.d.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/xrm/index.d.ts b/xrm/index.d.ts index 02bce0468e..67c5a8e778 100644 --- a/xrm/index.d.ts +++ b/xrm/index.d.ts @@ -1188,6 +1188,19 @@ declare namespace Xrm getVisible(): boolean; } + /** + * Interface for UI elements which can have the visibility value updated. + */ + export interface UiCanSetVisibleElement + { + /** + * Sets the visibility state. + * + * @param {boolean} visible true to show, false to hide. + */ + setVisible( visible: boolean ): void; + } + /** * Base interface for standard UI elements. */ @@ -2522,7 +2535,7 @@ declare namespace Xrm * * @sa FramedControl */ - export interface IframeControl extends FramedControl + export interface IframeControl extends FramedControl, UiCanSetVisibleElement { /** * Gets initial URL defined for the Iframe. From 3cfb266458c7bc4d05625b436164915ed494dd64 Mon Sep 17 00:00:00 2001 From: Matej Matiasko Date: Fri, 10 Mar 2017 23:52:32 +0100 Subject: [PATCH 137/567] Make success callback possible - cors (#14849) --- cors/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cors/index.d.ts b/cors/index.d.ts index ecad80d187..6c1fc3e4c3 100644 --- a/cors/index.d.ts +++ b/cors/index.d.ts @@ -10,7 +10,7 @@ import express = require('express'); type CustomOrigin = ( requestOrigin: string, - callback: (err: Error, allow?: boolean) => void + callback: (err: Error | null, allow?: boolean) => void ) => void; declare namespace e { From e849164bf3f4dbb27abab3819bbc2490c8922407 Mon Sep 17 00:00:00 2001 From: Adrian Ehrsam Date: Fri, 10 Mar 2017 23:53:22 +0100 Subject: [PATCH 138/567] Adds typing for navigo (npm package) (#14848) * Added typings for navigo * add missing header --- navigo/index.d.ts | 49 ++++++++++++++++ navigo/navigo-tests.ts | 123 +++++++++++++++++++++++++++++++++++++++++ navigo/tsconfig.json | 22 ++++++++ navigo/tslint.json | 1 + 4 files changed, 195 insertions(+) create mode 100644 navigo/index.d.ts create mode 100644 navigo/navigo-tests.ts create mode 100644 navigo/tsconfig.json create mode 100644 navigo/tslint.json diff --git a/navigo/index.d.ts b/navigo/index.d.ts new file mode 100644 index 0000000000..35c9f009f6 --- /dev/null +++ b/navigo/index.d.ts @@ -0,0 +1,49 @@ +// Type definitions for navigo 4.0 +// Project: https://github.com/krasimir/navigo +// Definitions by: Adrian Ehrsam +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface NavigoHooks { + before?: ((done: (suppress?: boolean) => void) => void); + after?: () => void; +} +type RouteHandler = ((parametersObj: any, query: string) => void) | { as: string; uses: (parametersObj: any) => void }; + +declare class Navigo { + + /** + * Constructs the router + * @param root The main URL of your application. + * @param useHash If useHash set to true then the router uses an old routing approach with hash in the URL. Navigo anyways falls back to this mode if there is no History API supported. + */ + constructor(root?: string | null, useHash?: boolean); + + + on(location: string, handler: RouteHandler, hooks?: NavigoHooks): Navigo; + on(location: RegExp, handler: (...parameters: string[]) => void, hooks?: NavigoHooks): Navigo; + on(routes: { [key: string]: RouteHandler }): Navigo; + + on(rootHandler: RouteHandler, hooks?: NavigoHooks): Navigo; + + notFound(handler: ((query: string) => void), hooks?: NavigoHooks): void; + + navigate(path: string, absolute?: boolean): void; + + updatePageLinks(): void; + + generate(path: string, params?: any): string; + + resolve(currentURL?: string): boolean; + + link(path: string): string; + + disableIfAPINotAvailable(): void; + + pause(): void; + + resume(): void; + + destroy(): void; +} +export = Navigo; +export as namespace Navigo; \ No newline at end of file diff --git a/navigo/navigo-tests.ts b/navigo/navigo-tests.ts new file mode 100644 index 0000000000..73ea91f416 --- /dev/null +++ b/navigo/navigo-tests.ts @@ -0,0 +1,123 @@ +import Navigo = require("navigo"); + +var root = null; +var useHash = false; + +var router = new Navigo(root, useHash); + +router + .on('/products/list', () => { + // display all the products + }) + .resolve(); + +router + .on(() => { + // show home page here + }) + .resolve(); + +router + .on({ + '/products/list': () => { + // do something + }, + '/products': () => { + // do something + } + }) + .resolve(); + +router + .on({ + 'products/:id': () => { + // do something + }, + 'products': () => { + // do something + }, + '*': () => { + // do something + } + }) + .resolve(); + + +router + .on('/user/:id/:action', (params: { id: string; action: string }) => { + // If we have http://site.com/user/42/save as a url then + // params.id = 42 + // params.action = save + }) + .resolve(); + +router + .on('/user/:id/:action', (params: { id: string; action: string }, query: string) => { + // If we have http://site.com/user/42/save?answer=42 as a url then + // params.id = 42 + // params.action = save + // query = answer=42 + }) + .resolve(); + +router.notFound((query: string) => { + // ... +}); + +router + .on(/users\/(\d+)\/(\w+)\/?/, (id: string, action: string) => { + // If we have http://site.com/user/42/save as a url then + // id = 42 + // action = save + }) + .resolve(); + +router + .on('/user/*', () => { + // This function will be called on every + // URL that starts with /user + }) + .resolve(); + +router.notFound(() => { + // called when there is path specified but + // there is no route matching +}); + +router.navigate('/products/list'); + +router.navigate('http://site.com/products/list', true); + +router = new Navigo('http://site.com/', true); +var handler = () => { + // do something +}; +router.on({ + '/trip/:tripId/edit': { as: 'trip.edit', uses: handler }, + '/trip/save': { as: 'trip.save', uses: handler }, + '/trip/:action/:tripId': { as: 'trip.action', uses: handler } +}); +var a: string = (router.generate('trip.edit', { tripId: 42 })); // --> /trip/42/edit +a = (router.generate('trip.action', { tripId: 42, action: 'save' })); // --> /trip/save/42 +a = (router.generate('trip.save')); // --> /trip/save + +router.pause(); +router.navigate('/en/products'); +router.resume(); // or .pause(false) + +router.on( + '/user/edit', + () => { + // show user edit page + }, + { + before: (done) => { + // doing some async operation + done(false); + done(); + }, + after: () => { + // do something + } + } +); diff --git a/navigo/tsconfig.json b/navigo/tsconfig.json new file mode 100644 index 0000000000..18a90350c6 --- /dev/null +++ b/navigo/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "navigo-tests.ts" + ] +} \ No newline at end of file diff --git a/navigo/tslint.json b/navigo/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/navigo/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 0e2384e4d350a397fd56a43017578f0664818d3f Mon Sep 17 00:00:00 2001 From: Klaus Sevensleeper Date: Fri, 10 Mar 2017 23:53:54 +0100 Subject: [PATCH 139/567] support strictNullChecks (#14844) better reflect the documented and implemented API --- query-string/index.d.ts | 2 +- query-string/query-string-tests.ts | 2 +- query-string/tsconfig.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/query-string/index.d.ts b/query-string/index.d.ts index 9cd6d8df1e..dcc9bfafb5 100644 --- a/query-string/index.d.ts +++ b/query-string/index.d.ts @@ -13,7 +13,7 @@ declare module "query-string" { * Leading ? or # are ignored, so you can pass location.search or location.hash directly. * @param str */ - export function parse(str: string): { [key: string]: string | string[] }; + export function parse(str: string): { [key: string]: string | string[] | null }; /** * Stringify an object into a query string, sorting the keys. diff --git a/query-string/query-string-tests.ts b/query-string/query-string-tests.ts index c39c2f4982..c5ec7b624d 100644 --- a/query-string/query-string-tests.ts +++ b/query-string/query-string-tests.ts @@ -21,7 +21,7 @@ namespace stringify_tests { } namespace parse_tests { - let result: { [key: string]: string | string[] }; + let result: { [key: string]: string | string[] | null }; result = qs.parse('?foo=bar'); result = qs.parse('#foo=bar'); result = qs.parse('&foo=bar&foo=baz'); diff --git a/query-string/tsconfig.json b/query-string/tsconfig.json index c0a4860fb8..3dd890dac3 100644 --- a/query-string/tsconfig.json +++ b/query-string/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From 82bfe951e14affdf3adb685d55e37f542fa16841 Mon Sep 17 00:00:00 2001 From: Iain McGinniss Date: Fri, 10 Mar 2017 14:56:19 -0800 Subject: [PATCH 140/567] Fix definition to be compatible with TS 2.2 (#14837) TS 2.2 provides definitions for the fetch API directly in the dom library, and those definitions are slightly different from those that were provided in @types/whatwg-fetch. This change updates the webappsec-credential-management definitions to be compatible with TS 2.2, and drops the dependency on @types/whatwg-fetch. --- webappsec-credential-management/index.d.ts | 228 ++++++++++++++++----- 1 file changed, 172 insertions(+), 56 deletions(-) diff --git a/webappsec-credential-management/index.d.ts b/webappsec-credential-management/index.d.ts index 0c1c2b5e2d..491efb3829 100644 --- a/webappsec-credential-management/index.d.ts +++ b/webappsec-credential-management/index.d.ts @@ -1,10 +1,150 @@ -// Type definitions for W3C (WebAppSec) Credential Management API, Level 1, 0.0 +// Type definitions for W3C (WebAppSec) Credential Management API Level 1, 0.1 // Project: https://github.com/w3c/webappsec-credential-management // Definitions by: Iain McGinniss // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + // Spec: http://www.w3.org/TR/2016/WD-credential-management-1-20160425/ -/// +/* ************************ FETCH API DEFINITIONS ****************************** + * TS 2.2 introduced definitions for the fetch API in the dom library, but + * prior to that it was necessary to use the types defined in + * @types/whatwg-fetch. In order to support all versions of TS 2.x, the + * definitions for fetch from TS 2.2 dom are duplicated here. As long as these + * remain identical to the definitions in dom 2.2+, they cause no issues. + * + * One caveat to "identical" here is that type definitions cannot be duplicated, + * and so the "RequestInfo" type has been substituted for its expansion in + * the below definitions: + * + * type RequestInfo = Request|string; + * ************************************************************************** */ + +interface Request extends Object, Body { + readonly cache: string; + readonly credentials: string; + readonly destination: string; + readonly headers: Headers; + readonly integrity: string; + readonly keepalive: boolean; + readonly method: string; + readonly mode: string; + readonly redirect: string; + readonly referrer: string; + readonly referrerPolicy: string; + readonly type: string; + readonly url: string; + clone(): Request; +} + +declare var Request: { + prototype: Request; + new(input: Request | string, init?: RequestInit): Request; +}; + +interface Headers { + append(name: string, value: string): void; + delete(name: string): void; + forEach(callback: ForEachCallback): void; + get(name: string): string | null; + has(name: string): boolean; + set(name: string, value: string): void; +} + +declare var Headers: { + prototype: Headers; + new(init?: any): Headers; +}; + +interface Response extends Object, Body { + readonly body: ReadableStream | null; + readonly headers: Headers; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly type: string; + readonly url: string; + clone(): Response; +} + +declare var Response: { + prototype: Response; + new(body?: any, init?: ResponseInit): Response; +}; + +interface ResponseInit { + status?: number; + statusText?: string; + headers?: any; +} + +interface ReadableStream { + readonly locked: boolean; + cancel(): Promise; + getReader(): ReadableStreamReader; +} + +declare var ReadableStream: { + prototype: ReadableStream; + new(): ReadableStream; +}; + +interface ReadableStreamReader { + cancel(): Promise; + read(): Promise; + releaseLock(): void; +} + +declare var ReadableStreamReader: { + prototype: ReadableStreamReader; + new(): ReadableStreamReader; +}; + +interface Body { + readonly bodyUsed: boolean; + arrayBuffer(): Promise; + blob(): Promise; + json(): Promise; + text(): Promise; +} + +interface URLSearchParams { + /** + * Appends a specified key/value pair as a new search parameter. + */ + append(name: string, value: string): void; + /** + * Deletes the given search parameter, and its associated value, from the list of all search parameters. + */ + delete(name: string): void; + /** + * Returns the first value associated to the given search parameter. + */ + get(name: string): string | null; + /** + * Returns all the values association with a given search parameter. + */ + getAll(name: string): string[]; + /** + * Returns a Boolean indicating if such a search parameter exists. + */ + has(name: string): boolean; + /** + * Sets the value associated to a given search parameter to the given value. If there were several values, delete the others. + */ + set(name: string, value: string): void; +} + +declare var URLSearchParams: { + prototype: URLSearchParams; + /** + * Constructor returning a URLSearchParams object. + */ + new (init?: string | URLSearchParams): URLSearchParams; +}; + +interface GlobalFetch { + fetch(input: Request|string, init?: RequestInit): Promise; +} /* ************************* FETCH MODIFICATIONS ******************************* * The credential management spec modifies fetch(), by adding a new @@ -16,78 +156,54 @@ * See: https://www.w3.org/TR/credential-management-1/#monkey-patching * ************************************************************************** */ -interface Window { - fetch(url: CMRequestInfo, init?: CMRequestInit): Promise; -} +declare function fetch( + input: Request|string, + init?: RequestInit|CMRequestInit): + Promise; -type CMRequestInfo = CMRequest|string; +interface GlobalFetch { + // variant for navigator.credentials monkey patching + fetch(url: Request|string, init?: CMRequestInit): Promise; +} /** - * Variant of {@link Request} that permits a {@code 'password'} value in the - * {@code credentials} property. + * Original definition from TS 2.2 dom. */ -interface CMRequest extends Body { - // the only modified property from RequestCredentials: - credentials: CMRequestCredentials; - - method: string; - url: string; - headers: Headers; - - type: RequestType; - destination: RequestDestination; - referrer: string; - referrerPolicy: ReferrerPolicy; - mode: RequestMode; - - cache: RequestCache; - redirect: RequestRedirect; - integrity: string; - - clone(): Request; +interface RequestInit { + method?: string; + headers?: any; + body?: any; + referrer?: string; + referrerPolicy?: string; + mode?: string; + credentials?: string; + cache?: string; + redirect?: string; + integrity?: string; + keepalive?: boolean; + window?: any; } -type CMRequestCredentials = RequestCredentials|'password'; - /** * Variant of {@link RequestInit} that permits a {@link PasswordCredential} to * be used in the {@code credentials} property. All other properties are * identical to {@link RequestInit}. */ interface CMRequestInit { - credentials?: PasswordCredential|CMRequestCredentials; - method?: string; - headers?: HeadersInit; - body?: BodyInit; + headers?: any; + body?: any; referrer?: string; - referrerPolicy?: ReferrerPolicy; - mode?: RequestMode; - - cache?: RequestCache; - redirect?: RequestRedirect; + referrerPolicy?: string; + mode?: string; + credentials?: PasswordCredential|string; + cache?: string; + redirect?: string; integrity?: string; + keepalive?: boolean; window?: any; } -/** - * URLSearchParams is not yet included in the core lib.d.ts declarations, so we - * include it here. - * The official definition should be included in TypeScript 2.2, at which point - * this can be removed. - * - * @see {@link https://github.com/Microsoft/TypeScript/issues/12517} - */ -declare class URLSearchParams { - constructor(init?: string|URLSearchParams); - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string|null; - getAll(name: string): string[]; - has(name: string): boolean; - set(name: string, value: string): void; -} - /* ***************** CREDENTIAL MANAGEMENT API DEFINITONS ******************* */ /** From a871ef4a1053ebd54b39c9924598d5dc54ff3710 Mon Sep 17 00:00:00 2001 From: mleko Date: Sat, 11 Mar 2017 00:01:02 +0100 Subject: [PATCH 141/567] Add qrcode.react definition (#14833) * Add qrcode.react definition * Remove patch version * Update to comply with contribution rules --- qrcode.react/index.d.ts | 22 ++++++++++++++++++++++ qrcode.react/qrcode.react-tests.tsx | 12 ++++++++++++ qrcode.react/tsconfig.json | 24 ++++++++++++++++++++++++ qrcode.react/tslint.json | 1 + 4 files changed, 59 insertions(+) create mode 100644 qrcode.react/index.d.ts create mode 100644 qrcode.react/qrcode.react-tests.tsx create mode 100644 qrcode.react/tsconfig.json create mode 100644 qrcode.react/tslint.json diff --git a/qrcode.react/index.d.ts b/qrcode.react/index.d.ts new file mode 100644 index 0000000000..c7a6b85d72 --- /dev/null +++ b/qrcode.react/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for qrcode.react 0.6 +// Project: https://github.com/zpao/qrcode.react +// Definitions by: Mleko +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +declare namespace qrcode { + export interface QRCodeProps { + value: string; + size?: number; + bgColor?: string; + fgColor?: string; + level?: "L"|"M"|"Q"|"H"; + } + + export type QRCode = React.ComponentClass; +} + +declare const qrcode: qrcode.QRCode; +export = qrcode; diff --git a/qrcode.react/qrcode.react-tests.tsx b/qrcode.react/qrcode.react-tests.tsx new file mode 100644 index 0000000000..ffae551b01 --- /dev/null +++ b/qrcode.react/qrcode.react-tests.tsx @@ -0,0 +1,12 @@ +import * as QRCode from "qrcode.react"; +import * as React from "react"; + +const qrcodes = [ + , + , + , + , + , + , + , +]; diff --git a/qrcode.react/tsconfig.json b/qrcode.react/tsconfig.json new file mode 100644 index 0000000000..c9938f0730 --- /dev/null +++ b/qrcode.react/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "qrcode.react-tests.tsx" + ] +} diff --git a/qrcode.react/tslint.json b/qrcode.react/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/qrcode.react/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From fd21da7d92a8b4f873ba000b2d566c712243198e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Menezes?= Date: Fri, 10 Mar 2017 20:02:04 -0300 Subject: [PATCH 142/567] Add gulp-batch declaration files (#14832) --- gulp-batch/gulp-batch-tests.ts | 8 ++++++++ gulp-batch/index.d.ts | 8 ++++++++ gulp-batch/tsconfig.json | 22 ++++++++++++++++++++++ gulp-batch/tslint.json | 1 + 4 files changed, 39 insertions(+) create mode 100644 gulp-batch/gulp-batch-tests.ts create mode 100644 gulp-batch/index.d.ts create mode 100644 gulp-batch/tsconfig.json create mode 100644 gulp-batch/tslint.json diff --git a/gulp-batch/gulp-batch-tests.ts b/gulp-batch/gulp-batch-tests.ts new file mode 100644 index 0000000000..a1e305c03b --- /dev/null +++ b/gulp-batch/gulp-batch-tests.ts @@ -0,0 +1,8 @@ +import * as gulp from "gulp"; +import * as batch from "gulp-batch"; + +gulp.task('default', function() { + gulp.watch([ 'lib/**', 'test/**' ], batch((events: any, cb: any) => { + events.on('data', console.log).on('end', cb); + })); +}); diff --git a/gulp-batch/index.d.ts b/gulp-batch/index.d.ts new file mode 100644 index 0000000000..a3be8e252e --- /dev/null +++ b/gulp-batch/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for gulp-batch 1.0 +// Project: https://github.com/floatdrop/gulp-batch +// Definitions by: Alvaro Menezes , Vinicius Salomao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function batch(opts?: any, cb?: any, errorHandler?: any): (event: any) => void; +declare namespace batch { } +export = batch; diff --git a/gulp-batch/tsconfig.json b/gulp-batch/tsconfig.json new file mode 100644 index 0000000000..eb09ea4f9c --- /dev/null +++ b/gulp-batch/tsconfig.json @@ -0,0 +1,22 @@ +{ + "files": [ + "index.d.ts", + "gulp-batch-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/gulp-batch/tslint.json b/gulp-batch/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/gulp-batch/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 12b1792ca088d1bcdd912988b88f552614005931 Mon Sep 17 00:00:00 2001 From: thisboyiscrazy Date: Fri, 10 Mar 2017 18:03:15 -0500 Subject: [PATCH 143/567] nedb-logger (#14826) * nedb-logger * nedb-logger --- nedb-logger/index.d.ts | 20 ++++++++++ nedb-logger/nedb-logger-tests.ts | 64 ++++++++++++++++++++++++++++++++ nedb-logger/tsconfig.json | 22 +++++++++++ nedb-logger/tslint.json | 1 + 4 files changed, 107 insertions(+) create mode 100644 nedb-logger/index.d.ts create mode 100644 nedb-logger/nedb-logger-tests.ts create mode 100644 nedb-logger/tsconfig.json create mode 100644 nedb-logger/tslint.json diff --git a/nedb-logger/index.d.ts b/nedb-logger/index.d.ts new file mode 100644 index 0000000000..4c47ee0dad --- /dev/null +++ b/nedb-logger/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for NeDB Logger 1.8 +// Project: https://github.com/louischatriot/nedb-logger +// Definitions by: Joe vanderstelt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = NeDBLoggerDataStore; +export as namespace NedbLogger; + +declare namespace NeDBLoggerDataStore { } +declare class NeDBLoggerDataStore { + + constructor(path?: string | {filename: string}); + + /** + * Insert a new document + * @param {Function} cb Optional callback, signature: err, insertedDoc + */ + insert(newDoc: T, cb?: (err: Error, document: T) => void): void; + +} diff --git a/nedb-logger/nedb-logger-tests.ts b/nedb-logger/nedb-logger-tests.ts new file mode 100644 index 0000000000..b6665ad44d --- /dev/null +++ b/nedb-logger/nedb-logger-tests.ts @@ -0,0 +1,64 @@ +/** + * Created by Joe Vanderstelt 2017-02-22. + */ + +/// + + +import * as es6styleimport from 'nedb-logger'; + +import Q = require('q'); +import nedblogger = require('nedb-logger'); + +class BaseCollection { + + private dataStore: nedblogger; + + constructor(dataStore: nedblogger) { + + this.dataStore = dataStore; + } + + insert(document: T): Q.Promise { + + var deferred = Q.defer(); + + this.dataStore.insert(document, function(err: Error, newDoc: T) { // Callback is optional + // newDoc is the newly inserted document, including its _id + if (err) { + deferred.reject(err); + } else { + deferred.resolve(newDoc); + } + }); + + return deferred.promise; + } + +} + +// Type 1: Persistent datastore with manual loading + +import Datastore = require('nedb-logger'); +var db = new Datastore({filename: 'path/to/datafile'}); + +var doc: any = { + hello: 'world' + , n: 5 + , today: new Date() + , nedbIsAwesome: true + , notthere: null + , notToBeSaved: undefined // Will not be saved + , fruits: ['apple', 'orange', 'pear'] + , infos: {name: 'nedb'} +}; + +db.insert(doc, function(err: Error, newDoc: any) { // Callback is optional + // newDoc is the newly inserted document, including its _id + // newDoc has no key called notToBeSaved since its value was undefined +}); + +db.insert([{a: 5}, {a: 42}], function(err: Error, newdocs: any[]) { + // Two documents were inserted in the database + // newDocs is an array with these documents, augmented with their _id +}); diff --git a/nedb-logger/tsconfig.json b/nedb-logger/tsconfig.json new file mode 100644 index 0000000000..917e72a038 --- /dev/null +++ b/nedb-logger/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "nedb-logger-tests.ts" + ] +} \ No newline at end of file diff --git a/nedb-logger/tslint.json b/nedb-logger/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/nedb-logger/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file From 75ffb8e47dfe51b8d4c1c33410e542f433c557c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksandar=20Rodi=C4=87?= Date: Sat, 11 Mar 2017 00:09:55 +0100 Subject: [PATCH 144/567] Changing 'scope' definition (#14810) current definition ```ts scope(options?: string | string[] | ScopeOptions | WhereOptions): this; ``` doesn't allow are valid calls. example from [documentation](http://docs.sequelizejs.com/en/latest/docs/scopes/): ```ts Project.scope('random', { method: ['accessLevel', 19]}).findAll(); ``` changing it to ```ts scope(options?: string | ScopeOptions | WhereOptions | Array): this; ``` should fix the issue since, according to the docs ```ts // These two are equivalent Project.scope('deleted', 'activeUsers').findAll(); Project.scope(['deleted', 'activeUsers']).findAll(); ``` --- sequelize/index.d.ts | 2 +- sequelize/sequelize-tests.ts | 5 ++++- sequelize/v3/index.d.ts | 2 +- sequelize/v3/sequelize-tests.ts | 5 ++++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sequelize/index.d.ts b/sequelize/index.d.ts index ec41863261..c3dd68ec98 100644 --- a/sequelize/index.d.ts +++ b/sequelize/index.d.ts @@ -3671,7 +3671,7 @@ declare namespace sequelize { * @return Model A reference to the model, with the scope(s) applied. Calling scope again on the returned * model will clear the previous scope. */ - scope(options?: string | string[] | ScopeOptions | WhereOptions): this; + scope(options?: string | ScopeOptions | WhereOptions | Array): this; /** * Search for multiple instances. diff --git a/sequelize/sequelize-tests.ts b/sequelize/sequelize-tests.ts index 71e6203a82..ceff709a6b 100644 --- a/sequelize/sequelize-tests.ts +++ b/sequelize/sequelize-tests.ts @@ -853,11 +853,14 @@ User.schema( 'special' ).create( { age : 3 }, { logging : function( ) {} } ); User.getTableName(); User.addScope('lowAccess', { where : { parent_id : 2 } }); -User.addScope('lowAccess', function() { } ); User.addScope('lowAccess', { where : { parent_id : 2 } }, { override: true }); +User.addScope('lowAccessWithParam', function(id: number) { + return { where : { parent_id : id } } +} ); User.scope( 'lowAccess' ).count(); User.scope( { where : { parent_id : 2 } } ); +User.scope( [ 'lowAccess', { method: ['lowAccessWithParam', 2] }, { where : { parent_id : 2 } } ] ) User.findAll(); User.findAll( { where : { data : { employment : null } } } ); diff --git a/sequelize/v3/index.d.ts b/sequelize/v3/index.d.ts index fb73cd94bf..edb1bb2a6d 100644 --- a/sequelize/v3/index.d.ts +++ b/sequelize/v3/index.d.ts @@ -3648,7 +3648,7 @@ declare namespace sequelize { * @return Model A reference to the model, with the scope(s) applied. Calling scope again on the returned * model will clear the previous scope. */ - scope(options?: string | string[] | ScopeOptions | WhereOptions): this; + scope(options?: string | ScopeOptions | WhereOptions | Array): this; /** * Search for multiple instances. diff --git a/sequelize/v3/sequelize-tests.ts b/sequelize/v3/sequelize-tests.ts index ef90600e91..83c4536a71 100644 --- a/sequelize/v3/sequelize-tests.ts +++ b/sequelize/v3/sequelize-tests.ts @@ -840,11 +840,14 @@ User.schema( 'special' ).create( { age : 3 }, { logging : function( ) {} } ); User.getTableName(); User.addScope('lowAccess', { where : { parent_id : 2 } }); -User.addScope('lowAccess', function() { } ); User.addScope('lowAccess', { where : { parent_id : 2 } }, { override: true }); +User.addScope('lowAccessWithParam', function(id: number) { + return { where : { parent_id : id } } +} ); User.scope( 'lowAccess' ).count(); User.scope( { where : { parent_id : 2 } } ); +User.scope( [ 'lowAccess', { method: ['lowAccessWithParam', 2] }, { where : { parent_id : 2 } } ] ) User.findAll(); User.findAll( { where : { data : { employment : null } } } ); From a43da75444d2aae17adabcfc6c8809586afcb658 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Fri, 10 Mar 2017 17:17:36 -0600 Subject: [PATCH 145/567] allow numbers as the right hand side of a join equality (#14823) --- knex/index.d.ts | 2 +- knex/knex-tests.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/knex/index.d.ts b/knex/index.d.ts index 0627498962..660a8dfcb2 100644 --- a/knex/index.d.ts +++ b/knex/index.d.ts @@ -165,7 +165,7 @@ declare namespace Knex { interface Join { (raw: Raw): QueryBuilder; - (tableName: string, columns: { [key: string]: string | Raw }): QueryBuilder; + (tableName: string, columns: { [key: string]: string | number | Raw }): QueryBuilder; (tableName: string, callback: Function): QueryBuilder; (tableName: TableName, raw: Raw): QueryBuilder; (tableName: TableName, column1: string, column2: string): QueryBuilder; diff --git a/knex/knex-tests.ts b/knex/knex-tests.ts index 420aafd724..3d02a7924b 100644 --- a/knex/knex-tests.ts +++ b/knex/knex-tests.ts @@ -188,6 +188,10 @@ knex('users') .join('contacts', 'users.id', '=', 'contacts.user_id') .select('users.id', 'contacts.phone'); +knex('users') + .join('contacts', { 'users.id': 12355 }) + .select('users.id', 'contacts.phone'); + knex('users') .join('contacts', 'users.id', 'contacts.user_id') .select('users.id', 'contacts.phone'); From 253d42273d6d5d1bbf35c020f7dc05d1ce6cdd0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alu=C3=ADsio=20Augusto=20Silva=20Gon=C3=A7alves?= Date: Fri, 10 Mar 2017 20:18:53 -0300 Subject: [PATCH 146/567] Add type definitions for 'printf' (#14821) * Add definitions for 'printf' * Add "lib" to tsconfig.json * Fix link --- printf/index.d.ts | 10 ++++++++++ printf/printf-tests.ts | 9 +++++++++ printf/tsconfig.json | 22 ++++++++++++++++++++++ printf/tslint.json | 1 + 4 files changed, 42 insertions(+) create mode 100644 printf/index.d.ts create mode 100644 printf/printf-tests.ts create mode 100644 printf/tsconfig.json create mode 100644 printf/tslint.json diff --git a/printf/index.d.ts b/printf/index.d.ts new file mode 100644 index 0000000000..e136eed929 --- /dev/null +++ b/printf/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for printf 0.2 +// Project: https://github.com/adaltas/node-printf +// Definitions by: Aluísio Augusto Silva Gonçalves +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export = printf; +declare function printf(format: string, ...args: any[]): string; +declare function printf(writeStream: NodeJS.WritableStream, format: string, ...args: any[]): void; diff --git a/printf/printf-tests.ts b/printf/printf-tests.ts new file mode 100644 index 0000000000..d116d45f76 --- /dev/null +++ b/printf/printf-tests.ts @@ -0,0 +1,9 @@ +import printf = require("printf"); + +printf('%c', 0x7f).charCodeAt(0); +printf('%2$s: %1$O', {hello: 'Node'}, 'Test'); +printf('%(temperature)s %(crevace)ss', { + temperature: 'Hot', + crevace: 'Pocket', +}); +printf(process.stdout, '%2$s: %1$O', {hello: 'Node'}, 'Test'); diff --git a/printf/tsconfig.json b/printf/tsconfig.json new file mode 100644 index 0000000000..e937977428 --- /dev/null +++ b/printf/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "printf-tests.ts" + ] +} diff --git a/printf/tslint.json b/printf/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/printf/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From f38e6124589657e0f50a93f292d142a81c392d75 Mon Sep 17 00:00:00 2001 From: Aluan Haddad Date: Fri, 10 Mar 2017 18:25:58 -0500 Subject: [PATCH 147/567] =?UTF-8?q?SystemJS:=20refined=20typeof=20'transpi?= =?UTF-8?q?ler'=20option,=20added=20plugin-typescript=20specific=20?= =?UTF-8?q?=E2=80=A6=20(#14801)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * SystemJS: refined typeof 'transpiler' option, added plugin-typescript specific flags to typescriptOptions Refined typeof 'transpiler' option to only allow `false` as opposed to `boolean`. Added the `typescriptOptions` properties that are specific to plugin-typescript to typescriptOptions object. * lint and fix warnings --- systemjs/index.d.ts | 56 ++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/systemjs/index.d.ts b/systemjs/index.d.ts index 876e4fdb4d..cf37862975 100644 --- a/systemjs/index.d.ts +++ b/systemjs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SystemJS 0.20.5 +// Type definitions for SystemJS 0.20 // Project: https://github.com/systemjs/systemjs // Definitions by: Ludovic HENIN , Nathan Walker , Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,9 +6,13 @@ declare namespace SystemJSLoader { - type ModulesList = { [bundleName: string]: Array }; + interface ModulesList { + [bundleName: string]: string[]; + } - type PackageList = { [packageName: string]: T }; + interface PackageList { + [packageName: string]: T; + } /** * The following module formats are supported: @@ -27,7 +31,7 @@ declare namespace SystemJSLoader { * Represents a module name for System.import that must resolve to either Traceur, Babel or TypeScript. * When set to traceur, babel or typescript, loading will be automatically configured as far as possible. */ - type Transpiler = "plugin-traceur" | "plugin-babel" | "plugin-typescript" | "traceur" | "babel" | "typescript" | boolean; + type Transpiler = "plugin-traceur" | "plugin-babel" | "plugin-typescript" | "traceur" | "babel" | "typescript" | false; type ConfigMap = PackageList>; @@ -49,7 +53,7 @@ declare namespace SystemJSLoader { * Dependencies to load before this module. Goes through regular paths and map normalization. * Only supported for the cjs, amd and global formats. */ - deps?: Array; + deps?: string[]; /** * A map of global names to module names that should be defined only for the execution of this module. @@ -225,13 +229,29 @@ declare namespace SystemJSLoader { * Sets the TypeScript transpiler options. */ //TODO: Import Typescript.CompilerOptions - typescriptOptions?: any; + typescriptOptions?: { + /** + * A boolean flag which instructs the plugin to load configuration from "tsconfig.json". + * To override the location of the file set this option to the path of the configuration file, + * which will be resolved using normal SystemJS resolution. + * Note: This setting is specific to plugin-typescript. + */ + tsconfig?: boolean | string, + /** + * A flag which controls whether the files are type-checked or simply transpiled. + * Set this option to "strict" to have the builds fail when compiler errors are encountered. + * Note: The strict option only affects builds and bundles via the SystemJS or JSPM Builder. + * Note: This setting is specific to plugin-typescript. + */ + typeCheck?: boolean | "strict", + [key: string]: any + }; } interface SystemJSSystemFields { env: string; loaderErrorStack: boolean; - packageConfigPaths: Array; + packageConfigPaths: string[]; pluginFirst: boolean; version: string; warnings: boolean; @@ -241,12 +261,12 @@ declare namespace SystemJSLoader { /** * For backwards-compatibility with AMD environments, set window.define = System.amdDefine. */ - amdDefine: Function; + amdDefine: (...args: any[]) => void; /** * For backwards-compatibility with AMD environments, set window.require = System.amdRequire. */ - amdRequire: Function; + amdRequire: (deps: string[], callback: (...modules: any[]) => void) => void; /** * SystemJS configuration helper function. @@ -257,7 +277,7 @@ declare namespace SystemJSLoader { /** * This represents the System base class, which can be extended or reinstantiated to create a custom System instance. */ - constructor: new() => System; + constructor: new () => System; /** * Deletes a module from the registry by normalized name. @@ -273,7 +293,7 @@ declare namespace SystemJSLoader { /** * Returns a clone of the internal SystemJS configuration in use. */ - getConfig(): Config + getConfig(): Config; /** * Returns whether a given module exists in the registry by normalized module name. @@ -303,15 +323,15 @@ declare namespace SystemJSLoader { /** * Declaration function for defining modules of the System.register polyfill module format. */ - register(name: string, deps: Array, declare: Function): void; - register(deps: Array, declare: Function): void; + register(name: string, deps: string[], declare: (...modules: any[]) => any): void; + register(deps: string[], declare: (...modules: any[]) => any): void; /** * Companion module format to System.register for non-ES6 modules. * Provides a