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/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/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/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/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/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/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/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 c800ea2842..346fef880b 100644
--- a/types/office-js/index.d.ts
+++ b/types/office-js/index.d.ts
@@ -13835,7 +13835,23 @@ declare namespace OfficeExtension {
declare namespace OfficeExtension {
/**
- * Specifies which properties of an object should be loaded.
+ * 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 {
/**
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-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/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/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/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/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,