mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Merge branch 'master' of github.com:oBusk/DefinitelyTyped into fix-jquery-2-events
This commit is contained in:
commit
e84be5f370
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@ -3343,6 +3343,7 @@
|
||||
/types/oembed-parser/ @BendingBender
|
||||
/types/ofe/ @Morfent
|
||||
/types/office-js/ @OfficeDev @LanceEA @Zlatkovsky @kbrandl @Rick-Kirkham @AlexJerabek @ElizabethSamuel-MSFT
|
||||
/types/office-js-preview @OfficeDev @Zlatkovsky @kbrandl @Rick-Kirkham @AlexJerabek @ElizabethSamuel-MSFT
|
||||
/types/office-runtime/ @Zlatkovsky @mscharlock
|
||||
/types/offline-js/ @cgwrench
|
||||
/types/oibackoff/ @geoffreak
|
||||
|
||||
2
types/ace/index.d.ts
vendored
2
types/ace/index.d.ts
vendored
@ -1223,7 +1223,7 @@ declare namespace AceAjax {
|
||||
/**
|
||||
* Returns `true` if the current `textInput` is in focus.
|
||||
**/
|
||||
isFocused(): void;
|
||||
isFocused(): boolean;
|
||||
|
||||
/**
|
||||
* Blurs the current `textInput`.
|
||||
|
||||
17
types/active-win/active-win-tests.ts
Normal file
17
types/active-win/active-win-tests.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import activeWin = require('active-win');
|
||||
|
||||
// $ExpectType Promise<Result>
|
||||
activeWin();
|
||||
// $ExpectType Result
|
||||
activeWin.sync();
|
||||
|
||||
let win = {
|
||||
title: 'Unicorns - Google Search',
|
||||
id: 5762,
|
||||
owner: {
|
||||
name: 'Google Chrome',
|
||||
processId: 310,
|
||||
},
|
||||
};
|
||||
|
||||
win = activeWin.sync();
|
||||
30
types/active-win/index.d.ts
vendored
Normal file
30
types/active-win/index.d.ts
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
// Type definitions for active-win 4.0
|
||||
// Project: https://github.com/sindresorhus/active-win#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = activeWin;
|
||||
|
||||
declare function activeWin(): Promise<activeWin.Result>;
|
||||
|
||||
declare namespace activeWin {
|
||||
function sync(): Result;
|
||||
|
||||
interface Result {
|
||||
title: string;
|
||||
id: number;
|
||||
bounds?: {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
owner: {
|
||||
name: string;
|
||||
processId: number;
|
||||
bundleId?: number;
|
||||
path?: string;
|
||||
};
|
||||
memoryUsage?: number;
|
||||
}
|
||||
}
|
||||
23
types/active-win/tsconfig.json
Normal file
23
types/active-win/tsconfig.json
Normal file
@ -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",
|
||||
"active-win-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/active-win/tslint.json
Normal file
1
types/active-win/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
4
types/all-property-names/all-property-names-tests.ts
Normal file
4
types/all-property-names/all-property-names-tests.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import allPropertyNames = require('all-property-names');
|
||||
|
||||
// $ExpectType Set<string>
|
||||
allPropertyNames(Symbol.prototype);
|
||||
9
types/all-property-names/index.d.ts
vendored
Normal file
9
types/all-property-names/index.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
// Type definitions for all-property-names 1.0
|
||||
// Project: https://github.com/sindresorhus/all-property-names#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export = allPropertyNames;
|
||||
|
||||
declare function allPropertyNames(input: object): Set<string>;
|
||||
23
types/all-property-names/tsconfig.json
Normal file
23
types/all-property-names/tsconfig.json
Normal file
@ -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",
|
||||
"all-property-names-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/all-property-names/tslint.json
Normal file
1
types/all-property-names/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
2
types/alt/index.d.ts
vendored
2
types/alt/index.d.ts
vendored
@ -54,7 +54,7 @@ declare namespace AltJS {
|
||||
export type Source = {[name:string]: () => SourceModel<any>};
|
||||
|
||||
export interface SourceModel<S> {
|
||||
local(state:any, ...args: any[]):any;
|
||||
local?(state:any, ...args: any[]):any;
|
||||
remote(state:any, ...args: any[]):Promise<S>;
|
||||
shouldFetch?(fetchFn:(...args:Array<any>) => boolean):void;
|
||||
loading?:(args:any) => void;
|
||||
|
||||
4
types/angular-material/index.d.ts
vendored
4
types/angular-material/index.d.ts
vendored
@ -153,6 +153,10 @@ declare module 'angular' {
|
||||
defaultFontSet(name: string): IIconProvider;
|
||||
}
|
||||
|
||||
interface IInkRippleProvider {
|
||||
disableInkRipple(): void;
|
||||
}
|
||||
|
||||
type IMedia = (media: string) => boolean;
|
||||
|
||||
interface ISidenavObject {
|
||||
|
||||
@ -1502,16 +1502,28 @@ interface MyScope extends ng.IScope {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
const directiveCompileFnWithGeneric: ng.IDirectiveCompileFn<MyScope> = (
|
||||
templateElement: JQLite,
|
||||
templateAttributes: ng.IAttributes,
|
||||
transclude: ng.ITranscludeFunction
|
||||
): ng.IDirectiveLinkFn<MyScope> => {
|
||||
return (
|
||||
scope: MyScope,
|
||||
instanceElement: JQLite,
|
||||
instanceAttributes: ng.IAttributes
|
||||
) => {
|
||||
return null;
|
||||
};
|
||||
};
|
||||
interface MyElement extends JQLite {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
interface MyAttributes extends ng.IAttributes {
|
||||
foo: string;
|
||||
}
|
||||
interface MyController extends ng.INgModelController {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
angular.module('WithGenerics', [])
|
||||
.directive('directiveUsingGenerics', () => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
link(scope: MyScope, element: MyElement, templateAttributes: MyAttributes, controller: MyController) {
|
||||
scope['name'] = 'Jeff';
|
||||
}
|
||||
};
|
||||
})
|
||||
.directive('linkFunctionUsingGenerics', () => {
|
||||
return (scope: MyScope, element: MyElement, templateAttributes: MyAttributes, controller: MyController) => {
|
||||
scope['name'] = 'Jeff';
|
||||
};
|
||||
});
|
||||
|
||||
47
types/angular/index.d.ts
vendored
47
types/angular/index.d.ts
vendored
@ -240,8 +240,9 @@ declare namespace angular {
|
||||
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
|
||||
* @param directiveFactory An injectable directive factory function.
|
||||
*/
|
||||
directive<TScope extends IScope = IScope>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope>>): IModule;
|
||||
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): IModule;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>): IModule;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>}): IModule;
|
||||
|
||||
/**
|
||||
* Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider.
|
||||
*
|
||||
@ -1346,8 +1347,8 @@ declare namespace angular {
|
||||
}
|
||||
|
||||
interface ICompileProvider extends IServiceProvider {
|
||||
directive<TScope extends IScope = IScope>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope>>): ICompileProvider;
|
||||
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): ICompileProvider;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>): ICompileProvider;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>}): ICompileProvider;
|
||||
|
||||
component(name: string, options: IComponentOptions): ICompileProvider;
|
||||
component(object: {[componentName: string]: IComponentOptions}): ICompileProvider;
|
||||
@ -2066,29 +2067,31 @@ declare namespace angular {
|
||||
// and http://docs.angularjs.org/guide/directive
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
interface IDirectiveFactory<TScope extends IScope = IScope> {
|
||||
(...args: any[]): IDirective<TScope> | IDirectiveLinkFn<TScope>;
|
||||
type IDirectiveController = IController | IController[] | {[key: string]: IController};
|
||||
|
||||
interface IDirectiveFactory<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
(...args: any[]): IDirective<TScope, TElement, TAttributes, TController> | IDirectiveLinkFn<TScope, TElement, TAttributes, TController>;
|
||||
}
|
||||
|
||||
interface IDirectiveLinkFn<TScope extends IScope = IScope> {
|
||||
interface IDirectiveLinkFn<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
(
|
||||
scope: TScope,
|
||||
instanceElement: JQLite,
|
||||
instanceAttributes: IAttributes,
|
||||
controller?: IController | IController[] | {[key: string]: IController},
|
||||
instanceElement: TElement,
|
||||
instanceAttributes: TAttributes,
|
||||
controller?: TController,
|
||||
transclude?: ITranscludeFunction
|
||||
): void;
|
||||
}
|
||||
|
||||
interface IDirectivePrePost<TScope extends IScope = IScope> {
|
||||
pre?: IDirectiveLinkFn<TScope>;
|
||||
post?: IDirectiveLinkFn<TScope>;
|
||||
interface IDirectivePrePost<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
pre?: IDirectiveLinkFn<TScope, TElement, TAttributes, TController>;
|
||||
post?: IDirectiveLinkFn<TScope, TElement, TAttributes, TController>;
|
||||
}
|
||||
|
||||
interface IDirectiveCompileFn<TScope extends IScope = IScope> {
|
||||
interface IDirectiveCompileFn<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
(
|
||||
templateElement: JQLite,
|
||||
templateAttributes: IAttributes,
|
||||
templateElement: TElement,
|
||||
templateAttributes: TAttributes,
|
||||
/**
|
||||
* @deprecated
|
||||
* Note: The transclude function that is passed to the compile function is deprecated,
|
||||
@ -2096,11 +2099,11 @@ declare namespace angular {
|
||||
* that is passed to the link function instead.
|
||||
*/
|
||||
transclude: ITranscludeFunction
|
||||
): void | IDirectiveLinkFn<TScope> | IDirectivePrePost<TScope>;
|
||||
): void | IDirectiveLinkFn<TScope, TElement, TAttributes, TController> | IDirectivePrePost<TScope, TElement, TAttributes, TController>;
|
||||
}
|
||||
|
||||
interface IDirective<TScope extends IScope = IScope> {
|
||||
compile?: IDirectiveCompileFn<TScope>;
|
||||
interface IDirective<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
compile?: IDirectiveCompileFn<TScope, TElement, TAttributes, TController>;
|
||||
controller?: string | Injectable<IControllerConstructor>;
|
||||
controllerAs?: string;
|
||||
/**
|
||||
@ -2109,7 +2112,7 @@ declare namespace angular {
|
||||
* relies upon bindings inside a $onInit method on the controller, instead.
|
||||
*/
|
||||
bindToController?: boolean | {[boundProperty: string]: string};
|
||||
link?: IDirectiveLinkFn<TScope> | IDirectivePrePost<TScope>;
|
||||
link?: IDirectiveLinkFn<TScope, TElement, TAttributes, TController> | IDirectivePrePost<TScope, TElement, TAttributes, TController>;
|
||||
multiElement?: boolean;
|
||||
priority?: number;
|
||||
/**
|
||||
@ -2119,9 +2122,9 @@ declare namespace angular {
|
||||
require?: string | string[] | {[controller: string]: string};
|
||||
restrict?: string;
|
||||
scope?: boolean | {[boundProperty: string]: string};
|
||||
template?: string | ((tElement: JQLite, tAttrs: IAttributes) => string);
|
||||
template?: string | ((tElement: TElement, tAttrs: TAttributes) => string);
|
||||
templateNamespace?: string;
|
||||
templateUrl?: string | ((tElement: JQLite, tAttrs: IAttributes) => string);
|
||||
templateUrl?: string | ((tElement: TElement, tAttrs: TAttributes) => string);
|
||||
terminal?: boolean;
|
||||
transclude?: boolean | 'element' | {[slot: string]: string};
|
||||
}
|
||||
|
||||
31051
types/arcgis-js-api/index.d.ts
vendored
31051
types/arcgis-js-api/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
74
types/arcgis-js-api/v3/index.d.ts
vendored
74
types/arcgis-js-api/v3/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for ArcGIS API for JavaScript 3.26
|
||||
// Type definitions for ArcGIS API for JavaScript 3.27
|
||||
// Project: https://developers.arcgis.com/javascript/3/
|
||||
// Definitions by: Esri <https://github.com/Esri>
|
||||
// Bjorn Svensson <https://github.com/bsvensson>
|
||||
@ -560,7 +560,7 @@ declare module "esri" {
|
||||
/** An array of driving time break values. */
|
||||
breakValues?: number[];
|
||||
/** The point feature layer around which drive-time areas will be drawn. */
|
||||
inputLayer: FeatureLayer;
|
||||
inputLayers: FeatureLayer[];
|
||||
/** The geometry type of the input layer. */
|
||||
inputType?: string;
|
||||
/** Reference to the map object. */
|
||||
@ -1351,6 +1351,8 @@ declare module "esri" {
|
||||
clip?: number;
|
||||
/** If the widget is enabled and layers can be swiped. */
|
||||
enabled?: boolean;
|
||||
/** Indicates whether layer placement should be inverted (switched). */
|
||||
invertPlacement?: boolean;
|
||||
/** The layers to be swiped. */
|
||||
layers: Layer[];
|
||||
/** The number of pixels to place the tool from the left of the map. */
|
||||
@ -2532,7 +2534,7 @@ declare module "esri/Credential" {
|
||||
class Credential {
|
||||
/** Token expiration time specified as number of milliseconds since 1 January 1970 00:00:00 UTC. */
|
||||
expires: number;
|
||||
/** Indicates whether this credential belongs to a user with admin privileges. */
|
||||
/** Indicates that this credential was created to access the ArcGIS REST Admin service */
|
||||
isAdmin: boolean;
|
||||
/** The Identity Manager's setOAuthRedirectionHandler returns an object that contains a "state" parameter. */
|
||||
oAuthState: any;
|
||||
@ -2600,6 +2602,12 @@ declare module "esri/IdentityManagerBase" {
|
||||
tokenValidity: number;
|
||||
/** If your application is on the same domain as *.arcgis.com or ArcGIS Enterprise Server, the IdentityManager will redirect the user to its sign-in page. */
|
||||
useSignInPage: boolean;
|
||||
/**
|
||||
* Returns a Credential object if the user has already signed in to access the given resource and is allowed to do so when using the given application id.
|
||||
* @param resUrl The resource URL.
|
||||
* @param appId The registered OAuth application id.
|
||||
*/
|
||||
checkAppAccess(resUrl: string, appId: string): any;
|
||||
/**
|
||||
* Returns the credential (via Deferred) if the user has already signed in to access the given resource.
|
||||
* @param resUrl The resource URL.
|
||||
@ -2891,7 +2899,7 @@ declare module "esri/SnappingManager" {
|
||||
}
|
||||
|
||||
declare module "esri/SpatialReference" {
|
||||
/** The spatial reference of a map, layer, or inputs to and outputs from a task. */
|
||||
/** Defines the spatial reference of a map, layer, or task parameters. */
|
||||
class SpatialReference {
|
||||
/** The well-known ID of a spatial reference. */
|
||||
wkid: number;
|
||||
@ -2953,6 +2961,54 @@ declare module "esri/TimeExtent" {
|
||||
export = TimeExtent;
|
||||
}
|
||||
|
||||
declare module "esri/arcadeProfiles/fieldCalculateProfile" {
|
||||
/** Module that implements the Arcade field calculate profile in web apps that calculate field values using Arcade expressions. */
|
||||
var fieldCalculateProfile: {
|
||||
/**
|
||||
* Initializes the field calculate profile for the given Arcade expressions.
|
||||
* @param expressions An array of Arcade expressions intended for use in the calculate profile.
|
||||
*/
|
||||
initialize(expressions: string[]): any;
|
||||
};
|
||||
export = fieldCalculateProfile;
|
||||
}
|
||||
|
||||
declare module "esri/arcadeProfiles/labelingProfile" {
|
||||
/** Module that implements the Arcade labeling profile in web apps that label features using Arcade expressions. */
|
||||
var labelingProfile: {
|
||||
/**
|
||||
* Initializes the labeling profile for the given Arcade expressions.
|
||||
* @param expressions An array of Arcade expressions intended for use in a label class.
|
||||
*/
|
||||
initialize(expressions: string[]): any;
|
||||
};
|
||||
export = labelingProfile;
|
||||
}
|
||||
|
||||
declare module "esri/arcadeProfiles/popupProfile" {
|
||||
/** Module that implements the Arcade popup profile for web apps that contain popups that reference Arcade expressions. */
|
||||
var popupProfile: {
|
||||
/**
|
||||
* Initializes the popup profile for the given Arcade expressions.
|
||||
* @param expressions An array of Arcade expressions intended for use in a popup template.
|
||||
*/
|
||||
initialize(expressions: string[]): any;
|
||||
};
|
||||
export = popupProfile;
|
||||
}
|
||||
|
||||
declare module "esri/arcadeProfiles/visualizationProfile" {
|
||||
/** Module that implements the Arcade visualization profile in web apps that render features using Arcade expressions. */
|
||||
var visualizationProfile: {
|
||||
/**
|
||||
* Initializes the visualization profile for the given Arcade expressions.
|
||||
* @param expressions An array of Arcade expressions intended for use in a renderer.
|
||||
*/
|
||||
initialize(expressions: string[]): any;
|
||||
};
|
||||
export = visualizationProfile;
|
||||
}
|
||||
|
||||
declare module "esri/arcgis/OAuthInfo" {
|
||||
import esri = require("esri");
|
||||
|
||||
@ -4827,6 +4883,8 @@ declare module "esri/dijit/LayerSwipe" {
|
||||
clip: number;
|
||||
/** If the widget is enabled and layers can be swiped. */
|
||||
enabled: boolean;
|
||||
/** Indicates whether layer placement should be inverted (switched). */
|
||||
invertPlacement: boolean;
|
||||
/** The layers to be swiped. */
|
||||
layers: Layer[];
|
||||
/** The number of pixels to place the tool from the left of the map. */
|
||||
@ -6285,7 +6343,7 @@ declare module "esri/dijit/analysis/CreateDriveTimeAreas" {
|
||||
/** An array of driving time break values. */
|
||||
breakValues: number[];
|
||||
/** The point feature layer around which drive-time areas will be drawn. */
|
||||
inputLayer: FeatureLayer;
|
||||
inputLayers: FeatureLayer[];
|
||||
/** The geometry type of the input layer. */
|
||||
inputType: string;
|
||||
/** Reference to the map object. */
|
||||
@ -9073,6 +9131,8 @@ declare module "esri/graphic" {
|
||||
getNode(): any;
|
||||
/** Returns one or more DOM nodes used to draw the graphic. */
|
||||
getNodes(): any;
|
||||
/** Applicable to label graphics. */
|
||||
getParentGraphic(): Graphic;
|
||||
/** Returns the dojox/gfx/shape.Shape of the Esri graphic. */
|
||||
getShape(): any;
|
||||
/** Returns one or more dojox/gfx/shape.Shape used to draw the graphic. */
|
||||
@ -10314,6 +10374,8 @@ declare module "esri/layers/FeatureLayer" {
|
||||
on(type: "query-limit-exceeded", listener: (event: { target: FeatureLayer }) => void): esri.Handle;
|
||||
/** Fires when queryRelatedFeatures() is complete. */
|
||||
on(type: "query-related-features-complete", listener: (event: { relatedFeatures: any; target: FeatureLayer }) => void): esri.Handle;
|
||||
/** Fires right before the actual refresh kicks in for the layer, and only fires when the refresh is triggered by the refreshInterval. */
|
||||
on(type: "refresh-tick", listener: (event: { target: FeatureLayer }) => void): esri.Handle;
|
||||
/** Fires when a layer resumes drawing. */
|
||||
on(type: "resume", listener: (event: { target: FeatureLayer }) => void): esri.Handle;
|
||||
/** Fires when a layer's minScale and/or maxScale is changed. */
|
||||
@ -12419,7 +12481,7 @@ declare module "esri/map" {
|
||||
getMinScale(): number;
|
||||
/** Returns the minimum zoom level of the map. */
|
||||
getMinZoom(): number;
|
||||
/** Returns the current map scale. */
|
||||
/** Returns the map scale at the center of the view. */
|
||||
getScale(): number;
|
||||
/** Returns the current zoom level of the map. */
|
||||
getZoom(): number;
|
||||
|
||||
@ -599,6 +599,27 @@ const CodePipelineEvent: AWSLambda.CodePipelineEvent = {
|
||||
|
||||
CodePipelineEvent["CodePipeline.job"].data.encryptionKey = { type: 'KMS', id: 'key' };
|
||||
|
||||
/* CodePipeline CloudWatch Events
|
||||
* see https://docs.aws.amazon.com/codepipeline/latest/userguide/detect-state-changes-cloudwatch-events.html
|
||||
* Their documentation says that detail.version is a string, but it is actually an integer
|
||||
*/
|
||||
const CodePipelineCloudWatchEvent: AWSLambda.CodePipelineCloudWatchEvent = {
|
||||
version: '0',
|
||||
id: 'event_Id',
|
||||
'detail-type': 'CodePipeline Pipeline Execution State Change',
|
||||
source: 'aws.codepipeline',
|
||||
account: 'Pipeline_Account',
|
||||
time: 'TimeStamp',
|
||||
region: 'us-east-1',
|
||||
resources: ['arn:aws:codepipeline:us-east-1:account_ID:myPipeline'],
|
||||
detail: {
|
||||
pipeline: 'myPipeline',
|
||||
version: 1,
|
||||
state: 'STARTED',
|
||||
'execution-id': 'execution_Id',
|
||||
},
|
||||
};
|
||||
|
||||
/* CloudFront events, see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */
|
||||
const CloudFrontRequestWithCustomOriginEvent: AWSLambda.CloudFrontRequestEvent = {
|
||||
Records: [
|
||||
|
||||
109
types/aws-lambda/index.d.ts
vendored
109
types/aws-lambda/index.d.ts
vendored
@ -24,6 +24,7 @@
|
||||
// Oliver Hookins <https://github.com/ohookins>
|
||||
// Trevor Leach <https://github.com/trevor-leach>
|
||||
// James Gregory <https://github.com/jagregory>
|
||||
// Erik Dalén <https://github.com/dalen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@ -576,6 +577,109 @@ export interface CodePipelineEvent {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* CodePipeline CloudWatch Events
|
||||
* https://docs.aws.amazon.com/codepipeline/latest/userguide/detect-state-changes-cloudwatch-events.html
|
||||
*
|
||||
* The above CodePipelineEvent is when a lambda is invoked by a CodePipeline.
|
||||
* These events are when you subsribe to CodePipeline events in CloudWatch.
|
||||
*
|
||||
* Their documentation says that detail.version is a string, but it is actually an integer
|
||||
*/
|
||||
export type CodePipelineState =
|
||||
| 'STARTED'
|
||||
| 'SUCCEEDED'
|
||||
| 'RESUMED'
|
||||
| 'FAILED'
|
||||
| 'CANCELED'
|
||||
| 'SUPERSEDED';
|
||||
|
||||
export type CodePipelineStageState =
|
||||
| 'STARTED'
|
||||
| 'SUCCEEDED'
|
||||
| 'RESUMED'
|
||||
| 'FAILED'
|
||||
| 'CANCELED';
|
||||
|
||||
export type CodePipelineActionState =
|
||||
| 'STARTED'
|
||||
| 'SUCCEEDED'
|
||||
| 'FAILED'
|
||||
| 'CANCELED';
|
||||
|
||||
export interface CodePipelineCloudWatchPipelineEvent {
|
||||
version: string;
|
||||
id: string;
|
||||
'detail-type': 'CodePipeline Pipeline Execution State Change';
|
||||
source: 'aws.codepipeline';
|
||||
account: string;
|
||||
time: string;
|
||||
region: string;
|
||||
resources: string[];
|
||||
detail: {
|
||||
pipeline: string;
|
||||
version: number;
|
||||
state: CodePipelineState;
|
||||
'execution-id': string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface CodePipelineCloudWatchStageEvent {
|
||||
version: string;
|
||||
id: string;
|
||||
'detail-type': 'CodePipeline Stage Execution State Change';
|
||||
source: 'aws.codepipeline';
|
||||
account: string;
|
||||
time: string;
|
||||
region: string;
|
||||
resources: string[];
|
||||
detail: {
|
||||
pipeline: string;
|
||||
version: number;
|
||||
'execution-id': string;
|
||||
stage: string;
|
||||
state: CodePipelineStageState;
|
||||
};
|
||||
}
|
||||
|
||||
export type CodePipelineActionCategory =
|
||||
| 'Approval'
|
||||
| 'Build'
|
||||
| 'Deploy'
|
||||
| 'Invoke'
|
||||
| 'Source'
|
||||
| 'Test';
|
||||
|
||||
export interface CodePipelineCloudWatchActionEvent {
|
||||
version: string;
|
||||
id: string;
|
||||
'detail-type': 'CodePipeline Action Execution State Change';
|
||||
source: 'aws.codepipeline';
|
||||
account: string;
|
||||
time: string;
|
||||
region: string;
|
||||
resources: string[];
|
||||
detail: {
|
||||
pipeline: string;
|
||||
version: number;
|
||||
'execution-id': string;
|
||||
stage: string;
|
||||
action: string;
|
||||
state: CodePipelineActionState;
|
||||
type: {
|
||||
owner: 'AWS' | 'Custom' | 'ThirdParty';
|
||||
category: CodePipelineActionCategory;
|
||||
provider: string;
|
||||
version: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export type CodePipelineCloudWatchEvent =
|
||||
| CodePipelineCloudWatchPipelineEvent
|
||||
| CodePipelineCloudWatchStageEvent
|
||||
| CodePipelineCloudWatchActionEvent;
|
||||
|
||||
/**
|
||||
* CloudFront events
|
||||
* http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html
|
||||
@ -837,6 +941,11 @@ export type ProxyCallback = APIGatewayProxyCallback; // Old name
|
||||
|
||||
export type CodePipelineHandler = Handler<CodePipelineEvent, void>;
|
||||
|
||||
export type CodePipelineCloudWatchHandler = Handler<CodePipelineCloudWatchEvent, void>;
|
||||
export type CodePipelineCloudWatchPipelineHandler = Handler<CodePipelineCloudWatchPipelineEvent, void>;
|
||||
export type CodePipelineCloudWatchStageHandler = Handler<CodePipelineCloudWatchStageEvent, void>;
|
||||
export type CodePipelineCloudWatchActionHandler = Handler<CodePipelineCloudWatchActionEvent, void>;
|
||||
|
||||
export type CloudFrontRequestHandler = Handler<CloudFrontRequestEvent, CloudFrontRequestResult>;
|
||||
export type CloudFrontRequestCallback = Callback<CloudFrontRequestResult>;
|
||||
|
||||
|
||||
24
types/base64-async/base64-async-tests.ts
Normal file
24
types/base64-async/base64-async-tests.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import b64 = require('base64-async');
|
||||
import * as fs from 'fs';
|
||||
|
||||
const buffer: Buffer = fs.readFileSync('somehugefile.jpg');
|
||||
const b64String = 'aGkgbXVt...';
|
||||
|
||||
b64.encode(buffer).then(b64String => {
|
||||
b64String; // $ExpectType string
|
||||
});
|
||||
b64.encode(buffer, { chunkSize: 10 }).then(b64String => {
|
||||
b64String; // $ExpectType string
|
||||
});
|
||||
|
||||
b64.decode(b64String).then(buffer => {
|
||||
buffer; // $ExpectType Buffer
|
||||
});
|
||||
b64.decode(b64String, { chunkSize: 10 }).then(buffer => {
|
||||
buffer; // $ExpectType Buffer
|
||||
});
|
||||
|
||||
b64(buffer); // $ExpectType Promise<string>
|
||||
b64(buffer, { chunkSize: 10 }); // $ExpectType Promise<string>
|
||||
b64(b64String); // $ExpectType Promise<Buffer>
|
||||
b64(b64String, { chunkSize: 10 }); // $ExpectType Promise<Buffer>
|
||||
20
types/base64-async/index.d.ts
vendored
Normal file
20
types/base64-async/index.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// Type definitions for base64-async 2.1
|
||||
// Project: https://github.com/lukechilds/base64-async
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export = base64Async;
|
||||
|
||||
declare function base64Async(input: Buffer, options?: base64Async.Options): Promise<string>;
|
||||
declare function base64Async(input: string, options?: base64Async.Options): Promise<Buffer>;
|
||||
|
||||
declare namespace base64Async {
|
||||
function encode(input: Buffer, options?: Options): Promise<string>;
|
||||
function decode(input: string, options?: Options): Promise<Buffer>;
|
||||
|
||||
interface Options {
|
||||
chunkSize?: number;
|
||||
}
|
||||
}
|
||||
23
types/base64-async/tsconfig.json
Normal file
23
types/base64-async/tsconfig.json
Normal file
@ -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",
|
||||
"base64-async-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/base64-async/tslint.json
Normal file
1
types/base64-async/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
4
types/battery-level/battery-level-tests.ts
Normal file
4
types/battery-level/battery-level-tests.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import batteryLevel = require('battery-level');
|
||||
|
||||
// $ExpectType Promise<number>
|
||||
batteryLevel();
|
||||
8
types/battery-level/index.d.ts
vendored
Normal file
8
types/battery-level/index.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// Type definitions for battery-level 3.0
|
||||
// Project: https://github.com/gillstrom/battery-level#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = batteryLevel;
|
||||
|
||||
declare function batteryLevel(): Promise<number>;
|
||||
23
types/battery-level/tsconfig.json
Normal file
23
types/battery-level/tsconfig.json
Normal file
@ -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",
|
||||
"battery-level-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/battery-level/tslint.json
Normal file
1
types/battery-level/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@ -1,40 +1,71 @@
|
||||
import Database = require('better-sqlite3');
|
||||
import Sqlite = require('better-sqlite3');
|
||||
|
||||
const integer = Database.Integer(1);
|
||||
const err = new Database.SqliteError('ok', 'ok');
|
||||
const result: Database.RunResult = { changes: 1, lastInsertRowid: 1 };
|
||||
const options: Database.Options = { fileMustExist: true, memory: true, readonly: true };
|
||||
const registrationOptions: Database.RegistrationOptions = {
|
||||
const integer = Sqlite.Integer(1);
|
||||
const err = new Sqlite.SqliteError('ok', 'ok');
|
||||
const result: Sqlite.RunResult = { changes: 1, lastInsertRowid: 1 };
|
||||
const options: Sqlite.Options = { fileMustExist: true, memory: true, readonly: true };
|
||||
const registrationOptions: Sqlite.RegistrationOptions = {
|
||||
deterministic: true,
|
||||
name: '',
|
||||
safeIntegers: true,
|
||||
varargs: true
|
||||
};
|
||||
|
||||
let db = Database('.');
|
||||
db = new Database('.', { memory: true });
|
||||
let db: Sqlite.Database = Sqlite('.');
|
||||
db = new Sqlite('.', { memory: true });
|
||||
db.exec('CREATE TABLE test (id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL);');
|
||||
db.exec('INSERT INTO test(name) VALUES("name");');
|
||||
db.pragma('data_version', true);
|
||||
db.pragma('data_version', { simple: true });
|
||||
db.checkpoint();
|
||||
db.checkpoint('main');
|
||||
db.register(() => { });
|
||||
db.register({ name: 'noop', deterministic: true, varargs: true }, () => { });
|
||||
db.function('noop', () => { });
|
||||
db.function('noop', { deterministic: true, varargs: true }, () => { });
|
||||
db.aggregate('add', {
|
||||
start: 0,
|
||||
step: (t, n) => t + n,
|
||||
deterministic: true,
|
||||
varargs: true
|
||||
});
|
||||
db.aggregate('getAverage', {
|
||||
start: () => [],
|
||||
step: (array, nextValue) => {
|
||||
array.push(nextValue);
|
||||
},
|
||||
result: array => array.reduce((t: any, v: any) => t + v) / array.length,
|
||||
});
|
||||
db.aggregate('addAll', {
|
||||
start: 0,
|
||||
step: (total, nextValue) => total + nextValue,
|
||||
inverse: (total, droppedValue) => total - droppedValue,
|
||||
result: total => Math.round(total),
|
||||
});
|
||||
db.defaultSafeIntegers();
|
||||
db.defaultSafeIntegers(true);
|
||||
|
||||
const stmt = db.prepare('SELECT * FROM test WHERE name == ?;');
|
||||
const stmt: Sqlite.Statement = db.prepare('SELECT * FROM test WHERE name == ?;');
|
||||
stmt.get(['name']);
|
||||
stmt.all({ name: 'name' });
|
||||
stmt.each('name', (row: { name: string }) => { });
|
||||
stmt.each((row: { name: string }) => { });
|
||||
for (const row of stmt.iterate('name')) {
|
||||
}
|
||||
stmt.pluck();
|
||||
stmt.pluck(true);
|
||||
stmt.expand();
|
||||
stmt.expand(true);
|
||||
stmt.bind('name');
|
||||
stmt.safeIntegers();
|
||||
stmt.safeIntegers(true);
|
||||
stmt.raw();
|
||||
stmt.raw(true);
|
||||
stmt.raw(false);
|
||||
let col: Sqlite.ColumnDefinition;
|
||||
for (col of stmt.columns()) {
|
||||
col.name;
|
||||
col.column;
|
||||
col.type;
|
||||
}
|
||||
|
||||
const trans = db.transaction(['INSERT INTO test(name) VALUES(?);']);
|
||||
trans.run('name');
|
||||
trans.bind('name');
|
||||
trans.run();
|
||||
const trans: Sqlite.Transaction = db.transaction((param) => stmt.all(param));
|
||||
trans('name');
|
||||
trans.default('name');
|
||||
trans.deferred('name');
|
||||
trans.immediate('name');
|
||||
trans.exclusive('name');
|
||||
|
||||
132
types/better-sqlite3/index.d.ts
vendored
132
types/better-sqlite3/index.d.ts
vendored
@ -1,58 +1,75 @@
|
||||
// Type definitions for better-sqlite3 5.0
|
||||
// Type definitions for better-sqlite3 5.2
|
||||
// Project: http://github.com/JoshuaWise/better-sqlite3
|
||||
// Definitions by: Ben Davies <https://github.com/Morfent>
|
||||
// Mathew Rumsey <https://github.com/matrumz>
|
||||
// Santiago Aguilar <https://github.com/sant123>
|
||||
// Alessandro Vergani <https://github.com/loghorn>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import Integer = require("integer");
|
||||
|
||||
declare class Statement {
|
||||
database: Database;
|
||||
source: string;
|
||||
returnsData: boolean;
|
||||
constructor(db: Database, sources: string[]);
|
||||
declare namespace BetterSqlite3 {
|
||||
interface Statement {
|
||||
database: Database;
|
||||
source: string;
|
||||
reader: boolean;
|
||||
|
||||
run(...params: any[]): Database.RunResult;
|
||||
get(...params: any[]): any;
|
||||
all(...params: any[]): any[];
|
||||
each(params: any, cb: (row: any) => void): void;
|
||||
each(cb: (row: any) => void): void;
|
||||
each(...params: any[]): void;
|
||||
pluck(toggleState?: boolean): this;
|
||||
bind(...params: any[]): this;
|
||||
safeIntegers(toggleState?: boolean): this;
|
||||
}
|
||||
run(...params: any[]): Database.RunResult;
|
||||
get(...params: any[]): any;
|
||||
all(...params: any[]): any[];
|
||||
iterate(...params: any[]): IterableIterator<any>;
|
||||
pluck(toggleState?: boolean): this;
|
||||
expand(toggleState?: boolean): this;
|
||||
raw(toggleState?: boolean): this;
|
||||
bind(...params: any[]): this;
|
||||
columns(): ColumnDefinition[];
|
||||
safeIntegers(toggleState?: boolean): this;
|
||||
}
|
||||
|
||||
declare class Transaction {
|
||||
database: Database;
|
||||
source: string;
|
||||
constructor(db: Database, sources: string[]);
|
||||
interface ColumnDefinition {
|
||||
name: string;
|
||||
column: string | null;
|
||||
table: string | null;
|
||||
database: string | null;
|
||||
type: string | null;
|
||||
}
|
||||
|
||||
run(...params: any[]): Database.RunResult;
|
||||
bind(...params: any[]): this;
|
||||
safeIntegers(toggleState?: boolean): this;
|
||||
}
|
||||
interface Transaction {
|
||||
(...params: any[]): any;
|
||||
default(...params: any[]): any;
|
||||
deferred(...params: any[]): any;
|
||||
immediate(...params: any[]): any;
|
||||
exclusive(...params: any[]): any;
|
||||
}
|
||||
|
||||
interface Database {
|
||||
memory: boolean;
|
||||
readonly: boolean;
|
||||
name: string;
|
||||
open: boolean;
|
||||
inTransaction: boolean;
|
||||
interface Database {
|
||||
memory: boolean;
|
||||
readonly: boolean;
|
||||
name: string;
|
||||
open: boolean;
|
||||
inTransaction: boolean;
|
||||
|
||||
prepare(source: string): Statement;
|
||||
transaction(sources: string[]): Transaction;
|
||||
exec(source: string): this;
|
||||
pragma(source: string, simplify?: boolean): any;
|
||||
checkpoint(databaseName?: string): this;
|
||||
register(cb: (...params: any[]) => any): this;
|
||||
register(
|
||||
options: Database.RegistrationOptions,
|
||||
cb: (...params: any[]) => any
|
||||
): this;
|
||||
close(): this;
|
||||
defaultSafeIntegers(toggleState?: boolean): this;
|
||||
prepare(source: string): Statement;
|
||||
transaction(fn: (...params: any[]) => any): Transaction;
|
||||
exec(source: string): this;
|
||||
pragma(source: string, options?: Database.PragmaOptions): any;
|
||||
checkpoint(databaseName?: string): this;
|
||||
function(name: string, cb: (...params: any[]) => any): this;
|
||||
function(name: string, options: Database.RegistrationOptions, cb: (...params: any[]) => any): this;
|
||||
aggregate(name: string, options: Database.AggregateOptions): this;
|
||||
loadExtension(path: string): this;
|
||||
close(): this;
|
||||
defaultSafeIntegers(toggleState?: boolean): this;
|
||||
}
|
||||
|
||||
interface DatabaseConstructor {
|
||||
new(filename: string, options?: Database.Options): Database;
|
||||
(filename: string, options?: Database.Options): Database;
|
||||
prototype: Database;
|
||||
|
||||
Integer: typeof Integer;
|
||||
SqliteError: typeof SqliteError;
|
||||
}
|
||||
}
|
||||
|
||||
declare class SqliteError implements Error {
|
||||
@ -62,15 +79,6 @@ declare class SqliteError implements Error {
|
||||
constructor(message: string, code: string);
|
||||
}
|
||||
|
||||
interface DatabaseConstructor {
|
||||
new (filename: string, options?: Database.Options): Database;
|
||||
(filename: string, options?: Database.Options): Database;
|
||||
prototype: Database;
|
||||
|
||||
Integer: typeof Integer;
|
||||
SqliteError: typeof SqliteError;
|
||||
}
|
||||
|
||||
declare namespace Database {
|
||||
interface RunResult {
|
||||
changes: number;
|
||||
@ -81,15 +89,33 @@ declare namespace Database {
|
||||
memory?: boolean;
|
||||
readonly?: boolean;
|
||||
fileMustExist?: boolean;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
interface PragmaOptions {
|
||||
simple?: boolean;
|
||||
}
|
||||
|
||||
interface RegistrationOptions {
|
||||
name?: string;
|
||||
varargs?: boolean;
|
||||
deterministic?: boolean;
|
||||
safeIntegers?: boolean;
|
||||
}
|
||||
|
||||
interface AggregateOptions extends RegistrationOptions {
|
||||
start?: any;
|
||||
step: (total: any, next: any) => any;
|
||||
inverse?: (total: any, dropped: any) => any;
|
||||
result?: (total: any) => any;
|
||||
}
|
||||
|
||||
type Integer = typeof Integer;
|
||||
type SqliteError = typeof SqliteError;
|
||||
type Statement = BetterSqlite3.Statement;
|
||||
type ColumnDefinition = BetterSqlite3.ColumnDefinition;
|
||||
type Transaction = BetterSqlite3.Transaction;
|
||||
type Database = BetterSqlite3.Database;
|
||||
}
|
||||
|
||||
declare const Database: DatabaseConstructor;
|
||||
declare const Database: BetterSqlite3.DatabaseConstructor;
|
||||
export = Database;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
@ -20,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"better-sqlite3-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
281
types/bluebird/index.d.ts
vendored
281
types/bluebird/index.d.ts
vendored
@ -35,7 +35,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
type CatchFilter<E> = (new (...args: any[]) => E) | ((error: E) => boolean) | (object & E);
|
||||
type Constructor<E> = new (...args: any[]) => E;
|
||||
type CatchFilter<E> = ((error: E) => boolean) | (object & E);
|
||||
type IterableItem<R> = R extends Iterable<infer U> ? U : never;
|
||||
type IterableOrNever<R> = Extract<R, Iterable<any>>;
|
||||
type Resolvable<R> = R | PromiseLike<R>;
|
||||
@ -85,69 +86,74 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
catch<E1, E2, E3, E4, E5>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter4: CatchFilter<E4>,
|
||||
filter5: CatchFilter<E5>,
|
||||
onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<R>,
|
||||
): Bluebird<R>;
|
||||
catch<U, E1, E2, E3, E4, E5>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter4: CatchFilter<E4>,
|
||||
filter5: CatchFilter<E5>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
filter3: Constructor<E3>,
|
||||
filter4: Constructor<E4>,
|
||||
filter5: Constructor<E5>,
|
||||
onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<E1, E2, E3, E4>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter4: CatchFilter<E4>,
|
||||
onReject: (error: E1 | E2 | E3 | E4) => Resolvable<R>,
|
||||
): Bluebird<R>;
|
||||
catch<U, E1, E2, E3, E4, E5>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
filter3: Constructor<E3> | CatchFilter<E3>,
|
||||
filter4: Constructor<E4> | CatchFilter<E4>,
|
||||
filter5: Constructor<E5> | CatchFilter<E5>,
|
||||
onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<U, E1, E2, E3, E4>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter4: CatchFilter<E4>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
filter3: Constructor<E3>,
|
||||
filter4: Constructor<E4>,
|
||||
onReject: (error: E1 | E2 | E3 | E4) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<U, E1, E2, E3, E4>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
filter3: Constructor<E3> | CatchFilter<E3>,
|
||||
filter4: Constructor<E4> | CatchFilter<E4>,
|
||||
onReject: (error: E1 | E2 | E3 | E4) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<E1, E2, E3>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
onReject: (error: E1 | E2 | E3) => Resolvable<R>,
|
||||
): Bluebird<R>;
|
||||
catch<U, E1, E2, E3>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
filter3: Constructor<E3>,
|
||||
onReject: (error: E1 | E2 | E3) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<U, E1, E2, E3>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
filter3: Constructor<E3> | CatchFilter<E3>,
|
||||
onReject: (error: E1 | E2 | E3) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<E1, E2>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
onReject: (error: E1 | E2) => Resolvable<R>,
|
||||
): Bluebird<R>;
|
||||
catch<U, E1, E2>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
onReject: (error: E1 | E2) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<U, E1, E2>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
onReject: (error: E1 | E2) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<E1>(
|
||||
filter1: CatchFilter<E1>,
|
||||
onReject: (error: E1) => Resolvable<R>,
|
||||
): Bluebird<R>;
|
||||
catch<U, E1>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter1: Constructor<E1>,
|
||||
onReject: (error: E1) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
catch<U, E1>(
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
onReject: (error: E1) => Resolvable<U>,
|
||||
): Bluebird<U | R>;
|
||||
|
||||
@ -201,33 +207,64 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
tapCatch(onReject: (error?: any) => Resolvable<any>): Bluebird<R>;
|
||||
|
||||
tapCatch<E1, E2, E3, E4, E5>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter4: CatchFilter<E4>,
|
||||
filter5: CatchFilter<E5>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
filter3: Constructor<E3>,
|
||||
filter4: Constructor<E4>,
|
||||
filter5: Constructor<E5>,
|
||||
onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2, E3, E4, E5>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
filter3: Constructor<E3> | CatchFilter<E3>,
|
||||
filter4: Constructor<E4> | CatchFilter<E4>,
|
||||
filter5: Constructor<E5> | CatchFilter<E5>,
|
||||
onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2, E3, E4>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter4: CatchFilter<E4>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
filter3: Constructor<E3>,
|
||||
filter4: Constructor<E4>,
|
||||
onReject: (error: E1 | E2 | E3 | E4) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2, E3, E4>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
filter3: Constructor<E3> | CatchFilter<E3>,
|
||||
filter4: Constructor<E4> | CatchFilter<E4>,
|
||||
onReject: (error: E1 | E2 | E3 | E4) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2, E3>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter3: CatchFilter<E3>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
filter3: Constructor<E3>,
|
||||
onReject: (error: E1 | E2 | E3) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2, E3>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
filter3: Constructor<E3> | CatchFilter<E3>,
|
||||
onReject: (error: E1 | E2 | E3) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter2: CatchFilter<E2>,
|
||||
filter1: Constructor<E1>,
|
||||
filter2: Constructor<E2>,
|
||||
onReject: (error: E1 | E2) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1, E2>(
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
filter2: Constructor<E2> | CatchFilter<E2>,
|
||||
onReject: (error: E1 | E2) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1>(
|
||||
filter1: CatchFilter<E1>,
|
||||
filter1: Constructor<E1>,
|
||||
onReject: (error: E1) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
tapCatch<E1>(
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
filter1: Constructor<E1> | CatchFilter<E1>,
|
||||
onReject: (error: E1) => Resolvable<any>,
|
||||
): Bluebird<R>;
|
||||
|
||||
@ -376,33 +413,64 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
|
||||
// No need to be specific about Error types in these overrides, since there's no handler function
|
||||
catchReturn<U>(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter3: CatchFilter<Error>,
|
||||
filter4: CatchFilter<Error>,
|
||||
filter5: CatchFilter<Error>,
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
filter3: Constructor<Error>,
|
||||
filter4: Constructor<Error>,
|
||||
filter5: Constructor<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter3: CatchFilter<Error>,
|
||||
filter4: CatchFilter<Error>,
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
filter3: Constructor<Error> | CatchFilter<Error>,
|
||||
filter4: Constructor<Error> | CatchFilter<Error>,
|
||||
filter5: Constructor<Error> | CatchFilter<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter3: CatchFilter<Error>,
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
filter3: Constructor<Error>,
|
||||
filter4: Constructor<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
filter3: Constructor<Error> | CatchFilter<Error>,
|
||||
filter4: Constructor<Error> | CatchFilter<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
filter3: Constructor<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
filter3: Constructor<Error> | CatchFilter<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
filter1: Constructor<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
catchReturn<U>(
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
value: U,
|
||||
): Bluebird<R | U>;
|
||||
|
||||
@ -420,33 +488,64 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
|
||||
// No need to be specific about Error types in these overrides, since there's no handler function
|
||||
catchThrow(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter3: CatchFilter<Error>,
|
||||
filter4: CatchFilter<Error>,
|
||||
filter5: CatchFilter<Error>,
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
filter3: Constructor<Error>,
|
||||
filter4: Constructor<Error>,
|
||||
filter5: Constructor<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter3: CatchFilter<Error>,
|
||||
filter4: CatchFilter<Error>,
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
filter3: Constructor<Error> | CatchFilter<Error>,
|
||||
filter4: Constructor<Error> | CatchFilter<Error>,
|
||||
filter5: Constructor<Error> | CatchFilter<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter3: CatchFilter<Error>,
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
filter3: Constructor<Error>,
|
||||
filter4: Constructor<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter2: CatchFilter<Error>,
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
filter3: Constructor<Error> | CatchFilter<Error>,
|
||||
filter4: Constructor<Error> | CatchFilter<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: CatchFilter<Error>,
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
filter3: Constructor<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
filter3: Constructor<Error> | CatchFilter<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: Constructor<Error>,
|
||||
filter2: Constructor<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
filter2: Constructor<Error> | CatchFilter<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
filter1: Constructor<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
catchThrow(
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
filter1: Constructor<Error> | CatchFilter<Error>,
|
||||
reason: Error,
|
||||
): Bluebird<R>;
|
||||
|
||||
|
||||
@ -34,12 +34,16 @@ $("#carousel").carousel("pause");
|
||||
|
||||
$("#carousel").carousel(100);
|
||||
|
||||
$("#carousel").on("slide.bs.carousel", function(ev) {
|
||||
$("#carousel").on("slide.bs.carousel", function(e) {
|
||||
const that: HTMLElement = this;
|
||||
const from: number = ev.from;
|
||||
const to: number = ev.to;
|
||||
const direction: string = ev.direction;
|
||||
const data: undefined = ev.data;
|
||||
|
||||
const data: undefined = e.data;
|
||||
const carousel: HTMLElement = e.target;
|
||||
|
||||
const direction: string = e.direction;
|
||||
const relatedTarget: HTMLElement = e.relatedTarget;
|
||||
const from: number = e.from;
|
||||
const to: number = e.to;
|
||||
});
|
||||
|
||||
$("#carousel").carousel({
|
||||
@ -101,7 +105,11 @@ $("#dropdown").dropdown();
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$("#dropdown").dropdown("update");
|
||||
|
||||
$("#dropdown").on("hide.bs.dropdown", () => {});
|
||||
$("#dropdown").on("hide.bs.dropdown", (e) => {
|
||||
const data: undefined = e.data;
|
||||
const container: HTMLElement = e.target;
|
||||
const togglingAnchorElement: HTMLElement = e.relatedTarget;
|
||||
});
|
||||
|
||||
$("#dropdown").dropdown({
|
||||
offset: 10,
|
||||
@ -141,7 +149,13 @@ $("#modal").modal();
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$("#modal").modal("show");
|
||||
|
||||
$("#modal").on("hide.bs.modal", () => {});
|
||||
$("#modal").on("show.bs.modal", (e) => {
|
||||
const data: undefined = e.data;
|
||||
const modal: HTMLElement = e.target;
|
||||
if (e.relatedTarget) {
|
||||
const clickedElement: HTMLElement = e.relatedTarget;
|
||||
}
|
||||
});
|
||||
|
||||
$("#modal").modal({
|
||||
backdrop: false,
|
||||
@ -226,8 +240,9 @@ $("#scrollspy").scrollspy({
|
||||
$("#someListItem").tab("show");
|
||||
|
||||
$("a[data-toggle=\"list\"]").on("shown.bs.tab", (e) => {
|
||||
e.target; // newly activated tab
|
||||
e.relatedTarget; // previous active tab
|
||||
const data: undefined = e.data;
|
||||
const newlyActivatedTab: HTMLElement = e.target;
|
||||
const previousActiveTab: HTMLElement = e.relatedTarget;
|
||||
});
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
189
types/bootstrap/index.d.ts
vendored
189
types/bootstrap/index.d.ts
vendored
@ -185,7 +185,10 @@ export interface PopoverOption extends TooltipOption {
|
||||
|
||||
export interface ScrollspyOption {
|
||||
/**
|
||||
* TODO: https://github.com/twbs/bootstrap/issues/25799
|
||||
* Finds which section the spied element is in:
|
||||
* * `auto` will choose the best method get scroll coordinates.
|
||||
* * `offset` will use jQuery offset method to get scroll coordinates.
|
||||
* * `position` will use jQuery position method to get scroll coordinates.
|
||||
*
|
||||
* @default "auto"
|
||||
*/
|
||||
@ -322,12 +325,22 @@ export interface TooltipOption {
|
||||
// Events
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
export interface CarouselEventHandler<TElement> extends JQuery.TriggeredEvent<TElement, undefined> {
|
||||
export interface CarouselEventHandler<TElement> extends JQuery.TriggeredEvent<TElement, undefined, HTMLElement, HTMLElement> {
|
||||
/**
|
||||
* The carousel dom element.
|
||||
*/
|
||||
target: HTMLElement; // overridden only for better JsDoc
|
||||
|
||||
/**
|
||||
* The direction in which the carousel is sliding.
|
||||
*/
|
||||
direction: "left" | "right";
|
||||
|
||||
/**
|
||||
* The DOM element that is being slid into place as the active item.
|
||||
*/
|
||||
relatedTarget: HTMLElement;
|
||||
|
||||
/**
|
||||
* The index of the current item.
|
||||
*/
|
||||
@ -339,7 +352,44 @@ export interface CarouselEventHandler<TElement> extends JQuery.TriggeredEvent<TE
|
||||
to: number;
|
||||
}
|
||||
|
||||
export interface TapEventHandler<TElement> extends JQuery.TriggeredEvent<TElement, undefined> {
|
||||
export interface DropdownsEventHandler<TElement> extends JQuery.TriggeredEvent<TElement, undefined, HTMLElement, HTMLElement> {
|
||||
/**
|
||||
* The the dropdown's toggle and the dropdown menu container (the `.dropdown` element).
|
||||
*/
|
||||
target: HTMLElement; // overridden only for better JsDoc
|
||||
|
||||
/**
|
||||
* The toggling anchor element.
|
||||
*/
|
||||
relatedTarget: HTMLElement;
|
||||
}
|
||||
|
||||
export interface ModalEventHandler<TElement> extends JQuery.TriggeredEvent<TElement, undefined, HTMLElement, HTMLElement> {
|
||||
/**
|
||||
* The modal dom element.
|
||||
*/
|
||||
target: HTMLElement; // overridden only for better JsDoc
|
||||
|
||||
/**
|
||||
* For `show.bs.modal` and `shown.bs.modal` is the clicked element, when caused by a _click_.
|
||||
* Otherwise is undefined.
|
||||
*/
|
||||
relatedTarget: HTMLElement | undefined;
|
||||
}
|
||||
|
||||
export interface TapEventHandler<TElement> extends JQuery.TriggeredEvent<TElement, undefined, HTMLElement, HTMLElement> {
|
||||
/**
|
||||
* * For `show.bs.tab` and `shown.bs.tab`, is the newly activated tab.
|
||||
* * For `hide.bs.tab`, is the current active tab.
|
||||
* * For `hidden.bs.tab`, is the previous active tab.
|
||||
*/
|
||||
target: HTMLElement; // overridden only for better JsDoc
|
||||
|
||||
/**
|
||||
* * For `show.bs.tab` and `shown.bs.tab`, is the previous active tab.
|
||||
* * For `hide.bs.tab`, is the new soon-to-be-active tab.
|
||||
* * For `hidden.bs.tab`, is the new active tab.
|
||||
*/
|
||||
relatedTarget: HTMLElement;
|
||||
}
|
||||
|
||||
@ -359,38 +409,163 @@ export type TooltipEvent = "show.bs.tooltip" | "shown.bs.tooltip" | "hide.bs.too
|
||||
|
||||
declare global {
|
||||
interface JQuery<TElement = HTMLElement> {
|
||||
/**
|
||||
* If no _method_ is specified, makes an alert listen for click events on descendant elements which have the `data-dismiss="alert"` attribute.
|
||||
* (Not necessary when using the data-api's auto-initialization.)
|
||||
* Otherwise, call the method on the alert element:
|
||||
* * `close` — Closes an alert by removing it from the DOM. If the `.fade` and `.show` classes are present on the element, the alert will fade out before it is removed.
|
||||
* * `dispose` — Destroys an element's alert.
|
||||
*/
|
||||
alert(action?: "close" | "dispose"): this;
|
||||
|
||||
/**
|
||||
* Call a method on the button element:
|
||||
* * `toggle` — Toggles push state. Gives the button the appearance that it has been activated.
|
||||
* * `dispose` — Destroys an element's button.
|
||||
*/
|
||||
button(action: "toggle" | "dispose"): this;
|
||||
|
||||
/**
|
||||
* Call a method on the carousel element:
|
||||
* * `cycle` — Cycles through the carousel items from left to right.
|
||||
* * `pause` — Stops the carousel from cycling through items.
|
||||
* * _number_ — Cycles the carousel to a particular frame (0 based, similar to an array).
|
||||
* * `prev` — Cycles to the previous item.
|
||||
* * `next` — Cycles to the next item.
|
||||
* * `dispose` — Destroys an element's carousel.
|
||||
*
|
||||
* Returns to the caller before the target item has been shown (i.e. before the `slid.bs.carousel` event occurs).
|
||||
*/
|
||||
carousel(action: "cycle" | "pause" | number | "prev" | "next" | "dispose"): this;
|
||||
/**
|
||||
* Initializes the carousel and starts cycling through items.
|
||||
*/
|
||||
carousel(options?: CarouselOption): this;
|
||||
|
||||
/**
|
||||
* Call a method on the collapsible element:
|
||||
* * `toggle` – Toggles a collapsible element to shown or hidden.
|
||||
* * `show` – Shows a collapsible element.
|
||||
* * `hide` – Hides a collapsible element.
|
||||
* * `dispose` – Destroys an element's collapse.
|
||||
*
|
||||
* Returns to the caller before the collapsible element has actually been shown or hidden (i.e. before the `shown.bs.collapse` or `hidden.bs.collapse` event occurs).
|
||||
*/
|
||||
collapse(action: "toggle" | "show" | "hide" | "dispose"): this;
|
||||
/**
|
||||
* Activates a content as a collapsible element.
|
||||
*/
|
||||
collapse(options?: CollapseOption): this;
|
||||
|
||||
/**
|
||||
* Call a method on the dropdown element:
|
||||
* * `toggle` – Toggles the dropdown menu of a given navbar or tabbed navigation.
|
||||
* * `update` – Updates the position of an element's dropdown.
|
||||
* * `dispose` — Destroys an element's dropdown.
|
||||
*/
|
||||
dropdown(action: "toggle" | "update" | "dispose"): this;
|
||||
/**
|
||||
* Toggle contextual overlays for displaying lists of links.
|
||||
*
|
||||
* The data-api, `data-toggle="dropdown"` is always required to be present on the dropdown's trigger element.
|
||||
*/
|
||||
dropdown(options?: DropdownOption): this;
|
||||
|
||||
/**
|
||||
* Call a method on the modal element:
|
||||
* * `toggle` – Manually toggles a modal.
|
||||
* * `show` – Manually opens a modal.
|
||||
* * `hide` – Manually hides a modal.
|
||||
* * `handleUpdate` – Manually readjust the modal's position if the height of a modal changes while it is open (i.e. in case a scrollbar appears).
|
||||
* * `dispose` – Destroys an element's modal.
|
||||
*
|
||||
* Returns to the caller before the modal has actually been shown or hidden (i.e. before the `shown.bs.modal` or `hidden.bs.modal` event occurs).
|
||||
*/
|
||||
modal(action: "toggle" | "show" | "hide" | "handleUpdate" | "dispose"): this;
|
||||
/**
|
||||
* Activates a content as a modal.
|
||||
*/
|
||||
modal(options?: ModalOption): this;
|
||||
|
||||
/**
|
||||
* Call a method on the popover element:
|
||||
* * `show` – Reveals an element's popover.
|
||||
* * `hide` – Hides an element's popover.
|
||||
* * `toggle` – Toggles an element's popover.
|
||||
* * `dispose` – Hides and destroys an element's popover.
|
||||
* Popovers that use delegation (which are created using the `selector` option) cannot be individually destroyed on descendant trigger elements.
|
||||
* * `enable` – Gives an element's popover the ability to be shown. Popovers are enabled by default.
|
||||
* * `disable` – Removes the ability for an element's popover to be shown. The popover will only be able to be shown if it is re-enabled.
|
||||
* * `toggleEnabled` – Toggles the ability for an element's popover to be shown or hidden.
|
||||
* * `update` – Updates the position of an element's popover.
|
||||
*
|
||||
* Returns to the caller before the popover has actually been shown or hidden (i.e. before the `shown.bs.popover` or `hidden.bs.popover` event occurs).
|
||||
* This is considered a "manual" triggering of the popover. Popovers whose both title and content are zero-length are never displayed.
|
||||
*/
|
||||
popover(action: "show" | "hide" | "toggle" | "dispose" | "enable" | "disable" | "toggleEnabled" | "update"): this;
|
||||
/**
|
||||
* Initializes popovers for an element collection.
|
||||
*/
|
||||
popover(options?: PopoverOption): this;
|
||||
|
||||
// tslint:disable:jsdoc-format
|
||||
/**
|
||||
* Call a method on the scrollspy element:
|
||||
* * `refresh` – When using scrollspy in conjunction with adding or removing of elements from the DOM, you'll need to call the refresh, see example.
|
||||
* * `dispose` – Destroys an element's scrollspy.
|
||||
*
|
||||
* @example
|
||||
```javascript
|
||||
$('[data-spy="scroll"]').each(function () {
|
||||
var $spy = $(this).scrollspy('refresh')
|
||||
})
|
||||
```
|
||||
*/
|
||||
// tslint:enable:jsdoc-format
|
||||
scrollspy(action: "refresh" | "dispose"): this;
|
||||
/**
|
||||
* Add scrollspy behavior to a topbar navigation.
|
||||
*/
|
||||
scrollspy(options?: ScrollspyOption): this;
|
||||
|
||||
/**
|
||||
* Call a method on the list item or tab element:
|
||||
* * `show` – Selects the given list item or tab and shows its associated pane.
|
||||
* Any other list item or tab that was previously selected becomes unselected and its associated pane is hidden.
|
||||
* * `dispose` – Destroys an element's tab.
|
||||
*
|
||||
* Returns to the caller before the tab pane has actually been shown (i.e. before the `shown.bs.tab` event occurs).
|
||||
*/
|
||||
tab(action: "show" | "dispose"): this;
|
||||
|
||||
/**
|
||||
* Call a method on the tooltip element:
|
||||
* * `show` – Reveals an element's tooltip.
|
||||
* * `hide` – Hides an element's tooltip.
|
||||
* * `toggle` – Toggles an element's tooltip.
|
||||
* * `dispose` – Hides and destroys an element's tooltip.
|
||||
* Tooltips that use delegation (which are created using `selector` option) cannot be individually destroyed on descendant trigger elements.
|
||||
* * `enable` – Gives an element's tooltip the ability to be shown. Tooltips are enabled by default.
|
||||
* * `disable` – Removes the ability for an element's tooltip to be shown. The tooltip will only be able to be shown if it is re-enabled.
|
||||
* * `toggleEnabled` – Toggles the ability for an element's tooltip to be shown or hidden.
|
||||
* * `update` – Updates the position of an element's tooltip.
|
||||
*
|
||||
* Returns to the caller before the tooltip has actually been shown or hidden (i.e. before the `shown.bs.tooltip` or `hidden.bs.tooltip` event occurs).
|
||||
* This is considered a "manual" triggering of the tooltip.
|
||||
*/
|
||||
tooltip(action: "show" | "hide" | "toggle" | "dispose" | "enable" | "disable" | "toggleEnabled" | "update"): this;
|
||||
/**
|
||||
* Attaches a tooltip handler to an element collection.
|
||||
*/
|
||||
tooltip(options?: TooltipOption): this;
|
||||
|
||||
on(events: CarouselEvent, handler: JQuery.EventHandlerBase<TElement, CarouselEventHandler<TElement>>): this;
|
||||
on(events: DropdownEvent, handler: JQuery.EventHandlerBase<TElement, DropdownsEventHandler<TElement>>): this;
|
||||
on(events: ModalEvent, handler: JQuery.EventHandlerBase<TElement, ModalEventHandler<TElement>>): this;
|
||||
on(events: TapEvent, handler: JQuery.EventHandlerBase<TElement, TapEventHandler<TElement>>): this;
|
||||
on(events:
|
||||
AlertEvent | CollapseEvent | DropdownEvent | ModalEvent |
|
||||
PopoverEvent | ScrollspyEvent | TooltipEvent,
|
||||
handler: JQuery.EventHandler<TElement>): this;
|
||||
on(
|
||||
events: AlertEvent | CollapseEvent | PopoverEvent | ScrollspyEvent | TooltipEvent,
|
||||
handler: JQuery.EventHandler<TElement>
|
||||
): this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,3 +23,19 @@ const myObject = { x: 1, y: 2 };
|
||||
log.info({ obj: myObject }, 'This is my object:');
|
||||
|
||||
new bunyan.ConsoleFormattedStream({ logByLevel: true });
|
||||
|
||||
const style = {
|
||||
levels: {
|
||||
trace: 'color: DeepPink',
|
||||
debug: 'color: GoldenRod',
|
||||
info: 'color: DarkTurquoise',
|
||||
warn: 'color: Purple',
|
||||
error: 'color: Crimson',
|
||||
fatal: 'color: Black',
|
||||
},
|
||||
def: 'color: DimGray',
|
||||
msg: 'color: SteelBlue',
|
||||
src: 'color: DimGray; font-style: italic; font-size: 0.9em',
|
||||
};
|
||||
|
||||
new bunyan.ConsoleFormattedStream({ css: style });
|
||||
|
||||
25
types/browser-bunyan/index.d.ts
vendored
25
types/browser-bunyan/index.d.ts
vendored
@ -10,17 +10,30 @@
|
||||
import * as bunyan from 'bunyan';
|
||||
|
||||
declare namespace BrowserBunyan {
|
||||
interface ConsoleFormattedStreamLevelStyle {
|
||||
trace: string;
|
||||
debug: string;
|
||||
info: string;
|
||||
warn: string;
|
||||
error: string;
|
||||
fatal: string;
|
||||
}
|
||||
|
||||
interface ConsoleFormattedStreamStyle {
|
||||
levels: Partial<ConsoleFormattedStreamLevelStyle>;
|
||||
def: string;
|
||||
msg: string;
|
||||
src: string;
|
||||
}
|
||||
|
||||
interface ConsoleFormattedStreamOptions {
|
||||
logByLevel?: boolean;
|
||||
css?: Partial<ConsoleFormattedStreamStyle>;
|
||||
}
|
||||
|
||||
interface ConsoleFormattedStream {
|
||||
new(options?: ConsoleFormattedStreamOptions): NodeJS.WritableStream;
|
||||
}
|
||||
type ConsoleFormattedStream = new(options?: ConsoleFormattedStreamOptions) => NodeJS.WritableStream;
|
||||
|
||||
interface ConsoleRawStream {
|
||||
new(options?: ConsoleFormattedStreamOptions): NodeJS.WritableStream;
|
||||
}
|
||||
type ConsoleRawStream = new(options?: ConsoleFormattedStreamOptions) => NodeJS.WritableStream;
|
||||
}
|
||||
|
||||
type BrowserBunyan = typeof bunyan & {
|
||||
|
||||
32
types/chai-almost/chai-almost-tests.ts
Normal file
32
types/chai-almost/chai-almost-tests.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import { expect, use } from 'chai';
|
||||
import chaiAlmost = require('chai-almost');
|
||||
|
||||
// Normally, call use(chaiAlmost(...)) only once, this is just to check that TypeScript correctly handles both.
|
||||
use(chaiAlmost(0.01)); // custom tolerance 0.01
|
||||
use(chaiAlmost()); // default tolerance 1e-6 (= 0.000001)
|
||||
|
||||
expect(1.0000001).to.almost.equal(1);
|
||||
expect(1.0000001).to.be.almost(1);
|
||||
expect(1.0000001).almost.equals(1);
|
||||
|
||||
expect(1.0001).to.not.almost.equal(1);
|
||||
expect(1.0001).to.not.be.almost(1);
|
||||
expect(1.0001).not.almost.equals(1);
|
||||
|
||||
// Note the "not" in the following.
|
||||
// Use deep equality checks to compare values inside of arrays and objects.
|
||||
expect([1]).to.not.be.almost([1]);
|
||||
|
||||
const arrA = [1, [{ num: 2, name: "Douglas" }, 3]];
|
||||
const arrB = [1.0000001, [{ num: 1.9999999, name: "Douglas" }, 2.9999996]];
|
||||
|
||||
expect(arrA).to.deep.almost.equal(arrB);
|
||||
expect(arrA).to.be.deep.almost(arrB);
|
||||
expect(arrA).deep.almost.equals(arrB);
|
||||
expect(arrA).to.almost.eql(arrB);
|
||||
expect(arrA).to.be.almost.eql(arrB);
|
||||
expect(arrA).almost.eqls(arrB);
|
||||
|
||||
expect(1.001).to.be.almost(1, 0.01);
|
||||
expect(1.001).to.not.be.almost(1, 0.0001);
|
||||
expect([42]).to.be.deep.almost([42.3145], 0.5);
|
||||
33
types/chai-almost/index.d.ts
vendored
Normal file
33
types/chai-almost/index.d.ts
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
// Type definitions for chai-almost 1.0
|
||||
// Project: https://github.com/nmuldavin/chai-almost#readme
|
||||
// Definitions by: Lennard Schulz <https://github.com/kclnn>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="chai" />
|
||||
|
||||
declare global {
|
||||
namespace Chai {
|
||||
interface Assertion {
|
||||
almost: ChaiAlmost.Almost;
|
||||
}
|
||||
interface Deep {
|
||||
almost: ChaiAlmost.DeepAlmost;
|
||||
}
|
||||
|
||||
namespace ChaiAlmost {
|
||||
interface DeepAlmost {
|
||||
(value: any, toleranceOverride?: number): Assertion;
|
||||
equal: Equal;
|
||||
equals: Equal;
|
||||
eq: Equal;
|
||||
}
|
||||
interface Almost extends DeepAlmost {
|
||||
eql: Equal;
|
||||
eqls: Equal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare function chaiAlmost(tolerance?: number): ((chai: any, utils: any) => void);
|
||||
export = chaiAlmost;
|
||||
23
types/chai-almost/tsconfig.json
Normal file
23
types/chai-almost/tsconfig.json
Normal file
@ -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",
|
||||
"chai-almost-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/chai-almost/tslint.json
Normal file
1
types/chai-almost/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
21
types/chalk-animation/chalk-animation-tests.ts
Normal file
21
types/chalk-animation/chalk-animation-tests.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import * as chalkAnimation from 'chalk-animation';
|
||||
|
||||
const rainbow: chalkAnimation.Animation = chalkAnimation.rainbow('Lorem ipsum dolor sit amet');
|
||||
chalkAnimation.rainbow('Lorem ipsum dolor sit amet', 2);
|
||||
chalkAnimation.pulse('Lorem ipsum dolor sit amet');
|
||||
chalkAnimation.pulse('Lorem ipsum dolor sit amet', 2);
|
||||
chalkAnimation.glitch('Lorem ipsum dolor sit amet');
|
||||
chalkAnimation.glitch('Lorem ipsum dolor sit amet', 2);
|
||||
chalkAnimation.radar('Lorem ipsum dolor sit amet');
|
||||
chalkAnimation.radar('Lorem ipsum dolor sit amet', 2);
|
||||
chalkAnimation.neon('Lorem ipsum dolor sit amet');
|
||||
chalkAnimation.neon('Lorem ipsum dolor sit amet', 2);
|
||||
chalkAnimation.karaoke('Lorem ipsum dolor sit amet');
|
||||
chalkAnimation.karaoke('Lorem ipsum dolor sit amet', 2);
|
||||
|
||||
rainbow.stop();
|
||||
rainbow.start();
|
||||
rainbow.replace('.');
|
||||
rainbow.render();
|
||||
// $ExpectType string
|
||||
rainbow.frame();
|
||||
21
types/chalk-animation/index.d.ts
vendored
Normal file
21
types/chalk-animation/index.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Type definitions for chalk-animation 1.6
|
||||
// Project: https://github.com/bokub/chalk-animation
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export const rainbow: AnimationFn;
|
||||
export const pulse: AnimationFn;
|
||||
export const glitch: AnimationFn;
|
||||
export const radar: AnimationFn;
|
||||
export const neon: AnimationFn;
|
||||
export const karaoke: AnimationFn;
|
||||
|
||||
export type AnimationFn = (text: string, speed?: number) => Animation;
|
||||
|
||||
export interface Animation {
|
||||
start(): void;
|
||||
stop(): void;
|
||||
replace(text: string): void;
|
||||
render(): void;
|
||||
frame(): string;
|
||||
}
|
||||
23
types/chalk-animation/tsconfig.json
Normal file
23
types/chalk-animation/tsconfig.json
Normal file
@ -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",
|
||||
"chalk-animation-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/chalk-animation/tslint.json
Normal file
1
types/chalk-animation/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@ -71,7 +71,11 @@ const chart: Chart = new Chart(ctx, {
|
||||
padding: 40
|
||||
}
|
||||
},
|
||||
devicePixelRatio: 2
|
||||
devicePixelRatio: 2,
|
||||
plugins: {
|
||||
bar: false,
|
||||
foo: {}
|
||||
}
|
||||
}
|
||||
});
|
||||
chart.update();
|
||||
|
||||
9
types/chart.js/index.d.ts
vendored
9
types/chart.js/index.d.ts
vendored
@ -284,8 +284,7 @@ declare namespace Chart {
|
||||
circumference?: number;
|
||||
rotation?: number;
|
||||
devicePixelRatio?: number;
|
||||
// Plugins can require any options
|
||||
plugins?: { [pluginId: string]: any };
|
||||
plugins?: ChartPluginsOptions;
|
||||
}
|
||||
|
||||
interface ChartFontOptions {
|
||||
@ -367,6 +366,12 @@ declare namespace Chart {
|
||||
borderWidth?: number;
|
||||
}
|
||||
|
||||
// NOTE: declare plugin options as interface instead of inline '{ [plugin: string]: any }'
|
||||
// to allow module augmentation in case some plugins want to strictly type their options.
|
||||
interface ChartPluginsOptions {
|
||||
[pluginId: string]: any;
|
||||
}
|
||||
|
||||
interface ChartTooltipsStaticConfiguration {
|
||||
positioners: { [mode: string]: ChartTooltipPositioner };
|
||||
}
|
||||
|
||||
@ -110,6 +110,9 @@ function test_color() {
|
||||
chroma('teal').alpha(0.5).css();
|
||||
chroma('teal').css('hsl');
|
||||
chroma('orange').rgb();
|
||||
chroma('orange').rgb(true);
|
||||
chroma('orange').rgba();
|
||||
chroma('orange').rgba(true);
|
||||
|
||||
chroma('#000000').num();
|
||||
chroma('#0000ff').num();
|
||||
|
||||
112
types/chroma-js/index.d.ts
vendored
112
types/chroma-js/index.d.ts
vendored
@ -21,6 +21,8 @@ declare namespace chroma {
|
||||
gl: [number, number, number, number];
|
||||
}
|
||||
|
||||
type InterpolationMode = "rgb" | "hsl" | "hsv" | "hsi" | "lab" | "lch" | "hcl";
|
||||
|
||||
interface ChromaStatic {
|
||||
/**
|
||||
* Creates a color from a string representation (as supported in CSS).
|
||||
@ -209,7 +211,7 @@ declare namespace chroma {
|
||||
css(col: string): Color;
|
||||
}
|
||||
|
||||
type Color = {
|
||||
interface Color {
|
||||
/**
|
||||
* Get and set the color opacity.
|
||||
*/
|
||||
@ -300,9 +302,109 @@ declare namespace chroma {
|
||||
* chroma('#ff0000').num() === 16711680
|
||||
*/
|
||||
num(): number;
|
||||
} & {
|
||||
[K in keyof ColorSpaces]: () => ColorSpaces[K];
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an array with the red, green, and blue component, each as
|
||||
* number within the range 0..255. Chroma internally stores RGB
|
||||
* channels as floats but rounds the numbers before returning them.
|
||||
* You can pass false to prevent the rounding.
|
||||
*
|
||||
* @example
|
||||
* chroma('orange').rgb() === [255,165,0]
|
||||
* chroma('orange').darken().rgb() === [198,118,0]
|
||||
* chroma('orange').darken().rgb(false) === [198.05,118.11,0]
|
||||
*/
|
||||
rgb: (round?: boolean) => ColorSpaces['rgb'];
|
||||
|
||||
/**
|
||||
* Just like color.rgb but adds the alpha channel to the returned array.
|
||||
*
|
||||
* @example
|
||||
* chroma('orange').rgba() === [255,165,0,1]
|
||||
* chroma('hsla(20, 100%, 40%, 0.5)').rgba() === [204,68,0,0.5]
|
||||
*/
|
||||
rgba: (round?: boolean) => ColorSpaces['rgba'];
|
||||
|
||||
/**
|
||||
* Returns an array with the `hue`, `saturation`, and `lightness`
|
||||
* component. Hue is the color angle in degree (`0..360`), saturation
|
||||
* and lightness are within `0..1`. Note that for hue-less colors
|
||||
* (black, white, and grays), the hue component will be NaN.
|
||||
*
|
||||
* @example
|
||||
* chroma('orange').hsl() === [38.82,1,0.5,1]
|
||||
* chroma('white').hsl() === [NaN,0,1,1]
|
||||
*/
|
||||
hsl: () => ColorSpaces['hsl'];
|
||||
|
||||
/**
|
||||
* Returns an array with the `hue`, `saturation`, and `value`
|
||||
* components. Hue is the color angle in degree (`0..360`),
|
||||
* saturation and value are within `0..1`. Note that for hue-less
|
||||
* colors (black, white, and grays), the hue component will be NaN.
|
||||
*
|
||||
* @example
|
||||
* chroma('orange').hsv() === [38.82,1,1]
|
||||
* chroma('white').hsv() === [NaN,0,1]
|
||||
*/
|
||||
hsv: () => ColorSpaces['hsv'];
|
||||
|
||||
/**
|
||||
* Returns an array with the `hue`, `saturation`, and `intensity`
|
||||
* components, each as number between 0 and 255. Note that for hue-less
|
||||
* colors (black, white, and grays), the hue component will be NaN.
|
||||
*
|
||||
* @example
|
||||
* chroma('orange').hsi() === [39.64,1,0.55]
|
||||
* chroma('white').hsi() === [NaN,0,1]
|
||||
*/
|
||||
hsi: () => ColorSpaces['hsi'];
|
||||
|
||||
/**
|
||||
* Returns an array with the **L**, **a**, and **b** components.
|
||||
*
|
||||
* @example
|
||||
* chroma('orange').lab() === [74.94,23.93,78.95]
|
||||
*/
|
||||
lab: () => ColorSpaces['lab'];
|
||||
|
||||
/**
|
||||
* Returns an array with the **Lightness**, **chroma**, and **hue**
|
||||
* components.
|
||||
*
|
||||
* @example
|
||||
* chroma('skyblue').lch() === [79.21,25.94,235.11]
|
||||
*/
|
||||
lch: () => ColorSpaces['lch'];
|
||||
|
||||
/**
|
||||
* Alias of [lch](#color-lch), but with the components in reverse
|
||||
* order.
|
||||
*
|
||||
* @example
|
||||
* chroma('skyblue').hcl() === [235.11,25.94,79.21]
|
||||
*/
|
||||
hcl: () => ColorSpaces['hcl'];
|
||||
|
||||
/**
|
||||
* Just like color.rgb but adds the alpha channel to the returned
|
||||
* array.
|
||||
*
|
||||
* @example
|
||||
* chroma('orange').rgba() === [255,165,0,1]
|
||||
* chroma('hsla(20, 100%, 40%, 0.5)').rgba() === [204,68,0,0.5]
|
||||
*/
|
||||
cmyk: () => ColorSpaces['cmyk'];
|
||||
|
||||
/**
|
||||
* Returns an array with the cyan, magenta, yellow, and key (black)
|
||||
* components, each as a normalized value between 0 and 1.
|
||||
*
|
||||
* @example
|
||||
* chroma('33cc00').gl() === [0.2,0.8,0,1]
|
||||
*/
|
||||
gl: () => ColorSpaces['gl'];
|
||||
}
|
||||
|
||||
interface Scale<OutType = Color> {
|
||||
(c: string[]): Scale;
|
||||
@ -311,7 +413,7 @@ declare namespace chroma {
|
||||
|
||||
domain(d?: number[], n?: number, mode?: string): this;
|
||||
|
||||
mode(mode: keyof ColorSpaces): this;
|
||||
mode(mode: InterpolationMode): this;
|
||||
|
||||
gamma(g: number): this;
|
||||
|
||||
|
||||
2
types/chrome-apps/index.d.ts
vendored
2
types/chrome-apps/index.d.ts
vendored
@ -13274,7 +13274,7 @@ interface HTMLElement {
|
||||
/**
|
||||
* ❗ Unprefixed version are not available as of Chrome 68, in Chrome apps ❗
|
||||
*/
|
||||
requestFullscreen(): void;
|
||||
requestFullscreen(): Promise<void>;
|
||||
/**
|
||||
* ❗ Unprefixed version are not available as of Chrome 68, in Chrome apps ❗
|
||||
*/
|
||||
|
||||
@ -917,7 +917,7 @@ chrome.app.runtime.onLaunched.addListener(() => {
|
||||
|
||||
// #region chrome.gcm
|
||||
|
||||
const gcmMessage = <chrome.gcm.OutgoingMessage>{};
|
||||
const gcmMessage = {} as chrome.gcm.OutgoingMessage;
|
||||
gcmMessage.data = {
|
||||
/*goog: 'any', should not be allowed, and it is not :) */
|
||||
test: true
|
||||
@ -1078,8 +1078,7 @@ chrome.networking.config.finishAuthentication(filter.HexSSID || '', 'rejected');
|
||||
// #region chrome.networking.onc
|
||||
|
||||
const TLSFormatExample = {
|
||||
NetworkConfigurations: <chrome.networking.onc.NetworkConfigProperties>
|
||||
{
|
||||
NetworkConfigurations: {
|
||||
GUID: '{00f79111-51e0-e6e0-76b3b55450d80a1b}',
|
||||
Name: 'MyTTLSNetwork',
|
||||
Type: 'WiFi',
|
||||
@ -1103,7 +1102,7 @@ const TLSFormatExample = {
|
||||
'SSID': 'MyTTLSNetwork',
|
||||
'Security': 'WPA-EAP'
|
||||
}
|
||||
}
|
||||
} as chrome.networking.onc.NetworkConfigProperties
|
||||
}
|
||||
|
||||
chrome.networking.onc.getNetworks({ 'networkType': 'All' }, (networkList) => {
|
||||
@ -2012,5 +2011,8 @@ appview.connect('id of app');
|
||||
document.appendChild(appview);
|
||||
//#endregion
|
||||
|
||||
// #region HTMLElement correctly subtypes Element in TS3.1.
|
||||
const htmlElement = document.querySelector('zzzzzz') as HTMLElement;
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
155
types/chrome/index.d.ts
vendored
155
types/chrome/index.d.ts
vendored
@ -762,6 +762,9 @@ declare namespace chrome.commands {
|
||||
* Permissions: "contentSettings"
|
||||
*/
|
||||
declare namespace chrome.contentSettings {
|
||||
|
||||
type ScopeEnum = 'regular' | 'incognito_session_only';
|
||||
|
||||
export interface ClearDetails {
|
||||
/**
|
||||
* Optional.
|
||||
@ -770,7 +773,7 @@ declare namespace chrome.contentSettings {
|
||||
* * regular: setting for regular profile (which is inherited by the incognito profile if not overridden elsewhere),
|
||||
* * incognito_session_only: setting for incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular settings).
|
||||
*/
|
||||
scope?: string;
|
||||
scope?: ScopeEnum;
|
||||
}
|
||||
|
||||
export interface SetDetails {
|
||||
@ -781,11 +784,63 @@ declare namespace chrome.contentSettings {
|
||||
/** Optional. The pattern for the secondary URL. Defaults to matching all URLs. For details on the format of a pattern, see Content Setting Patterns. */
|
||||
secondaryPattern?: string;
|
||||
/** Optional. Where to set the setting (default: regular). */
|
||||
scope?: string;
|
||||
scope?: ScopeEnum;
|
||||
/** The pattern for the primary URL. For details on the format of a pattern, see Content Setting Patterns. */
|
||||
primaryPattern: string;
|
||||
}
|
||||
|
||||
export interface CookieSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'session_only';
|
||||
}
|
||||
|
||||
export interface ImagesSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block';
|
||||
}
|
||||
|
||||
export interface JavascriptSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block';
|
||||
}
|
||||
|
||||
export interface LocationSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'ask';
|
||||
}
|
||||
|
||||
export interface PluginsSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'detect_important_content';
|
||||
}
|
||||
|
||||
export interface PopupsSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block';
|
||||
}
|
||||
|
||||
export interface NotificationsSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'ask';
|
||||
}
|
||||
|
||||
export interface FullscreenSetDetails extends SetDetails {
|
||||
setting: 'allow';
|
||||
}
|
||||
|
||||
export interface MouselockSetDetails extends SetDetails {
|
||||
setting: 'allow';
|
||||
}
|
||||
|
||||
export interface MicrophoneSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'ask';
|
||||
}
|
||||
|
||||
export interface CameraSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'ask';
|
||||
}
|
||||
|
||||
export interface PpapiBrokerSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'ask';
|
||||
}
|
||||
|
||||
export interface MultipleAutomaticDownloadsSetDetails extends SetDetails {
|
||||
setting: 'allow' | 'block' | 'ask';
|
||||
}
|
||||
|
||||
export interface GetDetails {
|
||||
/** Optional. The secondary URL for which the content setting should be retrieved. Defaults to the primary URL. Note that the meaning of a secondary URL depends on the content type, and not all content types use secondary URLs. */
|
||||
secondaryUrl?: string;
|
||||
@ -829,6 +884,58 @@ declare namespace chrome.contentSettings {
|
||||
get(details: GetDetails, callback: (details: ReturnedDetails) => void): void;
|
||||
}
|
||||
|
||||
export interface CookieContentSetting extends ContentSetting{
|
||||
set(details: CookieSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface PopupsContentSetting extends ContentSetting{
|
||||
set(details: PopupsSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface JavascriptContentSetting extends ContentSetting{
|
||||
set(details: JavascriptSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface NotificationsContentSetting extends ContentSetting{
|
||||
set(details: NotificationsSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface PluginsContentSetting extends ContentSetting{
|
||||
set(details: PluginsSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface ImagesContentSetting extends ContentSetting{
|
||||
set(details: ImagesSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface LocationContentSetting extends ContentSetting{
|
||||
set(details: LocationSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface FullscreenContentSetting extends ContentSetting{
|
||||
set(details: FullscreenSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface MouselockContentSetting extends ContentSetting{
|
||||
set(details: MouselockSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface MicrophoneContentSetting extends ContentSetting{
|
||||
set(details: MicrophoneSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface CameraContentSetting extends ContentSetting{
|
||||
set(details: CameraSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface PpapiBrokerContentSetting extends ContentSetting{
|
||||
set(details: PpapiBrokerSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface MultipleAutomaticDownloadsContentSetting extends ContentSetting{
|
||||
set(details: MultipleAutomaticDownloadsSetDetails, callback?: () => void): void;
|
||||
}
|
||||
|
||||
/** The only content type using resource identifiers is contentSettings.plugins. For more information, see Resource Identifiers. */
|
||||
export interface ResourceIdentifier {
|
||||
/** The resource identifier for the given content type. */
|
||||
@ -845,7 +952,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is allow.
|
||||
* The primary URL is the URL representing the cookie origin. The secondary URL is the URL of the top-level frame.
|
||||
*/
|
||||
export var cookies: ContentSetting;
|
||||
export var cookies: CookieContentSetting;
|
||||
/**
|
||||
* Whether to allow sites to show pop-ups. One of
|
||||
* allow: Allow sites to show pop-ups,
|
||||
@ -853,7 +960,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is block.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is not used.
|
||||
*/
|
||||
export var popups: ContentSetting;
|
||||
export var popups: PopupsContentSetting;
|
||||
/**
|
||||
* Whether to run JavaScript. One of
|
||||
* allow: Run JavaScript,
|
||||
@ -861,7 +968,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is allow.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is not used.
|
||||
*/
|
||||
export var javascript: ContentSetting;
|
||||
export var javascript: JavascriptContentSetting;
|
||||
/**
|
||||
* Whether to allow sites to show desktop notifications. One of
|
||||
* allow: Allow sites to show desktop notifications,
|
||||
@ -870,7 +977,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the document which wants to show the notification. The secondary URL is not used.
|
||||
*/
|
||||
export var notifications: ContentSetting;
|
||||
export var notifications: NotificationsContentSetting;
|
||||
/**
|
||||
* Whether to run plugins. One of
|
||||
* allow: Run plugins automatically,
|
||||
@ -879,7 +986,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is allow.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is not used.
|
||||
*/
|
||||
export var plugins: ContentSetting;
|
||||
export var plugins: PluginsContentSetting;
|
||||
/**
|
||||
* Whether to show images. One of
|
||||
* allow: Show images,
|
||||
@ -887,7 +994,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is allow.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is the URL of the image.
|
||||
*/
|
||||
export var images: ContentSetting;
|
||||
export var images: ImagesContentSetting;
|
||||
/**
|
||||
* Since Chrome 42.
|
||||
* Whether to allow Geolocation. One of
|
||||
@ -897,7 +1004,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the document which requested location data. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL).
|
||||
*/
|
||||
export var location: ContentSetting;
|
||||
export var location: LocationContentSetting;
|
||||
/**
|
||||
* Since Chrome 42.
|
||||
* Whether to allow sites to toggle the fullscreen mode. One of
|
||||
@ -906,7 +1013,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the document which requested to toggle the fullscreen mode. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL).
|
||||
*/
|
||||
export var fullscreen: ContentSetting;
|
||||
export var fullscreen: FullscreenContentSetting;
|
||||
/**
|
||||
* Since Chrome 42.
|
||||
* Whether to allow sites to disable the mouse cursor. One of
|
||||
@ -916,7 +1023,29 @@ declare namespace chrome.contentSettings {
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is not used.
|
||||
*/
|
||||
export var mouselock: ContentSetting;
|
||||
export var mouselock: MouselockContentSetting;
|
||||
/**
|
||||
* Since Chrome 46.
|
||||
* Whether to allow sites to access the microphone. One of
|
||||
* allow: Allow sites to access the microphone,
|
||||
* block: Don't allow sites to access the microphone,
|
||||
* ask: Ask when a site wants to access the microphone.
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the document which requested microphone access. The secondary URL is not used.
|
||||
* NOTE: The 'allow' setting is not valid if both patterns are ''.
|
||||
*/
|
||||
export var microphone: MicrophoneContentSetting;
|
||||
/**
|
||||
* Since Chrome 46.
|
||||
* Whether to allow sites to access the camera. One of
|
||||
* allow: Allow sites to access the camera,
|
||||
* block: Don't allow sites to access the camera,
|
||||
* ask: Ask when a site wants to access the camera.
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the document which requested camera access. The secondary URL is not used.
|
||||
* NOTE: The 'allow' setting is not valid if both patterns are ''.
|
||||
*/
|
||||
export var camera: CameraContentSetting;
|
||||
/**
|
||||
* Since Chrome 42.
|
||||
* Whether to allow sites to run plugins unsandboxed. One of
|
||||
@ -926,7 +1055,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is not used.
|
||||
*/
|
||||
export var unsandboxedPlugins: ContentSetting;
|
||||
export var unsandboxedPlugins: PpapiBrokerContentSetting;
|
||||
/**
|
||||
* Since Chrome 42.
|
||||
* Whether to allow sites to download multiple files automatically. One of
|
||||
@ -936,7 +1065,7 @@ declare namespace chrome.contentSettings {
|
||||
* Default is ask.
|
||||
* The primary URL is the URL of the top-level frame. The secondary URL is not used.
|
||||
*/
|
||||
export var automaticDownloads: ContentSetting;
|
||||
export var automaticDownloads: MultipleAutomaticDownloadsContentSetting;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
@ -369,6 +369,7 @@ function test_dom_walker() {
|
||||
node = walker.lastForward();
|
||||
node = walker.next();
|
||||
node = walker.previous();
|
||||
isSomething = walker.guard(node, true);
|
||||
walker.reset();
|
||||
|
||||
isSomething = CKEDITOR.dom.walker.blockBoundary({ div: 1 })(node);
|
||||
@ -485,7 +486,7 @@ function test_dialog() {
|
||||
{
|
||||
id: 'tab-basic',
|
||||
label: 'Basic Settings',
|
||||
elements: <any[]> []
|
||||
elements: [] as any []
|
||||
},
|
||||
{
|
||||
id: 'tab-adv',
|
||||
|
||||
2
types/ckeditor/index.d.ts
vendored
2
types/ckeditor/index.d.ts
vendored
@ -498,7 +498,7 @@ declare namespace CKEDITOR {
|
||||
|
||||
class walker {
|
||||
evaluator: (node: node) => boolean;
|
||||
guard: (node: node) => boolean;
|
||||
guard: (node: node, movingOut?: boolean) => boolean;
|
||||
|
||||
static validEmptyBlockContainers: { [key: string]: any };
|
||||
|
||||
|
||||
328
types/ckeditor__ckeditor5-core/ckeditor__ckeditor5-core-tests.ts
Normal file
328
types/ckeditor__ckeditor5-core/ckeditor__ckeditor5-core-tests.ts
Normal file
@ -0,0 +1,328 @@
|
||||
import * as utils from "ckeditor__ckeditor5-utils";
|
||||
import * as core from "ckeditor__ckeditor5-core";
|
||||
import * as engine from "ckeditor__ckeditor5-engine";
|
||||
|
||||
declare let bool: boolean;
|
||||
declare let command: core.Command;
|
||||
declare let commandCollection: core.CommandCollection;
|
||||
declare let commands: core.Command[];
|
||||
declare let componentFactory: core.ComponentFactory;
|
||||
declare let config: utils.Config;
|
||||
declare let conversion: engine.conversion.Conversion;
|
||||
declare let dataController: engine.controller.DataController;
|
||||
declare let editingController: engine.controller.EditingController;
|
||||
declare let editingKeystrokeHandler: core.EditingKeystrokeHandler;
|
||||
declare let editor: core.editor.Editor;
|
||||
declare let focusTracker: utils.FocusTracker;
|
||||
declare let htmlElement: HTMLElement;
|
||||
declare let keystrokes: core.EditingKeystrokeHandler;
|
||||
declare let locale: utils.Locale;
|
||||
declare let model: engine.model.Model;
|
||||
declare let num: number;
|
||||
declare let pendingActions: core.PendingActions;
|
||||
declare let plugin: core.Plugin;
|
||||
declare let pluginCollection: core.PluginCollection<any>;
|
||||
declare let pluginCollectionStr: core.PluginCollection<core.Plugin<string>>;
|
||||
declare let pluginStr: core.Plugin<string>;
|
||||
declare let myPlugin: MyPlugin;
|
||||
declare let myPluginMaybe: MyPlugin | undefined;
|
||||
declare let myPlugins: MyPlugin[];
|
||||
declare let str: string;
|
||||
declare let strOrUndef: string | undefined;
|
||||
declare let strs: string[];
|
||||
declare let ui: core.editor.EditorUI;
|
||||
declare let undef: undefined;
|
||||
declare let view: core.EditorUIView;
|
||||
|
||||
class MyPlugin extends core.Plugin {
|
||||
constructor(editor: core.editor.Editor) {
|
||||
super(editor);
|
||||
}
|
||||
|
||||
static get pluginName() {
|
||||
return "A";
|
||||
}
|
||||
|
||||
myMethod() {
|
||||
return "this is MyPlugin method";
|
||||
}
|
||||
}
|
||||
|
||||
class SomeCommand extends core.Command {
|
||||
execute() {}
|
||||
}
|
||||
|
||||
// core/editor/utils/dataapimixin =============================================
|
||||
|
||||
class DataApiEditor extends core.editor.Editor implements core.editor.utils.DataApi {
|
||||
// mixin by DataApiMixin
|
||||
getData: () => string;
|
||||
setData: (data: string) => void;
|
||||
}
|
||||
utils.mix(DataApiEditor, core.editor.utils.DataApiMixin);
|
||||
const dataApiEditor = new DataApiEditor();
|
||||
|
||||
dataApiEditor.setData("foo");
|
||||
str = dataApiEditor.getData();
|
||||
|
||||
// core/editor/utils/elementapimixin ==========================================
|
||||
|
||||
class ElementApiEditor extends core.editor.Editor implements core.editor.utils.ElementApi {
|
||||
// mixin by ElementApiMixin
|
||||
readonly sourceElement: HTMLElement;
|
||||
updateSourceElement: () => void;
|
||||
}
|
||||
utils.mix(ElementApiEditor, core.editor.utils.ElementApiMixin);
|
||||
const elementApiEditor = new ElementApiEditor();
|
||||
|
||||
htmlElement = elementApiEditor.sourceElement;
|
||||
elementApiEditor.updateSourceElement();
|
||||
|
||||
// core/editor/utils/attachtoform =============================================
|
||||
|
||||
// $ExpectError
|
||||
core.editor.utils.attachToForm(editor);
|
||||
core.editor.utils.attachToForm(elementApiEditor);
|
||||
|
||||
// core/editor/editor =========================================================
|
||||
|
||||
commandCollection = editor.commands;
|
||||
config = editor.config;
|
||||
editingController = editor.editing;
|
||||
conversion = editor.conversion;
|
||||
dataController = editor.data;
|
||||
editor.isReadOnly = bool;
|
||||
editingKeystrokeHandler = editor.keystrokes;
|
||||
locale = editor.locale;
|
||||
model = editor.model;
|
||||
pluginCollection = editor.plugins;
|
||||
|
||||
if (editor.state === "initializing") {
|
||||
console.log("new Editor()");
|
||||
} else if (editor.state === "ready") {
|
||||
console.log("Editor.create()");
|
||||
} else if (editor.state === "destroyed") {
|
||||
console.log("editor.destroy");
|
||||
} else {
|
||||
const n: never = editor.state;
|
||||
}
|
||||
|
||||
editor.state = "ready";
|
||||
|
||||
core.editor.Editor.builtinPlugins = [plugin, pluginStr, plugin];
|
||||
const plugins: Array<core.Plugin<any>> = core.editor.Editor.builtinPlugins;
|
||||
|
||||
core.editor.Editor.defaultConfig = {
|
||||
foo: {
|
||||
a: 1,
|
||||
b: 2
|
||||
}
|
||||
};
|
||||
|
||||
editor = new core.editor.Editor();
|
||||
editor = new core.editor.Editor({language: "pl"});
|
||||
|
||||
editor.destroy();
|
||||
editor.destroy().then(() => {
|
||||
console.log(`${editor.state} == destroyed`);
|
||||
});
|
||||
|
||||
editor.execute("someCommand");
|
||||
editor.execute("someCommand2", "arg1", 2);
|
||||
|
||||
editor.initPlugins();
|
||||
editor.initPlugins().then(() => {
|
||||
console.log(`init ${Array.from(editor.plugins).length} plugins`);
|
||||
});
|
||||
|
||||
locale.t = editor.t;
|
||||
str = editor.t("Label");
|
||||
str = editor.t('Created file "%0" in %1ms.', ["fileName", "100"]);
|
||||
|
||||
// core/editor/editorui =======================================================
|
||||
|
||||
componentFactory = ui.componentFactory;
|
||||
editor = ui.editor;
|
||||
focusTracker = ui.focusTracker;
|
||||
view = ui.view;
|
||||
|
||||
ui = new core.editor.EditorUI(editor, view);
|
||||
ui.destroy();
|
||||
ui.update();
|
||||
|
||||
// core/editor/editorwithui ===================================================
|
||||
|
||||
declare let ewui: core.editor.EditorWithUI;
|
||||
htmlElement = ewui.element!;
|
||||
ui = ewui.ui;
|
||||
|
||||
// core/command ===============================================================
|
||||
|
||||
editor = command.editor;
|
||||
|
||||
bool = command.isEnabled;
|
||||
|
||||
undef = command.value;
|
||||
strOrUndef = new core.Command<string>(editor).value;
|
||||
|
||||
command = new core.Command(editor);
|
||||
|
||||
command.destroy();
|
||||
|
||||
command.execute();
|
||||
|
||||
command.refresh();
|
||||
|
||||
// core/commandcollection =====================================================
|
||||
|
||||
commandCollection = new core.CommandCollection();
|
||||
|
||||
const collectionsPairs = Array.from(commandCollection);
|
||||
const collectionsPair = collectionsPairs[0];
|
||||
str = collectionsPair[0];
|
||||
command = collectionsPair[1];
|
||||
|
||||
commandCollection.add("foo", new SomeCommand(editor));
|
||||
|
||||
command = commandCollection.commands().next().value;
|
||||
commands = Array.from(commandCollection.commands());
|
||||
|
||||
commandCollection.destroy();
|
||||
|
||||
commandCollection.execute("foo");
|
||||
commandCollection.execute("bar", 1, "param");
|
||||
|
||||
command = commandCollection.get("foo");
|
||||
|
||||
str = commandCollection.names().next().value;
|
||||
strs = Array.from(commandCollection.names());
|
||||
|
||||
// core/editingkeystrokehandler ===============================================
|
||||
|
||||
keystrokes = new core.EditingKeystrokeHandler(editor);
|
||||
|
||||
editor = keystrokes.editor;
|
||||
|
||||
keystrokes.press({keyCode: 123});
|
||||
|
||||
keystrokes.set("Ctrl+A", "foo");
|
||||
keystrokes.set(["shift", "33"], "foo");
|
||||
keystrokes.set(["ctrl", "A"], "foo", {priority: 10});
|
||||
keystrokes.set(["ctrl", "A"], "foo", {priority: "high"});
|
||||
keystrokes.set(["ctrl", "A"], () => console.log("key"));
|
||||
keystrokes.set(["ctrl", "A"], (keyEvtData, cancel) => {
|
||||
console.log(keyEvtData.keyCode);
|
||||
cancel();
|
||||
});
|
||||
|
||||
// core/pendingactions ========================================================
|
||||
|
||||
pendingActions = new core.PendingActions(editor);
|
||||
|
||||
str = core.PendingActions.pluginName;
|
||||
|
||||
const firstAction = pendingActions.first;
|
||||
|
||||
bool = pendingActions.hasAny;
|
||||
|
||||
strs = Array.from(pendingActions, action => action.message);
|
||||
|
||||
const action1 = pendingActions.add("Action 1");
|
||||
|
||||
pendingActions.remove(action1);
|
||||
|
||||
firstAction!.fire("I'm an Observable with a message");
|
||||
str = firstAction!.message;
|
||||
str = action1.message;
|
||||
|
||||
// core/plugin ================================================================
|
||||
|
||||
class MyPluginMini extends core.Plugin {
|
||||
constructor(editor: core.editor.Editor) {
|
||||
super(editor);
|
||||
}
|
||||
}
|
||||
|
||||
class MyPluginAll extends core.Plugin<string> {
|
||||
constructor(editor: core.editor.Editor) {
|
||||
super(editor);
|
||||
}
|
||||
|
||||
static get pluginName() {
|
||||
return "All";
|
||||
}
|
||||
|
||||
static get requires() {
|
||||
return [MyPlugin, MyPluginMini];
|
||||
}
|
||||
|
||||
afterInit() {return Math.random() ? null : Promise.resolve("resolved"); }
|
||||
destroy() {return Math.random() ? null : Promise.resolve("destroy"); }
|
||||
init() {return Math.random() ? null : Promise.resolve("init"); }
|
||||
}
|
||||
|
||||
plugin = new MyPlugin(editor);
|
||||
plugin = new MyPluginMini(editor);
|
||||
pluginStr = new MyPluginAll(editor);
|
||||
|
||||
const Plugin: MyPlugin = new MyPlugin(editor);
|
||||
const pluginMini: MyPluginMini = new MyPluginMini(editor);
|
||||
const pluginAll: MyPluginAll = new MyPluginAll(editor);
|
||||
|
||||
editor = myPlugin.editor;
|
||||
|
||||
str = MyPluginAll.pluginName;
|
||||
strOrUndef = MyPluginMini.pluginName; // Todo: should be undefined.
|
||||
|
||||
plugin = new MyPluginAll.requires[0](editor);
|
||||
|
||||
const fs: Function[] = MyPluginAll.requires;
|
||||
const fsOrUndef = MyPluginMini.requires; // Todo: should be undefined.
|
||||
|
||||
// $ExpectError
|
||||
pluginMini.afterInit();
|
||||
pluginAll.afterInit();
|
||||
|
||||
// $ExpectError
|
||||
pluginMini.destroy();
|
||||
pluginAll.destroy();
|
||||
|
||||
// $ExpectError
|
||||
pluginMini.init();
|
||||
pluginAll.init();
|
||||
|
||||
// core/plugincollection ======================================================
|
||||
|
||||
pluginCollectionStr = new core.PluginCollection(editor, [MyPluginAll]);
|
||||
// $ExpectError
|
||||
pluginCollectionStr = new core.PluginCollection(editor, [MyPlugin]);
|
||||
|
||||
const aColl = new core.PluginCollection<MyPluginAll | MyPluginMini>(editor, [MyPluginAll, MyPluginMini]);
|
||||
|
||||
const myColl = new core.PluginCollection(editor, [MyPlugin]);
|
||||
|
||||
const myCollArray = Array.from(myColl);
|
||||
myPlugins = myCollArray.map(entry => entry[1]);
|
||||
myPlugin = new (myCollArray[0][0])(editor);
|
||||
|
||||
myColl.destroy()
|
||||
.then(destroyedPlugins => {
|
||||
num = destroyedPlugins.length;
|
||||
const plugin = destroyedPlugins[0];
|
||||
editor = plugin.editor;
|
||||
plugin.init!();
|
||||
plugin.destroy();
|
||||
str = plugin.myMethod();
|
||||
});
|
||||
|
||||
myPluginMaybe = myColl.get("A");
|
||||
myPluginMaybe = myColl.get(MyPlugin);
|
||||
|
||||
myColl.load([MyPlugin, "A"])
|
||||
.then((loadedPlugins) => {
|
||||
const plugin = loadedPlugins[0];
|
||||
editor = plugin.editor;
|
||||
str = plugin.myMethod();
|
||||
});
|
||||
|
||||
myColl.load([MyPlugin, "A"], [MyPlugin, "A"]);
|
||||
269
types/ckeditor__ckeditor5-core/index.d.ts
vendored
Normal file
269
types/ckeditor__ckeditor5-core/index.d.ts
vendored
Normal file
@ -0,0 +1,269 @@
|
||||
// Type definitions for @ckeditor/ckeditor5-core 11.0
|
||||
// Project: https://github.com/ckeditor/ckeditor5-core
|
||||
// Definitions by: denisname <https://github.com/denisname>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as engine from "ckeditor__ckeditor5-engine";
|
||||
import * as ckutils from "ckeditor__ckeditor5-utils";
|
||||
|
||||
// TODO: depends on other libraries
|
||||
export interface AlignmentConfig {}
|
||||
export interface AutosaveConfig {}
|
||||
export interface CKFinderAdapterConfig {}
|
||||
export interface CloudServicesConfig {}
|
||||
export interface FontFamilyConfig {}
|
||||
export interface FontSizeConfig {}
|
||||
export interface HeadingConfig {}
|
||||
export interface HighlightConfig {}
|
||||
export interface ImageConfig {}
|
||||
export interface MediaEmbedConfig {}
|
||||
export interface TypingConfig {}
|
||||
export interface ComponentFactory {} // CKEditor 5 UI
|
||||
export interface EditorUIView {} // CKEditor 5 UI
|
||||
|
||||
export namespace editor {
|
||||
namespace utils {
|
||||
// core/editor/utils/attachtoform
|
||||
|
||||
function attachToForm(editor: Editor & ElementApi): void;
|
||||
|
||||
// core/editor/utils/dataapimixin
|
||||
|
||||
const DataApiMixin: DataApi;
|
||||
|
||||
interface DataApi {
|
||||
getData(): string;
|
||||
setData(data: string): void;
|
||||
}
|
||||
|
||||
// core/editor/utils/elementapimixin
|
||||
|
||||
const ElementApiMixin: ElementApi;
|
||||
|
||||
interface ElementApi {
|
||||
readonly sourceElement: HTMLElement;
|
||||
updateSourceElement(): void;
|
||||
}
|
||||
}
|
||||
|
||||
// core/editor/editor
|
||||
|
||||
class Editor implements ckutils.Emitter, ckutils.Observable {
|
||||
readonly commands: CommandCollection;
|
||||
readonly config: ckutils.Config;
|
||||
readonly conversion: engine.conversion.Conversion;
|
||||
readonly data: engine.controller.DataController;
|
||||
readonly editing: engine.controller.EditingController;
|
||||
isReadOnly: boolean;
|
||||
readonly keystrokes: EditingKeystrokeHandler;
|
||||
readonly locale: ckutils.Locale;
|
||||
readonly model: engine.model.Model;
|
||||
readonly plugins: PluginCollection<Plugin<any>>;
|
||||
state: "initializing" | "ready" | "destroyed";
|
||||
|
||||
static builtinPlugins: Array<Plugin<any>>;
|
||||
static defaultConfig: object;
|
||||
|
||||
constructor(config?: object);
|
||||
destroy(): Promise<void>;
|
||||
execute(commandName: string, ...commandParams: any[]): void;
|
||||
initPlugins(): Promise<void>;
|
||||
t(str: string, values?: string[]): string;
|
||||
|
||||
static create(config: object): Promise<any>;
|
||||
|
||||
// Emitter
|
||||
delegate(...events: string[]): ckutils.EmitterMixinDelegateChain;
|
||||
fire(eventOrInfo: string | ckutils.EventInfo<ckutils.Emitter>, ...args: any[]): any;
|
||||
listenTo(emitter: ckutils.Emitter, event: string, callback: Function, options?: {priority?: ckutils.PriorityString | number }): void;
|
||||
off(event: string, callback?: Function): void;
|
||||
on(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
once(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
stopDelegating(event?: string, emitter?: ckutils.Emitter): void;
|
||||
stopListening(emitter?: ckutils.Emitter, event?: string, callback?: Function): void;
|
||||
|
||||
// Observable
|
||||
bind(...bindProperties: string[]): ckutils.BindChain;
|
||||
decorate(methodName: string): void;
|
||||
set(name: object): void;
|
||||
set(name: string, value: any): void;
|
||||
unbind(...unbindProperties: string[]): void;
|
||||
}
|
||||
|
||||
// core/editor/editorconfig
|
||||
|
||||
interface EditorConfig {
|
||||
alignment: AlignmentConfig;
|
||||
autosave: AutosaveConfig;
|
||||
balloonToolbar: string[];
|
||||
blockToolbar: string[];
|
||||
ckfinder: CKFinderAdapterConfig;
|
||||
cloudServices: CloudServicesConfig;
|
||||
fontFamily: FontFamilyConfig;
|
||||
fontSize: FontSizeConfig;
|
||||
heading: HeadingConfig;
|
||||
highlight: HighlightConfig;
|
||||
image: ImageConfig;
|
||||
language: string;
|
||||
mediaEmbed: MediaEmbedConfig;
|
||||
plugins: Array<string | Plugin>;
|
||||
removePlugins: string[];
|
||||
toolbar: string[] | {items: string[]; viewportTopOffset: number; };
|
||||
typing: TypingConfig;
|
||||
}
|
||||
|
||||
// core/editor/editorui
|
||||
|
||||
class EditorUI implements ckutils.Emitter {
|
||||
readonly componentFactory: ComponentFactory;
|
||||
readonly editor: Editor;
|
||||
readonly focusTracker: ckutils.FocusTracker;
|
||||
readonly view: EditorUIView;
|
||||
|
||||
constructor(editor: Editor, view: EditorUIView);
|
||||
destroy(): void;
|
||||
update(): void;
|
||||
|
||||
// Emitter
|
||||
delegate(...events: string[]): ckutils.EmitterMixinDelegateChain;
|
||||
fire(eventOrInfo: string | ckutils.EventInfo<ckutils.Emitter>, ...args: any[]): any;
|
||||
listenTo(emitter: ckutils.Emitter, event: string, callback: Function, options?: {priority?: ckutils.PriorityString | number }): void;
|
||||
off(event: string, callback?: Function): void;
|
||||
on(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
once(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
stopDelegating(event?: string, emitter?: ckutils.Emitter): void;
|
||||
stopListening(emitter?: ckutils.Emitter, event?: string, callback?: Function): void;
|
||||
}
|
||||
|
||||
// core/editor/editorwithui
|
||||
|
||||
interface EditorWithUI {
|
||||
readonly element: HTMLElement | null;
|
||||
readonly ui: EditorUI;
|
||||
}
|
||||
}
|
||||
|
||||
// core/command
|
||||
|
||||
export class Command<T = undefined> implements ckutils.Emitter, ckutils.Observable {
|
||||
readonly editor: editor.Editor;
|
||||
readonly isEnabled: boolean;
|
||||
readonly value: T | undefined;
|
||||
|
||||
constructor(editor: editor.Editor);
|
||||
destroy(): void;
|
||||
execute(): void;
|
||||
refresh(): void;
|
||||
|
||||
// Emitter
|
||||
delegate(...events: string[]): ckutils.EmitterMixinDelegateChain;
|
||||
fire(eventOrInfo: string | ckutils.EventInfo<ckutils.Emitter>, ...args: any[]): any;
|
||||
listenTo(emitter: ckutils.Emitter, event: string, callback: Function, options?: {priority?: ckutils.PriorityString | number }): void;
|
||||
off(event: string, callback?: Function): void;
|
||||
on(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
once(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
stopDelegating(event?: string, emitter?: ckutils.Emitter): void;
|
||||
stopListening(emitter?: ckutils.Emitter, event?: string, callback?: Function): void;
|
||||
|
||||
// Observable
|
||||
bind(...bindProperties: string[]): ckutils.BindChain;
|
||||
decorate(methodName: string): void;
|
||||
set(name: object): void;
|
||||
set(name: string, value: any): void;
|
||||
unbind(...unbindProperties: string[]): void;
|
||||
}
|
||||
|
||||
// core/commandcollection
|
||||
|
||||
export class CommandCollection {
|
||||
constructor();
|
||||
[Symbol.iterator](): Iterator<[string, Command]>;
|
||||
add(commandName: string, command: Command): void;
|
||||
commands(): IterableIterator<Command>;
|
||||
destroy(): void;
|
||||
execute(commandName: string, ...commandParams: any[]): void;
|
||||
get(commandName: string): Command;
|
||||
names(): IterableIterator<string>;
|
||||
}
|
||||
|
||||
// core/editingkeystrokehandler
|
||||
|
||||
export class EditingKeystrokeHandler extends ckutils.KeystrokeHandler {
|
||||
readonly editor: editor.Editor;
|
||||
|
||||
constructor(editor: editor.Editor);
|
||||
set(
|
||||
keystroke: string | Array<string | number>,
|
||||
callback: string | ((keyEvtData: engine.view.observer.KeyEventData, cancel: () => void) => void),
|
||||
options?: {priority: ckutils.PriorityString | number}
|
||||
): void;
|
||||
}
|
||||
|
||||
// core/pendingactions
|
||||
|
||||
export class PendingActions extends Plugin {
|
||||
static readonly pluginName: "PendingActions";
|
||||
|
||||
first: null | ckutils.Observable & {message: string};
|
||||
readonly hasAny: boolean;
|
||||
|
||||
[Symbol.iterator](): Iterator<ckutils.Observable & {message: string}>;
|
||||
add(message: string): ckutils.Observable & {message: string};
|
||||
remove(action: ckutils.Observable & {message: string}): void;
|
||||
}
|
||||
|
||||
// core/plugin
|
||||
|
||||
export abstract class Plugin<T = void> implements ckutils.Emitter, ckutils.Observable {
|
||||
readonly editor: editor.Editor;
|
||||
|
||||
static readonly pluginName?: string;
|
||||
static readonly requires?: Array<new(editor: editor.Editor) => Plugin>;
|
||||
|
||||
constructor(editor: editor.Editor);
|
||||
afterInit?(): null | Promise<T>;
|
||||
destroy?(): null | Promise<T>;
|
||||
init?(): null | Promise<T>;
|
||||
|
||||
// Emitter
|
||||
delegate(...events: string[]): ckutils.EmitterMixinDelegateChain;
|
||||
fire(eventOrInfo: string | ckutils.EventInfo<ckutils.Emitter>, ...args: any[]): any;
|
||||
listenTo(emitter: ckutils.Emitter, event: string, callback: Function, options?: {priority?: ckutils.PriorityString | number }): void;
|
||||
off(event: string, callback?: Function): void;
|
||||
on(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
once(event: string, callback: Function, options?: {priority: ckutils.PriorityString | number}): void;
|
||||
stopDelegating(event?: string, emitter?: ckutils.Emitter): void;
|
||||
stopListening(emitter?: ckutils.Emitter, event?: string, callback?: Function): void;
|
||||
|
||||
// Observable
|
||||
bind(...bindProperties: string[]): ckutils.BindChain;
|
||||
decorate(methodName: string): void;
|
||||
set(name: object): void;
|
||||
set(name: string, value: any): void;
|
||||
unbind(...unbindProperties: string[]): void;
|
||||
}
|
||||
|
||||
// PluginInterface, see Plugin
|
||||
|
||||
// core/plugincollection
|
||||
|
||||
export class PluginCollection<P extends Plugin<any>> {
|
||||
constructor(
|
||||
editor: editor.Editor,
|
||||
availablePlugins?: Array<new(editor: editor.Editor) => P>
|
||||
);
|
||||
|
||||
[Symbol.iterator](): Iterator<[new(editor: editor.Editor) => P, P]>;
|
||||
|
||||
destroy(): Promise<Array<P & {destroy(): void | null | Promise<any>}>>;
|
||||
|
||||
get(
|
||||
key: string | (new(editor: editor.Editor) => P)
|
||||
): P | undefined;
|
||||
|
||||
load(
|
||||
plugins: Array<string | (new(editor: editor.Editor) => P)>,
|
||||
removePlugins?: Array<string | (new(editor: editor.Editor) => P)>
|
||||
): Promise<P[]>;
|
||||
}
|
||||
26
types/ckeditor__ckeditor5-core/tsconfig.json
Normal file
26
types/ckeditor__ckeditor5-core/tsconfig.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom",
|
||||
"es2015.promise"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ckeditor__ckeditor5-core-tests.ts"
|
||||
]
|
||||
}
|
||||
22
types/ckeditor__ckeditor5-core/tslint.json
Normal file
22
types/ckeditor__ckeditor5-core/tslint.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": {
|
||||
"options": [
|
||||
["Object", "Avoid using the `Object` type. Did you mean `object`?"],
|
||||
["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
|
||||
["Number", "Avoid using the `Number` type. Did you mean `number`?"],
|
||||
["String", "Avoid using the `String` type. Did you mean `string`?"],
|
||||
["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"]
|
||||
]
|
||||
},
|
||||
"no-empty-interface": false,
|
||||
"prefer-switch": false,
|
||||
"quotemark": [
|
||||
true,
|
||||
"double",
|
||||
"avoid-escape",
|
||||
"avoid-template"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
import * as engine from "ckeditor__ckeditor5-engine";
|
||||
|
||||
declare let pattern: engine.view.MatcherPattern;
|
||||
|
||||
pattern = {name: /^p/};
|
||||
|
||||
pattern = {
|
||||
attributes: {
|
||||
title: "foobar",
|
||||
foo: /^\w+/,
|
||||
bar: true,
|
||||
}
|
||||
};
|
||||
|
||||
pattern = {
|
||||
classes: "foobar"
|
||||
};
|
||||
|
||||
pattern = {
|
||||
classes: /foo.../
|
||||
};
|
||||
|
||||
pattern = {
|
||||
classes: ["baz", "bar", /foo.../]
|
||||
};
|
||||
|
||||
pattern = {
|
||||
styles: {
|
||||
position: "absolute",
|
||||
color: /^\w*blue$/
|
||||
}
|
||||
};
|
||||
|
||||
pattern = {
|
||||
name: "span",
|
||||
styles: {
|
||||
"font-weight": "bold"
|
||||
},
|
||||
classes: "highlighted"
|
||||
};
|
||||
|
||||
pattern = (element: engine.view.Element) => {
|
||||
if (element.name === "div" && element.childCount > 0) {
|
||||
return {name: true};
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
pattern = (element: engine.view.Element) => {
|
||||
if (element.name === "p") {
|
||||
const fontSize = element.getStyle("font-size")!;
|
||||
const size = fontSize.match(/(\d+)/px);
|
||||
|
||||
if (size && Number(size[1]) > 26) {
|
||||
return {name: true, attribute: ["font-size"]};
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
declare let viewDefinition: engine.view.ElementDefinition;
|
||||
|
||||
viewDefinition = "p";
|
||||
|
||||
viewDefinition = {
|
||||
name: "h1",
|
||||
classes: ["foo", "bar"],
|
||||
};
|
||||
|
||||
viewDefinition = {
|
||||
name: "span",
|
||||
styles: {
|
||||
"font-size": "12px",
|
||||
"font-weight": "bold",
|
||||
},
|
||||
attributes: {
|
||||
"data-id": "123",
|
||||
}
|
||||
};
|
||||
1368
types/ckeditor__ckeditor5-engine/index.d.ts
vendored
Normal file
1368
types/ckeditor__ckeditor5-engine/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
24
types/ckeditor__ckeditor5-engine/tsconfig.json
Normal file
24
types/ckeditor__ckeditor5-engine/tsconfig.json
Normal file
@ -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",
|
||||
"ckeditor__ckeditor5-engine-tests.ts"
|
||||
]
|
||||
}
|
||||
20
types/ckeditor__ckeditor5-engine/tslint.json
Normal file
20
types/ckeditor__ckeditor5-engine/tslint.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": {
|
||||
"options": [
|
||||
["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
|
||||
["Number", "Avoid using the `Number` type. Did you mean `number`?"],
|
||||
["String", "Avoid using the `String` type. Did you mean `string`?"],
|
||||
["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"]
|
||||
]
|
||||
},
|
||||
"no-empty-interface": false,
|
||||
"quotemark": [
|
||||
true,
|
||||
"double",
|
||||
"avoid-escape",
|
||||
"avoid-template"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -489,24 +489,30 @@ utils.mapsEqual(map, map);
|
||||
|
||||
// utils/mix ==================================================================
|
||||
|
||||
class Editor {
|
||||
b: () => number;
|
||||
}
|
||||
|
||||
interface SomeMixin {
|
||||
a: () => string;
|
||||
}
|
||||
|
||||
class Editor implements SomeMixin {
|
||||
a: () => string;
|
||||
b() { return 3; }
|
||||
}
|
||||
|
||||
const SomeMixin = {
|
||||
a() {
|
||||
return "a";
|
||||
}
|
||||
a() { return "a"; }
|
||||
};
|
||||
|
||||
const SomeMixinNum = {
|
||||
a() { return 3; }
|
||||
};
|
||||
|
||||
utils.mix(Editor, SomeMixin);
|
||||
const mixEditor = new Editor() as Editor & SomeMixin;
|
||||
mixEditor.a();
|
||||
mixEditor.b();
|
||||
// $ExpectError
|
||||
utils.mix(Editor, SomeMixinNum);
|
||||
|
||||
const editor = new Editor();
|
||||
str = editor.a();
|
||||
num = editor.b();
|
||||
|
||||
// utils/nth ==================================================================
|
||||
|
||||
|
||||
8
types/ckeditor__ckeditor5-utils/index.d.ts
vendored
8
types/ckeditor__ckeditor5-utils/index.d.ts
vendored
@ -367,7 +367,11 @@ export class KeystrokeHandler {
|
||||
destroy(): void;
|
||||
listenTo(emitter: Emitter): void;
|
||||
press(keyEvtData: KeystrokeInfo): boolean;
|
||||
set(keystroke: string | Array<string | number>, callback: Function, options?: {priority?: PriorityString | number}): void;
|
||||
set(
|
||||
keystroke: string | Array<string | number>,
|
||||
callback: (keyEvtData: KeystrokeInfo, cancel: () => void) => void,
|
||||
options?: {priority?: PriorityString | number}
|
||||
): void;
|
||||
}
|
||||
|
||||
// utils/locale
|
||||
@ -392,7 +396,7 @@ export function mapsEqual<K, V>(mapsA: Map<K, V>, mapsB: Map<K, V>): boolean;
|
||||
|
||||
// utils/mix
|
||||
|
||||
export function mix(baseClass: {new(): any}, ...mixins: any[]): void;
|
||||
export function mix<T>(baseClass: {new(...p: any[]): T}, ...mixins: Array<Partial<T>>): void;
|
||||
|
||||
// utils/nth
|
||||
|
||||
|
||||
12
types/clean-regexp/clean-regexp-tests.ts
Normal file
12
types/clean-regexp/clean-regexp-tests.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import cleanRegexp = require('clean-regexp');
|
||||
|
||||
// $ExpectType string
|
||||
cleanRegexp('[0-9]');
|
||||
cleanRegexp('[^0-9]');
|
||||
cleanRegexp('[a-zA-Z0-9_]');
|
||||
cleanRegexp('[a-z0-9_]', 'i');
|
||||
cleanRegexp('[^a-zA-Z0-9_]');
|
||||
cleanRegexp('[^a-z0-9_]', 'i');
|
||||
cleanRegexp('[a-zA-Z\\d_]');
|
||||
cleanRegexp('[^a-zA-Z\\d_]');
|
||||
cleanRegexp('[0-9]+\\.[a-zA-Z0-9_]?');
|
||||
8
types/clean-regexp/index.d.ts
vendored
Normal file
8
types/clean-regexp/index.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// Type definitions for clean-regexp 1.0
|
||||
// Project: https://github.com/samverschueren/clean-regexp#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = cleanRegexp;
|
||||
|
||||
declare function cleanRegexp(regexp: string, flags?: string): string;
|
||||
23
types/clean-regexp/tsconfig.json
Normal file
23
types/clean-regexp/tsconfig.json
Normal file
@ -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",
|
||||
"clean-regexp-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/clean-regexp/tslint.json
Normal file
1
types/clean-regexp/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
36
types/coinlist/coinlist-tests.ts
Normal file
36
types/coinlist/coinlist-tests.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import coins = require('coinlist');
|
||||
import coinsJson = require('coinlist/src/coins.json');
|
||||
|
||||
// $ExpectType Coin[] & CoinsAPI
|
||||
coins;
|
||||
|
||||
// $ExpectType Coin[]
|
||||
coinsJson;
|
||||
|
||||
let coinsArr = [
|
||||
{
|
||||
id: 'bitcoin',
|
||||
symbol: 'BTC',
|
||||
name: 'Bitcoin',
|
||||
},
|
||||
{
|
||||
id: 'litecoin',
|
||||
symbol: 'LTC',
|
||||
name: 'Litecoin',
|
||||
},
|
||||
];
|
||||
|
||||
coinsArr = coins;
|
||||
coinsArr = coinsJson;
|
||||
|
||||
// $ExpectType Coin | undefined
|
||||
coins.get('BTC');
|
||||
|
||||
// $ExpectType string | undefined
|
||||
coins.get('BTC', 'name');
|
||||
// $ExpectType string | undefined
|
||||
coins.get('BTC', 'symbol');
|
||||
// $ExpectType string | undefined
|
||||
coins.get('BTC', 'id');
|
||||
|
||||
coins.map(coin => coin.name);
|
||||
19
types/coinlist/index.d.ts
vendored
Normal file
19
types/coinlist/index.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
// Type definitions for coinlist 3.1
|
||||
// Project: https://github.com/lukechilds/coinlist
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import coinsJson = require('./src/coins.json');
|
||||
|
||||
export = coins;
|
||||
|
||||
declare const coins: coins.Coin[] & coins.CoinsAPI;
|
||||
|
||||
declare namespace coins {
|
||||
type Coin = coinsJson.Coin;
|
||||
|
||||
interface CoinsAPI {
|
||||
get(symbol: string): Coin | undefined;
|
||||
get(symbol: string, property: 'id' | 'symbol' | 'name'): string | undefined;
|
||||
}
|
||||
}
|
||||
11
types/coinlist/src/coins.json.d.ts
vendored
Normal file
11
types/coinlist/src/coins.json.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
export = coins;
|
||||
|
||||
declare const coins: coins.Coin[];
|
||||
|
||||
declare namespace coins {
|
||||
interface Coin {
|
||||
id: string;
|
||||
symbol: string;
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
24
types/coinlist/tsconfig.json
Normal file
24
types/coinlist/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"src/coins.json.d.ts",
|
||||
"coinlist-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/coinlist/tslint.json
Normal file
1
types/coinlist/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
29
types/colornames/colornames-tests.ts
Normal file
29
types/colornames/colornames-tests.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import colorNames = require("colornames");
|
||||
|
||||
// $ExpectType Color
|
||||
const color = colorNames("red");
|
||||
|
||||
// $ExpectType string
|
||||
color.value;
|
||||
// $ExpectType boolean | undefined
|
||||
color.css;
|
||||
// $ExpectType boolean | undefined
|
||||
color.vga;
|
||||
// $ExpectType string
|
||||
color.name;
|
||||
|
||||
// $ExpectType Color
|
||||
colorNames.get("blue");
|
||||
// $ExpectType Color[]
|
||||
colorNames.get.all();
|
||||
// $ExpectType Color[]
|
||||
colorNames.get.css();
|
||||
// $ExpectType Color
|
||||
colorNames.get.css("orange");
|
||||
// $ExpectType Color[]
|
||||
colorNames.get.vga();
|
||||
// $ExpectType Color
|
||||
colorNames.get.vga("violet");
|
||||
|
||||
// $ExpectType Color[]
|
||||
colorNames.all();
|
||||
93
types/colornames/index.d.ts
vendored
Normal file
93
types/colornames/index.d.ts
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
// Type definitions for colornames 1.1
|
||||
// Project: https://github.com/timoxley/colornames#readme
|
||||
// Definitions by: Manuel Thalmann <https://github.com/manuth>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Represents a color.
|
||||
*/
|
||||
interface Color {
|
||||
/**
|
||||
* Gets the value of the color.
|
||||
*/
|
||||
value: string;
|
||||
|
||||
/**
|
||||
* Gets a value indicating whether the color is a valid `CSS`-color.
|
||||
*/
|
||||
css?: boolean;
|
||||
|
||||
/**
|
||||
* Gets a value indicating whether the color is a valid `VGA`-color.
|
||||
*/
|
||||
vga?: boolean;
|
||||
|
||||
/**
|
||||
* Gets the name of the color.
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Povides the functionality to resolve colors of a specific type by its name.
|
||||
*/
|
||||
interface ColorResolver {
|
||||
/**
|
||||
* Gets the color with the specified name.
|
||||
*
|
||||
* @param name
|
||||
* The name of the color to get.
|
||||
*/
|
||||
(name: string): Color;
|
||||
|
||||
/**
|
||||
* Gets all colors.
|
||||
*/
|
||||
(): Color[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the functionality to resolve any kind of color by its name.
|
||||
*/
|
||||
interface GlobalResolver {
|
||||
/**
|
||||
* Gets the color with the specified name.
|
||||
*/
|
||||
(name: string): Color;
|
||||
|
||||
/**
|
||||
* Provides the functionality to query colors.
|
||||
*/
|
||||
get: {
|
||||
/**
|
||||
* Gets the color with the specified name.
|
||||
*
|
||||
* @param name
|
||||
* The name of the color to get.
|
||||
*/
|
||||
(name: string): Color;
|
||||
|
||||
/**
|
||||
* Gets all available colors.
|
||||
*/
|
||||
all(): Color[];
|
||||
|
||||
/**
|
||||
* Provides the functionality to resolve `css`-colors.
|
||||
*/
|
||||
css: ColorResolver;
|
||||
|
||||
/**
|
||||
* Provides the functionality to resolve `vga`-colors.
|
||||
*/
|
||||
vga: ColorResolver;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets all available colors.
|
||||
*/
|
||||
all(): Color[];
|
||||
}
|
||||
|
||||
declare let colorNames: GlobalResolver;
|
||||
export = colorNames;
|
||||
23
types/colornames/tsconfig.json
Normal file
23
types/colornames/tsconfig.json
Normal file
@ -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",
|
||||
"colornames-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/colornames/tslint.json
Normal file
1
types/colornames/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@ -1,15 +1,76 @@
|
||||
import { Configuration } from 'webpack';
|
||||
import CompressionPlugin = require('compression-webpack-plugin');
|
||||
|
||||
const c: Configuration = {
|
||||
new CompressionPlugin();
|
||||
|
||||
new CompressionPlugin({
|
||||
include: ["a"] as ReadonlyArray<string>,
|
||||
exclude: [/a/g] as ReadonlyArray<RegExp>,
|
||||
test: "a",
|
||||
});
|
||||
|
||||
const config: Configuration = {
|
||||
plugins: [
|
||||
new CompressionPlugin({
|
||||
asset: "[path].gz[query]",
|
||||
algorithm: "gzip",
|
||||
cache: true,
|
||||
filename: "[path].gz[query]",
|
||||
minRatio: 0.8,
|
||||
test: /\.js$|\.html$/,
|
||||
threshold: 10240,
|
||||
minRatio: 0.8
|
||||
deleteOriginalAssets: true
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
const configDefaultAlgo = new CompressionPlugin({
|
||||
compressionOptions: { level: 7 }
|
||||
});
|
||||
|
||||
// $ExpectError
|
||||
new CompressionPlugin({ asset: "[path].gz[query]" });
|
||||
|
||||
const zlib: Configuration = {
|
||||
plugins: [
|
||||
new CompressionPlugin({
|
||||
algorithm: "deflate",
|
||||
compressionOptions: {
|
||||
flush: 5,
|
||||
windowBits: 20,
|
||||
level: 7
|
||||
}
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
const badZlib: Configuration = {
|
||||
plugins: [
|
||||
// $ExpectError
|
||||
new CompressionPlugin({
|
||||
algorithm: "deflate",
|
||||
compressionOptions: 5
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
function customAlgorithm(input: string, options: number, callback: (err: Error, result: Buffer) => void) {
|
||||
}
|
||||
|
||||
const custom: Configuration = {
|
||||
plugins: [
|
||||
new CompressionPlugin({
|
||||
algorithm: customAlgorithm,
|
||||
compressionOptions: 5
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
const badCustom: Configuration = {
|
||||
plugins: [
|
||||
// $ExpectError
|
||||
new CompressionPlugin({
|
||||
algorithm: customAlgorithm,
|
||||
compressionOptions: { flush: 5 }
|
||||
})
|
||||
]
|
||||
};
|
||||
|
||||
59
types/compression-webpack-plugin/index.d.ts
vendored
59
types/compression-webpack-plugin/index.d.ts
vendored
@ -1,42 +1,47 @@
|
||||
// Type definitions for compression-webpack-plugin 0.4
|
||||
// Type definitions for compression-webpack-plugin 2.0
|
||||
// Project: https://github.com/webpack-contrib/compression-webpack-plugin
|
||||
// Definitions by: Anton Kandybo <https://github.com/dublicator>
|
||||
// Rhys van der Waerden <https://github.com/rhys-vdw>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
import { ZlibOptions as ZlibCompressionOptions } from 'zlib';
|
||||
|
||||
export = CompressionPlugin;
|
||||
|
||||
declare class CompressionPlugin extends Plugin {
|
||||
constructor(options?: CompressionPlugin.Options);
|
||||
declare class CompressionPlugin<O = any> extends Plugin {
|
||||
constructor(options?: CompressionPlugin.Options<O>);
|
||||
}
|
||||
|
||||
declare namespace CompressionPlugin {
|
||||
interface Options {
|
||||
asset?: string;
|
||||
algorithm?: string;
|
||||
type AlgorithmCallback = (error: Error | null, result: Buffer) => void;
|
||||
type Algorithm<O> = (source: string, options: O, callback: AlgorithmCallback) => void;
|
||||
|
||||
// NOTE: These are the async compression algorithms on the zlib object.
|
||||
type ZlibAlgorithm = 'deflate' | 'deflateRaw' | 'gzip';
|
||||
type Pattern = string | RegExp | ReadonlyArray<RegExp> | ReadonlyArray<string>;
|
||||
|
||||
interface BaseOptions {
|
||||
cache?: boolean | string;
|
||||
test?: RegExp | RegExp[];
|
||||
regExp?: RegExp | RegExp[];
|
||||
threshold?: number;
|
||||
deleteOriginalAssets?: boolean;
|
||||
exclude?: Pattern;
|
||||
filename?: string;
|
||||
include?: Pattern;
|
||||
minRatio?: number;
|
||||
|
||||
// zopfli options
|
||||
verbose?: boolean;
|
||||
verbose_more?: boolean;
|
||||
numiterations?: number;
|
||||
blocksplitting?: boolean;
|
||||
blocksplittinglast?: boolean;
|
||||
blocksplittingmax?: number;
|
||||
|
||||
// zlib options
|
||||
level?: number;
|
||||
flush?: number;
|
||||
chunkSize?: number;
|
||||
windowBits?: number;
|
||||
memLevel?: number;
|
||||
strategy?: number;
|
||||
dictionary?: any;
|
||||
test?: Pattern;
|
||||
threshold?: number;
|
||||
}
|
||||
|
||||
interface ZlibOptions extends BaseOptions {
|
||||
algorithm?: ZlibAlgorithm;
|
||||
compressionOptions?: ZlibCompressionOptions;
|
||||
}
|
||||
|
||||
interface CustomOptions<O> extends BaseOptions {
|
||||
algorithm: Algorithm<O>;
|
||||
compressionOptions?: O;
|
||||
}
|
||||
|
||||
type Options<O> = ZlibOptions | CustomOptions<O>;
|
||||
}
|
||||
|
||||
@ -4,18 +4,24 @@ const conf = new Conf<string | number | boolean>();
|
||||
new Conf<string>({
|
||||
defaults: {
|
||||
foo: 'bar',
|
||||
unicorn: 'rainbow'
|
||||
unicorn: 'rainbow',
|
||||
},
|
||||
configName: '',
|
||||
projectName: 'foo',
|
||||
cwd: ''
|
||||
});
|
||||
new Conf<string>({ configName: '' });
|
||||
new Conf<string>({ projectName: 'foo' });
|
||||
new Conf<string>({ cwd: '' });
|
||||
new Conf<string>({ encryptionKey: '' });
|
||||
new Conf<string>({ encryptionKey: new Buffer('') });
|
||||
new Conf<string>({ encryptionKey: new Uint8Array([1]) });
|
||||
new Conf<string>({ encryptionKey: new DataView(new ArrayBuffer(2)) });
|
||||
new Conf<string>({ fileExtension: '.foo' });
|
||||
|
||||
// $ExpectError
|
||||
new Conf<string>({
|
||||
defaults: {
|
||||
foo: 'bar',
|
||||
unicorn: ['rainbow']
|
||||
}
|
||||
unicorn: ['rainbow'],
|
||||
},
|
||||
});
|
||||
conf.set('foo', 'bar');
|
||||
conf.set('hello', 1);
|
||||
@ -28,10 +34,17 @@ conf.get('foo', null); // $ExpectError
|
||||
conf.delete('foo');
|
||||
conf.has('foo'); // $ExpectType boolean
|
||||
conf.clear();
|
||||
conf.onDidChange('foo', (oldVal, newVal) => {
|
||||
// $ExpectType string | number | boolean | undefined
|
||||
oldVal;
|
||||
// $ExpectType string | number | boolean | undefined
|
||||
newVal;
|
||||
});
|
||||
|
||||
conf.size; // $ExpectType number
|
||||
conf.store = {
|
||||
foo: 'bar',
|
||||
unicorn: 'rainbow'
|
||||
unicorn: 'rainbow',
|
||||
};
|
||||
conf.path; // $ExpectType string
|
||||
|
||||
|
||||
42
types/conf/index.d.ts
vendored
42
types/conf/index.d.ts
vendored
@ -1,31 +1,37 @@
|
||||
// Type definitions for conf 1.4
|
||||
// Type definitions for conf 2.1
|
||||
// Project: https://github.com/sindresorhus/conf
|
||||
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
interface Options<T> {
|
||||
defaults?: {[key: string]: T};
|
||||
configName?: string;
|
||||
projectName?: string;
|
||||
cwd?: string;
|
||||
}
|
||||
/// <reference types="node" />
|
||||
|
||||
declare class Conf<T = any> implements Iterable<[string, T]> {
|
||||
store: {[key: string]: T};
|
||||
store: { [key: string]: T };
|
||||
readonly path: string;
|
||||
readonly size: number;
|
||||
readonly size: number;
|
||||
|
||||
constructor(options?: Options<T>);
|
||||
get(key: string, defaultValue?: T): T;
|
||||
set(key: string, val: T): void;
|
||||
set(object: {[key: string]: T}): void;
|
||||
has(key: string): boolean;
|
||||
delete(key: string): void;
|
||||
clear(): void;
|
||||
onDidChange(key: string, callback: (oldVal: any, newVal: any) => void): void;
|
||||
[Symbol.iterator](): Iterator<[string, T]>;
|
||||
constructor(options?: Conf.Options<T>);
|
||||
get(key: string, defaultValue?: T): T;
|
||||
set(key: string, val: T): void;
|
||||
set(object: { [key: string]: T }): void;
|
||||
has(key: string): boolean;
|
||||
delete(key: string): void;
|
||||
clear(): void;
|
||||
onDidChange(key: string, callback: (oldVal: T | undefined, newVal: T | undefined) => void): void;
|
||||
[Symbol.iterator](): Iterator<[string, T]>;
|
||||
}
|
||||
|
||||
declare namespace Conf {
|
||||
interface Options<T> {
|
||||
defaults?: { [key: string]: T };
|
||||
configName?: string;
|
||||
projectName?: string;
|
||||
cwd?: string;
|
||||
encryptionKey?: string | Buffer | NodeJS.TypedArray | DataView;
|
||||
fileExtension?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = Conf;
|
||||
|
||||
@ -21,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"conf-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
41
types/conf/v1/conf-tests.ts
Normal file
41
types/conf/v1/conf-tests.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import Conf = require('conf');
|
||||
|
||||
const conf = new Conf<string | number | boolean>();
|
||||
new Conf<string>({
|
||||
defaults: {
|
||||
foo: 'bar',
|
||||
unicorn: 'rainbow',
|
||||
},
|
||||
configName: '',
|
||||
projectName: 'foo',
|
||||
cwd: '',
|
||||
});
|
||||
// $ExpectError
|
||||
new Conf<string>({
|
||||
defaults: {
|
||||
foo: 'bar',
|
||||
unicorn: ['rainbow'],
|
||||
},
|
||||
});
|
||||
conf.set('foo', 'bar');
|
||||
conf.set('hello', 1);
|
||||
conf.set('unicorn', false);
|
||||
conf.set('null', null); // $ExpectError
|
||||
|
||||
conf.get('foo'); // $ExpectType string | number | boolean
|
||||
conf.get('foo', 'bar'); // $ExpectType string | number | boolean
|
||||
conf.get('foo', null); // $ExpectError
|
||||
conf.delete('foo');
|
||||
conf.has('foo'); // $ExpectType boolean
|
||||
conf.clear();
|
||||
|
||||
conf.store = {
|
||||
foo: 'bar',
|
||||
unicorn: 'rainbow',
|
||||
};
|
||||
conf.path; // $ExpectType string
|
||||
|
||||
for (const [key, value] of conf) {
|
||||
key; // $ExpectType string
|
||||
value; // $ExpectType string | number | boolean
|
||||
}
|
||||
31
types/conf/v1/index.d.ts
vendored
Normal file
31
types/conf/v1/index.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Type definitions for conf 1.4
|
||||
// Project: https://github.com/sindresorhus/conf
|
||||
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
interface Options<T> {
|
||||
defaults?: { [key: string]: T };
|
||||
configName?: string;
|
||||
projectName?: string;
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
declare class Conf<T = any> implements Iterable<[string, T]> {
|
||||
store: { [key: string]: T };
|
||||
readonly path: string;
|
||||
readonly size: number;
|
||||
|
||||
constructor(options?: Options<T>);
|
||||
get(key: string, defaultValue?: T): T;
|
||||
set(key: string, val: T): void;
|
||||
set(object: { [key: string]: T }): void;
|
||||
has(key: string): boolean;
|
||||
delete(key: string): void;
|
||||
clear(): void;
|
||||
onDidChange(key: string, callback: (oldVal: any, newVal: any) => void): void;
|
||||
[Symbol.iterator](): Iterator<[string, T]>;
|
||||
}
|
||||
|
||||
export = Conf;
|
||||
29
types/conf/v1/tsconfig.json
Normal file
29
types/conf/v1/tsconfig.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"conf": [
|
||||
"conf/v1"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"conf-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/conf/v1/tslint.json
Normal file
1
types/conf/v1/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
5
types/connect-timeout/index.d.ts
vendored
5
types/connect-timeout/index.d.ts
vendored
@ -14,10 +14,9 @@ declare namespace Express {
|
||||
clearTimeout(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {boolean} true if timeout fired; false otherwise.
|
||||
* @summary true if timeout fired; false otherwise.
|
||||
*/
|
||||
timedout(event: string, message: string): boolean;
|
||||
timedout: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
48
types/create-html-element/create-html-element-tests.ts
Normal file
48
types/create-html-element/create-html-element-tests.ts
Normal file
@ -0,0 +1,48 @@
|
||||
import createHtmlElement = require('create-html-element');
|
||||
|
||||
createHtmlElement(); // $ExpectType HTMLDivElement
|
||||
// $ExpectType HTMLDivElement
|
||||
createHtmlElement({
|
||||
attributes: {
|
||||
class: 'unicorn',
|
||||
rainbow: true,
|
||||
horse: false,
|
||||
number: 1,
|
||||
multiple: ['a', 'b'],
|
||||
},
|
||||
});
|
||||
createHtmlElement({ html: '🦄' }); // $ExpectType HTMLDivElement
|
||||
createHtmlElement({ text: 'Hello <em>World</em>' }); // $ExpectType HTMLDivElement
|
||||
createHtmlElement({ html: '🦄', text: 'Hello <em>World</em>' }); // $ExpectError
|
||||
|
||||
createHtmlElement({ name: 'h1' }); // $ExpectType HTMLHeadingElement
|
||||
// $ExpectType HTMLHeadingElement
|
||||
createHtmlElement({
|
||||
name: 'h1',
|
||||
attributes: {
|
||||
class: 'unicorn',
|
||||
rainbow: true,
|
||||
horse: false,
|
||||
number: 1,
|
||||
multiple: ['a', 'b'],
|
||||
},
|
||||
});
|
||||
createHtmlElement({ name: 'h1', html: '🦄' }); // $ExpectType HTMLHeadingElement
|
||||
createHtmlElement({ name: 'h1', text: 'Hello <em>World</em>' }); // $ExpectType HTMLHeadingElement
|
||||
createHtmlElement({ name: 'h1', html: '🦄', text: 'Hello <em>World</em>' }); // $ExpectError
|
||||
|
||||
createHtmlElement({ name: 'foo' }); // $ExpectType HTMLElement
|
||||
// $ExpectType HTMLElement
|
||||
createHtmlElement({
|
||||
name: 'foo',
|
||||
attributes: {
|
||||
class: 'unicorn',
|
||||
rainbow: true,
|
||||
horse: false,
|
||||
number: 1,
|
||||
multiple: ['a', 'b'],
|
||||
},
|
||||
});
|
||||
createHtmlElement({ name: 'foo', html: '🦄' }); // $ExpectType HTMLElement
|
||||
createHtmlElement({ name: 'foo', text: 'Hello <em>World</em>' }); // $ExpectType HTMLElement
|
||||
createHtmlElement({ name: 'foo', html: '🦄', text: 'Hello <em>World</em>' }); // $ExpectError
|
||||
40
types/create-html-element/index.d.ts
vendored
Normal file
40
types/create-html-element/index.d.ts
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
// Type definitions for create-html-element 2.0
|
||||
// Project: https://github.com/sindresorhus/create-html-element#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
export = createHtmlElement;
|
||||
|
||||
declare function createHtmlElement(
|
||||
options?: createHtmlElement.OptionsWithoutTagName
|
||||
): HTMLDivElement;
|
||||
declare function createHtmlElement<K extends keyof HTMLElementTagNameMap>(
|
||||
options: createHtmlElement.Options<K>
|
||||
): HTMLElementTagNameMap[K];
|
||||
declare function createHtmlElement(options: createHtmlElement.Options<string>): HTMLElement;
|
||||
|
||||
declare namespace createHtmlElement {
|
||||
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
|
||||
type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
|
||||
|
||||
interface AttributesOptions {
|
||||
attributes?: { [key: string]: string | boolean | number | string[] };
|
||||
}
|
||||
|
||||
interface HtmlOptions {
|
||||
html?: string;
|
||||
}
|
||||
|
||||
interface TextOptions {
|
||||
text?: string;
|
||||
}
|
||||
|
||||
type OptionsWithoutTagName = AttributesOptions & XOR<HtmlOptions, TextOptions>;
|
||||
|
||||
interface OptionsWithTagName<K> extends AttributesOptions {
|
||||
name: K;
|
||||
}
|
||||
|
||||
type Options<K> = OptionsWithTagName<K> & XOR<HtmlOptions, TextOptions>;
|
||||
}
|
||||
7
types/create-html-element/package.json
Normal file
7
types/create-html-element/package.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"types": "index",
|
||||
"typesVersions": {
|
||||
">=3.1.0-0": { "*": ["ts3.1/*"] }
|
||||
}
|
||||
}
|
||||
64
types/create-html-element/ts3.1/create-html-element-tests.ts
Normal file
64
types/create-html-element/ts3.1/create-html-element-tests.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import createHtmlElement = require('create-html-element');
|
||||
|
||||
createHtmlElement(); // $ExpectType HTMLDivElement
|
||||
// $ExpectType HTMLDivElement
|
||||
createHtmlElement({
|
||||
attributes: {
|
||||
class: 'unicorn',
|
||||
rainbow: true,
|
||||
horse: false,
|
||||
number: 1,
|
||||
multiple: ['a', 'b'],
|
||||
},
|
||||
});
|
||||
createHtmlElement({ html: '🦄' }); // $ExpectType HTMLDivElement
|
||||
createHtmlElement({ text: 'Hello <em>World</em>' }); // $ExpectType HTMLDivElement
|
||||
createHtmlElement({ html: '🦄', text: 'Hello <em>World</em>' }); // $ExpectError
|
||||
|
||||
createHtmlElement({ name: 'h1' }); // $ExpectType HTMLHeadingElement
|
||||
// $ExpectType HTMLHeadingElement
|
||||
createHtmlElement({
|
||||
name: 'h1',
|
||||
attributes: {
|
||||
class: 'unicorn',
|
||||
rainbow: true,
|
||||
horse: false,
|
||||
number: 1,
|
||||
multiple: ['a', 'b'],
|
||||
},
|
||||
});
|
||||
createHtmlElement({ name: 'h1', html: '🦄' }); // $ExpectType HTMLHeadingElement
|
||||
createHtmlElement({ name: 'h1', text: 'Hello <em>World</em>' }); // $ExpectType HTMLHeadingElement
|
||||
createHtmlElement({ name: 'h1', html: '🦄', text: 'Hello <em>World</em>' }); // $ExpectError
|
||||
|
||||
createHtmlElement({ name: 'listing' }); // $ExpectType HTMLPreElement
|
||||
// $ExpectType HTMLPreElement
|
||||
createHtmlElement({
|
||||
name: 'listing',
|
||||
attributes: {
|
||||
class: 'unicorn',
|
||||
rainbow: true,
|
||||
horse: false,
|
||||
number: 1,
|
||||
multiple: ['a', 'b'],
|
||||
},
|
||||
});
|
||||
createHtmlElement({ name: 'listing', html: '🦄' }); // $ExpectType HTMLPreElement
|
||||
createHtmlElement({ name: 'listing', text: 'Hello <em>World</em>' }); // $ExpectType HTMLPreElement
|
||||
createHtmlElement({ name: 'listing', html: '🦄', text: 'Hello <em>World</em>' }); // $ExpectError
|
||||
|
||||
createHtmlElement({ name: 'foo' }); // $ExpectType HTMLElement
|
||||
// $ExpectType HTMLElement
|
||||
createHtmlElement({
|
||||
name: 'foo',
|
||||
attributes: {
|
||||
class: 'unicorn',
|
||||
rainbow: true,
|
||||
horse: false,
|
||||
number: 1,
|
||||
multiple: ['a', 'b'],
|
||||
},
|
||||
});
|
||||
createHtmlElement({ name: 'foo', html: '🦄' }); // $ExpectType HTMLElement
|
||||
createHtmlElement({ name: 'foo', text: 'Hello <em>World</em>' }); // $ExpectType HTMLElement
|
||||
createHtmlElement({ name: 'foo', html: '🦄', text: 'Hello <em>World</em>' }); // $ExpectError
|
||||
38
types/create-html-element/ts3.1/index.d.ts
vendored
Normal file
38
types/create-html-element/ts3.1/index.d.ts
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
export = createHtmlElement;
|
||||
|
||||
declare function createHtmlElement(
|
||||
options?: createHtmlElement.OptionsWithoutTagName
|
||||
): HTMLDivElement;
|
||||
declare function createHtmlElement<K extends keyof HTMLElementTagNameMap>(
|
||||
options: createHtmlElement.Options<K>
|
||||
): HTMLElementTagNameMap[K];
|
||||
/** @deprecated */
|
||||
declare function createHtmlElement<K extends keyof HTMLElementDeprecatedTagNameMap>(
|
||||
options: createHtmlElement.Options<K>
|
||||
): HTMLElementDeprecatedTagNameMap[K];
|
||||
declare function createHtmlElement(options: createHtmlElement.Options<string>): HTMLElement;
|
||||
|
||||
declare namespace createHtmlElement {
|
||||
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
|
||||
type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
|
||||
|
||||
interface AttributesOptions {
|
||||
attributes?: { [key: string]: string | boolean | number | string[] };
|
||||
}
|
||||
|
||||
interface HtmlOptions {
|
||||
html?: string;
|
||||
}
|
||||
|
||||
interface TextOptions {
|
||||
text?: string;
|
||||
}
|
||||
|
||||
type OptionsWithoutTagName = AttributesOptions & XOR<HtmlOptions, TextOptions>;
|
||||
|
||||
interface OptionsWithTagName<K> extends AttributesOptions {
|
||||
name: K;
|
||||
}
|
||||
|
||||
type Options<K> = OptionsWithTagName<K> & XOR<HtmlOptions, TextOptions>;
|
||||
}
|
||||
24
types/create-html-element/ts3.1/tsconfig.json
Normal file
24
types/create-html-element/ts3.1/tsconfig.json
Normal file
@ -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",
|
||||
"create-html-element-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/create-html-element/ts3.1/tslint.json
Normal file
1
types/create-html-element/ts3.1/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
24
types/create-html-element/tsconfig.json
Normal file
24
types/create-html-element/tsconfig.json
Normal file
@ -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",
|
||||
"create-html-element-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/create-html-element/tslint.json
Normal file
1
types/create-html-element/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
53
types/cycled/cycled-tests.ts
Normal file
53
types/cycled/cycled-tests.ts
Normal file
@ -0,0 +1,53 @@
|
||||
import Cycled = require('cycled');
|
||||
|
||||
const cycled = new Cycled([1, 2, 3]);
|
||||
// $ExpectType Cycled<number>
|
||||
cycled;
|
||||
|
||||
// $ExpectType number
|
||||
cycled.index;
|
||||
cycled.index = 1;
|
||||
|
||||
// $ExpectType number
|
||||
cycled.current();
|
||||
|
||||
// $ExpectType number
|
||||
cycled.next();
|
||||
|
||||
// $ExpectType number
|
||||
cycled.previous();
|
||||
|
||||
// $ExpectType number
|
||||
cycled.step(10);
|
||||
|
||||
// $ExpectType Iterator<number>
|
||||
cycled.indefinitely();
|
||||
|
||||
// $ExpectType Iterator<number>
|
||||
cycled.indefinitelyReversed();
|
||||
|
||||
// $ExpectType number[]
|
||||
[...cycled];
|
||||
|
||||
class TabComponent {
|
||||
views: Cycled<string>;
|
||||
activeView: string;
|
||||
|
||||
constructor(views: string[]) {
|
||||
this.activeView = views[0];
|
||||
this.views = new Cycled(views);
|
||||
}
|
||||
|
||||
setActiveView(view: string) {
|
||||
this.activeView = view;
|
||||
this.views.index = this.views.indexOf(view);
|
||||
}
|
||||
|
||||
nextView() {
|
||||
this.setActiveView(this.views.next());
|
||||
}
|
||||
|
||||
previousView() {
|
||||
this.setActiveView(this.views.previous());
|
||||
}
|
||||
}
|
||||
58
types/cycled/index.d.ts
vendored
Normal file
58
types/cycled/index.d.ts
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
// Type definitions for cycled 1.0
|
||||
// Project: https://github.com/sindresorhus/cycled#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = Cycled;
|
||||
|
||||
// tslint:disable:jsdoc-format
|
||||
declare class Cycled<T> extends Array<T> {
|
||||
/**
|
||||
* Initiates an array subclass with the methods documented below.
|
||||
* Since it's an array, you can use all the normal array methods on it.
|
||||
*
|
||||
* The instance is an iterable that will cycle through the array.
|
||||
* It will cycle through the number of elements equaling the length of the array from the current index.
|
||||
* ```
|
||||
const numberCycle = new Cycled([1,2,3,4,5]);
|
||||
|
||||
console.log(...numberCycle);
|
||||
//=> 1 2 3 4 5
|
||||
```
|
||||
*
|
||||
* @param input
|
||||
*/
|
||||
constructor(input: T[]);
|
||||
|
||||
/**
|
||||
* Get or set the current index.
|
||||
*/
|
||||
index: number;
|
||||
|
||||
/**
|
||||
* Returns the current item.
|
||||
*/
|
||||
current(): T;
|
||||
/**
|
||||
* Returns the next item.
|
||||
*/
|
||||
next(): T;
|
||||
/**
|
||||
* Returns the previous item.
|
||||
*/
|
||||
previous(): T;
|
||||
/**
|
||||
* Returns the item by going the given amount of `steps` through the array.
|
||||
* For example, calling `step(2)` is like calling `next()` twice. You go backward by specifying a negative number.
|
||||
* @param steps
|
||||
*/
|
||||
step(steps: number): T;
|
||||
/**
|
||||
* Returns an iterable that will cycle through the array indefinitely.
|
||||
*/
|
||||
indefinitely(): Iterator<T>;
|
||||
/**
|
||||
* Returns an iterable that will cycle through the array backward indefinitely.
|
||||
*/
|
||||
indefinitelyReversed(): Iterator<T>;
|
||||
}
|
||||
23
types/cycled/tsconfig.json
Normal file
23
types/cycled/tsconfig.json
Normal file
@ -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",
|
||||
"cycled-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/cycled/tslint.json
Normal file
1
types/cycled/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
1
types/cytoscape/index.d.ts
vendored
1
types/cytoscape/index.d.ts
vendored
@ -1146,6 +1146,7 @@ declare namespace cytoscape {
|
||||
extends
|
||||
CollectionGraphManipulation, CollectionEvents,
|
||||
CollectionData, CollectionPosition,
|
||||
CollectionTraversing,
|
||||
CollectionLayout,
|
||||
CollectionSelection, CollectionStyle, CollectionAnimation,
|
||||
CollectionComparision, CollectionIteration<TIn, TOut>,
|
||||
|
||||
13
types/d/auto-bind.d.ts
vendored
Normal file
13
types/d/auto-bind.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
export = autoBind;
|
||||
|
||||
declare function autoBind(
|
||||
obj: { [key: string]: PropertyDescriptor },
|
||||
options?: autoBind.Options
|
||||
): PropertyDescriptorMap;
|
||||
|
||||
declare namespace autoBind {
|
||||
interface Options {
|
||||
overwriteDefinition?: boolean;
|
||||
resolveContext?: (context: any) => any;
|
||||
}
|
||||
}
|
||||
85
types/d/d-tests.ts
Normal file
85
types/d/d-tests.ts
Normal file
@ -0,0 +1,85 @@
|
||||
import d = require('d');
|
||||
import autoBind = require('d/auto-bind');
|
||||
import lazy = require('d/lazy');
|
||||
|
||||
class Account {}
|
||||
Object.defineProperties(Account.prototype, {
|
||||
deposit: d(() => {}),
|
||||
withdraw: d(() => {}),
|
||||
balance: d.gs(() => {}),
|
||||
});
|
||||
|
||||
d('foo'); // $ExpectType PropertyDescriptor
|
||||
d('foo', { enumerable: true }); // $ExpectType PropertyDescriptor
|
||||
d('c', 'foo'); // $ExpectType PropertyDescriptor
|
||||
d('c', 'foo', { enumerable: true }); // $ExpectType PropertyDescriptor
|
||||
|
||||
d('c', 'foo'); // $ExpectType PropertyDescriptor
|
||||
d('e', 'foo'); // $ExpectType PropertyDescriptor
|
||||
d('w', 'foo'); // $ExpectType PropertyDescriptor
|
||||
d('ce', 'foo'); // $ExpectType PropertyDescriptor
|
||||
d('cw', 'foo'); // $ExpectType PropertyDescriptor
|
||||
d('ew', 'foo'); // $ExpectType PropertyDescriptor
|
||||
d('cew', 'foo'); // $ExpectType PropertyDescriptor
|
||||
d('foo', 'foo'); // $ExpectError
|
||||
|
||||
d.gs('c', { enumerable: true }); // $ExpectType PropertyDescriptor
|
||||
d.gs('c', () => ({}), { enumerable: true }); // $ExpectType PropertyDescriptor
|
||||
d.gs(() => ({})); // $ExpectType PropertyDescriptor
|
||||
d.gs(null, () => ({})); // $ExpectType PropertyDescriptor
|
||||
d.gs(undefined, () => ({})); // $ExpectType PropertyDescriptor
|
||||
d.gs('c', () => ({})); // $ExpectType PropertyDescriptor
|
||||
d.gs('c', null, () => ({})); // $ExpectType PropertyDescriptor
|
||||
d.gs('c', undefined, () => ({})); // $ExpectType PropertyDescriptor
|
||||
d.gs('c', null, () => ({}), { enumerable: true }); // $ExpectType PropertyDescriptor
|
||||
d.gs('c', undefined, () => ({}), { enumerable: true }); // $ExpectType PropertyDescriptor
|
||||
|
||||
d.gs('c', () => ({})); // $ExpectType PropertyDescriptor
|
||||
d.gs('e', () => ({})); // $ExpectType PropertyDescriptor
|
||||
d.gs('ce', () => ({})); // $ExpectType PropertyDescriptor
|
||||
d.gs('cew', () => ({})); // $ExpectError
|
||||
|
||||
class Foo {
|
||||
_count: number;
|
||||
}
|
||||
|
||||
Object.defineProperties(
|
||||
Foo.prototype,
|
||||
autoBind({
|
||||
increment: d(function(this: any) {
|
||||
++this._count;
|
||||
}),
|
||||
})
|
||||
);
|
||||
autoBind(
|
||||
{
|
||||
increment: d(function(this: any) {
|
||||
++this._count;
|
||||
}),
|
||||
},
|
||||
{ overwriteDefinition: true }
|
||||
);
|
||||
autoBind(
|
||||
{
|
||||
increment: d(function(this: any) {
|
||||
++this._count;
|
||||
}),
|
||||
},
|
||||
{
|
||||
resolveContext(ctx: any) {
|
||||
return ctx;
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
Object.defineProperties(
|
||||
Foo.prototype,
|
||||
lazy({
|
||||
items: d(() => {
|
||||
return [];
|
||||
}),
|
||||
})
|
||||
);
|
||||
|
||||
const foo = new Foo();
|
||||
(foo as any).items.push(1, 2); // foo.items array created and defined directly on foo
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user