diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 86b77f8c6b..2d28d19f8c 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1104,6 +1104,7 @@
/types/ffprobe-static/ @iamstevetran
/types/fhir-js-client/ @rmchndrng
/types/fibers/ @soywiz
+/types/fibjs/ @richardo2016
/types/figures/ @BendingBender
/types/file-exists/ @BendingBender
/types/file-saver/ @cyrilschumacher @DaIgeb @chrismbarr
@@ -3383,7 +3384,7 @@
/types/react-json/ @spielc
/types/react-json-pretty/ @LKay
/types/react-json-tree/ @gnestor
-/types/react-jsonschema-form/ @iamdanfox @sirreal @iplus26 @KurtPreston
+/types/react-jsonschema-form/ @iamdanfox @iplus26 @KurtPreston
/types/react-lazyload/ @m0a
/types/react-leaflet/ @danzel @davschne @yuit
/types/react-list/ @buptyyf @tomshen
diff --git a/types/ace/index.d.ts b/types/ace/index.d.ts
index 828aab87c2..7faa5da4f8 100644
--- a/types/ace/index.d.ts
+++ b/types/ace/index.d.ts
@@ -832,8 +832,9 @@ declare namespace AceAjax {
/**
* [Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft}
+ * @param scrollLeft The new scroll left value
**/
- setScrollLeft(): void;
+ setScrollLeft(scrollLeft: number): void;
/**
* [Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft}
diff --git a/types/ace/test/edit_session.ts b/types/ace/test/edit_session.ts
index 4713495f7a..29b3bb6bd8 100644
--- a/types/ace/test/edit_session.ts
+++ b/types/ace/test/edit_session.ts
@@ -18,6 +18,23 @@ function createFoldTestSession() {
return session;
}
+function createScrollTestRenderer(): AceAjax.VirtualRenderer | null {
+ var el = document.createElement("div");
+
+ if (!el.getBoundingClientRect) {
+ console.log("Skipping test: This test only runs in the browser");
+ return null;
+ }
+
+ el.style.left = "20px";
+ el.style.top = "30px";
+ el.style.width = "300px";
+ el.style.height = "100px";
+ document.body.appendChild(el);
+
+ return new AceAjax.VirtualRenderer(el);
+}
+
function assertArray(a, b) {
assert.equal(a + "", b + "");
assert.ok(a.length == b.length);
@@ -915,5 +932,25 @@ const aceEditSessionTests = {
session = new AceAjax.EditSession(new Array(30).join("\n"));
session.documentToScreenPosition(2, 0);
session.documentToScreenPosition(2, 0);
+ },
+
+ "test setScrollTop()": function() {
+ var renderer = createScrollTestRenderer();
+ var session = new AceAjax.EditSession(["1", "2", "3", "2", "3", "4"]);
+ renderer.setSession(session);
+ assert.equal(renderer.getScrollTop(), 0);
+ session.setScrollTop(40);
+ assert.equal(renderer.getScrollTop(), 40);
+ renderer.getScrollTop()
+ },
+
+ "test setScrollLeft()": function() {
+ var renderer = createScrollTestRenderer();
+ var session = new AceAjax.EditSession(["1", "2", "3", "2", "3", "4"]);
+ renderer.setSession(session);
+ assert.equal(renderer.getScrollLeft(), 0);
+ session.setScrollLeft(40);
+ assert.equal(renderer.getScrollLeft(), 40);
+ renderer.getScrollLeft()
}
-};
\ No newline at end of file
+};
diff --git a/types/bencode/bencode-tests.ts b/types/bencode/bencode-tests.ts
new file mode 100644
index 0000000000..f6ad3c8292
--- /dev/null
+++ b/types/bencode/bencode-tests.ts
@@ -0,0 +1,6 @@
+import * as bencode from "bencode";
+
+bencode.byteLength("abcde"); // $ExpectType number
+bencode.encodingLength("abcde"); // $ExpectType number
+bencode.encode([1, 2, 3, 4], new Buffer([]), 1); // $ExpectType Buffer
+bencode.decode(new Buffer("abcde"), 1, 3); // $ExpectType any
diff --git a/types/bencode/index.d.ts b/types/bencode/index.d.ts
new file mode 100644
index 0000000000..444513192c
--- /dev/null
+++ b/types/bencode/index.d.ts
@@ -0,0 +1,16 @@
+// Type definitions for bencode 2.0
+// Project: https://github.com/themasch/node-bencode#readme
+// Definitions by: Tobenna Clears browsing data for the webview partition. Injects JavaScript code into the guest page. The following sample code uses script injection to set the guest page's background color to red: The following example code navigates the webview to about:blank when the guest attempts to close itself. The following example code forwards all log messages to the embedder's console without regard for log level or other properties. The following example code modifies the default font size of the guest's body element after the page loads: Handling this event will block the guest process until each event listener returns or the dialog object becomes unreachable (if preventDefault() was called.) The default behavior is to cancel the dialog. The following example code will show a farewell message whenever the guest page crashes: Note: When a resource load is aborted, a loadabort event will eventually be followed by a loadstop event, even if all committed loads since the last loadstop event (if any) were aborted. Note: When the load of either an about URL or a JavaScript URL is aborted, loadabort will be fired and then the webview will be navigated to 'about:blank'. Note: When a committed load is aborted, a loadstop event will eventually follow a loadabort event, even if all committed loads since the last loadstop event (if any) were aborted. The following example code will create and navigate a new webview in the embedder for each requested new window: The following example code will grant the guest page access to the webkitGetUserMedia API. Note that an app using this example code must itself specify audioCapture and/or videoCapture manifest permissions: The following example code will fade the webview element in or out as it becomes responsive or unresponsive: Posts a message to the embedded web content as long as the embedded content is displaying a page from the target origin. This method is available once the page has completed loading. Listen for the contentload event and then call the method. The guest will be able to send replies to the embedder by posting message to event.source on the message event it receives. This API is identical to the HTML5 postMessage API for communication between web pages. The embedder may listen for replies by adding a message event listener to its own frame. Posts a message to the embedded web content as long as the embedded content is displaying a page from the target origin. This method is available once the page has completed loading. Listen for the contentload event and then call the method. The guest will be able to send replies to the embedder by posting message to event.source on the message event it receives. This API is identical to the HTML5 postMessage API for communication between web pages. The embedder may listen for replies by adding a message event listener to its own frame. Describes a rectangle in screen coordinates. The containment semantics are array-like; that is, the coordinate (left, top) is considered to be contained by the rectangle, but the coordinate (left + width, top) is not. To illustrate how usage differs from the extensions webRequest API, consider the following example code which blocks any guest requests for URLs which match *://www.evil.com/*: Additionally, this interface supports declarative webRequest rules through onRequest and onMessage events. See declarativeWebRequest for API details.webview and interact with the web content, initiate navigations in an embedded web page, react to error events that happen within it, and more (see Usage).
+ * Use the webview tag to actively load live content from the web over the network and embed it in your Chrome App. Your app can control the appearance of the webview and interact with the web content, initiate navigations in an embedded web page, react to error events that happen within it, and more (see Usage).
*/
namespace webview {
/** Options that determine what data should be cleared by `clearData`. */
@@ -4611,7 +5493,7 @@ declare namespace chrome {
*/
interface InjectDetails {
/**
- * @description JavaScript or CSS code to inject.
Warning:
Be careful using the code parameter. Incorrect use of it may open your app to cross site scripting attacks.
+ * @description JavaScript or CSS code to inject.
Warning:
Be careful using the code parameter. Incorrect use of it may open your app to cross site scripting attacks.
* @type {string}
* @memberof InjectDetails
*/
@@ -4624,38 +5506,501 @@ declare namespace chrome {
file?: string
}
- interface WebViewElementEventMap {
- 'close': Event,
- 'consolemessage': IConsolemessage,
- 'contentload': Event,
- 'dialog': IDialog,
- 'exit': IExit,
- 'findupdate': IFindupdate,
- 'loadabort': ILoadabort,
- 'loadcommit': ILoadcommit,
- 'loadredirect': ILoadredirect,
- 'loadstart': ILoadstart,
- 'loadstop': Event,
- 'newwindow': INewwindow,
- 'permissionrequest': IPermissionrequest,
- 'responsive': IResponsive,
- 'sizechanged': ISizechanged,
- 'unresponsive': IUnresponsive,
- 'zoomchange': IZoomchange,
- }
-
-
/**
- * @description
- * @export
- * @interface HTMLWebViewElement
- * @extends {Element}
+ * @description WebView element from html
*/
interface HTMLWebViewElement extends Element {
- executeScript?: (details: InjectDetails, callback?: (result: any) => void) => void;
+ /**
+ * This sets the guest content's window.name object.
+ */
+ name: string;
+ /**
+ * Returns the visible URL. Mirrors the logic in the browser's omnibox: either returning a pending new navigation if initiated by the embedder page, or the last committed navigation. Writing to this attribute initiates top-level navigation.
+ * Assigning src its own value will reload the current page.
+ * The src attribute cannot be cleared or removed once it has been set, unless the webview is removed from the DOM.
+ * The src attribute can also accept data URLs, such as 'data:text/plain,Hello, world!'.
+ */
src: string;
- contentWindow: Window;
- addEventListenerwebview.executeScript({ code: 'document.body.style.backgroundColor = 'red'' });
+ * @param details Details of the script to run.
+ * @param callback
+ */
+ executeScript(details: InjectDetails, callback?: (result?: any[]) => void): void;
+
+ /**
+ * @description Initiates a find-in-page request.
+ * @param {string} searchText The string to find in the page.
+ * @param options Options for the find request.
+ * @param callback
+ */
+ find(searchText: string, options?: FindOptions, callback?: (results?: any) => void): void;
+
+ /**
+ * @description Navigates forward one history entry if possible. Equivalent to go(1).
+ * @param callback
+ */
+ forward(callback?: (success: boolean) => void): void;
+
+ /**
+ * @description Returns Chrome's internal process ID for the guest web page's current process, allowing embedders to know how many guests would be affected by terminating the process. Two guests will share a process only if they belong to the same app and have the same storage partition ID. The call is synchronous and returns the embedder's cached notion of the current process ID. The process ID isn't the same as the operating system's process ID.
+ */
+ getProcessId(): void;
+
+ /**
+ * @description Returns the user agent string used by the webview for guest page requests.
+ */
+ getUserAgent(): void;
+
+ /**
+ * @description Gets the current zoom factor.
+ * @param callback
+ */
+ getZoom(callback: (zoomFactor: number) => void): void;
+
+ /**
+ * @description Gets the current zoom mode.
+ * @param callback
+ */
+ getZoomMode(callback: (ZoomMode: any) => void): void;
+
+ /**
+ * @description Navigates to a history entry using a history index relative to the current navigation. If the requested navigation is impossible, this method has no effect.
+ * @param {number} relativeIndex Relative history index to which the webview should be navigated. For example, a value of 2 will navigate forward 2 history entries if possible; a value of -3 will navigate backward 3 entries.
+ * @param callback
+ */
+ go(relativeIndex: number, callback?: (success: boolean) => void): void;
+
+ /**
+ * @description Injects CSS into the guest page.
+ * @param details Details of the CSS to insert.
+ * @param callback
+ */
+ insertCSS(details: InjectDetails, callback?: () => void): void;
+
+ /**
+ * @description Indicates whether or not the webview's user agent string has been overridden by $(ref:webviewTag.setUserAgentOverride).
+ */
+ isUserAgentOverridden(): void;
+
+ /**
+ * @description Prints the contents of the webview. This is equivalent to calling scripted print function from the webview itself.
+ */
+ print(): void;
+
+ /**
+ * @description Reloads the current top-level page.
+ */
+ reload(): void;
+
+ /**
+ * @description Removes content scripts from a webview.
+ * @description The following example removes 'myRule' which was added before.
+ * @example webview.removeContentScripts(['myRule']);
+ * @description You can remove all the rules by calling:
+ * @example webview.removeContentScripts();
+ * @param {any[]} scriptNameList A list of names of content scripts that will be removed. If the list is empty, all the content scripts added to the webview will be removed.
+ */
+ removeContentScripts(scriptNameList?: any[]): void;
+
+ /**
+ * @description Override the user agent string used by the webview for guest page requests.
+ * @param {string} userAgent The user agent string to use.
+ */
+ setUserAgentOverride(userAgent: string): void;
+
+ /**
+ * @description Changes the zoom factor of the page. The scope and persistence of this change are determined by the webview's current zoom mode (see $(ref:webviewTag.ZoomMode)).
+ * @param {number} zoomFactor The new zoom factor.
+ * @param callback
+ */
+ setZoom(zoomFactor: number, callback?: () => void): void;
+
+ /**
+ * @description Sets the zoom mode of the webview.
+ * @param ZoomMode Defines how zooming is handled in the webview.
+ * @param callback
+ */
+ setZoomMode(ZoomMode: ZoomMode, callback?: () => void): void;
+
+ /**
+ * @description Stops loading the current webview navigation if in progress.
+ */
+ stop(): void;
+
+ /**
+ * @description Ends the current find session (clearing all highlighting) and cancels all find requests in progress.
+ * @param {string} action Determines what to do with the active match after the find session has ended. clear will clear the highlighting over the active match; keep will keep the active match highlighted; activate will keep the active match highlighted and simulate a user click on that match. The default action is keep.
+ */
+ stopFinding(action?: string): void;
+
+ /**
+ * @description Loads a data URL with a specified base URL used for relative links. Optionally, a virtual URL can be provided to be shown to the user instead of the data URL.
+ * @param {string} dataUrl The data URL to load.
+ * @param {string} baseUrl The base URL that will be used for relative links.
+ * @param {string} virtualUrl The URL that will be displayed to the user (in the address bar).
+ */
+ loadDataWithBaseUrl(dataUrl: string, baseUrl: string, virtualUrl?: string): void;
+
+ /**
+ * @description Forcibly kills the guest web page's renderer process. This may affect multiple webview tags in the current app if they share the same process, but it will not affect webview tags in other apps.
+ */
+ terminate(): void;
+
+ /**
+ * @description Fired when the guest window attempts to close itself.webview.addEventListener('close', function() {
+ webview.src = 'about:blank';
+ });
+ */
+
+ close(event: chrome.events.Eventwebview.addEventListener('consolemessage', function(e) {
+ console.log('Guest page logged a message: ', e.message);
+ });
+ * @param callback
+ */
+
+ consolemessage: chrome.events.Eventwebview.addEventListener('contentload', function() {
+ webview.executeScript({ code: 'document.body.style.fontSize = '42px'' });
+ });
+ */
+
+ contentload: (event: chrome.events.Eventwebview.addEventListener('exit', function(e) {
+ if (e.reason === 'crash') {
+ webview.src = 'data:text/plain,Goodbye, world!';
+ }
+ });
+ * @param callback
+ */
+
+ exit: chrome.events.Eventwebview.addEventListener('newwindow', function(e) {
+ var newWebview = document.createElement('webview');
+ document.body.appendChild(newWebview);
+ e.window.attach(newWebview);
+ });
+ * @param callback
+ */
+
+ newwindow: chrome.events.Eventwebview.addEventListener('permissionrequest', function(e) {
+ if (e.permission === 'media') {
+ e.request.allow();
+ }
+ });
+ * @param callback
+ */
+
+ permissionrequest: chrome.events.Eventwebview.style.webkitTransition = 'opacity 250ms';
+ webview.addEventListener('unresponsive', function() {
+ webview.style.opacity = '0.5';
+ });
+ webview.addEventListener('responsive', function() {
+ webview.style.opacity = '1';
+ });
+ * @param callback
+ */
+
+ responsive: chrome.events.Eventwebview.request.onBeforeRequest.addListener(
- function(details) { return {cancel: true}; },
- {urls: ["*://www.evil.com/*"]},
- ["blocking"]);
var rule = {
- conditions: [
- new chrome.webViewRequest.RequestMatcher({ url: { hostSuffix: 'example.com' } })
- ],
- actions: [ new chrome.webViewRequest.CancelRequest() ]
- };
- myWebview.request.onRequest.addRules([rule]); */
+ /**
+ * @description Interface which provides access to webRequest events on the guest page. See the chrome.webRequest extensions API for details on webRequest life cycle and related concepts.To illustrate how usage differs from the extensions webRequest API, consider the following example code which blocks any guest requests for URLs which match *://www.evil.com/*:
webview.request.onBeforeRequest.addListener(
+ * @example function(details) { return {cancel: true}; }, {urls: ['*://www.evil.com/*']}, ['blocking']);
+ * @description Additionally, this interface supports declarative webRequest rules through onRequest and onMessage events.
+ * @see http://developer.chrome.com/extensions/declarativeWebRequest.htmldeclarativeWebRequest
+ * @description Note that conditions and actions for declarative webview webRequests should be instantiated from their chrome.webViewRequest.* counterparts. The following example code declaratively blocks all requests to 'example.com' on the webview myWebview:
+ * @example var rule = { conditions: [ new chrome.webViewRequest.RequestMatcher({ url: { hostSuffix: 'example.com' } }) ], actions: [ new chrome.webViewRequest.CancelRequest() ] }; myWebview.request.onRequest.addRules([rule]);
+ **/
interface WebRequestEventInterface {
}
/**
* Defines the how zooming is handled in the webview.
* Enum values:
- * "per-origin"
+ * 'per-origin'
* * Zoom changes will persist in the zoomed page's origin, i.e. all other webviews in the same partition that are navigated to that same origin will be zoomed as well. Moreover, per-origin zoom changes are saved with the origin, meaning that when navigating to other pages in the same origin, they will all be zoomed to the same zoom factor.
- * "per-view"
+ * 'per-view'
* * Zoom changes only take effect in this webview, and zoom changes in other webviews will not affect the zooming of this webview. Also, per-view zoom changes are reset on navigation; navigating a webview will always load pages with their per-origin zoom factors (within the scope of the partition).
- * "disabled"
+ * 'disabled'
* * Disables all zooming in the webview. The content will revert to the default zoom level, and all attempted zoom changes will be ignored. */
- export type ZoomMode = "per-origin" | "per-view" | "disabled";
-
- /**
- * @description Queries audio state.
- * @param {any} [object Object]
- */
- export function getAudioState(callback: (audible: boolean) => void): void;
-
- /**
- * @description Sets audio mute state of the webview.
- * @param {boolean} mute Mute audio value
- */
- export function setAudioMuted(mute: boolean): void;
-
- /**
- * @description Queries whether audio is muted.
- * @param {any} [object Object]
- */
- export function isAudioMuted(callback: (muted: boolean) => void): void;
-
- /**
- * @description Captures the visible region of the webview.
- * @param {(dataUrl: string) => void} callback A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display.
- */
- export function captureVisibleRegion(callback: (dataUrl: string) => void): void;
- /**
- * @description Captures the visible region of the webview.
- * @param {*} options
- * @param {(dataUrl: string) => void} callback
- */
- export function captureVisibleRegion(options: chrome.extensionTypes.ImageDetails, callback: (dataUrl: string) => void): void;
-
- /**
- * @description Adds content script injection rules to the webview. When the webview navigates to a page matching one or more rules, the associated scripts will be injected. You can programmatically add rules or update existing rules.
The following example adds two rules to the webview: 'myRule' and 'anotherRule'.
webview.addContentScripts([
- {
- name: 'myRule',
- matches: ['http://www.foo.com/*'],
- css: { files: ['mystyles.css'] },
- js: { files: ['jquery.js', 'myscript.js'] },
- run_at: 'document_start'
- },
- {
- name: 'anotherRule',
- matches: ['http://www.bar.com/*'],
- js: { code: "document.body.style.backgroundColor = 'red';" },
- run_at: 'document_end'
- }]);
- ...
-
- // Navigates webview.
- webview.src = 'http://www.foo.com';You can defer addContentScripts call until you needs to inject scripts.
The following example shows how to overwrite an existing rule.
webview.addContentScripts([{
- name: 'rule',
- matches: ['http://www.foo.com/*'],
- js: { files: ['scriptA.js'] },
- run_at: 'document_start'}]);
-
- // Do something.
- webview.src = 'http://www.foo.com/*';
- ...
- // Overwrite 'rule' defined before.
- webview.addContentScripts([{
- name: 'rule',
- matches: ['http://www.bar.com/*'],
- js: { files: ['scriptB.js'] },
- run_at: 'document_end'}]);If webview has been naviagted to the origin (e.g., foo.com) and calls webview.addContentScripts to add 'myRule', you need to wait for next navigation to make the scripts injected. If you want immediate injection, executeScript will do the right thing.
Rules are preserved even if the guest process crashes or is killed or even if the webview is reparented.
Refer to the content scripts documentation for more details.
- * @param {ContentScriptDetails[]} contentScriptList Details of the content scripts to add.
- */
- export function addContentScripts(contentScriptList: ContentScriptDetails[]): void;
-
- /**
- * @description Navigates backward one history entry if possible. Equivalent to go(-1).
- * @param {(success: boolean) => void} [callback] Called after the navigation has either failed or completed successfully. Success parameter indicates whether the navigation was successful.
- */
- export function back(callback?: (success: boolean) => void): void;
-
- /**
- * @description Indicates whether or not it is possible to navigate backward through history. The state of this function is cached, and updated before each loadcommit, so the best place to call it is on loadcommit.
- */
- export function canGoBack(): void;
-
- /**
- * @description Indicates whether or not it is possible to navigate forward through history. The state of this function is cached, and updated before each loadcommit, so the best place to call it is on loadcommit.
- */
- export function canGoForward(): void;
-
- /**
- * @description Clears browsing data for the webview partition.
- * @param {any} options Options determining which data to clear.
- * @param {any} types The types of data to be cleared.
- * @param {any} [object Object]
- */
- export function clearData(options: ClearDataOptions, types: ClearDataTypeSet, callback?: () => void): void;
-
- /**
- * @description Injects JavaScript code into the guest page.
The following sample code uses script injection to set the guest page's background color to red:
webview.executeScript({ code: "document.body.style.backgroundColor = 'red'" });
- * @param {any} details Details of the script to run.
- * @param {any} [object Object]
- */
- export function executeScript(details: InjectDetails, callback?: (result?: any[]) => void): void;
-
- /**
- * @description Initiates a find-in-page request.
- * @param {string} searchText The string to find in the page.
- * @param {any} options Options for the find request.
- * @param {any} [object Object]
- */
- export function find(searchText: string, options?: FindOptions, callback?: (results?: any) => void): void;
-
- /**
- * @description Navigates forward one history entry if possible. Equivalent to go(1).
- * @param {any} [object Object]
- */
- export function forward(callback?: (success: boolean) => void): void;
-
- /**
- * @description Returns Chrome's internal process ID for the guest web page's current process, allowing embedders to know how many guests would be affected by terminating the process. Two guests will share a process only if they belong to the same app and have the same storage partition ID. The call is synchronous and returns the embedder's cached notion of the current process ID. The process ID isn't the same as the operating system's process ID.
- */
- export function getProcessId(): void;
-
- /**
- * @description Returns the user agent string used by the webview for guest page requests.
- */
- export function getUserAgent(): void;
-
- /**
- * @description Gets the current zoom factor.
- * @param {any} [object Object]
- */
- export function getZoom(callback: (zoomFactor: number) => void): void;
-
- /**
- * @description Gets the current zoom mode.
- * @param {any} [object Object]
- */
- export function getZoomMode(callback: (ZoomMode: any) => void): void;
-
- /**
- * @description Navigates to a history entry using a history index relative to the current navigation. If the requested navigation is impossible, this method has no effect.
- * @param {number} relativeIndex Relative history index to which the webview should be navigated. For example, a value of 2 will navigate forward 2 history entries if possible; a value of -3 will navigate backward 3 entries.
- * @param {any} [object Object]
- */
- export function go(relativeIndex: number, callback?: (success: boolean) => void): void;
-
- /**
- * @description Injects CSS into the guest page.
- * @param {any} details Details of the CSS to insert.
- * @param {any} [object Object]
- */
- export function insertCSS(details: InjectDetails, callback?: () => void): void;
-
- /**
- * @description Indicates whether or not the webview's user agent string has been overridden by $(ref:webviewTag.setUserAgentOverride).
- */
- export function isUserAgentOverridden(): void;
-
- /**
- * @description Prints the contents of the webview. This is equivalent to calling scripted print function from the webview itself.
- */
- export function print(): void;
-
- /**
- * @description Reloads the current top-level page.
- */
- export function reload(): void;
-
- /**
- * @description Removes content scripts from a webview.
The following example removes "myRule" which was added before.
webview.removeContentScripts(['myRule']);
You can remove all the rules by calling:
webview.removeContentScripts();
- * @param {any[]} scriptNameList A list of names of content scripts that will be removed. If the list is empty, all the content scripts added to the webview will be removed.
- */
- export function removeContentScripts(scriptNameList?: any[]): void;
-
- /**
- * @description Override the user agent string used by the webview for guest page requests.
- * @param {string} userAgent The user agent string to use.
- */
- export function setUserAgentOverride(userAgent: string): void;
-
- /**
- * @description Changes the zoom factor of the page. The scope and persistence of this change are determined by the webview's current zoom mode (see $(ref:webviewTag.ZoomMode)).
- * @param {number} zoomFactor The new zoom factor.
- * @param {any} [object Object]
- */
- export function setZoom(zoomFactor: number, callback?: () => void): void;
-
- /**
- * @description Sets the zoom mode of the webview.
- * @param {any} ZoomMode Defines how zooming is handled in the webview.
- * @param {any} [object Object]
- */
- export function setZoomMode(ZoomMode: ZoomMode, callback?: () => void): void;
-
- /**
- * @description Stops loading the current webview navigation if in progress.
- */
- export function stop(): void;
-
- /**
- * @description Ends the current find session (clearing all highlighting) and cancels all find requests in progress.
- * @param {string} action Determines what to do with the active match after the find session has ended. clear will clear the highlighting over the active match; keep will keep the active match highlighted; activate will keep the active match highlighted and simulate a user click on that match. The default action is keep.
- */
- export function stopFinding(action?: string): void;
-
- /**
- * @description Loads a data URL with a specified base URL used for relative links. Optionally, a virtual URL can be provided to be shown to the user instead of the data URL.
- * @param {string} dataUrl The data URL to load.
- * @param {string} baseUrl The base URL that will be used for relative links.
- * @param {string} virtualUrl The URL that will be displayed to the user (in the address bar).
- */
- export function loadDataWithBaseUrl(dataUrl: string, baseUrl: string, virtualUrl?: string): void;
-
- /**
- * @description Forcibly kills the guest web page's renderer process. This may affect multiple webview tags in the current app if they share the same process, but it will not affect webview tags in other apps.
- */
- export function terminate(): void;
-
- /**
- * @description Fired when the guest window attempts to close itself.The following example code navigates the webview to about:blank when the guest attempts to close itself.
webview.addEventListener('close', function() {
- webview.src = 'about:blank';
- });
- */
-
- export function close(event: chrome.events.Event): void;
-
- /**
- * @description Fired when the guest window logs a console message.The following example code forwards all log messages to the embedder's console without regard for log level or other properties.
webview.addEventListener('consolemessage', function(e) {
- console.log('Guest page logged a message: ', e.message);
- });
- * @param {any} [object Object]
- */
-
- export var consolemessage: chrome.events.Event;
-
- /**
- * @description Fired when the guest window fires a load event, i.e., when a new document is loaded. This does not include page navigation within the current document or asynchronous resource loads. The following example code modifies the default font size of the guest's body element after the page loads:
webview.addEventListener('contentload', function() {
- webview.executeScript({ code: 'document.body.style.fontSize = "42px"' });
- });
- */
-
- export var contentload: (event: chrome.events.Event) => void;
-
- /**
- * @description Fired when the guest window attempts to open a modal dialog via window.alert, window.confirm, or window.prompt.Handling this event will block the guest process until each event listener returns or the dialog object becomes unreachable (if preventDefault() was called.)
The default behavior is to cancel the dialog.
- * @param {any} [object Object]
- */
-
- export var dialog: chrome.events.Event;
-
- /**
- * @description Fired when the process rendering the guest web content has exited.The following example code will show a farewell message whenever the guest page crashes:
webview.addEventListener('exit', function(e) {
- if (e.reason === 'crash') {
- webview.src = 'data:text/plain,Goodbye, world!';
- }
- });
- * @param {any} [object Object]
- */
-
- export var exit: chrome.events.Event;
-
- /**
- * @description Fired when new find results are available for an active find request. This might happen multiple times for a single find request as matches are found.
- * @param {any} [object Object]
- */
-
- export var findupdate: chrome.events.Event;
-
- /**
- * @description Fired when a top-level load has aborted without committing. An error message will be printed to the console unless the event is default-prevented. Note: When a resource load is aborted, a loadabort event will eventually be followed by a loadstop event, even if all committed loads since the last loadstop event (if any) were aborted.
Note: When the load of either an about URL or a JavaScript URL is aborted, loadabort will be fired and then the webview will be navigated to 'about:blank'.
- * @param {any} [object Object]
- */
-
- export var loadabort: chrome.events.Event;
-
- /**
- * @description Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.
- * @param {any} [object Object]
- */
-
- export var loadcommit: chrome.events.Event;
-
- /**
- * @description Fired when a top-level load request has redirected to a different URL.
- * @param {any} [object Object]
- */
-
- export var loadredirect: chrome.events.Event;
-
- /**
- * @description Fired when a load has begun.
- * @param {any} [object Object]
- */
-
- export var loadstart: chrome.events.Event;
-
- /**
- * @description Fired when all frame-level loads in a guest page (including all its subframes) have completed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads. This event fires every time the number of document-level loads transitions from one (or more) to zero. For example, if a page that has already finished loading (i.e., loadstop already fired once) creates a new iframe which loads a page, then a second loadstop will fire when the iframe page load completes. This pattern is commonly observed on pages that load ads. Note: When a committed load is aborted, a loadstop event will eventually follow a loadabort event, even if all committed loads since the last loadstop event (if any) were aborted.
- */
-
- export function loadstop(event: chrome.events.Event): void;
-
- /**
- * @description Fired when the guest page attempts to open a new browser window.The following example code will create and navigate a new webview in the embedder for each requested new window:
webview.addEventListener('newwindow', function(e) {
- var newWebview = document.createElement('webview');
- document.body.appendChild(newWebview);
- e.window.attach(newWebview);
- });
- * @param {any} [object Object]
- */
-
- export var newwindow: chrome.events.Event;
-
- /**
- * @description Fired when the guest page needs to request special permission from the embedder.The following example code will grant the guest page access to the webkitGetUserMedia API. Note that an app using this example code must itself specify audioCapture and/or videoCapture manifest permissions:
webview.addEventListener('permissionrequest', function(e) {
- if (e.permission === 'media') {
- e.request.allow();
- }
- });
- * @param {any} [object Object]
- */
-
- export var permissionrequest: chrome.events.Event;
-
- /**
- * @description Fired when the process rendering the guest web content has become responsive again after being unresponsive.The following example code will fade the webview element in or out as it becomes responsive or unresponsive:
webview.style.webkitTransition = 'opacity 250ms';
- webview.addEventListener('unresponsive', function() {
- webview.style.opacity = '0.5';
- });
- webview.addEventListener('responsive', function() {
- webview.style.opacity = '1';
- });
- * @param {any} [object Object]
- */
-
- export var responsive: chrome.events.Event;
-
- /**
- * @description Fired when the embedded web content has been resized via autosize. Only fires if autosize is enabled.
- * @param {any} [object Object]
- */
-
- export var sizechanged: chrome.events.Event;
-
- /**
- * @description Fired when the process rendering the guest web content has become unresponsive. This event will be generated once with a matching responsive event if the guest begins to respond again.
- * @param {any} [object Object]
- */
-
- export var unresponsive: chrome.events.Event;
-
- /**
- * @description Fired when the page's zoom changes.
- * @param {any} [object Object]
- */
-
- export var zoomchange: chrome.events.Event;
- /**IConsolemessage (Auto generated interface) */
- interface IConsolemessage {
+ export type ZoomMode = 'per-origin' | 'per-view' | 'disabled';
+
+ export enum ConsoleMessageLevel {
+ LOG_VERBOSE = -1,
+ LOG_INFO = 0,
+ LOG_WARNING = 1,
+ LOG_ERROR = 2
+ }
+ interface IConsoleMessage {
/**
* @description The severity level of the log message. Ranges from -1 to 2. LOG_VERBOSE (console.debug) = -1, LOG_INFO (console.log, console.info) = 0, LOG_WARNING (console.warn) = 1, LOG_ERROR (console.error) = 2.
*/
- level: number
+ level: ConsoleMessageLevel;
/**
* @description The logged message contents.
@@ -5539,7 +6539,6 @@ declare namespace chrome {
*/
sourceId: string
}
- /**IDialog (Auto generated interface) */
interface IDialog {
/**
@@ -5557,7 +6556,6 @@ declare namespace chrome {
*/
dialog: DialogController
}
- /**IExit (Auto generated interface) */
interface IExit {
/**
@@ -5570,7 +6568,6 @@ declare namespace chrome {
*/
reason: 'normal' | 'abnormal' | 'crash' | 'kill'
}
- /**IFindupdate (Auto generated interface) */
interface IFindupdate {
/**
@@ -5603,7 +6600,6 @@ declare namespace chrome {
*/
finalUpdate: string
}
- /**ILoadabort (Auto generated interface) */
interface ILoadabort {
/**
@@ -5626,7 +6622,6 @@ declare namespace chrome {
*/
reason: 'ERR_ABORTED' | 'ERR_INVALID_URL' | 'ERR_DISALLOWED_URL_SCHEME' | 'ERR_BLOCKED_BY_CLIENT' | 'ERR_ADDRESS_UNREACHABLE' | 'ERR_EMPTY_RESPONSE' | 'ERR_FILE_NOT_FOUND' | 'ERR_UNKNOWN_URL_SCHEME'
}
- /**ILoadcommit (Auto generated interface) */
interface ILoadcommit {
/**
@@ -5703,7 +6698,6 @@ declare namespace chrome {
*/
windowOpenDisposition: 'ignore' | 'save_to_disk' | 'current_tab' | 'new_background_tab' | 'new_foreground_tab' | 'new_window' | 'new_popup'
}
- /**IPermissionrequest (Auto generated interface) */
interface IPermissionrequest {
/**
@@ -5714,8 +6708,9 @@ declare namespace chrome {
/**
* @description An object which holds details of the requested permission. Depending on the type of permission requested, this may be a $(ref:webviewTag.MediaPermissionRequest), $(ref:webviewTag.GeolocationPermissionRequest), $(ref:webviewTag.PointerLockPermissionRequest), $(ref:webviewTag.DownloadPermissionRequest), $(ref:webviewTag.LoadPluginPermissionRequest), or $(ref:webviewTag.FullscreenPermissionRequest).
*/
- request: object
+ request: GeolocationPermissionRequest | PointerLockPermissionRequest | DownloadPermissionRequest | LoadPluginPermissionRequest | FullscreenPermissionRequest;
}
+
/**IResponsive (Auto generated interface) */
interface IResponsive {
diff --git a/types/chrome-apps/test/index.ts b/types/chrome-apps/test/index.ts
index f976fc57b4..c0dc6402a6 100644
--- a/types/chrome-apps/test/index.ts
+++ b/types/chrome-apps/test/index.ts
@@ -1,7 +1,7 @@
import runtime = chrome.app.runtime;
import cwindow = chrome.app.window;
-var createOptions: cwindow.CreateWindowOptions = {
+const createOptions: cwindow.CreateWindowOptions = {
id: "My Window",
bounds: {
left: 0,
@@ -324,5 +324,40 @@ function testSystemNetwork() {
});
}
-import webview = chrome.webview;
-let element: webview.HTMLWebViewElement;
+const gcmMessage = {};
+gcmMessage.data = {
+ /*goog: 'any', should not be allowed, and it is not :) */
+ test: true
+};
+
+let wve: chrome.webview.HTMLWebViewElement = (document.getElementById('webview'));
+wve.name = 'test';
+wve.src = 'https://github.com/DefinitelyTyped';
+wve.allowtransparency = true;
+wve.autosize = 'on';
+wve.partition = 'persist:githubwebview';
+wve.addEventListener('close', () => {
+ return;
+});
+wve.addEventListener('consolemessage', (ev) => {
+ if (ev.level === chrome.webview.ConsoleMessageLevel.LOG_ERROR) {
+ const msg = ev.message;
+ }
+});
+wve.addEventListener('dialog', (ev) => {
+ ev.dialog.ok('Hello World!');
+});
+wve.addEventListener('loadstart', (ev) => {
+ if (ev.isTopLevel) {
+ return ev.url;
+ }
+ return;
+});
+wve.addEventListener('zoomchange', (ev) => {
+ return ev.newZoomFactor || ev.oldZoomFactor;
+});
+wve.addEventListener('loadredirect', (ev) => {
+ return ev.newUrl || ev.oldUrl;
+});
+
+chrome.bluetoothLowEnergy.connect('1111111', () => { });
diff --git a/types/com.wikitude.phonegap.wikitudeplugin/com.wikitude.phonegap.wikitudeplugin-tests.ts b/types/com.wikitude.phonegap.wikitudeplugin/com.wikitude.phonegap.wikitudeplugin-tests.ts
new file mode 100644
index 0000000000..c46d48d563
--- /dev/null
+++ b/types/com.wikitude.phonegap.wikitudeplugin/com.wikitude.phonegap.wikitudeplugin-tests.ts
@@ -0,0 +1,33 @@
+const startupConfiguration: any = { camera_position: 'back' };
+
+// Some code samples from the wikitude ionic starter
+WikitudePlugin.loadARchitectWorld(
+ success => {
+ console.log('ARchitect World loaded successfully.');
+ },
+ fail => {
+ console.log('Failed to load ARchitect World!');
+ },
+ 'www/assets/07_3dModels_6_3dModelAtGeoLocation/index.html',
+ ['geo'],
+ startupConfiguration
+);
+
+WikitudePlugin.setOnUrlInvokeCallback(url => {
+ if (url.indexOf('captureScreen') > -1) {
+ WikitudePlugin.captureScreen(
+ absoluteFilePath => {
+ WikitudePlugin.callJavaScript(
+ `World.testFunction('Screenshot saved at: ${absoluteFilePath}');`
+ );
+ },
+ errorMessage => {
+ console.log(errorMessage);
+ },
+ true,
+ null
+ );
+ } else {
+ alert(url + 'not handled');
+ }
+});
diff --git a/types/com.wikitude.phonegap.wikitudeplugin/index.d.ts b/types/com.wikitude.phonegap.wikitudeplugin/index.d.ts
new file mode 100644
index 0000000000..50307d57c8
--- /dev/null
+++ b/types/com.wikitude.phonegap.wikitudeplugin/index.d.ts
@@ -0,0 +1,82 @@
+// Type definitions for com.wikitude.phonegap.wikitudeplugin 7.2
+// Project: https://github.com/Wikitude/wikitude-cordova-plugin
+// Definitions by: zbarbuto
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.2
+
+// The following types are taken directly (unmodified) from the wikitude-ionic-3-starter-app
+// https://github.com/pbreuss/wikitude-ionic-3-starter-app
+// Latest commit at time of writing was 647cd546f6d1805765c4cee725566e246ca6259d
+
+/**
+ * Wrapper for the Wikitude SDK Phonegap Plugin - to use with IONIC2
+ * (c) 2016 Schneeweis.Technology
+ */
+interface WikitudePlugin {
+ isDeviceSupported(
+ successCallback: (success: string) => void,
+ errorCallback: (message: string) => void,
+ requiredFeatures: [string]
+ ): void;
+
+ loadARchitectWorld(
+ successCallback: (success: string) => void,
+ errorCallback: (message: string) => void,
+ architectWorldPath: string,
+ requiredFeatures: [string],
+ startupConfiguration: JSON | object
+ ): void;
+
+ close(): void;
+
+ hide(): void;
+
+ show(): void;
+
+ // test type ok?
+ callJavaScript(js: any): void;
+
+ setOnUrlInvokeCallback(onUrlInvokeCallback: (success: string) => void): void;
+
+ setLocation(latitude: any, longitude: any, altitude: any, accuracy: any): void;
+
+ captureScreen(
+ successCallback: (success: string) => void,
+ errorCallback: (message: string) => void,
+ includeWebView: boolean,
+ imagePathInBundleOrNullForPhotoLibrary: string | null
+ ): void;
+
+ setErrorHandler(errorHandler: (message: string) => void): void;
+
+ setDeviceSensorsNeedCalibrationHandler(
+ startCalibrationHandler: (message: string) => void
+ ): void;
+
+ setDeviceSensorsFinishedCalibrationHandler(
+ finishedCalibrationHandler: (message: string) => void
+ ): void;
+
+ setBackButtonCallback(onBackButtonCallback: (message: string) => void): void;
+
+ /* Lifecycle updates */
+
+ onResume(): void;
+ onBackButton(): void;
+ onPause(): void;
+
+ onWikitudeOK(): void;
+ onWikitudeError(): void;
+
+ _sdkKey: string;
+ FeatureGeo: string;
+ Feature2DTracking: string;
+ CameraPositionUndefined: number;
+ CameraPositionFront: number;
+ CameraPositionBack: number;
+ CameraFocusRangeNone: number;
+ CameraFocusRangeNear: number;
+ CameraFocusRangeFar: number;
+}
+
+declare var WikitudePlugin: WikitudePlugin;
diff --git a/types/com.wikitude.phonegap.wikitudeplugin/tsconfig.json b/types/com.wikitude.phonegap.wikitudeplugin/tsconfig.json
new file mode 100644
index 0000000000..ed0ce7783e
--- /dev/null
+++ b/types/com.wikitude.phonegap.wikitudeplugin/tsconfig.json
@@ -0,0 +1,24 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6",
+ "dom"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "com.wikitude.phonegap.wikitudeplugin-tests.ts"
+ ]
+}
diff --git a/types/com.wikitude.phonegap.wikitudeplugin/tslint.json b/types/com.wikitude.phonegap.wikitudeplugin/tslint.json
new file mode 100644
index 0000000000..f93cf8562a
--- /dev/null
+++ b/types/com.wikitude.phonegap.wikitudeplugin/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": "dtslint/dt.json"
+}
diff --git a/types/connect-mongo/tsconfig.json b/types/connect-mongo/tsconfig.json
index ca12068b57..c0c9ab3043 100644
--- a/types/connect-mongo/tsconfig.json
+++ b/types/connect-mongo/tsconfig.json
@@ -7,7 +7,10 @@
"paths": {
"mongodb": [
"mongodb/v2"
- ]
+ ],
+ "mongoose": [
+ "mongoose/v4"
+ ]
},
"noImplicitAny": true,
"noImplicitThis": true,
@@ -25,4 +28,4 @@
"index.d.ts",
"connect-mongo-tests.ts"
]
-}
\ No newline at end of file
+}
diff --git a/types/csso/csso-tests.ts b/types/csso/csso-tests.ts
new file mode 100644
index 0000000000..74e0b51dd9
--- /dev/null
+++ b/types/csso/csso-tests.ts
@@ -0,0 +1,40 @@
+import csso = require('csso');
+
+csso.minify('.test { color: #ff0000; }').css;
+csso.minify('.test { color: #ff0000; }').map;
+csso.minify('.test { color: #ff0000; }', {
+ sourceMap: true,
+ filename: '',
+ debug: true,
+ beforeCompress: () => {},
+ afterCompress: () => {},
+ restructure: false,
+ forceMediaMerge: true,
+ clone: false,
+ comments: '',
+ logger: () => {}
+});
+
+csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000').css;
+csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000').map;
+csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000', {
+ sourceMap: true,
+ filename: '',
+ debug: true,
+ beforeCompress: () => {},
+ afterCompress: () => {},
+ restructure: false,
+ forceMediaMerge: true,
+ clone: false,
+ comments: '',
+ logger: () => {}
+});
+
+csso.compress({}).ast;
+csso.compress({}, {
+ restructure: false,
+ forceMediaMerge: true,
+ clone: false,
+ comments: '',
+ logger: () => {}
+}).ast;
diff --git a/types/csso/index.d.ts b/types/csso/index.d.ts
new file mode 100644
index 0000000000..f89f395129
--- /dev/null
+++ b/types/csso/index.d.ts
@@ -0,0 +1,107 @@
+// Type definitions for csso 3.5
+// Project: https://github.com/css/csso
+// Definitions by: Christian Rackerseder
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.6
+
+declare namespace csso {
+ interface Result {
+ /**
+ * Resulting CSS.
+ */
+ css: string;
+ /**
+ * Instance of SourceMapGenerator or null.
+ */
+ map: object | null;
+ }
+
+ interface CompressOptions {
+ /**
+ * Disable or enable a structure optimisations.
+ * @default true
+ */
+ restructure?: boolean;
+ /**
+ * Enables merging of @media rules with the same media query by splitted by other rules.
+ * The optimisation is unsafe in general, but should work fine in most cases. Use it on your own risk.
+ * @default false
+ */
+ forceMediaMerge?: boolean;
+ /**
+ * Transform a copy of input AST if true. Useful in case of AST reuse.
+ * @default false
+ */
+ clone?: boolean;
+ /**
+ * Specify what comments to leave:
+ * - 'exclamation' or true – leave all exclamation comments
+ * - 'first-exclamation' – remove every comment except first one
+ * - false – remove all comments
+ * @default true
+ */
+ comments?: string | boolean;
+ /**
+ * Usage data for advanced optimisations.
+ */
+ usage?: object;
+ /**
+ * Function to track every step of transformation.
+ */
+ logger?: () => void;
+ }
+
+ interface MinifyOptions {
+ /**
+ * Generate a source map when true.
+ * @default false
+ */
+ sourceMap?: boolean;
+ /**
+ * Filename of input CSS, uses for source map generation.
+ * @default ''
+ */
+ filename?: string;
+ /**
+ * Output debug information to stderr.
+ * @default false
+ */
+ debug?: boolean;
+ /**
+ * Called right after parse is run.
+ */
+ beforeCompress?: BeforeCompressFn | BeforeCompressFn[];
+ /**
+ * Called right after compress() is run.
+ */
+ afterCompress?: AfterCompressFn | AfterCompressFn[];
+ restructure?: boolean;
+ }
+
+ type BeforeCompressFn = (ast: object, options: CompressOptions) => void;
+ type AfterCompressFn = (compressResult: string, options: CompressOptions) => void;
+}
+
+interface Csso {
+ /**
+ * Minify source CSS passed as String
+ * @param source
+ * @param options
+ */
+ minify(source: string, options?: csso.MinifyOptions & csso.CompressOptions): csso.Result;
+
+ /**
+ * The same as minify() but for list of declarations. Usually it's a style attribute value.
+ * @param source
+ * @param options
+ */
+ minifyBlock(source: string, options?: csso.MinifyOptions & csso.CompressOptions): csso.Result;
+
+ /**
+ * Does the main task – compress an AST.
+ */
+ compress(ast: object, options?: csso.CompressOptions): { ast: object };
+}
+
+declare const csso: Csso;
+export = csso;
diff --git a/types/csso/tsconfig.json b/types/csso/tsconfig.json
new file mode 100644
index 0000000000..9ed6695bc9
--- /dev/null
+++ b/types/csso/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "csso-tests.ts"
+ ]
+}
diff --git a/types/csso/tslint.json b/types/csso/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/csso/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/cytoscape/cytoscape-tests.ts b/types/cytoscape/cytoscape-tests.ts
index 39be1cd0e7..10a38145de 100644
--- a/types/cytoscape/cytoscape-tests.ts
+++ b/types/cytoscape/cytoscape-tests.ts
@@ -2,14 +2,8 @@
// TODO: document all aliases as aliases, not as duplicates!
-const assert = (tag: boolean) => { if (!tag) throw new Error(); };
-const aliases = (...obj: Array<{}>) => { if (obj.slice(1).some((alias) => alias !== obj[0])) throw new Error(); };
-const events = (obj: any) => {
- aliases(obj.on, obj.bind, obj.listen, obj.addListener);
- aliases(obj.promiseOn, obj.pon);
- aliases(obj.off, obj.unbind, obj.unlisten, obj.removeListener);
- aliases(obj.emit, obj.trigger);
-};
+const assert = (tag: boolean) => {};
+const aliases = (...obj: Array<{}>) => {};
// definitions
function oneOf(a: A, b: B, c: C, d: D, e: E): A | B | C | D | E;
@@ -129,7 +123,7 @@ cy.on('zoom', (event) => {
}
});
cy.off('zoom');
-events(cy);
+// events(cy); - TODO
cy.add({ data: { id: 'g' }, position: {x: 200, y: 150} });
cy.add([
@@ -383,11 +377,18 @@ assert(eles.removed());
assert(!eles.inside());
eles.restore();
-([ele, eles, node, nodes, edge, edges] as cytoscape.CollectionReturnValue[]).forEach((elem) => {
- aliases(elem.clone, elem.copy);
- events(elem);
- aliases(elem.data, elem.attr);
- aliases(elem.removeData, elem.removeAttr);
+([ele, eles, node, nodes, edge, edges] as [
+ cytoscape.SingularElementReturnValue,
+ cytoscape.CollectionReturnValue,
+ cytoscape.NodeSingular,
+ cytoscape.NodeCollection,
+ cytoscape.EdgeSingular,
+ cytoscape.EdgeCollection
+]).forEach((elemType) => {
+ aliases(elemType.clone, elemType.copy);
+ // events(elemType); - TODO
+ aliases(elemType.data, elemType.attr);
+ aliases(elemType.removeData, elemType.removeAttr);
});
// TODO: tests for data flow
@@ -490,6 +491,6 @@ eles.reduce((prev, ele, i, eles) => [...prev, [ele, i]], []).concat(['fin
const min = eles.min((ele, i, eles) => ele.id.length + i); min.ele.scratch('min', min.value);
const max = eles.max((ele, i, eles) => ele.id.length + i); max.ele.scratch('max', max.value);
-// TODO: traversing (need to actively check the nodes/edeges distinction)
+// TODO: traversing (need to actively check the nodes/edges distinction)
// TODO: algorithms
// TODO: compound nodes (there aren't any in current test case)
diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts
index a3226defd2..1fcdcb0f08 100644
--- a/types/cytoscape/index.d.ts
+++ b/types/cytoscape/index.d.ts
@@ -1118,7 +1118,7 @@ declare namespace cytoscape {
* http://js.cytoscape.org/#collection
*/
interface Collection
- extends Singular,
+ extends
CollectionGraphManipulation, CollectionEvents,
CollectionData, CollectionPosition,
CollectionLayout,
@@ -1129,8 +1129,10 @@ declare namespace cytoscape {
/**
* ele --> Cy.Singular
* a collection of a single element (node or edge)
+ * NB: every singular collection is a general collection too (but not vice versa)!
*/
- interface Singular extends
+ interface Singular
+ extends Collection,
SingularGraphManipulation,
SingularData, SingularPosition,
SingularSelection, SingularStyle, SingularAnimation { }
@@ -1154,7 +1156,7 @@ declare namespace cytoscape {
*
* The output is a collection of edge elements OR single edge.
*/
- interface EdgeCollection extends Collection, EdgeSingular,
+ interface EdgeCollection extends EdgeSingular,
EdgeCollectionTraversing { }
/**
* nodes -> Cy.NodeCollection
@@ -1162,7 +1164,7 @@ declare namespace cytoscape {
*
* The output is a collection of node elements OR single node.
*/
- interface NodeCollection extends Collection, NodeSingular,
+ interface NodeCollection extends NodeSingular,
NodeCollectionMetadata, NodeCollectionPosition, NodeCollectionTraversing,
NodeCollectionCompound { }
@@ -1172,14 +1174,14 @@ declare namespace cytoscape {
* edge --> Cy.EdgeSingular
* a collection of a single edge
*/
- interface EdgeSingular extends Singular,
+ interface EdgeSingular extends Singular,
EdgeSingularData, EdgeSingularPoints, EdgeSingularTraversing { }
/**
* node --> Cy.NodeSingular
* a collection of a single node
*/
- interface NodeSingular extends Singular,
+ interface NodeSingular extends Singular,
NodeSingularMetadata, NodeSingularPosition, NodeSingularCompound { }
/**
@@ -1251,6 +1253,15 @@ declare namespace cytoscape {
on(events: EventNames, selector: string, data: any, handler: EventHandler): void;
on(events: EventNames, selector: string, handler: EventHandler): void;
on(events: EventNames, handler: EventHandler): void;
+ bind(events: EventNames, selector: string, data: any, handler: EventHandler): void;
+ bind(events: EventNames, selector: string, handler: EventHandler): void;
+ bind(events: EventNames, handler: EventHandler): void;
+ listen(events: EventNames, selector: string, data: any, handler: EventHandler): void;
+ listen(events: EventNames, selector: string, handler: EventHandler): void;
+ listen(events: EventNames, handler: EventHandler): void;
+ addListener(events: EventNames, selector: string, data: any, handler: EventHandler): void;
+ addListener(events: EventNames, selector: string, handler: EventHandler): void;
+ addListener(events: EventNames, handler: EventHandler): void;
/**
* http://js.cytoscape.org/#eles.promiseOn
* alias: pon
@@ -1280,11 +1291,15 @@ declare namespace cytoscape {
* alias unbind, unlisten, removeListener
*/
off(events: EventNames, selector?: string, handler?: EventHandler): void;
+ unbind(events: EventNames, selector?: string, handler?: EventHandler): void;
+ unlisten(events: EventNames, selector?: string, handler?: EventHandler): void;
+ removeListener(events: EventNames, selector?: string, handler?: EventHandler): void;
/**
* http://js.cytoscape.org/#eles.trigger
* alias: emit
*/
trigger(events: EventNames, extra?: string[]): void;
+ emit(events: EventNames, extra?: string[]): void;
}
/**
@@ -2747,28 +2762,28 @@ declare namespace cytoscape {
*
* @param selector [optional] An optional selector that is used to filter the resultant collection.
*/
- outgoers(selector?: Selector): EdgeCollection;
+ outgoers(selector?: Selector): CollectionReturnValue;
/**
* Recursively get edges (and their targets) coming out of the nodes in the collection (i.e. the outgoers, the outgoers' outgoers, ...).
*
* @param selector [optional] An optional selector that is used to filter the resultant collection.
*/
- successors(selector?: Selector): EdgeCollection;
+ successors(selector?: Selector): CollectionReturnValue;
/**
* Get edges (and their sources) coming into the nodes in the collection.
*
* @param selector [optional] An optional selector that is used to filter the resultant collection.
*/
- incomers(selector?: Selector): EdgeCollection;
+ incomers(selector?: Selector): CollectionReturnValue;
/**
* Recursively get edges (and their sources) coming into the nodes in the collection (i.e. the incomers, the incomers' incomers, ...).
*
* @param selector [optional] An optional selector that is used to filter the resultant collection.
*/
- predecessors(selector?: Selector): EdgeCollection;
+ predecessors(selector?: Selector): CollectionReturnValue;
}
/**
diff --git a/types/dat.gui/index.d.ts b/types/dat.gui/index.d.ts
index 967b5ae13b..5c20fd51fe 100644
--- a/types/dat.gui/index.d.ts
+++ b/types/dat.gui/index.d.ts
@@ -51,8 +51,7 @@ export class GUI {
__folders: GUI[];
domElement: HTMLElement;
- add(target: Object, propName:string): GUIController;
- add(target: Object, propName:string, min: number, max: number): GUIController;
+ add(target: Object, propName:string, min?: number, max?: number, step?: number): GUIController;
add(target: Object, propName:string, status: boolean): GUIController;
add(target: Object, propName:string, items:string[]): GUIController;
add(target: Object, propName:string, items:number[]): GUIController;
@@ -64,6 +63,7 @@ export class GUI {
destroy(): void;
addFolder(propName:string): GUI;
+ removeFolder(subFolder:GUI):void;
open(): void;
close(): void;
diff --git a/types/datatables.net-scroller/datatables.net-scroller-tests.ts b/types/datatables.net-scroller/datatables.net-scroller-tests.ts
new file mode 100644
index 0000000000..cb93306ba0
--- /dev/null
+++ b/types/datatables.net-scroller/datatables.net-scroller-tests.ts
@@ -0,0 +1,13 @@
+$(document).ready(() => {
+ const config: DataTables.Settings = {
+ // Scroller extension options
+ scroller: {
+ trace: true,
+ rowHeight: 30,
+ serverWait: 1000,
+ displayBuffer: 10,
+ boundaryScale: 0.6,
+ loadingIndicator: true
+ }
+ };
+});
diff --git a/types/datatables.net-scroller/index.d.ts b/types/datatables.net-scroller/index.d.ts
new file mode 100644
index 0000000000..fe97507712
--- /dev/null
+++ b/types/datatables.net-scroller/index.d.ts
@@ -0,0 +1,106 @@
+// Type definitions for datatables.net-scroller 1.4
+// Project: https://datatables.net
+// Definitions by: Konstantin Rohde
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.4
+
+///
+///
+
+declare namespace DataTables {
+ interface Settings {
+ /*
+ * Select extension options
+ */
+ scroller?: boolean | ScrollerSettings;
+ }
+
+ interface ScrollerSettings {
+ /*
+ * Indicate if Scroller show show trace information on the console or not.
+ */
+ trace?: boolean;
+
+ /*
+ * Scroller will attempt to automatically calculate the height of rows for it's internal
+ * calculations. However the height that is used can be overridden using this parameter.
+ */
+ rowHeight?: number | string;
+
+ /*
+ * When using server-side processing, Scroller will wait a small amount of time to allow
+ * the scrolling to finish before requesting more data from the server.
+ */
+ serverWait?: number;
+
+ /*
+ * The display buffer is what Scroller uses to calculate how many rows it should pre-fetch
+ * for scrolling.
+ */
+ displayBuffer?: number;
+
+ /*
+ * Scroller uses the boundary scaling factor to decide when to redraw the table - which it
+ * typically does before you reach the end of the currently loaded data set (in order to
+ * allow the data to look continuous to a user scrolling through the data).
+ */
+ boundaryScale?: number;
+
+ /*
+ * Show (or not) the loading element in the background of the table. Note that you should
+ * include the dataTables.scroller.css file for this to be displayed correctly.
+ */
+ loadingIndicator?: boolean;
+ }
+
+ interface Api {
+ scroller: ScrollerMethodsModel;
+ }
+
+ interface ScrollerMethodsModel {
+ /*
+ * Calculate and store information about how many rows are to be displayed
+ * in the scrolling viewport, based on current dimensions in the browser's
+ * rendering.
+ */
+ measure(redraw?: boolean): Api;
+ /*
+ * Get information about current displayed record range.
+ */
+ page(): PageInfo;
+ /*
+ * Get Scroller Api
+ */
+ scroller(): ScrollerMethods;
+ }
+
+ interface ScrollerMethods extends Api {
+ /*
+ * Calculate the pixel position from the top of the scrolling container for
+ * a given row
+ */
+ rowToPixels(rowIdx: number, intParse?: boolean, virtual?: boolean): number;
+ /*
+ * Calculate the row number that will be found at the given pixel position
+ * (y-scroll).
+ */
+ pixelsToRow(pixels: number, intParse?: boolean, virtual?: boolean): number;
+ scrollToRow(rowIdx: number, animate?: boolean): Api;
+ }
+
+ /*
+ * start: {int}, // the 0-indexed record at the top of the viewport
+ * end: {int}, // the 0-indexed record at the bottom of the viewport
+ */
+ interface PageInfo {
+ start: number;
+ end: number;
+ }
+
+ interface RowMethods {
+ /**
+ * Scroll to a row
+ */
+ scrollTo(animate?: boolean): Api;
+ }
+}
diff --git a/types/datatables.net-scroller/tsconfig.json b/types/datatables.net-scroller/tsconfig.json
new file mode 100644
index 0000000000..29e1854557
--- /dev/null
+++ b/types/datatables.net-scroller/tsconfig.json
@@ -0,0 +1,24 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6",
+ "dom"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "datatables.net-scroller-tests.ts"
+ ]
+}
diff --git a/types/datatables.net-scroller/tslint.json b/types/datatables.net-scroller/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/datatables.net-scroller/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/emoji-regex/emoji-regex-tests.ts b/types/emoji-regex/emoji-regex-tests.ts
new file mode 100644
index 0000000000..6d6b0d25d9
--- /dev/null
+++ b/types/emoji-regex/emoji-regex-tests.ts
@@ -0,0 +1,3 @@
+import emojiRegex from "emoji-regex";
+
+emojiRegex(); // $ExpectType RegExp
diff --git a/types/emoji-regex/index.d.ts b/types/emoji-regex/index.d.ts
new file mode 100644
index 0000000000..edff690dc7
--- /dev/null
+++ b/types/emoji-regex/index.d.ts
@@ -0,0 +1,7 @@
+// Type definitions for emoji-regex 7.0
+// Project: https://github.com/mathiasbynens/emoji-regex
+// Definitions by: iKBAHT
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare function createRegExp(): RegExp;
+export = createRegExp;
diff --git a/types/emoji-regex/tsconfig.json b/types/emoji-regex/tsconfig.json
new file mode 100644
index 0000000000..1dfdf53dac
--- /dev/null
+++ b/types/emoji-regex/tsconfig.json
@@ -0,0 +1,24 @@
+{
+ "compilerOptions": {
+ "allowSyntheticDefaultImports": true,
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictFunctionTypes": true,
+ "strictNullChecks": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "emoji-regex-tests.ts"
+ ]
+}
diff --git a/types/emoji-regex/tslint.json b/types/emoji-regex/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/emoji-regex/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/ethereum-protocol/ethereum-protocol-tests.ts b/types/ethereum-protocol/ethereum-protocol-tests.ts
new file mode 100644
index 0000000000..a30a691e87
--- /dev/null
+++ b/types/ethereum-protocol/ethereum-protocol-tests.ts
@@ -0,0 +1,4 @@
+import { CallData, BlockParamLiteral } from 'ethereum-protocol';
+BlockParamLiteral.Earliest;
+BlockParamLiteral.Latest;
+BlockParamLiteral.Pending;
diff --git a/types/ethereum-protocol/index.d.ts b/types/ethereum-protocol/index.d.ts
new file mode 100644
index 0000000000..9b967cfc83
--- /dev/null
+++ b/types/ethereum-protocol/index.d.ts
@@ -0,0 +1,293 @@
+// Type definitions for ethereum-protocol 1.0
+// Project: https://www.npmjs.com/package/ethereum-protocol
+// Definitions by: Leonid Logvinov
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.4
+
+import BigNumber from 'bignumber.js';
+
+export type JSONRPCErrorCallback = (err: Error | null, result?: JSONRPCResponsePayload) => void;
+
+/**
+ * Do not create your own provider. Use an existing provider from a Web3 or ProviderEngine library
+ * Read more about Providers in the 0x wiki.
+ */
+export interface Provider {
+ sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): void;
+}
+
+export type ContractAbi = AbiDefinition[];
+
+export type AbiDefinition = FunctionAbi | EventAbi;
+
+export type FunctionAbi = MethodAbi | ConstructorAbi | FallbackAbi;
+
+export type ConstructorStateMutability = 'nonpayable' | 'payable';
+export type StateMutability = 'pure' | 'view' | ConstructorStateMutability;
+
+export enum AbiType {
+ Function = 'function',
+ Constructor = 'constructor',
+ Event = 'event',
+ Fallback = 'fallback',
+}
+
+export interface MethodAbi {
+ type: AbiType.Function;
+ name: string;
+ inputs: DataItem[];
+ outputs: DataItem[];
+ constant: boolean;
+ stateMutability: StateMutability;
+ payable: boolean;
+}
+
+export interface ConstructorAbi {
+ type: AbiType.Constructor;
+ inputs: DataItem[];
+ payable: boolean;
+ stateMutability: ConstructorStateMutability;
+}
+
+export interface FallbackAbi {
+ type: AbiType.Fallback;
+ payable: boolean;
+}
+
+export interface EventParameter extends DataItem {
+ indexed: boolean;
+}
+
+export interface EventAbi {
+ type: AbiType.Event;
+ name: string;
+ inputs: EventParameter[];
+ anonymous: boolean;
+}
+
+export interface DataItem {
+ name: string;
+ type: string;
+ components?: DataItem[];
+}
+
+export enum OpCode {
+ DelegateCall = 'DELEGATECALL',
+ Revert = 'REVERT',
+ Create = 'CREATE',
+ Stop = 'STOP',
+ Invalid = 'INVALID',
+ CallCode = 'CALLCODE',
+ StaticCall = 'STATICCALL',
+ Return = 'RETURN',
+ Call = 'CALL',
+ SelfDestruct = 'SELFDESTRUCT',
+}
+
+export interface StructLog {
+ depth: number;
+ error: string;
+ gas: number;
+ gasCost: number;
+ memory: string[];
+ op: OpCode;
+ pc: number;
+ stack: string[];
+ storage: { [location: string]: string };
+}
+
+export interface TransactionTrace {
+ gas: number;
+ returnValue: any;
+ structLogs: StructLog[];
+}
+
+export type Unit =
+ | 'kwei'
+ | 'ada'
+ | 'mwei'
+ | 'babbage'
+ | 'gwei'
+ | 'shannon'
+ | 'szabo'
+ | 'finney'
+ | 'ether'
+ | 'kether'
+ | 'grand'
+ | 'einstein'
+ | 'mether'
+ | 'gether'
+ | 'tether';
+
+export interface JSONRPCRequestPayload {
+ params: any[];
+ method: string;
+ id: number;
+ jsonrpc: string;
+}
+
+export interface JSONRPCResponsePayload {
+ result: any;
+ id: number;
+ jsonrpc: string;
+}
+
+export interface AbstractBlock {
+ number: number | null;
+ hash: string | null;
+ parentHash: string;
+ nonce: string | null;
+ sha3Uncles: string;
+ logsBloom: string | null;
+ transactionsRoot: string;
+ stateRoot: string;
+ miner: string;
+ difficulty: BigNumber;
+ totalDifficulty: BigNumber;
+ extraData: string;
+ size: number;
+ gasLimit: number;
+ gasUsed: number;
+ timestamp: number;
+ uncles: string[];
+}
+
+export interface BlockWithoutTransactionData extends AbstractBlock {
+ transactions: string[];
+}
+
+export interface BlockWithTransactionData extends AbstractBlock {
+ transactions: Transaction[];
+}
+
+export interface Transaction {
+ hash: string;
+ nonce: number;
+ blockHash: string | null;
+ blockNumber: number | null;
+ transactionIndex: number | null;
+ from: string;
+ to: string | null;
+ value: BigNumber;
+ gasPrice: BigNumber;
+ gas: number;
+ input: string;
+}
+
+export interface CallTxDataBase {
+ to?: string;
+ value?: number | string | BigNumber;
+ gas?: number | string | BigNumber;
+ gasPrice?: number | string | BigNumber;
+ data?: string;
+ nonce?: number;
+}
+
+export interface TxData extends CallTxDataBase {
+ from: string;
+}
+
+export interface CallData extends CallTxDataBase {
+ from?: string;
+}
+
+export interface FilterObject {
+ fromBlock?: number | string;
+ toBlock?: number | string;
+ address?: string;
+ topics?: LogTopic[];
+}
+
+export type LogTopic = null | string | string[];
+
+export interface DecodedLogEntry extends LogEntry {
+ event: string;
+ args: A;
+}
+
+export interface DecodedLogEntryEvent extends DecodedLogEntry {
+ removed: boolean;
+}
+
+export interface LogEntryEvent extends LogEntry {
+ removed: boolean;
+}
+
+export interface LogEntry {
+ logIndex: number | null;
+ transactionIndex: number | null;
+ transactionHash: string;
+ blockHash: string | null;
+ blockNumber: number | null;
+ address: string;
+ data: string;
+ topics: string[];
+}
+
+export interface TxDataPayable extends TxData {
+ value?: BigNumber;
+}
+
+export interface TransactionReceipt {
+ blockHash: string;
+ blockNumber: number;
+ transactionHash: string;
+ transactionIndex: number;
+ from: string;
+ to: string;
+ status: null | string | 0 | 1;
+ cumulativeGasUsed: number;
+ gasUsed: number;
+ contractAddress: string | null;
+ logs: LogEntry[];
+}
+
+export type ContractEventArg = string | BigNumber | number | boolean;
+
+export interface DecodedLogArgs {
+ [argName: string]: ContractEventArg;
+}
+
+export interface LogWithDecodedArgs extends DecodedLogEntry {}
+export type RawLog = LogEntry;
+
+export enum BlockParamLiteral {
+ Earliest = 'earliest',
+ Latest = 'latest',
+ Pending = 'pending',
+}
+
+export type BlockParam = BlockParamLiteral | number;
+
+export interface RawLogEntry {
+ logIndex: string | null;
+ transactionIndex: string | null;
+ transactionHash: string;
+ blockHash: string | null;
+ blockNumber: string | null;
+ address: string;
+ data: string;
+ topics: string[];
+}
+
+export enum SolidityTypes {
+ Address = 'address',
+ Uint256 = 'uint256',
+ Uint8 = 'uint8',
+ Uint = 'uint',
+}
+
+/**
+ * Contains the logs returned by a TransactionReceipt. We attempt to decode the
+ * logs using AbiDecoder. If we have the logs corresponding ABI, we decode it,
+ * otherwise we don't.
+ */
+export interface TransactionReceiptWithDecodedLogs extends TransactionReceipt {
+ logs: Array | LogEntry>;
+}
+
+export interface TraceParams {
+ disableMemory?: boolean;
+ disableStack?: boolean;
+ disableStorage?: boolean;
+}
diff --git a/types/ethereum-protocol/package.json b/types/ethereum-protocol/package.json
new file mode 100644
index 0000000000..4eeb6b18c8
--- /dev/null
+++ b/types/ethereum-protocol/package.json
@@ -0,0 +1,4 @@
+{
+ "private": true,
+ "dependencies": { "bignumber.js": "7.2.1" }
+}
diff --git a/types/ethereum-protocol/tsconfig.json b/types/ethereum-protocol/tsconfig.json
new file mode 100644
index 0000000000..5f358a8dec
--- /dev/null
+++ b/types/ethereum-protocol/tsconfig.json
@@ -0,0 +1,16 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": ["es6"],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": ["../"],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": ["index.d.ts", "ethereum-protocol-tests.ts"]
+}
diff --git a/types/ethereum-protocol/tslint.json b/types/ethereum-protocol/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/ethereum-protocol/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/ffi/index.d.ts b/types/ffi/index.d.ts
index 76e197e841..cf562cea06 100644
--- a/types/ffi/index.d.ts
+++ b/types/ffi/index.d.ts
@@ -1,6 +1,6 @@
-// Type definitions for node-ffi 0.1
+// Type definitions for node-ffi 0.2
// Project: https://github.com/rbranson/node-ffi
-// Definitions by: Paul Loyd
+// Definitions by: Paul Loyd , Waiting Song
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -135,12 +135,13 @@ export const DynamicLibrary: {
* The function pointer may be used in other C functions that
* accept C callback functions.
*/
-export const Callback: {
+export interface Callback {
new (retType: any, argTypes: any[], abi: number, fn: any): Buffer;
new (retType: any, argTypes: any[], fn: any): Buffer;
(retType: any, argTypes: any[], abi: number, fn: any): Buffer;
(retType: any, argTypes: any[], fn: any): Buffer;
-};
+}
+export const Callback: Callback;
export const ffiType: {
/** Get a `ffi_type *` Buffer appropriate for the given type. */
diff --git a/types/fibjs/declare/dgram.d.ts b/types/fibjs/declare/dgram.d.ts
index 1f87090814..a8004536e2 100644
--- a/types/fibjs/declare/dgram.d.ts
+++ b/types/fibjs/declare/dgram.d.ts
@@ -214,7 +214,7 @@ declare module "dgram" {
*
*
*/
- export class DgramSocket extends Class_DgramSocket {}
+ export class Socket extends Class_DgramSocket {}
diff --git a/types/fibjs/declare/http.d.ts b/types/fibjs/declare/http.d.ts
index d5080f12bb..f558303870 100644
--- a/types/fibjs/declare/http.d.ts
+++ b/types/fibjs/declare/http.d.ts
@@ -196,7 +196,7 @@
/** module Or Internal Object */
/**
- * @brief 超文本传输协议模块,用以支持 http 协议处理
+ * @brief 超文本传输协议模块,用以支持 http 协议处理,模块别名:https
* @detail
*/
declare module "http" {
@@ -212,7 +212,7 @@ declare module "http" {
*
*
*/
- export class HttpRequest extends Class_HttpRequest {}
+ export class Request extends Class_HttpRequest {}
/**
@@ -221,7 +221,7 @@ declare module "http" {
*
*
*/
- export class HttpResponse extends Class_HttpResponse {}
+ export class Response extends Class_HttpResponse {}
/**
@@ -230,7 +230,7 @@ declare module "http" {
*
*
*/
- export class HttpCookie extends Class_HttpCookie {}
+ export class Cookie extends Class_HttpCookie {}
/**
@@ -239,7 +239,7 @@ declare module "http" {
*
*
*/
- export class HttpServer extends Class_HttpServer {}
+ export class Server extends Class_HttpServer {}
/**
@@ -248,7 +248,7 @@ declare module "http" {
*
*
*/
- export class HttpClient extends Class_HttpClient {}
+ export class Client extends Class_HttpClient {}
/**
@@ -266,7 +266,7 @@ declare module "http" {
*
*
*/
- export class HttpHandler extends Class_HttpHandler {}
+ export class Handler extends Class_HttpHandler {}
diff --git a/types/fibjs/declare/net.d.ts b/types/fibjs/declare/net.d.ts
index dcf90e72eb..f9d9c222c9 100644
--- a/types/fibjs/declare/net.d.ts
+++ b/types/fibjs/declare/net.d.ts
@@ -271,7 +271,7 @@ declare module "net" {
*
*
*/
- export class UrlObject extends Class_UrlObject {}
+ export class Url extends Class_UrlObject {}
diff --git a/types/fibjs/declare/ssl.d.ts b/types/fibjs/declare/ssl.d.ts
index befed4f19a..6fbdabd87c 100644
--- a/types/fibjs/declare/ssl.d.ts
+++ b/types/fibjs/declare/ssl.d.ts
@@ -196,7 +196,7 @@
/** module Or Internal Object */
/**
- * @brief ssl/tls 模块
+ * @brief ssl/tls 模块,模块别名:tls
* @detail
*/
declare module "ssl" {
@@ -300,7 +300,7 @@ declare module "ssl" {
*
*
*/
- export class SslSocket extends Class_SslSocket {}
+ export class Socket extends Class_SslSocket {}
/**
@@ -309,7 +309,7 @@ declare module "ssl" {
*
*
*/
- export class SslHandler extends Class_SslHandler {}
+ export class Handler extends Class_SslHandler {}
/**
@@ -318,7 +318,7 @@ declare module "ssl" {
*
*
*/
- export class SslServer extends Class_SslServer {}
+ export class Server extends Class_SslServer {}
diff --git a/types/fibjs/declare/ws.d.ts b/types/fibjs/declare/ws.d.ts
index d5402ad972..78ab282d97 100644
--- a/types/fibjs/declare/ws.d.ts
+++ b/types/fibjs/declare/ws.d.ts
@@ -292,7 +292,7 @@ declare module "ws" {
*
*
*/
- export class WebSocketMessage extends Class_WebSocketMessage {}
+ export class Message extends Class_WebSocketMessage {}
/**
@@ -301,7 +301,7 @@ declare module "ws" {
*
*
*/
- export class WebSocket extends Class_WebSocket {}
+ export class Socket extends Class_WebSocket {}
diff --git a/types/fibjs/declare/xml.d.ts b/types/fibjs/declare/xml.d.ts
index 4dbb477dc1..5526a84e5c 100644
--- a/types/fibjs/declare/xml.d.ts
+++ b/types/fibjs/declare/xml.d.ts
@@ -284,7 +284,7 @@ declare module "xml" {
*
*
*/
- export class XmlDocument extends Class_XmlDocument {}
+ export class Document extends Class_XmlDocument {}
diff --git a/types/fibjs/declare/zmq.d.ts b/types/fibjs/declare/zmq.d.ts
index 04f7b59815..e6ef8fde76 100644
--- a/types/fibjs/declare/zmq.d.ts
+++ b/types/fibjs/declare/zmq.d.ts
@@ -300,7 +300,7 @@ declare module "zmq" {
*
*
*/
- export class ZmqSocket extends Class_ZmqSocket {}
+ export class Socket extends Class_ZmqSocket {}
diff --git a/types/fibjs/index.d.ts b/types/fibjs/index.d.ts
index 67bc9f3a4e..0b4ef29975 100644
--- a/types/fibjs/index.d.ts
+++ b/types/fibjs/index.d.ts
@@ -1,6 +1,6 @@
// Type definitions for fibjs 0.25
// Project: https://github.com/fibjs/fibjs
-// Definitions by: Richard
+// Definitions by: richardo2016
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///
diff --git a/types/gramps__rest-helpers/gramps__rest-helpers-tests.ts b/types/gramps__rest-helpers/gramps__rest-helpers-tests.ts
new file mode 100644
index 0000000000..cbb74725ca
--- /dev/null
+++ b/types/gramps__rest-helpers/gramps__rest-helpers-tests.ts
@@ -0,0 +1,16 @@
+import { GraphQLConnector, GraphQLModel } from '@gramps/rest-helpers';
+
+const myConnector = new GraphQLConnector();
+
+myConnector.apiBaseUri = "some uri";
+myConnector.headers = {};
+myConnector.cacheExpiry = 300;
+myConnector.enableCache = true;
+myConnector.redis = false;
+
+myConnector.get("someurl");
+myConnector.post("someendpoint", {}, {}).then(() => {});
+myConnector.put("someendpoint", {}, {}).then(() => {});
+myConnector.delete("someendpoint", {}).then(() => {});
+
+const myModel = new GraphQLModel(myConnector);
diff --git a/types/gramps__rest-helpers/index.d.ts b/types/gramps__rest-helpers/index.d.ts
new file mode 100644
index 0000000000..4fb7e32a27
--- /dev/null
+++ b/types/gramps__rest-helpers/index.d.ts
@@ -0,0 +1,26 @@
+// Type definitions for @gramps/rest-helpers 1.1
+// Project: https://github.com/gramps-graphql/rest-helpers
+// Definitions by: Claude Ciocan
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.3
+
+export class GraphQLConnector {
+ constructor();
+
+ apiBaseUri: string;
+ headers: object;
+ request: any;
+ cacheExpiry: number;
+ enableCache: boolean;
+ redis: boolean;
+ get(endpoint: string): Promise;
+ post(endpoint: string, body: object, options: object): Promise;
+ put(endpoint: string, body: object, options: object): Promise;
+ delete(endpoint: string, options: object): Promise;
+}
+
+export class GraphQLModel {
+ connector: GraphQLConnector;
+
+ constructor({});
+}
diff --git a/types/gramps__rest-helpers/tsconfig.json b/types/gramps__rest-helpers/tsconfig.json
new file mode 100644
index 0000000000..03402cad31
--- /dev/null
+++ b/types/gramps__rest-helpers/tsconfig.json
@@ -0,0 +1,28 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true,
+ "paths": {
+ "@gramps/rest-helpers": [
+ "gramps__rest-helpers"
+ ]
+ }
+ },
+ "files": [
+ "index.d.ts",
+ "gramps__rest-helpers-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/types/gramps__rest-helpers/tslint.json b/types/gramps__rest-helpers/tslint.json
new file mode 100644
index 0000000000..e60c15844f
--- /dev/null
+++ b/types/gramps__rest-helpers/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": "dtslint/dt.json"
+}
\ No newline at end of file
diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts
index 1434999411..6ef4ef4e2a 100644
--- a/types/highcharts/index.d.ts
+++ b/types/highcharts/index.d.ts
@@ -2354,7 +2354,7 @@ declare namespace Highcharts {
* can be customized by defining a new array of items and assigning null to unwanted positions.
* @since 2.0
*/
- menuItems?: MenuItem[];
+ menuItems?: string[] | MenuItem[];
/**
* A click handler callback to use on the button directly instead of the popup menu.
* @since 2.0
@@ -2661,6 +2661,12 @@ declare namespace Highcharts {
* @default ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
*/
shortMonths?: string[];
+ /**
+ * Short week days, starting Sunday. If not specified, Highcharts uses the first three letters of the lang.weekdays option.
+ * @default undefined
+ * @since 4.2.4
+ */
+ shortWeekdays?: string[];
/**
* The default thousands separator used in the Highcharts.numberFormat method unless otherwise specified in the
* function arguments. Since Highcharts 4.1 it defaults to a single space character, which is compatible with ISO
diff --git a/types/highcharts/modules/drilldown.d.ts b/types/highcharts/modules/drilldown.d.ts
new file mode 100644
index 0000000000..adf9bae6f8
--- /dev/null
+++ b/types/highcharts/modules/drilldown.d.ts
@@ -0,0 +1,10 @@
+// Type definitions for Highcharts Drilldown 4.2.7
+// Project: http://www.highcharts.com/
+// Definitions by: Konstantin Rohde
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+import { Static } from "highcharts";
+
+declare function HighchartsDrilldown(H: Static): Static;
+export = HighchartsDrilldown;
+export as namespace HighchartsDrilldown;
diff --git a/types/highcharts/test/drilldown.ts b/types/highcharts/test/drilldown.ts
new file mode 100644
index 0000000000..f4aa33ca4a
--- /dev/null
+++ b/types/highcharts/test/drilldown.ts
@@ -0,0 +1 @@
+HighchartsDrilldown(Highcharts);
diff --git a/types/highcharts/tsconfig.json b/types/highcharts/tsconfig.json
index 24b0cf2dd7..e69f0eeb57 100644
--- a/types/highcharts/tsconfig.json
+++ b/types/highcharts/tsconfig.json
@@ -21,6 +21,7 @@
"index.d.ts",
"modules/map/index.d.ts",
"modules/boost.d.ts",
+ "modules/drilldown.d.ts",
"modules/exporting.d.ts",
"modules/no-data-to-display.d.ts",
"modules/offline-exporting.d.ts",
@@ -28,6 +29,7 @@
"highstock.d.ts",
"js/highcharts/index.d.ts",
"test/boost.ts",
+ "test/drilldown.ts",
"test/exporting.ts",
"test/highstock.ts",
"test/index.ts",
diff --git a/types/http-graceful-shutdown/http-graceful-shutdown-tests.ts b/types/http-graceful-shutdown/http-graceful-shutdown-tests.ts
new file mode 100644
index 0000000000..17bc81ce1d
--- /dev/null
+++ b/types/http-graceful-shutdown/http-graceful-shutdown-tests.ts
@@ -0,0 +1,21 @@
+import GracefulShutdown = require('http-graceful-shutdown');
+import * as http from "http";
+
+const opts: GracefulShutdown.Options = {
+ signals: "SIGINT SIGTERM",
+ timeout: 1337,
+ development: false,
+ onShutdown: () => {
+ console.log('fake shutdown handler');
+ return Promise.resolve();
+ },
+ finally: () => {
+ console.log('fake finally handler');
+ }
+};
+
+const server = http.createServer((req, res) => {
+ res.end();
+});
+
+GracefulShutdown(server, opts);
diff --git a/types/http-graceful-shutdown/index.d.ts b/types/http-graceful-shutdown/index.d.ts
new file mode 100644
index 0000000000..f8269adea7
--- /dev/null
+++ b/types/http-graceful-shutdown/index.d.ts
@@ -0,0 +1,22 @@
+// Type definitions for http-graceful-shutdown 2.1
+// Project: https://github.com/sebhildebrandt/http-graceful-shutdown
+// Definitions by: Dave Lee
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+import { Server } from "http";
+
+declare function GracefulShutdown(server: Server, options?: GracefulShutdown.Options): void;
+
+declare namespace GracefulShutdown {
+ interface Options {
+ signals?: string;
+ timeout?: number;
+ development?: boolean;
+ onShutdown?: () => Promise;
+ finally?: () => void;
+ }
+}
+
+export = GracefulShutdown;
diff --git a/types/http-graceful-shutdown/tsconfig.json b/types/http-graceful-shutdown/tsconfig.json
new file mode 100644
index 0000000000..a738609778
--- /dev/null
+++ b/types/http-graceful-shutdown/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "http-graceful-shutdown-tests.ts"
+ ]
+}
diff --git a/types/http-graceful-shutdown/tslint.json b/types/http-graceful-shutdown/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/http-graceful-shutdown/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/i18next-ko/i18next-ko-tests.ts b/types/i18next-ko/i18next-ko-tests.ts
new file mode 100644
index 0000000000..1b8cd90904
--- /dev/null
+++ b/types/i18next-ko/i18next-ko-tests.ts
@@ -0,0 +1,24 @@
+import * as i18next from 'i18next';
+import * as i18nextko from 'i18next-ko';
+import * as ko from 'knockout';
+
+const resourceStore = {
+ en: {
+ translation: {
+ testTranslation: 'Test translation'
+ }
+ },
+
+ de: {
+ translation: {
+ testTranslation: 'Test-Übersetzung'
+ }
+ }
+};
+i18nextko.init(resourceStore, 'en', ko);
+
+i18nextko.setLanguage('de');
+
+i18nextko.i18n;
+
+i18nextko.t('testTranslation');
diff --git a/types/i18next-ko/index.d.ts b/types/i18next-ko/index.d.ts
new file mode 100644
index 0000000000..e9d3c2c639
--- /dev/null
+++ b/types/i18next-ko/index.d.ts
@@ -0,0 +1,25 @@
+// Type definitions for i18next-ko 3.0
+// Project: https://github.com/leMaik/i18next-ko
+// Definitions by: Daniel Waxweiler
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.3
+
+///
+
+import * as i18next from 'i18next';
+
+export const i18n: i18next.i18n;
+
+export function init(resourceStore: i18nextkoResourceStore, language: string, ko: KnockoutStatic): void;
+
+export function setLanguage(language: string): void;
+
+export function t(key: string): KnockoutComputed;
+
+export interface i18nextkoResourceStore {
+ [language: string]: {
+ translation: {
+ [key: string]: string
+ }
+ };
+}
diff --git a/types/i18next-ko/tsconfig.json b/types/i18next-ko/tsconfig.json
new file mode 100644
index 0000000000..9509fa509e
--- /dev/null
+++ b/types/i18next-ko/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "i18next-ko-tests.ts"
+ ]
+}
diff --git a/types/i18next-ko/tslint.json b/types/i18next-ko/tslint.json
new file mode 100644
index 0000000000..f93cf8562a
--- /dev/null
+++ b/types/i18next-ko/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": "dtslint/dt.json"
+}
diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts
index c13cd7f26f..d370b06f4d 100644
--- a/types/jquery.fancytree/index.d.ts
+++ b/types/jquery.fancytree/index.d.ts
@@ -1,10 +1,11 @@
-// Type definitions for jquery.fancytree 2.7.0
+// Type definitions for jquery.fancytree 2.28.2-0
// Project: https://github.com/mar10/fancytree
// Definitions by: Peter Palotas
// Mahdi Abedi
+// Nikolai Ommundsen
// Nitecube
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-// TypeScript Version: 2.3
+// TypeScript Version: 2.8
///
@@ -95,10 +96,10 @@ declare namespace Fancytree {
findNextNode(match: (node: FancytreeNode) => boolean, startNode?: FancytreeNode): FancytreeNode;
/** Find all nodes that matches condition.
- *
+ *
* @returns array of nodes (may be empty)
*/
- findAll(match: string|((node: FancytreeNode) => boolean|undefined)): FancytreeNode[];
+ findAll(match: string | ((node: FancytreeNode) => boolean | undefined)): FancytreeNode[];
/** Generate INPUT elements that can be submitted with html forms. In selectMode 3 only the topmost selected nodes are considered. */
generateFormElements(selected?: boolean, active?: boolean): void;
@@ -315,7 +316,7 @@ declare namespace Fancytree {
* @param map callback function(NodeData) that could modify the new node
* @returns new node.
*/
- copyTo(node: FancytreeNode, mode?: string, map?: (node: NodeData) => void) : FancytreeNode;
+ copyTo(node: FancytreeNode, mode?: string, map?: (node: NodeData) => void): FancytreeNode;
/** Count direct and indirect children.
*
@@ -545,7 +546,7 @@ declare namespace Fancytree {
resetLazy(): void;
/** Schedule activity for delayed execution (cancel any pending request). scheduleAction('cancel') will only cancel a pending request (if any). */
- scheduleAction(mode: string, ms: number) : void;
+ scheduleAction(mode: string, ms: number): void;
/**
* @param effects animation options.
@@ -761,7 +762,20 @@ declare namespace Fancytree {
/** Make sure that the active node is always visible, i.e. its parents are expanded (default: true). */
activeVisible?: boolean;
/** Default options for ajax requests. */
- ajax?: Object;
+ ajax?: {
+ /**
+ * HTTP Method (default: 'GET')
+ */
+ type: string;
+ /**
+ * false: Append random '_' argument to the request url to prevent caching.
+ */
+ cache: boolean;
+ /**
+ * Default 'json' -> Expect json format and pass json object to callbacks.
+ */
+ dataType: string;
+ };
/** (default: false) Add WAI-ARIA attributes to markup */
aria?: boolean;
/** Activate a node when focused with the keyboard (default: true) */
@@ -771,24 +785,26 @@ declare namespace Fancytree {
/** Scroll node into visible area, when focused by keyboard (default: false). */
autoScroll?: boolean;
/** Display checkboxes to allow selection (default: false) */
- checkbox?: boolean|string|((event: JQueryEventObject, data: EventData) => boolean);
+ checkbox?: boolean | string | ((event: JQueryEventObject, data: EventData) => boolean);
/** Defines what happens, when the user click a folder node. (default: activate_dblclick_expands) */
clickFolderMode?: FancytreeClickFolderMode;
- /** 0..2 (null: use global setting $.ui.fancytree.debugInfo) */
- debugLevel?: number;
+ /** 0..4 (null: use global setting $.ui.fancytree.debugInfo) */
+ debugLevel?: 0 | 1 | 2 | 3 | 4;
/** callback(node) is called for new nodes without a key. Must return a new unique key. (default null: generates default keys like that: "_" + counter) */
defaultKey?: (node: FancytreeNode) => string;
/** Accept passing ajax data in a property named `d` (default: true). */
enableAspx?: boolean;
+ /** Enable titles (default: false) */
+ enableTitles?: boolean;
/** List of active extensions (default: []) */
- extensions?: string[];
+ extensions?: Array;
/** Set focus when node is checked by a mouse click (default: false) */
focusOnSelect?: boolean;
/** Add `id="..."` to node markup (default: true). */
generateIds?: boolean;
- /** Display node icons (default: true) */
- icons?: boolean;
- /** (default: "ft_") */
+ /** Node icon url, if only filename, please use imagePath to set the path */
+ icon?: boolean | string;
+ /** Prefix (default: "ft_") */
idPrefix?: string;
/** Path to a folder containing icons (default: null, using 'skin/' subdirectory). */
imagePath?: string;
@@ -800,36 +816,227 @@ declare namespace Fancytree {
minExpandLevel?: number;
/** navigate to next node by typing the first letters (default: false) */
quicksearch?: boolean;
+ /** Right to left mode (default: false) */
+ rtl?: false;
/** optional margins for node.scrollIntoView() (default: {top: 0, bottom: 0}) */
- scrollOfs?: Object;
+ scrollOfs?: { top: number, bottom: number };
/** scrollable container for node.scrollIntoView() (default: $container) */
- scrollParent?: JQuery;
+ scrollParent?: JQuery | null;
/** default: multi_hier */
selectMode?: FancytreeSelectMode;
/** Used to Initialize the tree. */
- source?: any;
+ source?: any[] | any;
/** Translation table */
- strings?: Object;
+ strings?: TranslationTable;
/** Add tabindex='0' to container, so tree can be reached using TAB */
tabbable?: boolean;
/** Add tabindex='0' to node title span, so it can receive keyboard focus */
titlesTabbable?: boolean;
/** Animation options, false:off (default: { effect: "blind", options: {direction: "vertical", scale: "box"}, duration: 200 }) */
toggleEffect?: JQueryUI.EffectOptions;
+ /** Tooltips */
+ tooltip?: boolean;
/** (dynamic Option)Prevent (de-)selection using mouse or keyboard. */
- unselectable?: boolean|((event: JQueryEventObject, data: Fancytree.EventData) => boolean|undefined);
+ unselectable?: boolean | ((event: JQueryEventObject, data: Fancytree.EventData) => boolean | undefined);
/** (dynamic Option)Ignore this node when calculating the partsel status of parent nodes in selectMode 3 propagation. */
- unselectableIgnore?: boolean|((event: JQueryEventObject, data: Fancytree.EventData) => boolean|undefined);
+ unselectableIgnore?: boolean | ((event: JQueryEventObject, data: Fancytree.EventData) => boolean | undefined);
/** (dynamic Option)Use this as constant selected value (overriding selectMode 3 propagation). */
- unselectableStatus?: boolean|((event: JQueryEventObject, data: Fancytree.EventData) => boolean|undefined);
+ unselectableStatus?: boolean | ((event: JQueryEventObject, data: Fancytree.EventData) => boolean | undefined);
+
+ ////////////////
+ // EXTENSIONS //
+ ////////////////
+ dnd5?: Extensions.DragAndDrop5;
+ filter?: Extensions.Filter;
+ table?: Extensions.Table;
+
+ /** Options for misc extensions - see docs for typings */
+ [extension: string]: any;
}
+ interface TranslationTable {
+ /**
+ * "Loading..." // … would be escaped when escapeTitles is true
+ */
+ loading: string;
+ /**
+ * "Load error!"
+ */
+ loadError: string;
+ /**
+ * "More..."
+ */
+ moreData: string;
+ /**
+ * "No data."
+ */
+ noData: string;
+ }
+
+ namespace Extensions {
+ interface List {
+ dnd5?: DragAndDrop5;
+ filter?: Filter;
+ table?: Table;
+ [extension: string]: any;
+ }
+
+ interface DragAndDrop5 {
+ /**
+ * Expand nodes after n milliseconds of hovering.
+ */
+ autoExpandMS?: number;
+ /**
+ * Absolute position offset for .fancytree-drop-marker
+ */
+ dropMarkerOffsetX?: number;
+ /**
+ * Additional offset for drop-marker with hitMode = "before"/"after"
+ */
+ dropMarkerInsertOffsetX?: number;
+ /**
+ * true: Drag multiple (i.e. selected) nodes.
+ */
+ multiSource?: boolean;
+ /**
+ * Prevent dropping nodes from different Fancytrees
+ */
+ preventForeignNodes?: boolean;
+ /**
+ * Prevent dropping items other than Fancytree nodes
+ */
+ preventNonNodes?: boolean;
+ /**
+ * Prevent dropping nodes on own descendants
+ */
+ preventRecursiveMoves?: boolean;
+ /**
+ * Prevent dropping nodes 'before self', etc.
+ */
+ preventVoidMoves?: boolean;
+ /**
+ * Enable auto-scrolling while dragging
+ */
+ scroll?: boolean;
+ /**
+ * Active top/bottom margin in pixel
+ */
+ scrollSensitivity?: number;
+ /**
+ * Pixel per event
+ */
+ scrollSpeed?: number;
+ /**
+ * Allow dragging of nodes to different IE windows, default: false
+ */
+ setTextTypeJson?: boolean;
+ /**
+ * Callback(sourceNode, data), return true, to enable dnd drag
+ */
+ dragStart?: (sourceNode: FancytreeNode, data: any) => void;
+ dragDrag?: (sourceNode: FancytreeNode, data: any) => void;
+ dragEnd?: (sourceNode: FancytreeNode, data: any) => void;
+ /**
+ * Callback(targetNode, data), return true, to enable dnd drop
+ */
+ dragEnter?: (targetNode: FancytreeNode, data: any) => void;
+ /**
+ * Events (drag over)
+ */
+ dragOver?: (targetNode: FancytreeNode, data: any) => void;
+ /**
+ * Callback(targetNode, data), return false to prevent autoExpand
+ */
+ dragExpand?: (targetNode: FancytreeNode, data: any) => void;
+ /**
+ * Events (drag drop)
+ */
+ dragDrop?: (node: FancytreeNode, data: any) => void;
+ dragLeave?: (targetNode: FancytreeNode, data: any) => void;
+ /**
+ * Support misc options
+ */
+ [key: string]: any;
+ }
+ /**
+ * Define filter-extension options
+ */
+ interface Filter {
+ /**
+ * Re-apply last filter if lazy data is loaded
+ */
+ autoApply: boolean;
+ /**
+ * Expand all branches that contain matches while filtered
+ */
+ autoExpand: boolean;
+ /**
+ * Show a badge with number of matching child nodes near parent icons
+ */
+ counter: boolean;
+ /**
+ * Match single characters in order, e.g. 'fb' will match 'FooBar'
+ */
+ fuzzy: boolean;
+ /**
+ * Hide counter badge if parent is expanded
+ */
+ hideExpandedCounter: boolean;
+ /**
+ * Hide expanders if all child nodes are hidden by filter
+ */
+ hideExpanders: boolean;
+ /**
+ * Highlight matches by wrapping inside tags
+ */
+ highlight: boolean;
+ /**
+ * Match end nodes only
+ */
+ leavesOnly: boolean;
+ /**
+ * Display a 'no data' status node if result is empty
+ */
+ nodata: boolean;
+ /**
+ * Grayout unmatched nodes (pass "hide" to remove unmatched node instead); default 'dimm'
+ */
+ mode: 'dimm' | 'string';
+ /**
+ * Support misc options
+ */
+ [key: string]: any;
+ }
+ /**
+ * Define table-extension options
+ */
+ interface Table {
+ /**
+ * Render the checkboxes into the this column index (default: nodeColumnIdx)
+ */
+ checkboxColumnIdx: any;
+ /**
+ * Indent every node level by 16px; default: 16
+ */
+ indentation: number;
+ /**
+ * Render node expander, icon, and title to this column (default: 0)
+ */
+ nodeColumnIdx: number;
+ /**
+ * Support misc options
+ */
+ [key: string]: any;
+ }
+ }
+
+
/** Data object passed to FancytreeNode() constructor. Note: typically these attributes are accessed by meber methods, e.g. `node.isExpanded()` and `node.setSelected(false)`. */
interface NodeData {
/** node text (may contain HTML tags) */
title: string;
- icon?: boolean|string;
+ icon?: boolean | string;
/** unique key for this node (auto-generated if omitted) */
key?: string;
/** (reserved) */
diff --git a/types/jquery.fancytree/jquery.fancytree-tests.ts b/types/jquery.fancytree/jquery.fancytree-tests.ts
index de1489de42..8f9707597e 100644
--- a/types/jquery.fancytree/jquery.fancytree-tests.ts
+++ b/types/jquery.fancytree/jquery.fancytree-tests.ts
@@ -1,4 +1,4 @@
-$("#tree").fancytree({
+$("#tree").fancytree({
source: [
{ title: "Node 1", key: "1" },
{
@@ -12,16 +12,20 @@ $("#tree").fancytree({
{ title: "Node 1", key: "1" },
{
title: "Folder 2", key: "2", folder: true, children: [
- { title: "Node 2.1", key: "3" },
- { title: "Node 2.2", key: "4" },
- { title: "NOde 2.3", key: "5", icon: "./icon.svg", checkbox: "radio"}
- ]
+ { title: "Node 2.1", key: "3" },
+ { title: "Node 2.2", key: "4" },
+ { title: "NOde 2.3", key: "5", icon: "./icon.svg", checkbox: "radio" }
+ ]
}
]
}
]
}
],
+ extensions: ['dnd5'],
+ dnd5: {
+ dragDrag: (node, data) => { }
+ },
click: (ev: JQueryEventObject, node: Fancytree.EventData) => {
return true;
},
@@ -51,9 +55,9 @@ $("#tree").fancytree({
//$("#tree").fancytree();
-var tree : Fancytree.Fancytree = $("#tree").fancytree("getTree");
+var tree: Fancytree.Fancytree = $("#tree").fancytree("getTree");
-var activeNode : Fancytree.FancytreeNode = tree.getRootNode();
+var activeNode: Fancytree.FancytreeNode = tree.getRootNode();
// Sort children of active node:
activeNode.sortChildren();
@@ -72,15 +76,15 @@ activeNode.addChildren({
tree.loadKeyPath("/1/2", function (node, status) {
if (status === "loaded") {
console.log("loaded intermiediate node " + node);
- } else if (status === "ok") {
+ } else if (status === "ok") {
node.setActive();
}
});
-var node = $.ui.fancytree.getNode($("#tree"));
+var node = $.ui.fancytree.getNode($("#tree"));
alert($.ui.fancytree.version);
-var f = $.ui.fancytree.debounce(50, (a : number) => { console.log(a); }, true);
-f(2);
+var f = $.ui.fancytree.debounce(50, (a: number) => { console.log(a); }, true);
+f(2);
node = tree.getFirstChild();
node.setExpanded().done(function () {
@@ -120,4 +124,4 @@ node.addChildren({
statusNodeType: "loading",
unselectableIgnore: true,
unselectableStatus: false,
-}, 0);
\ No newline at end of file
+}, 0);
diff --git a/types/json-patch-gen/index.d.ts b/types/json-patch-gen/index.d.ts
new file mode 100644
index 0000000000..46b9a7c029
--- /dev/null
+++ b/types/json-patch-gen/index.d.ts
@@ -0,0 +1,20 @@
+// Type definitions for json-patch-gen 1.0
+// Project: https://github.com/gregsexton/json-patch-gen
+// Definitions by: Konstantin Rohde
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.2
+
+declare function diff(obj1: object | null, obj2: object | null): diff.JsonPatch[];
+
+declare namespace diff {
+ type PatchOperation = "replace" | "add" | "remove";
+
+ interface JsonPatch {
+ op: PatchOperation;
+ path: string;
+ value: any;
+ }
+}
+
+export = diff;
+export as namespace diff;
diff --git a/types/json-patch-gen/json-patch-gen-tests.ts b/types/json-patch-gen/json-patch-gen-tests.ts
new file mode 100644
index 0000000000..6f45195f22
--- /dev/null
+++ b/types/json-patch-gen/json-patch-gen-tests.ts
@@ -0,0 +1,24 @@
+import diff = require("json-patch-gen");
+
+const assertEqual = (a: object, b: object) => JSON.stringify(a) === JSON.stringify(b);
+const assertLength = (a: any[], b: number) => a.length === b;
+
+assertLength(diff({a: "a"}, {a: "a", b: "b"}), 1);
+assertEqual(diff({a: "a"}, {a: "a", b: "b"})[0], {
+ op: "add",
+ path: "/b",
+ value: "b"
+});
+
+assertLength(diff({a: "a", b: "b"}, {a: "a"}), 1);
+assertEqual(diff({a: "a", b: "b"}, {a: "a"})[0], {
+ op: "remove",
+ path: "/b"
+});
+
+assertLength(diff({a: "a"}, {a: "b"}), 1);
+assertEqual(diff({a: "a"}, {a: "b"})[0], {
+ op: "replace",
+ path: "/a",
+ value: "b"
+});
diff --git a/types/json-patch-gen/tsconfig.json b/types/json-patch-gen/tsconfig.json
new file mode 100644
index 0000000000..266cb4acae
--- /dev/null
+++ b/types/json-patch-gen/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "json-patch-gen-tests.ts"
+ ]
+}
diff --git a/types/json-patch-gen/tslint.json b/types/json-patch-gen/tslint.json
new file mode 100644
index 0000000000..ece4c342d1
--- /dev/null
+++ b/types/json-patch-gen/tslint.json
@@ -0,0 +1,80 @@
+{
+ "extends": "dtslint/dt.json",
+ "rules": {
+ "adjacent-overload-signatures": false,
+ "array-type": false,
+ "arrow-return-shorthand": false,
+ "ban-types": false,
+ "callable-types": false,
+ "comment-format": false,
+ "dt-header": false,
+ "eofline": false,
+ "export-just-namespace": false,
+ "import-spacing": false,
+ "interface-name": false,
+ "interface-over-type-literal": false,
+ "jsdoc-format": false,
+ "max-line-length": false,
+ "member-access": false,
+ "new-parens": false,
+ "no-any-union": false,
+ "no-boolean-literal-compare": false,
+ "no-conditional-assignment": false,
+ "no-consecutive-blank-lines": false,
+ "no-construct": false,
+ "no-declare-current-package": false,
+ "no-duplicate-imports": false,
+ "no-duplicate-variable": false,
+ "no-empty-interface": false,
+ "no-eval": false,
+ "no-for-in-array": false,
+ "no-inferrable-types": false,
+ "no-internal-module": false,
+ "no-irregular-whitespace": false,
+ "no-mergeable-namespace": false,
+ "no-misused-new": false,
+ "no-namespace": false,
+ "no-object-literal-type-assertion": false,
+ "no-padding": false,
+ "no-redundant-jsdoc": false,
+ "no-redundant-jsdoc-2": false,
+ "no-redundant-undefined": false,
+ "no-reference-import": false,
+ "no-relative-import-in-test": false,
+ "no-self-import": false,
+ "no-single-declare-module": false,
+ "no-string-throw": false,
+ "no-unnecessary-callback-wrapper": false,
+ "no-unnecessary-class": false,
+ "no-unnecessary-generics": false,
+ "no-unnecessary-qualifier": false,
+ "no-unnecessary-type-assertion": false,
+ "no-useless-files": false,
+ "no-var-keyword": false,
+ "no-var-requires": false,
+ "no-void-expression": false,
+ "no-trailing-whitespace": false,
+ "object-literal-key-quotes": false,
+ "object-literal-shorthand": false,
+ "one-line": false,
+ "one-variable-per-declaration": false,
+ "only-arrow-functions": false,
+ "prefer-conditional-expression": false,
+ "prefer-const": false,
+ "prefer-declare-function": false,
+ "prefer-for-of": false,
+ "prefer-method-signature": false,
+ "prefer-template": false,
+ "radix": false,
+ "semicolon": false,
+ "space-before-function-paren": false,
+ "space-within-parens": false,
+ "strict-export-declare-modifiers": false,
+ "trim-file": false,
+ "triple-equals": false,
+ "typedef-whitespace": false,
+ "unified-signatures": false,
+ "void-return": false,
+ "whitespace": false
+ }
+}
diff --git a/types/knockout/index.d.ts b/types/knockout/index.d.ts
index 1813b29413..1340e22d8f 100644
--- a/types/knockout/index.d.ts
+++ b/types/knockout/index.d.ts
@@ -9,22 +9,18 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
-interface KnockoutExtensionFunctions {
- [key: string]: any;
-}
-
-interface KnockoutSubscribableFunctions extends KnockoutExtensionFunctions {
+interface KnockoutSubscribableFunctions {
notifySubscribers(valueToWrite?: T, event?: string): void;
}
-interface KnockoutComputedFunctions extends KnockoutExtensionFunctions {
+interface KnockoutComputedFunctions {
}
-interface KnockoutObservableFunctions extends KnockoutExtensionFunctions {
+interface KnockoutObservableFunctions {
equalityComparer(a: T, b: T): boolean;
}
-interface KnockoutObservableArrayFunctions extends KnockoutExtensionFunctions {
+interface KnockoutObservableArrayFunctions {
// General Array functions
indexOf(searchElement: T, fromIndex?: number): number;
slice(start: number, end?: number): T[];
diff --git a/types/koa-bodyparser/index.d.ts b/types/koa-bodyparser/index.d.ts
index 256a2fad0a..1664e86cac 100644
--- a/types/koa-bodyparser/index.d.ts
+++ b/types/koa-bodyparser/index.d.ts
@@ -1,6 +1,6 @@
-// Type definitions for koa-bodyparser 4.2
+// Type definitions for koa-bodyparser 5.0
// Project: https://github.com/koajs/bodyparser
-// Definitions by: Jerry Chin
+// Definitions by: Jerry Chin , Anup Kishore
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -18,8 +18,8 @@ import * as Koa from "koa";
declare module "koa" {
interface Request {
- body: any;
- rawBody: any;
+ body: {} | null | undefined;
+ rawBody: {} | null | undefined;
}
}
diff --git a/types/koa-websocket/index.d.ts b/types/koa-websocket/index.d.ts
index e7a6c39a7d..ebbfeee8f2 100644
--- a/types/koa-websocket/index.d.ts
+++ b/types/koa-websocket/index.d.ts
@@ -1,6 +1,6 @@
-// Type definitions for koa-websocket 2.1
+// Type definitions for koa-websocket 5.0
// Project: https://github.com/kudos/koa-websocket
-// Definitions by: My Self
+// Definitions by: Maël Lavault
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -21,7 +21,7 @@ declare class KoaWebsocketServer {
middleware: Koa.Middleware[];
constructor(app: Koa);
- listen(server: http.Server | https.Server): ws.Server;
+ listen(options: ws.ServerOptions): ws.Server;
onConnection(handler: KoaWebsocketConnectionHandler): void;
use(middleware: KoaWebsocketMiddleware): this;
}
diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts
index 94623c5abb..75491e24f6 100644
--- a/types/luxon/index.d.ts
+++ b/types/luxon/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for luxon 0.5
+// Type definitions for luxon 1.2
// Project: https://github.com/moment/luxon#readme
// Definitions by: Colby DeHart
// Hyeonseok Yang
@@ -180,14 +180,14 @@ declare module 'luxon' {
zoneName: string;
diff(
other: DateTime,
- unit?: string | string[],
+ unit?: DurationUnit | DurationUnit[],
options?: DiffOptions
): Duration;
- diffNow(unit?: string | string[], options?: DiffOptions): Duration;
- endOf(unit: string): DateTime;
+ diffNow(unit?: DurationUnit | DurationUnit[], options?: DiffOptions): Duration;
+ endOf(unit: DurationUnit): DateTime;
equals(other: DateTime): boolean;
- get(unit: string): number;
- hasSame(other: DateTime, unit: string): boolean;
+ get(unit: keyof DateTime): number;
+ hasSame(other: DateTime, unit: DurationUnit): boolean;
minus(duration: Duration | number | DurationObject): DateTime;
plus(duration: Duration | number | DurationObject): DateTime;
reconfigure(properties: LocaleOptions): DateTime;
@@ -195,7 +195,8 @@ declare module 'luxon' {
set(values: DateObjectUnits): DateTime;
setLocale(locale: any): DateTime;
setZone(zone: string | Zone, options?: ZoneOptions): DateTime;
- startOf(unit: string): DateTime;
+ startOf(unit: DurationUnit): DateTime;
+ toBSON(): Date;
toFormat(format: string, options?: ToFormatOptions): string;
toHTTP(): string;
toISO(options?: ISOTimeOptions): string;
@@ -207,6 +208,7 @@ declare module 'luxon' {
toLocal(): DateTime;
toLocaleParts(options?: DateTimeFormatOptions): any[];
toLocaleString(options?: DateTimeFormatOptions): string;
+ toMillis(): number;
toObject(options?: { includeConfig?: boolean }): DateObject;
toMillis(): number;
toRFC2822(): string;
@@ -238,6 +240,9 @@ declare module 'luxon' {
type DurationObject = DurationObjectUnits & DurationOptions;
+ type DurationUnit = 'year' | 'years' | 'quarter' | 'quarters' | 'month' | 'months' | 'week' | 'weeks' | 'day' | 'days'
+ | 'hour' | 'hours' | 'minute' | 'minutes' | 'second' | 'seconds' | 'millisecond' | 'milliseconds';
+
class Duration {
static fromISO(text: string, options?: DurationOptions): Duration;
static fromMillis(
@@ -261,16 +266,16 @@ declare module 'luxon' {
seconds: number;
weeks: number;
years: number;
- as(unit: string): number;
+ as(unit: DurationUnit): number;
equals(other: Duration): boolean;
- get(unit: string): number;
+ get(unit: DurationUnit): number;
minus(duration: Duration | number | DurationObject): Duration;
negate(): Duration;
normalize(): Duration;
plus(duration: Duration | number | DurationObject): Duration;
reconfigure(objectPattern: DurationOptions): Duration;
set(values: DurationObjectUnits): Duration;
- shiftTo(...units: string[]): Duration;
+ shiftTo(...units: DurationUnit[]): Duration;
toFormat(format: string, options?: ToFormatOptions): string;
toISO(): string;
toJSON(): string;
@@ -278,6 +283,7 @@ declare module 'luxon' {
includeConfig?: boolean;
}): DurationObject;
toString(): string;
+ valueOf(): number;
}
type EraLength = 'short' | 'long';
@@ -341,23 +347,23 @@ declare module 'luxon' {
abutsEnd(other: Interval): boolean;
abutsStart(other: Interval): boolean;
contains(dateTime: DateTime): boolean;
- count(unit?: string): number;
+ count(unit?: DurationUnit): number;
difference(...intervals: Interval[]): Interval[];
divideEqually(numberOfParts?: number): Interval[];
engulfs(other: Interval): boolean;
equals(other: Interval): boolean;
- hasSame(unit: string): boolean;
+ hasSame(unit: DurationUnit): boolean;
intersection(other: Interval): Interval;
isAfter(dateTime: DateTime): boolean;
isBefore(dateTime: DateTime): boolean;
isEmpty(): boolean;
- length(unit?: string): number;
+ length(unit?: DurationUnit): number;
overlaps(other: Interval): boolean;
set(values: IntervalObject): Interval;
splitAt(...dateTimes: DateTime[]): Interval[];
splitBy(duration: Duration | DurationObject | number): Interval[];
toDuration(
- unit: string | string[],
+ unit: DurationUnit | DurationUnit[],
options?: DiffOptions
): Duration;
toFormat(
diff --git a/types/merge-stream/index.d.ts b/types/merge-stream/index.d.ts
index 5a5493b06e..6c6426b902 100644
--- a/types/merge-stream/index.d.ts
+++ b/types/merge-stream/index.d.ts
@@ -12,6 +12,5 @@ interface IMergedStream extends NodeJS.ReadWriteStream {
isEmpty(): boolean;
}
-declare function merge(streams: T[]): IMergedStream;
-declare function merge(...streams: T[]): IMergedStream;
+declare function merge(...streams: (T | T[])[]): IMergedStream;
export = merge;
diff --git a/types/mocha/index.d.ts b/types/mocha/index.d.ts
index 1ada77c0a4..5f0aa3baf6 100644
--- a/types/mocha/index.d.ts
+++ b/types/mocha/index.d.ts
@@ -2846,7 +2846,7 @@ declare global {
// #region Deprecations
- /** @deprecated use `Mocha.DoneCallback` instead. */
+ /** @deprecated use `Mocha.Done` instead. */
type MochaDone = Mocha.Done;
/** @deprecated use `Mocha.ReporterConstructor` instead. */
diff --git a/types/mosca/index.d.ts b/types/mosca/index.d.ts
new file mode 100644
index 0000000000..178f150d05
--- /dev/null
+++ b/types/mosca/index.d.ts
@@ -0,0 +1,85 @@
+// Type definitions for mosca 2.8
+// Project: https://github.com/mcollina/mosca
+// Definitions by: Joao Gabriel Gouveia
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+export class Server {
+ opts: any;
+ modernOpts: any;
+ clients: any;
+ closed: boolean;
+
+ constructor(opts: any, callback?: () => void);
+
+ on(when: string, callback: (() => void) | ((client: Client) => void) | ((packet: Packet, client: Client) => void)): void;
+ once(when: string, callback: () => void): void;
+ toString(): string;
+ subscribe(topic: string, callback: () => void, done: () => void): void;
+ publish(message: Message, callback: (obj: any, packet: Packet) => void): void;
+ authenticate(client: Client, username: string, password: string,
+ callback: (obj: any, authenticated: boolean) => void): void;
+ published(packet: Packet, client: Client, callback: (obj: any) => void): void;
+ authorizePublish(client: Client, topic: string, payload: string,
+ callback: (obj: any, authorized: boolean) => void): void;
+ authorizeSubscribe(client: Client, topic: string, callback: (obj: any, authorized: boolean) => void): void;
+ authorizeForward(client: Client, packet: Packet, callback: (obj: any, authorized: boolean) => void): void;
+ storePacket(packet: Packet, callback: () => void): void;
+ deleteOfflinePacket(client: Client, messageId: number, callback: () => void): void;
+ forwardRetained(pattern: string, client: Client, callback: () => void): void;
+ restoreClientSubscriptions(client: Client, callback: () => void): void;
+ forwardOfflinePackets(client: Client, callback: () => void): void;
+ updateOfflinePacket(client: Client, originMessageId: number, packet: Packet,
+ callback: (obj: any, packet: Packet) => void): void;
+ persistClient(client: Client, callback: () => void): void;
+ close(callback?: () => void): void;
+ attachHttpServer(server: any, path?: any): void;
+}
+
+export class Client {
+ id: string;
+ connection: any;
+ server: Server;
+ logger: any;
+ subscriptions: any;
+ nextId: number;
+ inflight: any;
+ inflightCounter: number;
+
+ constructor(connection: any, server: Server);
+
+ close(callback?: () => void, reason?: string): void;
+}
+
+export class Stats {
+ maxConnectedClients: number;
+ connectedClients: number;
+ lastIntervalConnectedClients: number;
+ publishedMessages: number;
+ lastIntervalPublishedMessages: number;
+ started: Date;
+ load: any;
+
+ wire(server: Server): void;
+}
+
+export class Authorizer {
+ users: any;
+
+ addUser(username: string, password: string, authorizePublish: string,
+ authorizeSubscribe: string, callback: (func: any) => void): void;
+}
+
+export interface Packet {
+ topic: string;
+ payload: any;
+ messageId: string;
+ qos: number;
+ retain: boolean;
+}
+
+export interface Message {
+ topic: string;
+ payload: any;
+ qos: number;
+ retain: boolean;
+}
diff --git a/types/mosca/mosca-tests.ts b/types/mosca/mosca-tests.ts
new file mode 100644
index 0000000000..e03b664b1b
--- /dev/null
+++ b/types/mosca/mosca-tests.ts
@@ -0,0 +1,16 @@
+import { Server, Client, Packet } from 'mosca';
+
+const settings = {
+ port: 1883,
+ host: '0.0.0.0'
+};
+
+const server = new Server(settings);
+
+server.on('ready', () => {});
+
+server.on('clientConnected', (client: Client) => {});
+
+server.on('clientDisconnected', (client: Client) => {});
+
+server.on('published', (packet: Packet, client: Client) => {});
diff --git a/types/mosca/tsconfig.json b/types/mosca/tsconfig.json
new file mode 100644
index 0000000000..58b3dcaaf8
--- /dev/null
+++ b/types/mosca/tsconfig.json
@@ -0,0 +1,21 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": ["../"],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "mosca-tests.ts"
+ ]
+}
diff --git a/types/mosca/tslint.json b/types/mosca/tslint.json
new file mode 100644
index 0000000000..6746359dda
--- /dev/null
+++ b/types/mosca/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": "dtslint/dt.json"
+}
diff --git a/types/mustache/index.d.ts b/types/mustache/index.d.ts
index 26a00fc796..2b0ab91cd0 100644
--- a/types/mustache/index.d.ts
+++ b/types/mustache/index.d.ts
@@ -1,53 +1,247 @@
-// Type definitions for Mustache 0.8.2
+// Type definitions for Mustache 0.8.3
// Project: https://github.com/janl/mustache.js
-// Definitions by: Mark Ashley Bell
+// Definitions by: Mark Ashley Bell , Manuel Thalmann
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+/**
+ * Provides the functionality to render templates with `{{mustaches}}`.
+ */
+interface MustacheStatic {
+ /**
+ * The name of the module.
+ */
+ name: string;
-interface MustacheScanner {
+ /**
+ * The version of the module.
+ */
+ version: string;
+
+ /**
+ * The opening and closing tags to parse.
+ */
+ tags: string;
+
+ /**
+ * A simple string scanner that is used by the template parser to find tokens in template strings.
+ */
+ Scanner: typeof MustacheScanner
+
+ /**
+ * Represents a rendering context by wrapping a view object and maintaining a reference to the parent context.
+ */
+ Context: typeof MustacheContext;
+
+ /**
+ * A Writer knows how to take a stream of tokens and render them to a `string`, given a context.
+ *
+ * It also maintains a cache of templates to avoid the need to parse the same template twice.
+ */
+ Writer: typeof MustacheWriter;
+
+ /**
+ * Escapes HTML-characters.
+ *
+ * @param value
+ * The string to escape.
+ */
+ escape: (value: string) => string;
+
+ /**
+ * Clears all cached templates in this writer.
+ */
+ clearCache(): void;
+
+ /**
+ * Parses and caches the given template in the default writer and returns the array of tokens it contains.
+ *
+ * Doing this ahead of time avoids the need to parse templates on the fly as they are rendered.
+ *
+ * @param template
+ * The template to parse.
+ *
+ * @param tags
+ * The tags to use.
+ */
+ parse(template: string, tags?: string[]): any;
+
+ /**
+ * Renders the `template` with the given `view` and `partials` using the default writer.
+ *
+ * @param template
+ * The template to render.
+ *
+ * @param view
+ * The view to render the template with.
+ *
+ * @param partials
+ * Either an object that contains the names and templates of partials that are used in a template
+ *
+ * -- or --
+ *
+ * A function that is used to load partial template on the fly that takes a single argument: the name of the partial.
+ */
+ render(template: string, view: any | MustacheContext, partials?: any): string;
+
+ /**
+ * Renders the `template` with the given `view` and `partials` using the default writer.
+ *
+ * @param template
+ * The template to render.
+ *
+ * @param view
+ * The view to render the template with.
+ *
+ * @param partials
+ * Either an object that contains the names and templates of partials that are used in a template
+ *
+ * -- or --
+ *
+ * A function that is used to load partial template on the fly that takes a single argument: the name of the partial.
+ */
+ to_html(template: string, view: any | MustacheContext, partials?: any, send?: any): any;
+}
+
+/**
+ * A simple string scanner that is used by the template parser to find tokens in template strings.
+ */
+declare class MustacheScanner {
string: string;
tail: string;
pos: number;
+ /**
+ * Initializes a new instance of the `MustacheScanner` class.
+ */
+ constructor(string: string);
+
+ /**
+ * Returns `true` if the tail is empty (end of string).
+ */
eos(): boolean;
+
+ /**
+ * Tries to match the given regular expression at the current position.
+ *
+ * @param re
+ * The regex-pattern to match.
+ *
+ * @returns
+ * The matched text if it can match, the empty string otherwise.
+ */
scan(re: RegExp): string;
+
+ /**
+ * Skips all text until the given regular expression can be matched.
+ *
+ * @param re
+ * The regex-pattern to match.
+ *
+ * @returns
+ * Returns the skipped string, which is the entire tail if no match can be made.
+ */
scanUntil(re: RegExp): string;
}
-interface MustacheContext {
+/**
+ * Represents a rendering context by wrapping a view object and maintaining a reference to the parent context.
+ */
+declare class MustacheContext {
view: any;
parentContext: MustacheContext;
+ /**
+ * Initializes a new instance of the `MustacheContenxt` class.
+ */
+ constructor(view: any, parentContext: MustacheContext);
+
+ /**
+ * Initializes a new instance of the `MustacheContenxt` class.
+ */
+ constructor(view: any);
+
+ /**
+ * Creates a new context using the given view with this context as the parent.
+ *
+ * @param view
+ * The view to create the new context with.
+ */
push(view: any): MustacheContext;
+
+ /**
+ * Returns the value of the given name in this context, traversing up the context hierarchy if the value is absent in this context's view.
+ *
+ * @param name
+ * The name to look up.
+ */
lookup(name: string): any;
}
-interface MustacheWriter {
- (view: any): string;
+/**
+ * A Writer knows how to take a stream of tokens and render them to a `string`, given a context.
+ *
+ * It also maintains a cache of templates to avoid the need to parse the same template twice.
+ */
+declare class MustacheWriter {
+ /**
+ * Initializes a new instance of the `MustacheWriter` class.
+ */
+ constructor();
+ /**
+ * Clears all cached templates in this writer.
+ */
clearCache(): void;
+
+ /**
+ * Parses and caches the given `template` and returns the array of tokens that is generated from the parse.
+ *
+ * @param template
+ * The template to parse.
+ */
parse(template: string, tags?: any): any;
- render(template: string, view: any, partials: any): string;
+
+ /**
+ * High-level method that is used to render the given `template` with the given `view`.
+ *
+ * @param template
+ * The template to render.
+ *
+ * @param view
+ * The view to render the template with.
+ *
+ * @param partials
+ * Either an object that contains the names and templates of partials that are used in a template
+ *
+ * -- or --
+ *
+ * A function that is used to load partial template on the fly that takes a single argument: the name of the partial.
+ */
+ render(template: string, view: any | MustacheContext, partials: any): string;
+
+ /**
+ * Low-level method that renders the given array of `tokens` using the given `context` and `partials`.
+ *
+ * @param tokens
+ * The tokens to render.
+ *
+ * @param context
+ * The context to use for rendering the tokens.
+ *
+ * @param partials
+ * The partials to use for rendering the tokens.
+ *
+ * @param originalTemplate
+ * An object used to extract the portion of the original template that was contained in a higher-order section.
+ *
+ * If the template doesn't use higher-order sections, this argument may be omitted.
+ */
renderTokens(tokens: string[], context: MustacheContext, partials: any, originalTemplate: any): string;
}
-interface MustacheStatic {
- name: string;
- version: string;
- tags: string;
- Scanner: MustacheScanner;
- Context: MustacheContext;
- Writer: MustacheWriter;
- escape: any;
-
- clearCache(): MustacheWriter;
- parse(template: string, tags?: any): any;
- render(template: string, view: any, partials?: any): string;
- to_html(template: string, view: any, partials?: any, send?: any): any;
-}
-
+/**
+ * Provides the functionality to render templates with `{{mustaches}}`.
+ */
declare var Mustache: MustacheStatic;
-
-declare module 'mustache' {
- export = Mustache;
-}
+export = Mustache;
+export as namespace Mustache;
diff --git a/types/mustache/mustache-tests.ts b/types/mustache/mustache-tests.ts
index ad9c410d76..30c920a30a 100644
--- a/types/mustache/mustache-tests.ts
+++ b/types/mustache/mustache-tests.ts
@@ -12,3 +12,18 @@ var output2 = Mustache.render(template2, view2);
var view3 = { firstName: "John", lastName: "Smith", blogURL: "http://testblog.com" };
var template3 = "{{firstName}} {{lastName}}
Blog: {{blogURL}}";
var html = Mustache.to_html(template3, view3);
+
+var view4 = new class extends Mustache.Context
+{
+ constructor()
+ {
+ super({});
+ }
+
+ public lookup(name: string)
+ {
+ return name.toUpperCase();
+ }
+};
+var template4 = "Hello, {{firstName}} {{lastName}}";
+var html4 = Mustache.render(template4, view4);
\ No newline at end of file
diff --git a/types/new-relic-browser/index.d.ts b/types/new-relic-browser/index.d.ts
index 6d9fc22fdc..581d6efb52 100644
--- a/types/new-relic-browser/index.d.ts
+++ b/types/new-relic-browser/index.d.ts
@@ -13,7 +13,7 @@ declare namespace NewRelic {
* @param releaseId The ID or version of this release; for example, a version number, build number
* from your CI environment, GitHub SHA, GUID, or a hash of the contents. Since New Relic converts this
* value into a string, you can also use null or undefined if necessary
- * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/addRelease
+ * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/add-release
*/
addRelease(releaseName: string, releaseId: string): void;
@@ -23,9 +23,9 @@ declare namespace NewRelic {
* @param name Name or category of the action. Reports to Insights as the actionName attribute.
* @param attributes JSON object with one or more key/value pairs.
* The key will report to Insights as its own PageAction attribute with the specified values.
- * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/addPageAction
+ * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/add-page-action
*/
- addPageAction(name: string, attributes: { [key: string]: string }): void;
+ addPageAction(name: string, attributes: { [key: string]: string | number }): void;
/**
* Adds a JavaScript object with a custom name, start time, etc. to an in-progress session trace.
@@ -51,7 +51,7 @@ declare namespace NewRelic {
*
* @param Provide a meaningful error message that you can use when analyzing data on
* New Relic Browser's JavaScript errors page.
- * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/noticeError
+ * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/notice-error
*/
noticeError(error: any): void;
@@ -63,7 +63,7 @@ declare namespace NewRelic {
* @param value Value of the attribute. Appears as the value in the named attribute column in the
* PageView event. It will appear as a column in the PageAction event if you are using it. Custom attribute
* values cannot be complex objects, only simple types such as strings and numbers.
- * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/setCustomAttribute
+ * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/set-custom-attribute
*/
setCustomAttribute(name: string, value: string): void;
@@ -72,7 +72,7 @@ declare namespace NewRelic {
*
* @param filterCallback The callback will be called with each error, so it is not
* specific to one error. `err` will usually be an error object, but it can be other data types.
- * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/setErrorHandler
+ * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/set-error-handler
*/
setErrorHandler(filterCallback: (err: any) => boolean): void;
@@ -84,7 +84,7 @@ declare namespace NewRelic {
* To further group these custom transactions, provide a custom host. Otherwise, the page views will be
* assigned the default domain custom.transaction. Segments within the name must be explicitly added to
* the Whitelist segments in your URL whitelist settings if they do not already appear.
- * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/setPageViewName
+ * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/set-pageview-name
*/
setPageViewName(name: string, host?: string): void;
diff --git a/types/new-relic-browser/new-relic-browser-tests.ts b/types/new-relic-browser/new-relic-browser-tests.ts
index 86ce781e18..b593f335e1 100644
--- a/types/new-relic-browser/new-relic-browser-tests.ts
+++ b/types/new-relic-browser/new-relic-browser-tests.ts
@@ -9,6 +9,7 @@ newrelic.addRelease('checkout page', 'a818994');
// addPageAction()
newrelic.addPageAction('copy-text-button', { result: 'success' });
+newrelic.addPageAction('async-action', { duration: 3000 });
// addToTrace()
newrelic.addToTrace({
diff --git a/types/next/document.d.ts b/types/next/document.d.ts
index 38e20e00c0..0955877d61 100644
--- a/types/next/document.d.ts
+++ b/types/next/document.d.ts
@@ -1,10 +1,43 @@
import * as React from "react";
+
import { NextContext } from ".";
+export interface RenderPageResponse {
+ buildManifest: { [key: string]: any };
+ chunks: {
+ names: string[];
+ filenames: string[];
+ };
+ html?: string;
+ head: Array>;
+ errorHtml: string;
+}
+
+export interface PageProps {
+ url: string;
+}
+
+export interface AnyPageProps extends PageProps {
+ [key: string]: any;
+}
+
+export type Enhancer = (page: React.ComponentType) => React.ComponentType;
+
+/**
+ * Context object used inside `Document`
+ */
+export interface NextDocumentContext extends NextContext {
+ /** A callback that executes the actual React rendering logic (synchronously) */
+ renderPage(enhancer?: Enhancer): RenderPageResponse; // tslint:disable-line:no-unnecessary-generics
+}
+
export interface DocumentProps {
__NEXT_DATA__?: any;
dev?: boolean;
- chunks?: string[];
+ chunks?: {
+ names: string[];
+ filenames: string[];
+ };
html?: string;
head?: Array>;
errorHtml?: string;
@@ -13,21 +46,9 @@ export interface DocumentProps {
[key: string]: any;
}
-/**
- * Context object used inside `Document`
- */
-export interface NextDocumentContext extends NextContext {
- /** A callback that executes the actual React rendering logic (synchronously) */
- renderPage(
- cb?: (enhancer: () => JSX.Element) => React.ComponentType
- ): {
- [key: string]: any
- };
-}
-
export class Head extends React.Component {}
export class Main extends React.Component {}
export class NextScript extends React.Component {}
export default class extends React.Component {
- static getInitialProps(ctx: NextContext): DocumentProps;
+ static getInitialProps(ctx: NextDocumentContext): Promise | DocumentProps;
}
diff --git a/types/next/test/next-document-tests.tsx b/types/next/test/next-document-tests.tsx
index 2b3257cd25..f727262b0e 100644
--- a/types/next/test/next-document-tests.tsx
+++ b/types/next/test/next-document-tests.tsx
@@ -1,7 +1,7 @@
-import Document, { Head, Main, NextScript, NextDocumentContext } from 'next/document';
+import Document, { DocumentProps, Enhancer, Head, Main, NextScript, NextDocumentContext, PageProps } from 'next/document';
import * as React from "react";
-const results = (
+const basicResults = (
@@ -11,16 +11,18 @@ const results = (
);
-const Wrapper: React.SFC = ({ children }) => {children} ;
-
-export default class MyDocument extends Document {
+class MyDoc extends Document {
static async getInitialProps({ renderPage }: NextDocumentContext) {
- // Without callback
- const page = renderPage();
- // With callback
- const differentPage = renderPage(App => props => );
+ // without callback
+ const _page = renderPage();
+
+ // with callback
+ const enhancer: Enhancer = (App) => (props) => ( );
+ const { html, head, errorHtml, chunks, buildManifest } = renderPage(enhancer);
+
const style = {};
- return { ...page, style };
+
+ return { html, head, errorHtml, chunks, buildManifest, style };
}
render() {
@@ -33,8 +35,45 @@ export default class MyDocument extends Document {
+ {this.props.children}
);
}
}
+
+const extendedResults = (
+
+
+
+
+ Hey there
+
+);
+
+const renderPage: NextDocumentContext['renderPage'] = (enhancer) => ({
+ buildManifest: {},
+ chunks: { names: [], filenames: [] },
+ html: '',
+ head: [ ],
+ errorHtml: '',
+});
+
+interface PageInitialProps extends PageProps {
+ foo: string;
+ bar: number;
+}
+
+interface ProcessedInitialProps {
+ fooLength: number;
+ bar: boolean;
+}
+
+const enhancerExplicit: Enhancer = (App) => (props) => ( );
+const enhancerInferred = (App: React.ComponentType) => ({ foo, bar }: PageInitialProps) => ( );
+const explicitEnhancerRenderResponse = renderPage(enhancerExplicit);
+const inferredEnhancerRenderResponse = renderPage(enhancerInferred);
+const defaultedTypesRenderResponse = renderPage((App) => (props) => ( ));
+const defaultedTypesExtendedRenderResponse = renderPage((App) => (props) => ( ));
+const explicitTypesRenderResponseOne = renderPage((App) => (props) => ( ));
+const explicitTypesRenderResponseTwo = renderPage((App) => ({ foo, bar }) => ( ));
diff --git a/types/node-vault/index.d.ts b/types/node-vault/index.d.ts
index 835e364ae7..f21d625822 100644
--- a/types/node-vault/index.d.ts
+++ b/types/node-vault/index.d.ts
@@ -111,7 +111,7 @@ declare namespace NodeVault {
debug?(...args: any[]): any;
tv4?(...args: any[]): any;
commands?: Array<{ method: string, path: string, scheme: any }>;
- mustache?: MustacheStatic;
+ mustache?: typeof mustache;
"request-promise"?: any;
Promise?: PromiseConstructor;
diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts
index fc2bcb51b9..eea1cd2bb0 100644
--- a/types/office-js/index.d.ts
+++ b/types/office-js/index.d.ts
@@ -13559,12 +13559,46 @@ declare namespace OfficeExtension {
}
declare namespace OfficeExtension {
+ /**
+ * Specifies which properties of an object should be loaded. This load happens when the sync() method is executed. This synchronizes the states between Office objects and corresponding JavaScript proxy objects.
+ *
+ * @remarks
+ *
+ * For Word, the preferred method for specifying the properties and paging information is by using a string literal. The first two examples show the preferred way to request the text and font size properties for paragraphs in a paragraph collection:
+ *
+ * `context.load(paragraphs, 'text, font/size');`
+ *
+ * `paragraphs.load('text, font/size');`
+ *
+ * Here is a similar example using object notation (includes paging):
+ *
+ * `context.load(paragraphs, {select: 'text, font/size', expand: 'font', top: 50, skip: 0});`
+ *
+ * `paragraphs.load({select: 'text, font/size', expand: 'font', top: 50, skip: 0});`
+ *
+ * Note that if we don't specify the specific properties on the font object in the select statement, the expand statement by itself would indicate that all of the font properties are loaded.
+ */
interface LoadOption {
+ /**
+ * A comma-delimited string, or array of strings, that specifies the properties/relationships to load.
+ */
select?: string | string[];
+ /**
+ * A comma-delimited string, or array of strings, that specifies the relationships to load.
+ */
expand?: string | string[];
+ /**
+ * Only usable on collection types. Specifies the maximum number of collection items that can be included in the result.
+ */
top?: number;
+ /**
+ * Only usable on collection types. Specifies the number of items in the collection that are to be skipped and not included in the result. If top is specified, the result set will start after skipping the specified number of items.
+ */
skip?: number;
}
+ /**
+ * Provides an option for suppressing an error when the object that is used to set multiple properties tries to set read-only properties.
+ */
interface UpdateOptions {
/**
* Throw an error if the passed-in property list includes read-only properties (default = true).
@@ -13592,7 +13626,11 @@ declare namespace OfficeExtension {
/** Request headers */
requestHeaders: { [name: string]: string };
- /** Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading the properties. */
+ /** Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading the properties.
+ *
+ * @param object The object whose properties are loaded.
+ * @param option A comma-delimited string, or array of strings, that specifies the properties/relationships to load, or an {@link Office.OfficeExtension.LoadOption} object.
+ */
load(object: ClientObject, option?: string | string[] | LoadOption): void;
/**
@@ -13652,7 +13690,9 @@ declare namespace OfficeExtension {
*/
extendedErrorLogging: boolean;
};
-
+ /**
+ * Provides information about an error.
+ */
interface DebugInfo {
/** Error code string, such as "InvalidArgument". */
code: string;
@@ -13660,24 +13700,20 @@ declare namespace OfficeExtension {
message: string;
/** Inner error, if applicable. */
innerError?: DebugInfo | string;
-
/** The object type and property or method name (or similar information), if available. */
errorLocation?: string;
-
/**
* The statement that caused the error, if available.
*
* This statement will never contain any potentially-sensitive data and may not match the code exactly as written, but will be a close approximation.
*/
statements?: string;
-
/**
* The statements that closely precede and follow the statement that caused the error, if available.
*
* These statements will never contain any potentially-sensitive data and may not match the code exactly as written, but will be a close approximation.
*/
surroundingStatements?: string[];
-
/**
* All statements in the batch request (including any potentially-sensitive information that was specified in the request), if available.
*
@@ -13731,11 +13767,23 @@ declare namespace OfficeExtension {
declare namespace OfficeExtension {
/** Collection of tracked objects, contained within a request context. See "context.trackedObjects" for more information. */
class TrackedObjects {
- /** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */
+ /**
+ * Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created.
+ *
+ * This method also has the following signature:
+ *
+ * `add(objects: ClientObject[]): void;` Where objects is an array of objects to be tracked.
+ */
add(object: ClientObject): void;
- /** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */
+ /** Track a set of objects for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */
add(objects: ClientObject[]): void;
- /** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call `context.sync()` before the memory release takes effect. */
+ /**
+ * Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call `context.sync()` before the memory release takes effect.
+ *
+ * This method also has the following signature:
+ *
+ * `remove(objects: ClientObject[]): void;` Where objects is an array of objects to be removed.
+ */
remove(object: ClientObject): void;
/** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call `context.sync()` before the memory release takes effect. */
remove(objects: ClientObject[]): void;
diff --git a/types/p-timeout/index.d.ts b/types/p-timeout/index.d.ts
index 882cc7adc8..40e1dc6410 100644
--- a/types/p-timeout/index.d.ts
+++ b/types/p-timeout/index.d.ts
@@ -5,8 +5,8 @@
export = pTimeout;
-declare function pTimeout(input: Promise, ms: number, message?: string | pTimeout.TimeoutError): Promise;
-declare function pTimeout(input: Promise, ms: number, fallback: () => R | Promise): Promise;
+declare function pTimeout(input: PromiseLike, ms: number, message?: string | pTimeout.TimeoutError): Promise;
+declare function pTimeout(input: PromiseLike, ms: number, fallback: () => R | Promise): Promise;
declare namespace pTimeout {
class TimeoutError extends Error {
diff --git a/types/pngjs/index.d.ts b/types/pngjs/index.d.ts
index d5476e9e1f..f5ac2e6d2a 100644
--- a/types/pngjs/index.d.ts
+++ b/types/pngjs/index.d.ts
@@ -85,7 +85,7 @@ export interface PackerOptions {
export type PNGOptions = BaseOptions & ParserOptions & PackerOptions;
-export type ColorType = 0 | 1 | 2 | 4;
+export type ColorType = 0 | 2 | 4 | 6;
export interface Metadata {
width: number;
diff --git a/types/pouchdb-find/index.d.ts b/types/pouchdb-find/index.d.ts
index 7f5f925f8c..1ccd3d4c14 100644
--- a/types/pouchdb-find/index.d.ts
+++ b/types/pouchdb-find/index.d.ts
@@ -1,6 +1,7 @@
// Type definitions for pouchdb-find 6.3
// Project: https://pouchdb.com/
// Definitions by: Jakub Navratil
+// Sebastian Ramirez
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -100,7 +101,7 @@ declare namespace PouchDB {
}
interface FindResponse {
- docs: Array>;
+ docs: Array>;
}
interface CreateIndexOptions {
diff --git a/types/react-amplitude/index.d.ts b/types/react-amplitude/index.d.ts
new file mode 100644
index 0000000000..c6a9ff3d2d
--- /dev/null
+++ b/types/react-amplitude/index.d.ts
@@ -0,0 +1,22 @@
+// Type definitions for react-amplitude 0.1
+// Project: https://github.com/rorygarand/react-amplitude
+// Definitions by: Raymond Ho
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+export interface AmplitudeInstance {
+ init(apiKey: string, userId?: string, config?: any, cb?: () => void): void;
+ amplitude(): void;
+ clearUserProperties(): void;
+ getSessionId(): void;
+ identify(idObj: any, cb: () => void): void;
+ isNewSession(): void;
+ logEvent(eventType: string, eventProperties: {}, cb: () => void): void;
+ logEventWithTimestamp(eventType: string, eventProperties: {}, timestamp: number, cb: () => void): void;
+ resetUserId(): void;
+ setUserId(userId: string): void;
+ setUserProperties(userProps: any): void;
+}
+
+declare const Amplitude: AmplitudeInstance;
+
+export default Amplitude;
diff --git a/types/react-amplitude/react-amplitude-tests.ts b/types/react-amplitude/react-amplitude-tests.ts
new file mode 100644
index 0000000000..f311f8491f
--- /dev/null
+++ b/types/react-amplitude/react-amplitude-tests.ts
@@ -0,0 +1,2 @@
+import Amplitude from 'react-amplitude';
+Amplitude.init('YOUR_UNIQUE_TRACKING_CODE');
diff --git a/types/react-amplitude/tsconfig.json b/types/react-amplitude/tsconfig.json
new file mode 100644
index 0000000000..6f7a8a296e
--- /dev/null
+++ b/types/react-amplitude/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "react-amplitude-tests.ts"
+ ]
+}
diff --git a/types/react-amplitude/tslint.json b/types/react-amplitude/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/react-amplitude/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/react-autocomplete/index.d.ts b/types/react-autocomplete/index.d.ts
index 58339d3b31..0de7cd7eac 100644
--- a/types/react-autocomplete/index.d.ts
+++ b/types/react-autocomplete/index.d.ts
@@ -143,8 +143,27 @@ declare namespace Autocomplete {
open?: boolean;
debug?: boolean;
}
+
+ interface State {
+ /**
+ * True when the menu is visible. Provided to `onMenuVisibilityChange`.
+ */
+ isOpen: boolean;
+
+ /**
+ * Index of the highlighted item, `null` if none currently is.
+ */
+ highlightedIndex: number | null;
+
+ /**
+ * These three `menu___` values are used in CSS to layout the menu.
+ */
+ menuLeft?: number;
+ menuTop?: number;
+ menuWidth?: number;
+ }
}
-declare class Autocomplete extends Component {
+declare class Autocomplete extends Component {
/**
* Autocomplete exposes a subset of `HTMLInputElement` properties to the parent component.
* They can be accessed through Autocomplete's `ref` prop.
diff --git a/types/react-beautiful-dnd/index.d.ts b/types/react-beautiful-dnd/index.d.ts
index 8d25e79407..3cb5e026f8 100644
--- a/types/react-beautiful-dnd/index.d.ts
+++ b/types/react-beautiful-dnd/index.d.ts
@@ -1,8 +1,9 @@
-// Type definitions for react-beautiful-dnd 6.0
+// Type definitions for react-beautiful-dnd 7.1
// Project: https://github.com/atlassian/react-beautiful-dnd
// Definitions by: varHarrie
// Bradley Ayers
// Austin Turner
+// Mark Nelissen
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -84,8 +85,8 @@ export class Droppable extends React.Component {}
*/
export interface NotDraggingStyle {
- transform: null | string;
- transition: null | 'none';
+ transform?: string;
+ transition?: 'none';
}
export interface DraggingStyle {
@@ -97,14 +98,14 @@ export interface DraggingStyle {
top: number;
left: number;
margin: 0;
- transform: null | string;
+ transform?: string;
transition: 'none';
zIndex: ZIndex;
}
export interface DraggableProvidedDraggableProps {
// inline style
- style: null | DraggingStyle | NotDraggingStyle;
+ style?: DraggingStyle | NotDraggingStyle;
// used for shared global styles
'data-react-beautiful-dnd-draggable': string;
}
diff --git a/types/react-jsonschema-form/index.d.ts b/types/react-jsonschema-form/index.d.ts
index ef1b359e5d..52903e8375 100644
--- a/types/react-jsonschema-form/index.d.ts
+++ b/types/react-jsonschema-form/index.d.ts
@@ -35,6 +35,7 @@ declare module "react-jsonschema-form" {
>;
safeRenderCompletion?: boolean;
transformErrors?: (errors: AjvError[]) => AjvError[];
+ idPrefix?: string;
// HTML Attributes
id?: string;
diff --git a/types/react-places-autocomplete/index.d.ts b/types/react-places-autocomplete/index.d.ts
index 667106d916..f05820bbce 100644
--- a/types/react-places-autocomplete/index.d.ts
+++ b/types/react-places-autocomplete/index.d.ts
@@ -1,6 +1,7 @@
// Type definitions for react-places-autocomplete 6.1
// Project: https://github.com/kenny-hibino/react-places-autocomplete/
// Definitions by: Guilherme Hübner
+// Andrew Makarov
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
//
@@ -56,6 +57,11 @@ export interface PropTypes {
}
export function geocodeByAddress(address: string, callback: (results: google.maps.GeocoderResult[], status: google.maps.GeocoderStatus) => void): void;
+export function geocodeByAddress(address: string): Promise;
+
export function geocodeByPlaceId(placeId: string, callback: (results: google.maps.GeocoderResult[], status: google.maps.GeocoderStatus) => void): void;
+export function geocodeByPlaceId(placeId: string): Promise;
+
+export function getLatLng(results: google.maps.GeocoderResult): Promise;
export default class PlacesAutocomplete extends React.Component {}
diff --git a/types/react-places-autocomplete/react-places-autocomplete-tests.tsx b/types/react-places-autocomplete/react-places-autocomplete-tests.tsx
new file mode 100644
index 0000000000..41e6ff37b4
--- /dev/null
+++ b/types/react-places-autocomplete/react-places-autocomplete-tests.tsx
@@ -0,0 +1,52 @@
+import * as React from 'react';
+import PlacesAutocomplete, { geocodeByAddress, geocodeByPlaceId, getLatLng } from 'react-places-autocomplete';
+
+class Test extends React.Component {
+ state = {
+ address: 'San Francisco, CA',
+ placeId: '12345',
+ };
+
+ handleFormSubmit = (event: any) => {
+ event.preventDefault();
+
+ const { address, placeId } = this.state;
+
+ // Old API
+ geocodeByAddress(address, (results, status) => {
+ const latLng = getLatLng(results[0]);
+ console.info(latLng, status);
+ });
+
+ geocodeByPlaceId(placeId, (results, status) => {
+ const latLng = getLatLng(results[0]);
+ console.info(latLng, status);
+ });
+
+ // New API
+ geocodeByAddress(address)
+ .then((results) => getLatLng(results[0]))
+ .then((latLng) => console.log('Success', latLng))
+ .catch((error) => console.error('Error', error));
+
+ geocodeByPlaceId(placeId)
+ .then((results) => getLatLng(results[0]))
+ .then((latLng) => console.log('Success', latLng))
+ .catch((error) => console.error('Error', error));
+ }
+
+ onChange = (address: string) => this.setState({ address });
+
+ render() {
+ const inputProps = {
+ value: this.state.address,
+ onChange: this.onChange,
+ };
+
+ return (
+
+ );
+ }
+}
diff --git a/types/react-places-autocomplete/tsconfig.json b/types/react-places-autocomplete/tsconfig.json
index 02dbd0279c..6f45bffc51 100644
--- a/types/react-places-autocomplete/tsconfig.json
+++ b/types/react-places-autocomplete/tsconfig.json
@@ -1,12 +1,19 @@
{
- "files": ["index.d.ts"],
+ "files": [
+ "index.d.ts",
+ "react-places-autocomplete-tests.tsx"
+ ],
"compilerOptions": {
"module": "commonjs",
- "lib": ["es6"],
+ "lib": [
+ "es6",
+ "dom"
+ ],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
+ "jsx": "react",
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
diff --git a/types/react-rnd/index.d.ts b/types/react-rnd/index.d.ts
index 31d477ca5e..ff5ac2078e 100644
--- a/types/react-rnd/index.d.ts
+++ b/types/react-rnd/index.d.ts
@@ -4,117 +4,118 @@
// fsubal
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
-import React = require('react');
+import * as React from "react";
type CSSProperties = React.CSSProperties;
-declare namespace Rnd {
- type Direction =
- | 'bottom'
- | 'bottomLeft'
- | 'bottomRight'
- | 'left'
- | 'right'
- | 'top'
- | 'topLeft'
- | 'topRight';
+export type Direction =
+ | "bottom"
+ | "bottomLeft"
+ | "bottomRight"
+ | "left"
+ | "right"
+ | "top"
+ | "topLeft"
+ | "topRight";
- interface Enable {
- bottom?: boolean;
- bottomLeft?: boolean;
- bottomRight?: boolean;
- left?: boolean;
- right?: boolean;
- top?: boolean;
- topLeft?: boolean;
- topRight?: boolean;
- }
-
- interface HandleClasses {
- bottom?: string;
- bottomLeft?: string;
- bottomRight?: string;
- left?: string;
- right?: string;
- top?: string;
- topLeft?: string;
- topRight?: string;
- }
-
- interface HandleStyles {
- bottom?: CSSProperties;
- bottomLeft?: CSSProperties;
- bottomRight?: CSSProperties;
- left?: CSSProperties;
- right?: CSSProperties;
- top?: CSSProperties;
- topLeft?: CSSProperties;
- topRight?: CSSProperties;
- }
-
- interface Position {
- x: number;
- y: number;
- }
-
- interface Size {
- width: number;
- height: number;
- }
-
- interface DraggableData {
- node: HTMLElement;
- x: number;
- y: number;
- deltaX: number;
- deltaY: number;
- lastX: number;
- lastY: number;
- }
-
- type DraggableEventHandler = (e: MouseEvent | TouchEvent, data: DraggableData) => void|false;
-
- type ResizeHandler = (
- e: MouseEvent|TouchEvent,
- direction: Direction,
- ref: HTMLDivElement,
- delta: Size,
- position: Position
- ) => void;
-
- interface Options {
- default: {
- x?: number;
- y?: number;
- width?: number|string;
- height?: number|string;
- };
- className: string;
- style: any;
- width: number|string;
- height: number|string;
- minWidth: number|string;
- minHeight: number|string;
- maxWidth: number|string;
- maxHeight: number|string;
- z: number;
- resizeHandleClasses: HandleClasses;
- resizeHandleStyles: HandleStyles;
-
- lockAspectRatio: boolean;
- enableResizing?: Enable;
- disableDragging?: boolean;
-
- onResizeStart: () => void;
- onResize: () => void;
- onResizeStop: ResizeHandler;
-
- onDragStart: DraggableEventHandler;
- onDrag: DraggableEventHandler;
- onDragStop: DraggableEventHandler;
- }
+export interface Enable {
+ bottom?: boolean;
+ bottomLeft?: boolean;
+ bottomRight?: boolean;
+ left?: boolean;
+ right?: boolean;
+ top?: boolean;
+ topLeft?: boolean;
+ topRight?: boolean;
}
-declare class Rnd extends React.Component> {}
+export interface HandleClasses {
+ bottom?: string;
+ bottomLeft?: string;
+ bottomRight?: string;
+ left?: string;
+ right?: string;
+ top?: string;
+ topLeft?: string;
+ topRight?: string;
+}
-export = Rnd;
+export interface HandleStyles {
+ bottom?: CSSProperties;
+ bottomLeft?: CSSProperties;
+ bottomRight?: CSSProperties;
+ left?: CSSProperties;
+ right?: CSSProperties;
+ top?: CSSProperties;
+ topLeft?: CSSProperties;
+ topRight?: CSSProperties;
+}
+
+export interface Position {
+ x: number;
+ y: number;
+}
+
+export interface Size {
+ width: number;
+ height: number;
+}
+
+export interface DraggableData {
+ node: HTMLElement;
+ x: number;
+ y: number;
+ deltaX: number;
+ deltaY: number;
+ lastX: number;
+ lastY: number;
+}
+
+export type DraggableEventHandler = (
+ e: MouseEvent | TouchEvent,
+ data: DraggableData
+) => void | false;
+
+export type ResizeHandler = (
+ e: MouseEvent | TouchEvent,
+ direction: Direction,
+ ref: HTMLDivElement,
+ delta: Size,
+ position: Position
+) => void;
+
+export interface Options {
+ default: {
+ x?: number;
+ y?: number;
+ width?: number | string;
+ height?: number | string;
+ };
+ className: string;
+ style: any;
+ width: number | string;
+ height: number | string;
+ minWidth: number | string;
+ minHeight: number | string;
+ maxWidth: number | string;
+ maxHeight: number | string;
+ z: number;
+ resizeHandleClasses: HandleClasses;
+ resizeHandleStyles: HandleStyles;
+
+ lockAspectRatio: boolean;
+ enableResizing?: Enable;
+ disableDragging?: boolean;
+
+ onResizeStart: () => void;
+ onResize: () => void;
+ onResizeStop: ResizeHandler;
+
+ onDragStart: DraggableEventHandler;
+ onDrag: DraggableEventHandler;
+ onDragStop: DraggableEventHandler;
+}
+
+declare class Rnd extends React.Component> {}
+
+export default Rnd;
diff --git a/types/react-rnd/react-rnd-tests.tsx b/types/react-rnd/react-rnd-tests.tsx
index 9f1cbc593c..461a0d03ba 100644
--- a/types/react-rnd/react-rnd-tests.tsx
+++ b/types/react-rnd/react-rnd-tests.tsx
@@ -1,7 +1,7 @@
-import React = require('react');
-import Rnd = require('react-rnd');
+import * as React from 'react';
+import { default as Rnd, ResizeHandler } from "react-rnd";
-const onResize: Rnd.ResizeHandler = (e, direction, ref, delta, position) => {
+const onResize: ResizeHandler = (e, direction, ref, delta, position) => {
direction === 'right';
delta.width;
delta.height;
diff --git a/types/redux-form/index.d.ts b/types/redux-form/index.d.ts
index 8ee5fa9698..336ab9ade4 100644
--- a/types/redux-form/index.d.ts
+++ b/types/redux-form/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for redux-form 7.2
+// Type definitions for redux-form 7.3
// Project: https://github.com/erikras/redux-form
// Definitions by: Carson Full
// Daniel Lytkin
@@ -7,6 +7,7 @@
// Alex Young
// Anton Novik
// Huw Martin
+// Tim de Koning
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
diff --git a/types/redux-form/lib/reducer.d.ts b/types/redux-form/lib/reducer.d.ts
index 9e865fc6c1..6324ab92e6 100644
--- a/types/redux-form/lib/reducer.d.ts
+++ b/types/redux-form/lib/reducer.d.ts
@@ -18,7 +18,7 @@ export interface FormStateMap {
export interface FormState {
registeredFields: RegisteredFieldState[];
fields?: {[name: string]: FieldState};
- values?: { [fieldName: string]: string };
+ values?: { [fieldName: string]: any };
active?: string;
anyTouched?: boolean;
submitting?: boolean;
diff --git a/types/redux-form/v6/lib/reducer.d.ts b/types/redux-form/v6/lib/reducer.d.ts
index 1800391863..9089a8802d 100644
--- a/types/redux-form/v6/lib/reducer.d.ts
+++ b/types/redux-form/v6/lib/reducer.d.ts
@@ -29,7 +29,7 @@ export interface FormStateMap {
export interface FormState {
registeredFields: RegisteredFieldState[];
fields?: {[name: string]: FieldState};
- values?: { [fieldName: string]: string };
+ values?: { [fieldName: string]: any };
active?: string;
anyTouched?: boolean;
submitting?: boolean;
diff --git a/types/sax/index.d.ts b/types/sax/index.d.ts
index 4c556d8aab..40d17caa4d 100644
--- a/types/sax/index.d.ts
+++ b/types/sax/index.d.ts
@@ -1,6 +1,7 @@
// Type definitions for sax-js 1.x
// Project: https://github.com/isaacs/sax-js
// Definitions by: Asana
+// Evert Pot
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///
@@ -44,7 +45,7 @@ export interface Tag extends BaseTag {
export declare function parser(strict: boolean, opt: SAXOptions): SAXParser;
export declare class SAXParser {
- constructor(strict: boolean, opt: SAXOptions);
+ constructor(strict: boolean, opt?: SAXOptions);
// Methods
end(): void;
diff --git a/types/seamless-immutable/index.d.ts b/types/seamless-immutable/index.d.ts
index d3d2ef5b6a..b781523ef2 100644
--- a/types/seamless-immutable/index.d.ts
+++ b/types/seamless-immutable/index.d.ts
@@ -18,6 +18,10 @@ declare namespace SeamlessImmutable {
merger?(a: any, b: any, config: any): any;
}
+ interface ReplaceConfig {
+ deep: boolean;
+ }
+
interface Options {
prototype?: any;
}
@@ -75,6 +79,8 @@ declare namespace SeamlessImmutable {
without(property: K): ImmutableObject;
without(...properties: K[]): ImmutableObject;
without(filter: (value: T[K], key: K) => boolean): ImmutableObject;
+
+ replace(valueObj: S, options?: ReplaceConfig): ImmutableObject;
}
interface ImmutableArrayMixin {
@@ -92,6 +98,8 @@ declare namespace SeamlessImmutable {
function isImmutable(target: any): boolean;
function ImmutableError(message: string): Error;
+
+ function replace(obj: ImmutableObject, valueObj: S, options?: ReplaceConfig): ImmutableObject;
}
declare function SeamlessImmutable(obj: T[], options?: SeamlessImmutable.Options): SeamlessImmutable.ImmutableArray;
diff --git a/types/seamless-immutable/seamless-immutable-tests.ts b/types/seamless-immutable/seamless-immutable-tests.ts
index ddec87e81d..cccb2d7f96 100644
--- a/types/seamless-immutable/seamless-immutable-tests.ts
+++ b/types/seamless-immutable/seamless-immutable-tests.ts
@@ -44,6 +44,12 @@ interface ExtendedUser extends User {
{
const isImmutable: boolean = Immutable.isImmutable(Immutable.from([0, 2]));
+ const user1: Immutable.ImmutableObject = Immutable.from({
+ firstName: 'Angry',
+ lastName: 'Monkey'
+ });
+ const replacedUser01 = Immutable.replace(user1, { firstName: 'Super', lastName: 'Monkey' });
+ const replacedUser02 = Immutable.replace(user1, { firstName: 'Super', lastName: 'Monkey' }, { deep: true });
}
//
@@ -124,4 +130,8 @@ interface ExtendedUser extends User {
const firstNameWithDynamicPathWithDefault = immutableUser.getIn(['first' + 'name'], '');
const line1WithoutDefault = immutableUserEx.getIn(['address', 'line1']);
const line1WithDefault = immutableUserEx.getIn(['address', 'line1'], '');
+
+ // replace
+ const replacedUser01 = immutableUser.replace({ firstName: 'Super', lastName: 'Monkey' });
+ const replacedUser02 = immutableUser.replace({ firstName: 'Super', lastName: 'Monkey' }, { deep: true });
}
diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts
index 0d9a96bfc4..f003b77731 100644
--- a/types/sequelize/index.d.ts
+++ b/types/sequelize/index.d.ts
@@ -3233,9 +3233,10 @@ declare namespace sequelize {
as?: string;
/**
- * The association you want to eagerly load. (This can be used instead of providing a model/as pair)
+ * The association you want to eagerly load. (This can be used instead of providing a model/as pair).
+ * You can also use the association alias.
*/
- association?: IncludeAssociation;
+ association?: IncludeAssociation | string;
/**
* Where clauses to apply to the child models. Note that this converts the eager load to an inner join,
diff --git a/types/sequelize/v3/index.d.ts b/types/sequelize/v3/index.d.ts
index eafa70b641..11b6775846 100644
--- a/types/sequelize/v3/index.d.ts
+++ b/types/sequelize/v3/index.d.ts
@@ -4339,7 +4339,7 @@ declare namespace sequelize {
*
* PostgreSQL only
*/
- deferrable?: Deferrable;
+ deferrable?: DeferrableInitiallyDeferred | DeferrableInitiallyImmediate | DeferrableNot | DeferrableSetDeferred | DeferrableSetImmediate;
}
diff --git a/types/signale/index.d.ts b/types/signale/index.d.ts
new file mode 100644
index 0000000000..d14660e5a9
--- /dev/null
+++ b/types/signale/index.d.ts
@@ -0,0 +1,136 @@
+// Type definitions for signale 1.1
+// Project: https://github.com/klauscfhq/signale
+// Definitions by: Resi Respati
+// Kingdaro
+// Joydip Roy
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.7
+
+///
+
+declare namespace signale {
+ type DefaultMethods =
+ | "await"
+ | "complete"
+ | "error"
+ | "debug"
+ | "fatal"
+ | "fav"
+ | "info"
+ | "note"
+ | "pause"
+ | "pending"
+ | "star"
+ | "start"
+ | "success"
+ | "warn"
+ | "watch"
+ | "log";
+
+ interface CommandType {
+ /** The icon corresponding to the logger. */
+ badge: string;
+ /**
+ * The color of the label, can be any of the foreground colors supported by
+ * [chalk](https://github.com/chalk/chalk#colors).
+ */
+ color: string;
+ /** The label used to identify the type of the logger. */
+ label: string;
+ }
+
+ interface SignaleConfig {
+ /** Display the scope name of the logger. */
+ displayScope?: boolean;
+ /** Display the badge of the logger. */
+ displayBadge?: boolean;
+ /** Display the current local date in `YYYY-MM-DD` format. */
+ displayDate?: boolean;
+ /** Display the name of the file that the logger is reporting from. */
+ displayFilename?: boolean;
+ /** Display the label of the logger. */
+ displayLabel?: boolean;
+ /** Display the current local time in `HH:MM:SS` format. */
+ displayTimestamp?: boolean;
+ /** Underline the logger label. */
+ underlineLabel?: boolean;
+ /** Underline the logger message. */
+ underlineMessage?: boolean;
+ }
+
+ interface SignaleOptions {
+ /** Sets the configuration of an instance overriding any existing global or local configuration. */
+ config?: SignaleConfig;
+ /**
+ * Name of the scope.
+ */
+ scope?: string;
+ /**
+ * Holds the configuration of the custom and default loggers.
+ */
+ types?: Partial>;
+ interactive?: boolean;
+ timers?: Map;
+ /**
+ * Destination to which the data is written, can be any valid
+ * [Writable stream](https://nodejs.org/api/stream.html#stream_writable_streams).
+ */
+ stream?: NodeJS.WriteStream;
+ }
+
+ interface SignaleConstructor {
+ new (
+ options?: SignaleOptions
+ ): Signale;
+ }
+
+ interface SignaleBase {
+ /**
+ * Sets the configuration of an instance overriding any existing global or local configuration.
+ *
+ * @param configObj Can hold any of the documented options.
+ */
+ config(configObj: SignaleConfig): Signale;
+ /**
+ * Defines the scope name of the logger.
+ *
+ * @param name Can be one or more comma delimited strings.
+ */
+ scope(...name: string[]): Signale;
+ /** Clears the scope name of the logger. */
+ unscope(): void;
+ /**
+ * Sets a timers and accepts an optional label. If none provided the timer will receive a unique label automatically.
+ *
+ * @param label Label corresponding to the timer. Each timer must have its own unique label.
+ * @returns a string corresponding to the timer label.
+ */
+ time(label?: string): string;
+ /**
+ * Deactivates the timer to which the given label corresponds. If no label
+ * is provided the most recent timer, that was created without providing a
+ * label, will be deactivated.
+ *
+ * @param label Label corresponding to the timer, each timer has its own unique label.
+ * @param span Total running time.
+ */
+ timeEnd(
+ label?: string,
+ span?: number
+ ): { label: string; span?: number };
+ }
+
+ type LoggerFunc = (message?: any, ...optionalArgs: any[]) => void;
+ type Signale = SignaleBase &
+ Record &
+ Record;
+}
+
+declare const signale: signale.Signale & {
+ Signale: signale.SignaleConstructor;
+ SignaleConfig: signale.SignaleConfig;
+ SignaleOptions: signale.SignaleOptions;
+ DefaultMethods: signale.DefaultMethods;
+};
+
+export = signale;
diff --git a/types/signale/signale-tests.ts b/types/signale/signale-tests.ts
new file mode 100644
index 0000000000..7fd96638a8
--- /dev/null
+++ b/types/signale/signale-tests.ts
@@ -0,0 +1,129 @@
+import { Signale, SignaleOptions } from "signale";
+
+// --- Test 1: Basic Usage --- //
+
+const signale = new Signale();
+
+signale.success("Operation successful");
+signale.debug("Hello", "from", "L59");
+signale.pending("Write release notes for 1.2.0");
+signale.fatal(new Error("Unable to acquire lock"));
+signale.watch("Recursively watching build directory...");
+signale.complete({
+ prefix: "[task]",
+ message: "Fix issue #59",
+ suffix: "(@klauscfhq)"
+});
+
+// --- Test 2: Custom Loggers --- //
+
+type CustomLogger = "remind" | "santa";
+
+const optionsCustom: SignaleOptions = {
+ stream: process.stdout,
+ scope: "custom",
+ types: {
+ remind: {
+ badge: "**",
+ color: "yellow",
+ label: "reminder"
+ },
+ santa: {
+ badge: "🎅",
+ color: "red",
+ label: "santa"
+ }
+ }
+};
+
+const custom = new Signale(optionsCustom);
+custom.remind("Improve documentation.");
+custom.santa("Hoho! You have an unused variable on L45.");
+custom.debug("This should still work");
+
+// --- Test 3: Overriding Default Loggers --- //
+
+const optionsOverride: SignaleOptions = {
+ types: {
+ error: {
+ badge: "!!",
+ color: "red",
+ label: "fatal error"
+ },
+ success: {
+ badge: "++",
+ color: "green",
+ label: "huge success"
+ }
+ }
+};
+
+signale.error("Default Error Log");
+signale.success("Default Success Log");
+
+const customOverride = new Signale(optionsOverride);
+customOverride.error("Custom Error Log");
+customOverride.success("Custom Success Log");
+
+// --- Test 4: Scoped Loggers --- //
+
+const optionsScope: SignaleOptions = {
+ scope: "global scope"
+};
+
+const global = new Signale(optionsScope);
+global.success("Successful Operation");
+
+const global2 = signale.scope("global scope");
+global2.success("Hello from the global scope");
+
+function scopedTest() {
+ const outer = global2.scope("outer", "scope");
+ outer.success("Hello from the outer scope");
+
+ setTimeout(() => {
+ const inner = outer.scope("inner", "scope");
+ inner.success("Hello from the inner scope");
+ }, 500);
+}
+
+scopedTest();
+
+// --- Test 5: Timers --- //
+
+signale.time("test");
+signale.time();
+signale.time();
+
+setTimeout(() => {
+ signale.timeEnd();
+ signale.timeEnd();
+ signale.timeEnd("test");
+}, 500);
+
+// --- Test 6: Configuration --- //
+
+// Overrides any existing `package.json` config
+signale.config({
+ displayFilename: true,
+ displayTimestamp: true,
+ displayDate: false
+});
+
+signale.success("Hello from the Global scope");
+
+function scopedConfigTest() {
+ // `fooLogger` inherits the config of `signale`
+ const fooLogger = signale.scope("foo scope");
+
+ // Overrides both `signale` and `package.json` configs
+ fooLogger.config({
+ displayFilename: true,
+ displayTimestamp: false,
+ displayDate: true
+ });
+
+ fooLogger.success("Hello from the Local scope");
+}
+
+scopedConfigTest();
diff --git a/types/signale/tsconfig.json b/types/signale/tsconfig.json
new file mode 100644
index 0000000000..ef5b67d941
--- /dev/null
+++ b/types/signale/tsconfig.json
@@ -0,0 +1,24 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true,
+ "esModuleInterop": true
+ },
+ "files": [
+ "index.d.ts",
+ "signale-tests.ts"
+ ]
+}
diff --git a/types/signale/tslint.json b/types/signale/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/signale/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/styled-system/index.d.ts b/types/styled-system/index.d.ts
new file mode 100644
index 0000000000..ea6fdc03db
--- /dev/null
+++ b/types/styled-system/index.d.ts
@@ -0,0 +1,603 @@
+// Type definitions for styled-system 2.3
+// Project: https://github.com/jxnblk/styled-system#readme
+// Definitions by: Marshall Bowers
+// Ben McCormick
+// Justin Bennett
+// Christopher Pappas
+// Eloy Durán
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.6
+
+/**
+ * Core
+ */
+
+export type GlobalStyleValues = "inherit" | "initial" | "unset";
+
+export interface BaseTheme {
+ breakpoints?: number[];
+ space?: number[];
+ fontSizes?: number[];
+ colors?: {
+ [name: string]: string;
+ };
+}
+
+/**
+ * Space
+ */
+
+export type ResponsiveValue = T | Array;
+
+export type SpaceValue = number | string;
+export type ResponsiveSpaceValue = ResponsiveValue;
+
+export interface SpaceProps {
+ m?: ResponsiveSpaceValue;
+ mt?: ResponsiveSpaceValue;
+ mr?: ResponsiveSpaceValue;
+ mb?: ResponsiveSpaceValue;
+ ml?: ResponsiveSpaceValue;
+ mx?: ResponsiveSpaceValue;
+ my?: ResponsiveSpaceValue;
+ p?: ResponsiveSpaceValue;
+ pt?: ResponsiveSpaceValue;
+ pr?: ResponsiveSpaceValue;
+ pb?: ResponsiveSpaceValue;
+ pl?: ResponsiveSpaceValue;
+ px?: ResponsiveSpaceValue;
+ py?: ResponsiveSpaceValue;
+}
+
+export function space(...args: any[]): any;
+
+/**
+ * Width
+ */
+
+export type WidthValue = number | string;
+export type ResponsiveWidthValue = ResponsiveValue;
+
+export interface WidthProps {
+ width?: ResponsiveWidthValue;
+}
+
+export interface MinWidthProps {
+ minWidth?: ResponsiveWidthValue;
+}
+
+export interface MaxWidthProps {
+ maxWidth?: ResponsiveWidthValue;
+}
+
+export function width(...args: any[]): any;
+export function minWidth(...args: any[]): any;
+export function maxWidth(...args: any[]): any;
+
+/**
+ * Height
+ */
+
+export type HeightValue = number | string;
+export type ResponsiveHeightValue = ResponsiveValue;
+
+export interface HeightProps {
+ height?: ResponsiveHeightValue;
+}
+
+export interface MinHeightProps {
+ minHeight?: ResponsiveHeightValue;
+}
+
+export interface MaxHeightProps {
+ maxHeight?: ResponsiveHeightValue;
+}
+
+export function height(...args: any[]): any;
+export function minHeight(...args: any[]): any;
+export function maxHeight(...args: any[]): any;
+
+/**
+ * Font Size
+ */
+
+export type FontSizeValue = number | string;
+export type ResponsiveFontSizeValue = ResponsiveValue;
+
+export interface FontSizeProps {
+ fontSize?: ResponsiveFontSizeValue;
+}
+
+export function fontSize(...args: any[]): any;
+
+/**
+ * Color
+ */
+export type ColorValue = string;
+export type ResponsiveColorValue = ResponsiveValue;
+
+export interface ColorProps {
+ color?: ResponsiveColorValue;
+}
+
+export function color(...args: any[]): any;
+
+/**
+ * Typography
+ */
+export interface FontFamilyProps {
+ fontFamily?: string;
+}
+export function fontFamily(...args: any[]): any;
+
+export type TextAlignValue =
+ | "left"
+ | "right"
+ | "center"
+ | "justify"
+ | "justify-all"
+ | "start"
+ | "end"
+ | "match-parent";
+export type ResponsiveTextAlignValue = ResponsiveValue;
+
+export interface TextAlignProps {
+ textAlign?: ResponsiveTextAlignValue;
+}
+
+export function textAlign(...args: any[]): any;
+
+export type LineHeightValue = number | string;
+export type ResponsiveLineHeightValue = ResponsiveValue;
+export interface LineHeightProps {
+ lineHeight?: ResponsiveLineHeightValue;
+}
+export function lineHeight(...args: any[]): any;
+
+export type FontWeightValue =
+ | GlobalStyleValues
+ | "normal"
+ | "bold"
+ | "lighter"
+ | "bolder"
+ | number;
+
+export interface FontWeightProps {
+ fontWeight?: FontWeightValue;
+}
+
+export function fontWeight(...args: any[]): any;
+
+export type LetterSpacingValue = number | string;
+export type ResponsiveLetterSpacingValue = ResponsiveValue;
+export interface LetterSpacingProps {
+ letterSpacing?: ResponsiveLetterSpacingValue;
+}
+export function letterSpacing(...args: any[]): any;
+
+/**
+ * Layout
+ */
+
+export type DisplayValue =
+ | "inline"
+ | "block"
+ | "contents"
+ | "flex"
+ | "grid"
+ | "inline-block";
+export type ResponsiveDisplayValue = ResponsiveValue;
+export interface DisplayProps {
+ display?: ResponsiveDisplayValue;
+}
+
+export function display(...args: any[]): any;
+
+export interface SizeProps {
+ size?: ResponsiveWidthValue | ResponsiveHeightValue;
+}
+
+export function size(...args: any[]): any;
+
+export type RatioValue = SpaceValue;
+
+export interface RatioProps {
+ ratio?: RatioValue;
+}
+
+export function ratio(...args: any[]): any;
+
+/**
+ * Flexbox
+ */
+
+export type AlignItemsValue =
+ | "normal"
+ | "stretch"
+ | "center"
+ | "start"
+ | "end"
+ | "flex-start"
+ | "flex-end"
+ | "self-start"
+ | "self-end"
+ | "left"
+ | "right"
+ | "baseline"
+ | "first baseline"
+ | "last baseline"
+ | "safe center"
+ | "unsafe center";
+export type ResponsiveAlignItemsValue = ResponsiveValue;
+
+export interface AlignItemsProps {
+ align?: ResponsiveAlignItemsValue;
+ alignItems?: ResponsiveAlignItemsValue;
+}
+
+export function alignItems(...args: any[]): any;
+
+export type JustifyContentValue =
+ | "center"
+ | "start"
+ | "end"
+ | "flex-start"
+ | "flex-end"
+ | "left"
+ | "right"
+ | "baseline"
+ | "first baseline"
+ | "last baseline"
+ | "space-between"
+ | "space-around"
+ | "space-evenly"
+ | "stretch"
+ | "safe center"
+ | "unsafe center";
+export type ResponsiveJustifyContentValue = ResponsiveValue<
+ JustifyContentValue
+>;
+
+export interface JustifyContentProps {
+ justify?: ResponsiveJustifyContentValue;
+ justifyContent?: ResponsiveJustifyContentValue;
+}
+
+export function justifyContent(...args: any[]): any;
+
+export type FlexWrapValue = true | "nowrap" | "wrap" | "wrap-reverse";
+
+export interface FlexWrapProps {
+ flexWrap?: FlexWrapValue;
+}
+
+export function flexWrap(...args: any[]): any;
+
+export type FlexDirectionValue =
+ | GlobalStyleValues
+ | "row"
+ | "row-reverse"
+ | "column"
+ | "column-reverse";
+
+export type ResponsiveFlexDirectionValue = ResponsiveValue;
+
+export interface FlexDirectionProps {
+ flexDirection?: ResponsiveFlexDirectionValue;
+}
+
+export function flexDirection(...args: any[]): any;
+
+export type FlexValue = number | string;
+export type ResponsiveFlexValue = ResponsiveValue;
+
+export interface FlexProps {
+ flex?: ResponsiveFlexValue;
+}
+
+export function flex(...args: any[]): any;
+
+export type AlignContentValue =
+ | GlobalStyleValues
+ | "center"
+ | "start"
+ | "end"
+ | "flex-start"
+ | "flex-end"
+ | "normal"
+ | "baseline"
+ | "first baseline"
+ | "last baseline"
+ | "space-between"
+ | "space-around"
+ | "space-evenly"
+ | "stretch"
+ | "safe center"
+ | "unsafe center";
+export type ResponsiveAlignContentValue = ResponsiveValue;
+
+export interface AlignContentProps {
+ alignContent?: ResponsiveAlignItemsValue;
+}
+
+export function alignContent(...args: any[]): any;
+
+export type JustifySelfValue =
+ | GlobalStyleValues
+ | "auto"
+ | "normal"
+ | "stretch"
+ | "center"
+ | "start"
+ | "end"
+ | "flex-start"
+ | "flex-end"
+ | "self-start"
+ | "self-end"
+ | "left"
+ | "right"
+ | "baseline"
+ | "first baseline"
+ | "last baseline"
+ | "safe center"
+ | "unsafe center";
+
+export type ResponsiveJustifySelfValue = ResponsiveValue;
+
+export interface JustifySelfProps {
+ justifySelf?: ResponsiveJustifySelfValue;
+}
+
+export function justifySelf(...args: any[]): any;
+
+export type AlignSelfValue =
+ | "auto"
+ | "normal"
+ | "center"
+ | "start"
+ | "end"
+ | "self-start"
+ | "self-end"
+ | "flex-start"
+ | "flex-end"
+ | "left"
+ | "right"
+ | "baseline"
+ | "first baseline"
+ | "last baseline"
+ | "stretch"
+ | "safe center"
+ | "unsafe center";
+export type ResponsiveAlignSelfValue = ResponsiveValue;
+
+export interface AlignSelfProps {
+ alignSelf?: ResponsiveAlignSelfValue;
+}
+
+export function alignSelf(...args: any[]): any;
+
+export type OrderValue = GlobalStyleValues | number;
+export type ResponsiveOrderValue = ResponsiveValue;
+
+export interface OrderProps {
+ order?: ResponsiveOrderValue;
+}
+
+export function order(...args: any[]): any;
+
+export type FlexBasisValue =
+ | GlobalStyleValues
+ | "auto"
+ | "fill"
+ | "max-content"
+ | "min-content"
+ | "fit-content"
+ | "content";
+
+export interface FlexBasisProps {
+ // TODO: The FlexBasisValue currently really only exists for documentation
+ // purposes, because flex-basis also accepts `Nem` and `Npx` strings.
+ // Not sure there’s a way to still have the union values show up as
+ // auto-completion results.
+ flexBasis?: FlexBasisValue | string;
+}
+
+export function flexBasis(...args: any[]): any;
+
+/**
+ * Grid Layout
+ */
+
+// TODO: Add grid values
+
+/**
+ * Background
+ */
+
+export type BackgroundValue = string;
+export interface BackgroundProps {
+ background?: BackgroundValue;
+ bg?: BackgroundValue;
+}
+
+export function background(...args: any[]): any;
+
+export type BackgroundImageValue = string;
+export interface BackgroundImageProps {
+ /**
+ * Value will be wrapped in url()
+ */
+ backgroundImage?: BackgroundImageValue;
+}
+
+export function backgroundImage(...args: any[]): any;
+
+export type BackgroundSizeValue = string;
+export interface BackgroundSizeProps {
+ backgroundSize?: BackgroundSizeValue;
+}
+
+export function backgroundSize(...args: any[]): any;
+
+export type BackgroundPositionValue = string;
+export interface BackgroundPositionProps {
+ backgroundPosition?: BackgroundPositionValue;
+}
+
+export function backgroundPosition(...args: any[]): any;
+
+export type BackgroundRepeatValue = string;
+export interface BackgroundRepeatProps {
+ backgroundRepeat?: BackgroundRepeatValue;
+}
+
+export function backgroundRepeat(...args: any[]): any;
+
+/**
+ * Misc
+ */
+
+export type BorderRadiusValue = string | number;
+export interface BorderRadiusProps {
+ borderRadius?: BorderRadiusValue;
+}
+export function borderRadius(...args: any[]): any;
+
+export type BorderColorValue = string;
+export interface BorderColorProps {
+ borderColor?: BorderColorValue;
+}
+export function borderColor(...args: any[]): any;
+
+export type BorderValue = string | number;
+export type ResponsiveBorderValue = ResponsiveValue;
+export interface BorderProps {
+ border?: ResponsiveBorderValue;
+ borderTop?: ResponsiveBorderValue;
+ borderRight?: ResponsiveBorderValue;
+ borderBottom?: ResponsiveBorderValue;
+ borderLeft?: ResponsiveBorderValue;
+}
+export function borders(...args: any[]): any;
+
+export type BoxShadowValue = string | number;
+export interface BoxShadowProps {
+ boxShadow?: BoxShadowValue;
+}
+export function boxShadow(...arg: any[]): any;
+
+/**
+ * Position
+ */
+
+export type PositionValue =
+ | "static"
+ | "relative"
+ | "absolute"
+ | "sticky"
+ | "fixed";
+export type ResponsivePositionValue = ResponsiveValue;
+export interface PositionProps {
+ position?: ResponsivePositionValue;
+}
+export function position(...args: any[]): any;
+
+export type ZIndexValue = GlobalStyleValues | "auto" | number;
+
+export interface ZIndexProps {
+ zIndex?: ZIndexValue;
+}
+export function zIndex(...args: any[]): any;
+
+export type TopValue = string | number;
+export type ResponsiveTopValue = ResponsiveValue;
+export interface TopProps {
+ top?: ResponsiveTopValue;
+}
+export function top(...args: any[]): any;
+
+export type RightValue = string | number;
+export type ResponsiveRightValue = ResponsiveValue;
+export interface RightProps {
+ right?: ResponsiveRightValue;
+}
+export function right(...args: any[]): any;
+
+export type BottomValue = string | number;
+export type ResponsiveBottomValue = ResponsiveValue;
+export interface BottomProps {
+ bottom?: ResponsiveBottomValue;
+}
+export function bottom(...args: any[]): any;
+
+export type LeftValue = string | number;
+export type ResponsiveLeftValue = ResponsiveValue;
+export interface LeftProps {
+ left?: ResponsiveLeftValue;
+}
+export function left(...args: any[]): any;
+
+/**
+ * Pseudo-classes
+ */
+
+export interface PseudoStyleValue {
+ color?: ColorValue;
+ backgroundColor?: ColorValue;
+ borderColor?: BorderColorValue;
+ boxShadow?: BoxShadowValue;
+ textDecoration?: string;
+}
+export type HoverValue = PseudoStyleValue;
+export interface HoverProps {
+ hover?: HoverValue;
+}
+export function hover(...args: any[]): any;
+
+export type FocusValue = PseudoStyleValue;
+export interface FocusProps {
+ focus?: FocusValue;
+}
+export function focus(...args: any[]): any;
+
+export type ActiveValue = PseudoStyleValue;
+export interface ActiveProps {
+ active?: ActiveValue;
+}
+export function active(...args: any[]): any;
+
+export type DisabledValue = PseudoStyleValue;
+export interface DisabledProps {
+ disabledStyle?: DisabledValue;
+}
+export function disabled(...args: any[]): any;
+
+/**
+ * Utilities
+ */
+
+export function theme(keys: string): any;
+export function themeGet(keys: string, fallback?: string): any;
+
+export function cleanElement(component: any): any;
+
+export function removeProps(props: any): any;
+
+/**
+ * Low-level style export functions
+ */
+
+export interface LowLevelStylefunctionArguments {
+ prop: string;
+ cssProperty?: string;
+ key?: string;
+ numberToPx?: boolean;
+ alias?: string;
+ getter?: () => any;
+}
+
+export function style(args: LowLevelStylefunctionArguments): any;
+
+export function responsiveStyle(args: LowLevelStylefunctionArguments): any;
+
+export function pseudoStyle(args: LowLevelStylefunctionArguments): any;
diff --git a/types/styled-system/package.json b/types/styled-system/package.json
new file mode 100644
index 0000000000..da1a3181d0
--- /dev/null
+++ b/types/styled-system/package.json
@@ -0,0 +1,6 @@
+{
+ "private": true,
+ "dependencies": {
+ "styled-components": "^3.3.2"
+ }
+}
diff --git a/types/styled-system/styled-system-tests.tsx b/types/styled-system/styled-system-tests.tsx
new file mode 100644
index 0000000000..78340eb3d8
--- /dev/null
+++ b/types/styled-system/styled-system-tests.tsx
@@ -0,0 +1,351 @@
+// Example uses styled-components, but styled-system works with most other css-in-js libraries as well
+import * as React from "react";
+import styled from "styled-components";
+import {
+ themeGet,
+ space,
+ width,
+ fontSize,
+ color,
+ fontFamily,
+ display,
+ SpaceProps,
+ WidthProps,
+ ColorProps,
+ DisplayProps,
+ FontSizeProps,
+ FontFamilyProps,
+ textAlign,
+ TextAlignProps,
+ background,
+ BackgroundProps,
+ maxWidth,
+ MaxWidthProps,
+ lineHeight,
+ LineHeightProps,
+ FontWeightProps,
+ fontWeight,
+ letterSpacing,
+ LetterSpacingProps,
+ minWidth,
+ MinWidthProps,
+ HeightProps,
+ height,
+ MaxHeightProps,
+ maxHeight,
+ minHeight,
+ MinHeightProps,
+ size,
+ SizeProps,
+ RatioProps,
+ ratio,
+ alignItems,
+ AlignItemsProps,
+ AlignContentProps,
+ alignContent,
+ justifyContent,
+ JustifyContentProps,
+ FlexWrapProps,
+ flexWrap,
+ flexBasis,
+ FlexBasisProps,
+ borderColor,
+ BorderColorProps,
+ flexDirection,
+ FlexDirectionProps,
+ flex,
+ FlexProps,
+ justifySelf,
+ JustifySelfProps,
+ alignSelf,
+ AlignSelfProps,
+ borders,
+ BorderProps,
+ borderRadius,
+ BorderRadiusProps,
+ position,
+ PositionProps,
+ zIndex,
+ ZIndexProps,
+ top,
+ bottom,
+ left,
+ right,
+ TopProps,
+ BottomProps,
+ LeftProps,
+ RightProps,
+ boxShadow,
+ BoxShadowProps,
+ backgroundImage,
+ backgroundPosition,
+ backgroundRepeat,
+ backgroundSize,
+ BackgroundImageProps,
+ BackgroundPositionProps,
+ BackgroundRepeatProps,
+ BackgroundSizeProps,
+ hover,
+ HoverProps,
+ focus,
+ FocusProps,
+ active,
+ ActiveProps,
+ disabled,
+ DisabledProps
+} from "styled-system";
+
+interface BoxProps
+ extends SpaceProps,
+ WidthProps,
+ FontSizeProps,
+ ColorProps,
+ DisplayProps,
+ BackgroundProps,
+ MaxWidthProps,
+ MinWidthProps,
+ HeightProps,
+ MaxHeightProps,
+ MinHeightProps,
+ SizeProps,
+ RatioProps,
+ BorderColorProps,
+ FlexProps,
+ JustifySelfProps,
+ AlignSelfProps,
+ BorderProps,
+ BorderRadiusProps,
+ PositionProps,
+ ZIndexProps,
+ TopProps,
+ BottomProps,
+ LeftProps,
+ RightProps,
+ BoxShadowProps,
+ BackgroundImageProps,
+ BackgroundPositionProps,
+ BackgroundRepeatProps,
+ BackgroundSizeProps,
+ HoverProps,
+ FocusProps,
+ ActiveProps,
+ DisabledProps {}
+const Box = styled.div.attrs({})`
+
+border-radius: ${themeGet("radii.small", "4px")};
+ ${space}
+ ${width}
+ ${fontSize}
+ ${color}
+ ${display}
+ ${background}
+ ${maxWidth}
+ ${minWidth}
+ ${height}
+ ${maxHeight}
+ ${minHeight}
+ ${size}
+ ${ratio}
+ ${borderColor}
+ ${flex}
+ ${justifySelf}
+ ${alignSelf}
+ ${borders}
+ ${borderRadius}
+ ${position}
+ ${zIndex}
+ ${top}
+ ${bottom}
+ ${left}
+ ${right}
+ ${boxShadow}
+ ${backgroundImage}
+ ${backgroundPosition}
+ ${backgroundRepeat}
+ ${backgroundSize}
+ ${hover}
+ ${focus}
+ ${active}
+ ${disabled}
+`;
+
+interface TextProps
+ extends FontSizeProps,
+ FontFamilyProps,
+ TextAlignProps,
+ LineHeightProps,
+ FontWeightProps,
+ LetterSpacingProps {}
+const Text = styled.div.attrs({})`
+ ${fontSize};
+ ${fontFamily};
+ ${textAlign};
+ ${lineHeight};
+ ${fontWeight};
+ ${letterSpacing};
+`;
+
+interface FlexComponentProps
+ extends AlignItemsProps,
+ AlignContentProps,
+ JustifyContentProps,
+ FlexWrapProps,
+ FlexBasisProps,
+ FlexDirectionProps {}
+const Flex = styled.div.attrs({})`
+ ${alignItems};
+ ${alignContent};
+ ${justifyContent};
+ ${flexWrap};
+ ${flexBasis};
+ ${flexDirection};
+`;
+
+const test = () => (
+
+ // width: 50%
+
+ // font-size: 20px (theme.fontSizes[4])
+
+ // margin: 16px (theme.space[2])
+
+ // padding: 32px (theme.space[3])
+
+ // color
+
+ // color: #333 (theme.colors.gray[0])
+
+ // background color
+
+ // responsive width
+
+ // responsive font-size
+
+ // responsive margin
+
+ // responsive padding
+
+ // examples (margin prop) // sets margin value of `theme.space[2]`
+
+ // sets margin value of `-1 * theme.space[2]`
+
+ // sets a margin value of `16px` since it's greater than
+ `theme.space.length`
+
+ // sets margin `'auto'`
+
+ // sets margin `8px` on all viewports and `16px` from the smallest
+ breakpoint and up
+
+ // examples // width `50%`
+
+ // width `256px`
+
+ // width `'2em'`
+
+ // width `100%` on all viewports and `50%` from the smallest breakpoint
+ and up
+
+ // examples // font-size of `theme.fontSizes[3]`
+
+ // font-size `32px`
+
+ // font-size `'2em'`
+
+ // font-size `10px` on all viewports and `12px` from the smallest
+ breakpoint and up
+
+ // examples // picks the value defined in `theme.colors['blue']`
+
+ // picks up a nested color value using dot notation //
+ `theme.colors['gray'][0]`
+
+ // raw CSS color value
+
+ // fontFamily
+
+ // textAlign (responsive)
+
+
+ // lineHeight
+
+ // fontWeight
+
+ // letterSpacing
+
+ // display (responsive)
+
+
+ // maxWidth (responsive)
+
+
+ // minWidth (responsive)
+
+
+ // height (responsive)
+
+
+ // maxHeight (responsive)
+
+
+ // minHeight (responsive)
+
+
+ // size (responsive, width & height)
+
+
+ // ratio (height: 0 & paddingBottom)
+
+ // alignItems (responsive)
+
+ // alignContent (responsive)
+
+ // justifyContent (responsive)
+
+ // flexWrap (responsive)
+
+ // flexBasis (responsive)
+
+ // flexDirection (responsive)
+
+ // flex (responsive)
+
+ // justifySelf (responsive)
+
+ // alignSelf (responsive)
+
+
+
+
+
+
+ // borderColor
+
+ // borderRadius
+
+ // position (responsive)
+
+ // zIndex
+
+ // top, right, bottom, left (responsive)
+
+ // boxShadow
+
+ // backgroundImage, backgroundSize, backgroundPosition, backgroundRepeat
+
+
+
+
+
+
+);
diff --git a/types/styled-system/tsconfig.json b/types/styled-system/tsconfig.json
new file mode 100644
index 0000000000..2cc754217f
--- /dev/null
+++ b/types/styled-system/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": ["es6"],
+ "jsx": "react",
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": ["../"],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": ["index.d.ts", "styled-system-tests.tsx"]
+}
diff --git a/types/styled-system/tslint.json b/types/styled-system/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/styled-system/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/three/index.d.ts b/types/three/index.d.ts
index cc26a82225..88cd09c70a 100644
--- a/types/three/index.d.ts
+++ b/types/three/index.d.ts
@@ -33,6 +33,7 @@ export * from "./three-effectcomposer";
export * from "./three-examples";
export * from "./three-fbxloader";
export * from "./three-FirstPersonControls";
+export * from "./three-gltfexporter";
export * from "./three-maskpass";
export * from "./three-mtlloader";
export * from "./three-objloader";
diff --git a/types/three/test/webvr/webvr.ts b/types/three/test/webvr/webvr.ts
index e831e493ee..dfc8576f59 100644
--- a/types/three/test/webvr/webvr.ts
+++ b/types/three/test/webvr/webvr.ts
@@ -10,4 +10,10 @@
const obj = new THREE.Object3D();
renderer.vr.setPoseTarget(obj);
renderer.vr.dispose();
+
+ const scene = new THREE.Scene();
+ const render = function() {
+ renderer.render(scene, camera);
+ }
+ renderer.animate(render);
}
diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts
index b0798a61d9..7736b46fa4 100644
--- a/types/three/three-core.d.ts
+++ b/types/three/three-core.d.ts
@@ -5519,6 +5519,12 @@ export class WebGLRenderer implements Renderer {
renderBufferDirect(camera: Camera, fog: Fog, material: Material, geometryGroup: any, object: Object3D): void;
+ /**
+ * A build in function that can be used instead of requestAnimationFrame. For WebVR projects this function must be used.
+ * @param callback The function will be called every available frame. If `null` is passed it will stop any already ongoing animation.
+ */
+ animate(callback: Function): void;
+
/**
* Render a scene using a camera.
* The render is done to the renderTarget (if specified) or to the canvas as usual.
diff --git a/types/three/three-gltfexporter.d.ts b/types/three/three-gltfexporter.d.ts
new file mode 100644
index 0000000000..2bdba480a7
--- /dev/null
+++ b/types/three/three-gltfexporter.d.ts
@@ -0,0 +1,9 @@
+import { Object3D } from "three";
+
+export class GLTFExporter {
+ constructor();
+
+ parse(input: Object3D, onCompleted: (gltf: object) => void, options: object): null;
+
+}
+
diff --git a/types/tinycon/index.d.ts b/types/tinycon/index.d.ts
new file mode 100644
index 0000000000..3f385603cc
--- /dev/null
+++ b/types/tinycon/index.d.ts
@@ -0,0 +1,18 @@
+// Type definitions for tinycon 0.6
+// Project: https://github.com/tommoor/tinycon
+// Definitions by: Daniel Waxweiler
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+export function setBubble(count: number): void;
+
+export function setOptions(options: TinyconOptions): void;
+
+export interface TinyconOptions {
+ abbreviate?: boolean;
+ background?: string;
+ color?: string;
+ fallback?: boolean;
+ font?: string;
+ height?: number;
+ width?: number;
+}
diff --git a/types/tinycon/tinycon-tests.ts b/types/tinycon/tinycon-tests.ts
new file mode 100644
index 0000000000..b4bcc304ac
--- /dev/null
+++ b/types/tinycon/tinycon-tests.ts
@@ -0,0 +1,13 @@
+import * as Tinycon from 'tinycon';
+
+Tinycon.setOptions({
+ abbreviate: false,
+ background: '#549A2F',
+ color: '#ffffff',
+ fallback: true,
+ font: '10px arial',
+ height: 9,
+ width: 7
+});
+
+Tinycon.setBubble(7);
diff --git a/types/tinycon/tsconfig.json b/types/tinycon/tsconfig.json
new file mode 100644
index 0000000000..2410f4bd8a
--- /dev/null
+++ b/types/tinycon/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "tinycon-tests.ts"
+ ]
+}
diff --git a/types/tinycon/tslint.json b/types/tinycon/tslint.json
new file mode 100644
index 0000000000..f93cf8562a
--- /dev/null
+++ b/types/tinycon/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": "dtslint/dt.json"
+}
diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts
index 89d28766b3..f4a7be74b4 100644
--- a/types/twit/index.d.ts
+++ b/types/twit/index.d.ts
@@ -24,7 +24,7 @@ declare module 'twit' {
*/
export interface Contributors {
id: number,
- id_str: number,
+ id_str: string,
screen_name: string,
}
@@ -169,7 +169,7 @@ declare module 'twit' {
created_at: string,
current_user_retweet?: {
id: number,
- id_str: number,
+ id_str: string,
},
entities: Entities,
favorite_count?: number,
@@ -257,7 +257,7 @@ declare module 'twit' {
id?: string,
slug?: string,
status?: string,
- user_id?: number,
+ user_id?: number | string,
lat?: number,
long?: number,
follow?: boolean,
diff --git a/types/w3c-web-usb/index.d.ts b/types/w3c-web-usb/index.d.ts
index d481245e14..d596351a5b 100644
--- a/types/w3c-web-usb/index.d.ts
+++ b/types/w3c-web-usb/index.d.ts
@@ -62,7 +62,7 @@ declare class USBAlternateInterface {
readonly interfaceClass: number;
readonly interfaceSubclass: number;
readonly interfaceProtocol: number;
- readonly alternatinterfaceName?: string;
+ readonly interfaceName?: string;
readonly endpoints: USBEndpoint[];
}
@@ -146,6 +146,7 @@ declare class USBDevice {
transferOut(endpointNumber: number, data: BufferSource): Promise;
isochronousTransferIn(endpointNumber: number, packetLengths: number[]): Promise;
isochronousTransferOut(endpointNumber: number, data: BufferSource, packetLengths: number[]): Promise;
+ reset(): Promise;
}
interface Navigator {
diff --git a/types/w3c-web-usb/w3c-web-usb-tests.ts b/types/w3c-web-usb/w3c-web-usb-tests.ts
index fe29480479..49efebcdbc 100644
--- a/types/w3c-web-usb/w3c-web-usb-tests.ts
+++ b/types/w3c-web-usb/w3c-web-usb-tests.ts
@@ -43,6 +43,7 @@ navigator.usb.addEventListener('disconnect', evt => {
});
async function handleConnectedDevice(device: USBDevice) {
+ await device.reset();
connectedDevices.push(device);
await device.open();
diff --git a/types/webpack-serve/index.d.ts b/types/webpack-serve/index.d.ts
index 5a1a302af0..f0426c5ad7 100644
--- a/types/webpack-serve/index.d.ts
+++ b/types/webpack-serve/index.d.ts
@@ -1,6 +1,7 @@
// Type definitions for webpack-serve 1.0
// Project: https://github.com/webpack-contrib/webpack-serve
// Definitions by: Ryan Clark
+// Jokcy
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -21,7 +22,7 @@ declare module 'webpack' {
}
declare function WebpackServe(
- { config }: { config: webpack.Configuration }
+ options: WebpackServe.Options
): Promise;
declare namespace WebpackServe {
diff --git a/types/webpack-serve/webpack-serve-tests.ts b/types/webpack-serve/webpack-serve-tests.ts
index 2a29cec317..d22c1adfea 100644
--- a/types/webpack-serve/webpack-serve-tests.ts
+++ b/types/webpack-serve/webpack-serve-tests.ts
@@ -1,19 +1,25 @@
import webpack = require('webpack');
import serve = require('webpack-serve');
-const compiler = webpack();
+const config: webpack.Configuration = {
+ mode: 'development',
+ entry: ['index.js'], // when use compiler entry must be array or object
+};
+
+const serveConfig = {
+ http2: true,
+ dev: {
+ publicPath: '/',
+ logLevel: 'info'
+ },
+ host: 'localhost'
+};
+
+const compiler = webpack(config);
const server = serve({
- config: {
- serve: {
- http2: true,
- dev: {
- publicPath: '/',
- logLevel: 'info'
- },
- host: 'localhost'
- },
- },
+ compiler,
+ ...serveConfig
});
server
@@ -22,3 +28,25 @@ server
server.close();
});
});
+
+const config2: webpack.Configuration = {
+ ...config,
+ serve: {
+ ...serveConfig,
+ port: 8888,
+ hot: {
+ port: 8889
+ }
+ },
+};
+
+const server2 = serve({
+ config: config2
+});
+
+server2
+ .then((server) => {
+ server.on('listening', () => {
+ server.close();
+ });
+ });
diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts
index 55d7dbd801..d482955d2c 100644
--- a/types/webpack/index.d.ts
+++ b/types/webpack/index.d.ts
@@ -61,24 +61,22 @@ declare namespace webpack {
/** Like resolve but for loaders. */
resolveLoader?: ResolveLoader;
/**
- * Specify dependencies that shouldn’t be resolved by webpack, but should become dependencies of the resulting bundle.
- * The kind of the dependency depends on output.libraryTarget.
+ * Specify dependencies that shouldn’t be resolved by webpack, but should become dependencies of the resulting bundle.
+ * The kind of the dependency depends on output.libraryTarget.
*/
externals?: ExternalsElement | ExternalsElement[];
/**
- *
- * - "web" Compile for usage in a browser-like environment (default)
- * - "webworker" Compile as WebWorker
- * - "node" Compile for usage in a node.js-like environment (use require to load chunks)
- * - "async-node" Compile for usage in a node.js-like environment (use fs and vm to load chunks async)
- * - "node-webkit" Compile for usage in webkit, uses jsonp chunk loading but also supports builtin node.js modules plus require(“nw.gui”) (experimental)
- * - "atom" Compile for usage in electron (formerly known as atom-shell), supports require for modules necessary to run Electron.
- * - "electron-renderer" Compile for Electron for renderer process, providing a target using JsonpTemplatePlugin, FunctionModulePlugin
- * for browser environments and NodeTargetPlugin and ExternalsPlugin for CommonJS and Electron built-in modules.
-
- *
- "electron-main" Compile for Electron for main process.
- * - "atom" Alias for electron-main
- * - "electron" Alias for electron-main
- *
+ * - "web" Compile for usage in a browser-like environment (default).
+ * - "webworker" Compile as WebWorker.
+ * - "node" Compile for usage in a node.js-like environment (use require to load chunks).
+ * - "async-node" Compile for usage in a node.js-like environment (use fs and vm to load chunks async).
+ * - "node-webkit" Compile for usage in webkit, uses jsonp chunk loading but also supports builtin node.js modules plus require(“nw.gui”) (experimental)
+ * - "atom" Compile for usage in electron (formerly known as atom-shell), supports require for modules necessary to run Electron.
+ * - "electron-renderer" Compile for Electron for renderer process, providing a target using JsonpTemplatePlugin, FunctionModulePlugin for browser
+ * environments and NodeTargetPlugin and ExternalsPlugin for CommonJS and Electron built-in modules.
+ * - "electron-main" Compile for Electron for main process.
+ * - "atom" Alias for electron-main.
+ * - "electron" Alias for electron-main.
*/
target?: 'web' | 'webworker' | 'node' | 'async-node' | 'node-webkit' | 'atom' | 'electron' | 'electron-renderer' | 'electron-main' | ((compiler?: any) => void);
/** Report the first error as a hard error instead of tolerating it. */
@@ -171,17 +169,15 @@ declare namespace webpack {
library?: string | string[];
/**
* Which format to export the library:
- *
- * - "var" - Export by setting a variable: var Library = xxx (default)
- * - "this" - Export by setting a property of this: this["Library"] = xxx
- * - "commonjs" - Export by setting a property of exports: exports["Library"] = xxx
- * - "commonjs2" - Export by setting module.exports: module.exports = xxx
- * - "amd" - Export to AMD (optionally named)
- * - "umd" - Export to AMD, CommonJS2 or as property in root
- * - "window" - Assign to window
- * - "assign" - Assign to a global variable
- * - "jsonp" - Generate Webpack JSONP module
-
- *
+ * - "var" - Export by setting a variable: var Library = xxx (default)
+ * - "this" - Export by setting a property of this: this["Library"] = xxx
+ * - "commonjs" - Export by setting a property of exports: exports["Library"] = xxx
+ * - "commonjs2" - Export by setting module.exports: module.exports = xxx
+ * - "amd" - Export to AMD (optionally named)
+ * - "umd" - Export to AMD, CommonJS2 or as property in root
+ * - "window" - Assign to window
+ * - "assign" - Assign to a global variable
+ * - "jsonp" - Generate Webpack JSONP module
*/
libraryTarget?: 'var' | 'this' | 'commonjs' | 'commonjs2' | 'amd' | 'umd' | 'window' | 'assign' | 'jsonp';
/** Configure which module or modules will be exposed via the `libraryTarget` */
@@ -955,42 +951,9 @@ declare namespace webpack {
usedModuleIds: any;
getStats(): Stats;
addModule(module: CompilationModule, cacheGroup: any): any;
- // getModule(module)
- // findModule(identifier)
- // waitForBuildingFinished(module, callback)
- // buildModule(module, optional, origin, dependencies, thisCallback)
- // processModuleDependencies(module, callback)
- // addModuleDependencies(module, dependencies, bail, cacheGroup, recursive, callback)
// tslint:disable-next-line:ban-types
addEntry(context: any, entry: any, name: any, callback: Function): void;
- // prefetch(context, dependency, callback)
- // rebuildModule(module, thisCallback)
- // finish()
- // unseal()
- // seal(callback)
- // sortModules(modules)
- // reportDependencyErrorsAndWarnings(module, blocks)
- // addChunkInGroup(name, module, loc, request)
- // addChunk(name)
- // assignIndex(module)
- // assignDepth(module)
- // processDependenciesBlocksForChunkGroups(inputChunkGroups)
- // removeReasonsOfDependencyBlock(module, block)
- // patchChunksAfterReasonRemoval(module, chunk)
- // removeChunkFromDependencies(block, chunk)
- // applyModuleIds()
- // applyChunkIds()
- // sortItemsWithModuleIds()
- // sortItemsWithChunkIds()
- // summarizeDependencies()
- // createHash()
- // modifyHash(update)
- // createModuleAssets()
- // createChunkAssets()
getPath(filename: string, data: {hash?: any, chunk?: any, filename?: string, basename?: string, query?: any}): string;
- // createChildCompiler(name, outputOptions, plugins)
- // checkConstraints()
-
/**
* @deprecated Compilation.applyPlugins is deprecated. Use new API on `.hooks` instead
*/
@@ -1131,10 +1094,14 @@ declare namespace webpack {
| 'verbose';
interface ToJsonOptionsObject {
+ /** fallback value for stats options when an option is not defined (has precedence over local webpack defaults) */
+ all?: boolean;
/** Add asset Information */
assets?: boolean;
/** Sort assets by a field */
assetsSort?: string;
+ /** Add built at time information */
+ builtAt?: boolean;
/** Add information about cached (not built) modules */
cached?: boolean;
/** Show cached assets (setting this to `false` only shows emitted files) */
diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts
index b7b9ca8913..913eea0b19 100644
--- a/types/webpack/webpack-tests.ts
+++ b/types/webpack/webpack-tests.ts
@@ -383,6 +383,7 @@ webpack({
const jsonStatsWithAllOptions = stats.toJson({
assets: true,
assetsSort: "field",
+ builtAt: true,
cached: true,
children: true,
chunks: true,
diff --git a/types/wepy/app.d.ts b/types/wepy/app.d.ts
new file mode 100644
index 0000000000..cc2636ed92
--- /dev/null
+++ b/types/wepy/app.d.ts
@@ -0,0 +1,13 @@
+export interface AppConfig {
+ appEvents?: string[];
+ pageEvents?: string[];
+ noPromiseAPI?: string[] | { [name: string]: boolean };
+}
+
+export interface AppConstructor {
+ new (): app;
+}
+
+export default class app {
+ $init(wepy: any, config: AppConfig): any;
+}
diff --git a/types/wepy/base.d.ts b/types/wepy/base.d.ts
new file mode 100644
index 0000000000..91c934b8b1
--- /dev/null
+++ b/types/wepy/base.d.ts
@@ -0,0 +1,12 @@
+import page, { PageConstructor } from "./page";
+import app, { AppConstructor, AppConfig } from "./app";
+
+declare const defaultExport: {
+ $createApp?: (appClass: AppConstructor, appConfig: AppConfig) => app;
+ $createPage?: (
+ pageClass: PageConstructor,
+ pagePath: string | boolean
+ ) => page;
+};
+
+export default defaultExport;
diff --git a/types/wepy/component.d.ts b/types/wepy/component.d.ts
new file mode 100644
index 0000000000..ddcea63ed6
--- /dev/null
+++ b/types/wepy/component.d.ts
@@ -0,0 +1,20 @@
+import event from "./event";
+
+export default class component {
+ $isComponent: boolean;
+ $prefix: string;
+ data: { [name: string]: any };
+
+ computed?: { [name: string]: (self?: component) => any };
+ methods?: { [name: string]: (evt?: event) => any };
+
+ $init($wxpage: any, $root: any, $parent: any): void;
+ $initMixins(): void;
+ onLoad(): void;
+ setData(k: string | string[], v: any): void;
+ getWxPage(): any;
+ $setIndex(index: number): void;
+ $getComponent(com: any): any;
+ $apply(fn: () => void): void;
+ $nextTick(fn: () => void): void;
+}
diff --git a/types/wepy/event.d.ts b/types/wepy/event.d.ts
new file mode 100644
index 0000000000..f3a0d6c5a8
--- /dev/null
+++ b/types/wepy/event.d.ts
@@ -0,0 +1,6 @@
+export default class event {
+ active: boolean;
+ constructor(name: string, source: any, type: any);
+ $destroy(): void;
+ $transfor(wxevent: any[]): void;
+}
diff --git a/types/wepy/index.d.ts b/types/wepy/index.d.ts
new file mode 100644
index 0000000000..bff673ee8c
--- /dev/null
+++ b/types/wepy/index.d.ts
@@ -0,0 +1,35 @@
+// Type definitions for wepy 1.7
+// Project: https://github.com/Tencent/wepy#readme
+// Definitions by: Jiayu Liu
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.2
+
+import component from "./component";
+import mixin from "./mixin";
+import event from "./event";
+import page from "./page";
+import app from "./app";
+import util from "./util";
+import base from "./base";
+import { WxEnhances } from "./wx_enhanced";
+
+interface DefaultExport extends WxEnhances {
+ event: typeof event;
+ app: typeof app;
+ component: typeof component;
+ page: typeof page;
+ mixin: typeof mixin;
+ $createApp: typeof base.$createApp;
+ $createPage: typeof base.$createPage;
+ $isEmpty: typeof util.$isEmpty;
+ $isEqual: typeof util.$isEqual;
+ $isDeepEqual: typeof util.$isDeepEqual;
+ $has: typeof util.$has;
+ $extend: typeof util.$extend;
+ $isPlainObject: typeof util.$isPlainObject;
+ $copy: typeof util.$copy;
+}
+
+declare const defaultExport: DefaultExport;
+
+export default defaultExport;
diff --git a/types/wepy/mixin.d.ts b/types/wepy/mixin.d.ts
new file mode 100644
index 0000000000..c70aedd7b1
--- /dev/null
+++ b/types/wepy/mixin.d.ts
@@ -0,0 +1 @@
+export default class mixin {}
diff --git a/types/wepy/page.d.ts b/types/wepy/page.d.ts
new file mode 100644
index 0000000000..7655621106
--- /dev/null
+++ b/types/wepy/page.d.ts
@@ -0,0 +1,23 @@
+import component from "./component";
+
+export interface UrlParam {
+ url: string;
+}
+
+export interface PageConstructor {
+ new (): page;
+}
+
+export default class page extends component {
+ $preloadData: { [key: string]: any };
+ $init(wxpage: any, $parent: any): any;
+ $route(
+ type: "redirectTo" | "navigateTo",
+ url: string | UrlParam,
+ params?: { [name: string]: any }
+ ): any;
+ $preload(key: string | { [key: string]: any }, data: any): any;
+ $switch(url: string | UrlParam): any;
+ $redirect(url: string, params?: object): any;
+ $back(delta: number | { delta: number }): any;
+}
diff --git a/types/wepy/tsconfig.json b/types/wepy/tsconfig.json
new file mode 100644
index 0000000000..f363a749a1
--- /dev/null
+++ b/types/wepy/tsconfig.json
@@ -0,0 +1,27 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": ["es6"],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": ["../"],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "app.d.ts",
+ "base.d.ts",
+ "component.d.ts",
+ "event.d.ts",
+ "index.d.ts",
+ "mixin.d.ts",
+ "page.d.ts",
+ "util.d.ts",
+ "wx_enhanced.d.ts",
+ "wepy-tests.ts"
+ ]
+}
diff --git a/types/wepy/tslint.json b/types/wepy/tslint.json
new file mode 100644
index 0000000000..f93cf8562a
--- /dev/null
+++ b/types/wepy/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": "dtslint/dt.json"
+}
diff --git a/types/wepy/util.d.ts b/types/wepy/util.d.ts
new file mode 100644
index 0000000000..cff1be1ce5
--- /dev/null
+++ b/types/wepy/util.d.ts
@@ -0,0 +1,15 @@
+declare const defaultExport: {
+ $isEmpty: (obj: object) => boolean;
+ $isEqual: (a: any, b: any, aStack?: any[], bStack?: any[]) => boolean;
+ $isDeepEqual: (a: any, b: any, aStack?: any[], bStack?: any[]) => boolean;
+ $has: (obj: object, path: string) => boolean;
+ $extend: () => any;
+ $copy: (obj: T, deep?: boolean) => T;
+ $isPlainObject: (obj: any) => boolean;
+ $resolvePath: (route: string, url: string) => string;
+ $getParams: (url: string) => object;
+ hyphenate: (str: string) => string;
+ camelize: (str: string) => string;
+};
+
+export default defaultExport;
diff --git a/types/wepy/wepy-tests.ts b/types/wepy/wepy-tests.ts
new file mode 100644
index 0000000000..9ed5462fb9
--- /dev/null
+++ b/types/wepy/wepy-tests.ts
@@ -0,0 +1,41 @@
+import wepy from "wepy";
+
+export class MyComponent extends wepy.component {
+ data = {
+ reveal: false,
+ img: "",
+ animationData: "",
+ imgClassName: "",
+ imgMode: "scaleToFill",
+ title: "loading",
+ titleClassName: ""
+ };
+
+ methods = {};
+
+ onLoad() {
+ super.onLoad();
+ }
+}
+
+export class BindJwc extends wepy.page {
+ config = {
+ navigationBarTitleText: "校历",
+ enablePullDownRefresh: true
+ };
+ mixins = [];
+ data = {};
+ computed = {
+ termName(): number {
+ return 1;
+ }
+ };
+ methods = {
+ returnToday(): number {
+ return 123;
+ }
+ };
+
+ init() {}
+ async onLoad() {}
+}
diff --git a/types/wepy/wx_enhanced.d.ts b/types/wepy/wx_enhanced.d.ts
new file mode 100644
index 0000000000..d5e66dea34
--- /dev/null
+++ b/types/wepy/wx_enhanced.d.ts
@@ -0,0 +1,391 @@
+export interface WechatProfileDetails {
+ photoFilePath?: string;
+ nickName?: string;
+ lastName?: string;
+ middleName?: string;
+ firstName?: string;
+ remark?: string;
+ mobilePhoneNumber?: string;
+ email?: string;
+ url?: string;
+ workAddressCountry?: string;
+ workAddressState?: string;
+ workAddressCity?: string;
+ workAddressStreet?: string;
+ workAddressPostalCode?: string;
+ homeFaxNumber?: string;
+ homePhoneNumber?: string;
+ homeAddressCountry?: string;
+ homeAddressState?: string;
+ homeAddressCity?: string;
+ homeAddressStreet?: string;
+ homeAddressPostalCode?: string;
+}
+
+export interface RotateAnimation {
+ rotate(deg: number): Animation;
+ rotateX(deg: number): Animation;
+ rotateY(deg: number): Animation;
+ rotateZ(deg: number): Animation;
+ rotate3d(): Animation;
+}
+
+export interface ScaleAnimation {
+ scale(sx: number): Animation;
+ scaleX(sx: number): Animation;
+ scaleY(sy: number): Animation;
+ scaleZ(sz: number): Animation;
+ scale3d(): Animation;
+}
+
+export interface TranslateAnimation {
+ translate(tx: number): Animation;
+ translateX(tx: number): Animation;
+ translateY(ty: number): Animation;
+ translateZ(tz: number): Animation;
+ translate3d(): Animation;
+}
+
+export interface SkewAnimation {
+ skew(ax: number): Animation;
+ skewX(ax: number): Animation;
+ skewY(ay: number): Animation;
+}
+
+export interface Animation
+ extends RotateAnimation,
+ ScaleAnimation,
+ SkewAnimation,
+ TranslateAnimation {
+ opacity(x: number): Animation;
+ backgroundColor(x: string): Animation;
+ width(x: number): Animation;
+ height(x: number): Animation;
+ top(x: number): Animation;
+ left(x: number): Animation;
+ bottom(x: number): Animation;
+ right(x: number): Animation;
+}
+
+export interface LagLng {
+ latitude: number;
+ longitude: number;
+}
+
+export type CallbackFunction = (
+ callbacks: {
+ success: (res: T) => void;
+ fail: () => void;
+ complete: () => void;
+ }
+) => void;
+
+export interface MapContext {
+ getCenterLocation: CallbackFunction;
+
+ moveToLocation(): void;
+
+ translateMarker(params: {
+ markerId: number;
+ autoRotate: boolean;
+ duration: number;
+ destination: LagLng;
+ animationEnd: () => void;
+ }): void;
+
+ includePoints(params: { padding: number[]; points: LagLng[] }): void;
+
+ getRegion: CallbackFunction<{ southwest: LagLng; northeast: LagLng }>;
+
+ getScale: CallbackFunction<{ scale: number }>;
+}
+
+export interface UserInfo {
+ nickName: string;
+ avatarUrl: string;
+ gender: string;
+ city: string;
+ province: string;
+ country: string;
+ language: string;
+}
+
+export interface UrlParam {
+ url: string;
+}
+
+export interface FilePathParam {
+ filePath: string;
+}
+
+// WePY enhanced Wx interfaces and methods below are all accessible
+export interface WxEnhances {
+ addPhoneContact(param: WechatProfileDetails): Promise;
+
+ authorize(param: { scope: string }): Promise;
+
+ canIUse(name: string): Promise;
+
+ canvasGetImageData(
+ params: {
+ canvasId: string;
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+ },
+ context: any
+ ): Promise<{
+ width: number;
+ height: number;
+ data: Uint8ClampedArray;
+ }>;
+
+ canvasPutImageData(
+ params: {
+ canvasId: string;
+ data: Uint8ClampedArray;
+ x: number;
+ y: number;
+ height?: number;
+ wdith: number;
+ },
+ context: any
+ ): Promise;
+
+ canvasToTempFilePath(
+ params: {
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+ destWidth: number;
+ destHeight: number;
+ canvasId: string;
+ },
+ context: any
+ ): Promise<{ tempFilePath: string }>;
+
+ checkIsSoterEnrolledInDevice(params: {
+ checkAuthMode: "fingerPrint" | "facial" | "speech";
+ }): Promise<{
+ isEnrolled: boolean;
+ errMsg: string;
+ }>;
+
+ checkIsSupportSoterAuthentication(): Promise<{
+ supportMode: string[];
+ }>;
+
+ checkSession(): Promise;
+
+ chooseInvoiceTitle(): Promise<{
+ type: "0" | "1";
+ title: string;
+ taxNumber: string;
+ companyAddress: string;
+ telephone: string;
+ bankName: string;
+ bankAccount: string;
+ errMsg: string;
+ }>;
+
+ chooseLocation(): Promise<{
+ name: string;
+ address: string;
+ latitude: number;
+ longitude: number;
+ }>;
+
+ chooseVideo(params: {
+ sourceType: string[];
+ compressed: boolean;
+ maxDuration: number;
+ }): Promise<{
+ tempFilePath: string;
+ duration: number;
+ size: number;
+ height: number;
+ width: number;
+ }>;
+
+ clearStorage(): Promise;
+
+ createAnimation(params: {
+ duration: number;
+ timingFunction: string;
+ delay: number;
+ transformOrigin: string;
+ }): Promise;
+
+ createCanvasContext(canvasId: string, context: any): Promise;
+
+ createMapContext(mapId: string, context: any): MapContext;
+
+ createSelectorQuery(): Promise<{}>;
+
+ getLocation(params: {
+ type: string;
+ altitude: boolean;
+ }): Promise<{
+ latitude: number;
+ longitude: number;
+ speed: number;
+ accuracy: number;
+ altitude: number;
+ verticalAccuracy: number;
+ horizontalAccuracy: number;
+ }>;
+
+ getNetworkType(): Promise<{ networkType: string }>;
+
+ getSavedFileInfo(
+ params: FilePathParam
+ ): Promise<{
+ errMsg: string;
+ size: number;
+ createTime: number;
+ }>;
+
+ getSavedFileList(): Promise<{
+ errMsg: string;
+ fileList: object[];
+ }>;
+
+ getSetting(): Promise<{
+ authSetting: {
+ "scope.userInfo": boolean;
+ "scope.userLocation": boolean;
+ "scope.address": boolean;
+ "scope.invoiceTitle": boolean;
+ "scope.werun": boolean;
+ "scope.record": boolean;
+ "scope.writePhotosAlbum": boolean;
+ "scope.camera": boolean;
+ };
+ }>;
+
+ getShareInfo(params: {
+ shareTicket: string;
+ timeout: number;
+ }): Promise<{
+ errMsg: string;
+ encryptedData: string;
+ iv: string;
+ }>;
+
+ getSystemInfo(): Promise<{
+ brand: string;
+ model: string;
+ pixelRatio: number;
+ screenWidth: number;
+ screenHeight: number;
+ windowWidth: number;
+ windowHeight: number;
+ statusBarHeight: number;
+ language: string;
+ version: string;
+ system: string;
+ platform: string;
+ fontSizeSetting: string;
+ SDKVersion: string;
+ }>;
+
+ getUserInfo(params: {
+ withCredentials: boolean;
+ lang: string;
+ timeout: number;
+ }): Promise<{
+ userInfo: object;
+ rawData: string;
+ signature: string;
+ encryptedData: string;
+ iv: string;
+ }>;
+
+ hideLoading(): Promise;
+
+ hideNavigationBarLoading(): Promise;
+
+ makePhoneCall(params: { phoneNumber: string }): Promise;
+
+ navigateTo(params: UrlParam): Promise;
+
+ onUserCaptureScreen(): Promise;
+
+ openLocation(params: {
+ latitude: number;
+ longitude: number;
+ scale?: number;
+ name?: string;
+ address?: string;
+ }): Promise;
+
+ pageScrollTo(params: {
+ scrollTop: number;
+ duration: number;
+ }): Promise;
+
+ redirectTo(params: UrlParam): Promise;
+
+ removeSavedFile(params: FilePathParam): Promise;
+
+ removeStorage(params: { key: string }): Promise;
+
+ request(params: UrlParam): Promise;
+
+ requestPayment(params: {
+ timeStamp: string;
+ nonceStr: string;
+ package: string;
+ signType: string;
+ paySign: string;
+ }): Promise;
+
+ scanCode(params: {
+ onlyFromCamera?: boolean;
+ scanType?: string[];
+ }): Promise<{
+ result: string;
+ scanType: string;
+ charSet: string;
+ path: string;
+ }>;
+
+ setNavigationBarAlpha(params: { alpha: number }): Promise;
+
+ setNavigationBarColor(params: { color: number }): Promise;
+
+ setNavigationBarTitle(params: { title: string }): Promise;
+
+ setStorage(params: { key: string; data: string | object }): Promise;
+
+ showActionSheet(params: {
+ itemList: string[];
+ itemColor: string;
+ }): Promise;
+
+ showLoading(params: { title: string }): Promise;
+
+ showModal(params: {
+ title: string;
+ content: string;
+ showCancel?: boolean;
+ cancelText?: string;
+ cancelColor?: string;
+ confirmText?: string;
+ confirmColor?: string;
+ }): Promise<{ confirm: boolean; cancel: boolean }>;
+
+ showNavigationBarLoading(): Promise;
+
+ showToast(params: {
+ title: string;
+ icon?: "success" | "loading" | "none";
+ image?: string;
+ duration?: number;
+ mask?: boolean;
+ }): Promise;
+
+ switchTab(params: UrlParam): Promise;
+}
diff --git a/types/workbox-sw/index.d.ts b/types/workbox-sw/index.d.ts
new file mode 100644
index 0000000000..a169714094
--- /dev/null
+++ b/types/workbox-sw/index.d.ts
@@ -0,0 +1,1424 @@
+// Type definitions for workbox-sw 3.2
+// Project: https://github.com/GoogleChrome/workbox
+// Definitions by: Frederik Wessberg
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.6
+
+/**
+ * ===== BroadcastCacheUpdate =====
+ */
+
+interface IBroadcastCacheUpdateOptions {
+ /**
+ * A list of headers that will be used to determine whether the responses differ.
+ */
+ headersToCheck: string[];
+
+ /**
+ * An attribution value that indicates where the update originated.
+ */
+ source: string;
+}
+
+/**
+ * Uses the Broadcast Channel API to notify interested parties when a cached response has been updated.
+ * For efficiency's sake, the underlying response bodies are not compared; only specific response headers are checked
+ */
+declare class BroadcastCacheUpdate {
+ /**
+ * Compare two Responses and send a message via the Broadcast Channel API if they differ.
+ * Neither of the Responses can be opaque.
+ * @param {Response} firstResponse - First response to compare.
+ * @param {Response} secondResponse - Second response to compare.
+ * @param {string} url - The URL of the updated request.
+ * @param {string} cacheName - Name of the cache the responses belong to. This is included in the message posted on the broadcast channel.
+ */
+ notifyIfUpdated (firstResponse: Response, secondResponse: Response, url: string, cacheName: string): void;
+}
+
+/**
+ * Construct a BroadcastCacheUpdate instance with a specific channelName to broadcast messages on
+ */
+interface IBroadcastCacheUpdateConstructor {
+ new (channelName: string, options: Partial): BroadcastCacheUpdate;
+}
+
+/**
+ * ===== CacheableResponse =====
+ */
+
+interface ICacheableResponseOptions {
+ statuses: number[];
+ headers: { [key: string]: string };
+}
+
+/**
+ * This class allows you to set up rules determining what status codes and/or headers need to be present in order for a Response to be considered cacheable.
+ */
+declare class CacheableResponse {
+ /**
+ * Checks a response to see whether it's cacheable or not, based on this object's configuration.
+ * @param {Response} response - The response whose cacheability is being checked.
+ * @returns {boolean}
+ */
+ isResponseCacheable (response: Response): boolean;
+}
+
+/**
+ * To construct a new CacheableResponse instance you must provide at least one of the config properties.
+ * If both statuses and headers are specified, then both conditions must be met for the Response to be considered cacheable.
+ */
+interface ICacheableResponseConstructor {
+ new (options: Partial): CacheableResponse;
+}
+
+/**
+ * ===== CacheExpiration =====
+ */
+
+interface ICacheExpirationOptions {
+ /**
+ * The maximum number of entries to store in a cache.
+ */
+ maxEntries: number;
+
+ /**
+ * The maximum lifetime of a request to stay in the cache before it's removed.
+ */
+ maxAgeSeconds: number;
+}
+
+/**
+ * The CacheExpiration class allows you define an expiration and / or limit on the number of responses stored in a Cache.
+ */
+declare class CacheExpiration {
+ /**
+ * Expires entries for the given cache and given criteria.
+ * @returns {Promise