mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Merge branch 'master' of https://github.com/mscharlock/DefinitelyTyped
This commit is contained in:
+349
-150
File diff suppressed because it is too large
Load Diff
@@ -390,6 +390,12 @@
|
||||
"sourceRepoURL": "https://github.com/MikeMcl/decimal.js",
|
||||
"asOfVersion": "7.4.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "delay",
|
||||
"typingsPackageName": "delay",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/delay",
|
||||
"asOfVersion": "3.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "DevExtreme",
|
||||
"typingsPackageName": "devextreme",
|
||||
@@ -972,6 +978,12 @@
|
||||
"sourceRepoURL": "https://github.com/mqttjs/MQTT.js",
|
||||
"asOfVersion": "2.5.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "nano",
|
||||
"typingsPackageName": "nano",
|
||||
"sourceRepoURL": "https://github.com/apache/couchdb-nano",
|
||||
"asOfVersion": "7.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "ng-table",
|
||||
"typingsPackageName": "ng-table",
|
||||
@@ -1266,6 +1278,12 @@
|
||||
"sourceRepoURL": "https://github.com/zalmoxisus/redux-devtools-extension",
|
||||
"asOfVersion": "2.13.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "redux-little-router",
|
||||
"typingsPackageName": "redux-little-router",
|
||||
"sourceRepoURL": "https://github.com/FormidableLabs/redux-little-router",
|
||||
"asOfVersion": "15.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "redux-persist",
|
||||
"typingsPackageName": "redux-persist",
|
||||
|
||||
@@ -11,3 +11,7 @@ const test = (levelDown: AbstractLevelDOWN<any, string>) => {
|
||||
test(new AbstractLevelDOWN('here'));
|
||||
// $ExpectType void
|
||||
test(AbstractLevelDOWN('there'));
|
||||
// $ExpectType void
|
||||
test(new AbstractLevelDOWN<any, string>('here'));
|
||||
// $ExpectType void
|
||||
test(AbstractLevelDOWN<any, string>('there'));
|
||||
|
||||
Vendored
+25
-14
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Meirion Hughes <https://github.com/MeirionHughes>
|
||||
// Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export interface AbstractOptions {
|
||||
readonly [k: string]: any;
|
||||
@@ -21,7 +22,7 @@ export interface AbstractGetOptions extends AbstractOptions {
|
||||
asBuffer?: boolean;
|
||||
}
|
||||
|
||||
export interface AbstractLevelDOWN<K, V> extends AbstractOptions {
|
||||
export interface AbstractLevelDOWN<K = any, V = any> extends AbstractOptions {
|
||||
open(cb: ErrorCallback): void;
|
||||
open(options: AbstractOpenOptions, cb: ErrorCallback): void;
|
||||
|
||||
@@ -38,17 +39,23 @@ export interface AbstractLevelDOWN<K, V> extends AbstractOptions {
|
||||
|
||||
batch(): AbstractChainedBatch<K, V>;
|
||||
batch(array: ReadonlyArray<AbstractBatch<K, V>>, cb: ErrorCallback): AbstractChainedBatch<K, V>;
|
||||
batch(array: ReadonlyArray<AbstractBatch<K, V>>, options: AbstractOptions, cb: ErrorCallback): AbstractChainedBatch<K, V>;
|
||||
batch(
|
||||
array: ReadonlyArray<AbstractBatch<K, V>>,
|
||||
options: AbstractOptions,
|
||||
cb: ErrorCallback,
|
||||
): AbstractChainedBatch<K, V>;
|
||||
|
||||
iterator(options?: AbstractIteratorOptions<K>): AbstractIterator<K, V>;
|
||||
}
|
||||
|
||||
export interface AbstractLevelDOWNConstructor {
|
||||
new (location: string): AbstractLevelDOWN<any, any>;
|
||||
(location: string): AbstractLevelDOWN<any, any>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
new <K = any, V = any>(location: string): AbstractLevelDOWN<K, V>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
<K = any, V = any>(location: string): AbstractLevelDOWN<K, V>;
|
||||
}
|
||||
|
||||
export interface AbstractIteratorOptions<K> extends AbstractOptions {
|
||||
export interface AbstractIteratorOptions<K = any> extends AbstractOptions {
|
||||
gt?: K;
|
||||
gte?: K;
|
||||
lt?: K;
|
||||
@@ -61,20 +68,20 @@ export interface AbstractIteratorOptions<K> extends AbstractOptions {
|
||||
valueAsBuffer?: boolean;
|
||||
}
|
||||
|
||||
export type AbstractBatch<K, V> = PutBatch<K, V> | DelBatch<K, V>;
|
||||
export type AbstractBatch<K = any, V = any> = PutBatch<K, V> | DelBatch<K, V>;
|
||||
|
||||
export interface PutBatch<K, V> {
|
||||
export interface PutBatch<K = any, V = any> {
|
||||
readonly type: 'put';
|
||||
readonly key: K;
|
||||
readonly value: V;
|
||||
}
|
||||
|
||||
export interface DelBatch<K, V> {
|
||||
export interface DelBatch<K = any, V = any> {
|
||||
readonly type: 'del';
|
||||
readonly key: K;
|
||||
}
|
||||
|
||||
export interface AbstractChainedBatch<K, V> extends AbstractChainedBatchConstructor, AbstractOptions {
|
||||
export interface AbstractChainedBatch<K = any, V = any> extends AbstractOptions {
|
||||
put: (key: K, value: V) => this;
|
||||
del: (key: K) => this;
|
||||
clear: () => this;
|
||||
@@ -83,19 +90,23 @@ export interface AbstractChainedBatch<K, V> extends AbstractChainedBatchConstruc
|
||||
}
|
||||
|
||||
export interface AbstractChainedBatchConstructor {
|
||||
new(db: any): AbstractChainedBatch<any, any>;
|
||||
(db: any): AbstractChainedBatch<any, any>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
new <K = any, V = any>(db: any): AbstractChainedBatch<K, V>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
<K = any, V = any>(db: any): AbstractChainedBatch<K, V>;
|
||||
}
|
||||
|
||||
export interface AbstractIterator<K, V> extends AbstractChainedBatchConstructor {
|
||||
export interface AbstractIterator<K, V> extends AbstractOptions {
|
||||
db: AbstractLevelDOWN<K, V>;
|
||||
next(cb: ErrorKeyValueCallback<K, V>): this;
|
||||
end(cb: ErrorCallback): void;
|
||||
}
|
||||
|
||||
export interface AbstractIteratorConstructor {
|
||||
new(db: any): AbstractIterator<any, any>;
|
||||
(db: any): AbstractIterator<any, any>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
new <K = any, V = any>(db: any): AbstractIterator<K, V>;
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
<K = any, V = any>(db: any): AbstractIterator<K, V>;
|
||||
}
|
||||
|
||||
export const AbstractLevelDOWN: AbstractLevelDOWNConstructor;
|
||||
|
||||
Vendored
+437
-306
@@ -1,345 +1,476 @@
|
||||
// Type definitions for AFRAME 0.7
|
||||
// Type definitions for AFRAME 0.8
|
||||
// Project: https://aframe.io/
|
||||
// Definitions by: Paul Shannon <https://github.com/devpaul>
|
||||
// Roberto Ritger <https://github.com/bertoritger>
|
||||
// Trygve Wastvedt <https://github.com/twastvedt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/**
|
||||
* Extended tests available at https://github.com/devpaul/aframe-typings.git
|
||||
* Extended tests and examples available at https://github.com/devpaul/aframe-experiments.git
|
||||
*/
|
||||
|
||||
/// <reference types="three" />
|
||||
/// <reference types="tween.js" />
|
||||
|
||||
// Globals
|
||||
declare var AFRAME: AFrame.AFrameGlobal;
|
||||
declare var hasNativeWebVRImplementation: boolean;
|
||||
import * as three from 'three';
|
||||
import * as tween from '@tweenjs/tween.js';
|
||||
|
||||
interface Document {
|
||||
createElement(tagName: string): AFrame.Entity;
|
||||
querySelector(selectors: 'a-scene'): AFrame.Scene;
|
||||
querySelector(selectors: string): AFrame.Entity<any>;
|
||||
querySelectorAll(selectors: string): NodeListOf<AFrame.Entity<any> | Element>;
|
||||
export type ThreeLib = typeof three;
|
||||
export type TweenLib = typeof tween;
|
||||
|
||||
export interface ObjectMap<T = any> {
|
||||
[key: string]: T;
|
||||
}
|
||||
|
||||
// Interfaces
|
||||
declare namespace AFrame {
|
||||
interface ObjectMap<T = any> {
|
||||
[ key: string ]: T;
|
||||
}
|
||||
export interface Animation {
|
||||
attribute: string;
|
||||
begin: string | number;
|
||||
delay: number;
|
||||
direction: 'alternate' | 'alternateReverse' | 'normal' | 'reverse';
|
||||
dur: number;
|
||||
easing(): void;
|
||||
end: string;
|
||||
fill: 'backwards' | 'both' | 'forwards' | 'none';
|
||||
from: any; // TODO type
|
||||
repeat: number | 'indefinite';
|
||||
to: number;
|
||||
}
|
||||
|
||||
interface AFrameGlobal {
|
||||
AEntity: Entity;
|
||||
ANode: ANode;
|
||||
AScene: Scene;
|
||||
components: { [ key: string ]: ComponentDescriptor };
|
||||
geometries: { [ key: string ]: GeometryDescriptor };
|
||||
primitives: { [ key: string ]: Entity };
|
||||
registerComponent<T extends Component>(name: string, component: ComponentDefinition<T>): ComponentConstructor<T>;
|
||||
registerElement(name: string, element: ANode): void;
|
||||
registerGeometry<T extends Geometry>(name: string, geometry: GeometryDefinition<T>): GeometryConstructor<T>;
|
||||
registerPrimitive(name: string, primitive: PrimitiveDefinition): void;
|
||||
registerShader<T extends Shader>(name: string, shader: T): ShaderConstructor<T>;
|
||||
registerSystem<T extends System>(name: string, definition: SystemDefinition<T>): SystemConstructor<T>;
|
||||
schema: SchemaUtils;
|
||||
shaders: { [ key: string ]: ShaderDescriptor };
|
||||
systems: { [key: string]: SystemConstructor };
|
||||
THREE: typeof THREE;
|
||||
TWEEN: typeof TWEEN;
|
||||
utils: Utils;
|
||||
version: string;
|
||||
}
|
||||
export interface ANode extends HTMLElement {
|
||||
// Only public APIs added. Many methods intentionally left out.
|
||||
// createdCallback
|
||||
// attachedCallback
|
||||
// attributeChangedCallback
|
||||
closestScene(): Scene;
|
||||
closest(selector: string): ANode;
|
||||
// detachedCallback
|
||||
hasLoaded: boolean;
|
||||
load(cb?: () => void, childFilter?: (el: Element) => boolean): void;
|
||||
// updateMixins
|
||||
registerMixin(id: string): void;
|
||||
setAttribute(type: string, newValue: any): void;
|
||||
unregisterMixin(id: string): void;
|
||||
removeMixinListener(id: string): void;
|
||||
attachMixinListener(mixin: HTMLElement): void;
|
||||
emit(name: string, detail?: any, bubbles?: boolean): void;
|
||||
emitter(name: string, detail?: any, bubbles?: boolean): () => void;
|
||||
}
|
||||
|
||||
interface Animation {
|
||||
attribute: string;
|
||||
begin: string | number;
|
||||
delay: number;
|
||||
direction: 'alternate' | 'alternateReverse' | 'normal' | 'reverse';
|
||||
dur: number;
|
||||
easing(): void;
|
||||
end: string;
|
||||
fill: 'backwards' | 'both' | 'forwards' | 'none';
|
||||
from: any; // TODO type
|
||||
repeat: number | 'indefinite';
|
||||
to: number;
|
||||
}
|
||||
export interface Behavior {
|
||||
tick(): void;
|
||||
}
|
||||
|
||||
interface ANode extends HTMLElement {
|
||||
// Only public APIs added. Many methods intentionally left out.
|
||||
// createdCallback
|
||||
// attachedCallback
|
||||
// attributeChangedCallback
|
||||
closestScene(): Scene;
|
||||
closest(selector: string): ANode;
|
||||
// detachedCallback
|
||||
hasLoaded: boolean;
|
||||
load(cb?: () => void, childFilter?: (el: Element) => boolean): void;
|
||||
// updateMixins
|
||||
registerMixin(id: string): void;
|
||||
setAttribute(type: string, newValue: any): void;
|
||||
unregisterMixin(id: string): void;
|
||||
removeMixinListener(id: string): void;
|
||||
attachMixinListener(mixin: HTMLElement): void;
|
||||
emit(name: string, detail?: any, bubbles?: boolean): void;
|
||||
emitter(name: string, detail?: any, bubbles?: boolean): () => void;
|
||||
}
|
||||
export interface Component<T extends object = any, S extends System = System> {
|
||||
attrName?: string;
|
||||
data: T;
|
||||
dependencies?: string[];
|
||||
el: Entity;
|
||||
id: string;
|
||||
multiple?: boolean;
|
||||
name: string;
|
||||
schema: Schema<T>;
|
||||
system: S | undefined;
|
||||
|
||||
interface Behavior {
|
||||
tick(): void;
|
||||
}
|
||||
init(data?: T): void;
|
||||
pause(): void;
|
||||
play(): void;
|
||||
remove(): void;
|
||||
tick?(time: number, timeDelta: number): void;
|
||||
update(oldData: T): void;
|
||||
updateSchema?(): void;
|
||||
|
||||
interface Component<T extends { [key: string]: any } = any, S extends System = System> {
|
||||
attrName?: string;
|
||||
data: T;
|
||||
dependencies?: string[];
|
||||
el: Entity;
|
||||
id: string;
|
||||
multiple?: boolean;
|
||||
extendSchema(update: Schema): void;
|
||||
flushToDOM(): void;
|
||||
}
|
||||
|
||||
export interface ComponentConstructor<T extends object> {
|
||||
new (el: Entity, attrValue: string, id: string): T & Component;
|
||||
prototype: T & {
|
||||
name: string;
|
||||
schema: Schema<T>;
|
||||
system: S | undefined;
|
||||
|
||||
init(this: this, data?: T): void;
|
||||
pause(this: this): void;
|
||||
play(this: this): void;
|
||||
remove(this: this): void;
|
||||
tick?(this: this, time: number, timeDelta: number): void;
|
||||
update(this: this, oldData: T): void;
|
||||
updateSchema?(this: this): void;
|
||||
|
||||
extendSchema(this: this, update: Schema): void;
|
||||
flushToDOM(this: this): void;
|
||||
}
|
||||
|
||||
interface ComponentConstructor<T extends Component> {
|
||||
new (el: Entity, attrValue: string, id: string): T;
|
||||
}
|
||||
|
||||
type ComponentDefinition<T extends Component = Component> = Partial<T>;
|
||||
|
||||
interface ComponentDescriptor<T extends Component = Component> {
|
||||
Component: ComponentConstructor<T>;
|
||||
dependencies: string[] | undefined;
|
||||
multiple: boolean | undefined;
|
||||
|
||||
// internal APIs2
|
||||
// parse
|
||||
// parseAttrValueForCache
|
||||
// schema
|
||||
// stringify
|
||||
// type
|
||||
}
|
||||
|
||||
interface Coordinate {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
interface DefaultComponents {
|
||||
position: Component<Coordinate>;
|
||||
rotation: Component<Coordinate>;
|
||||
scale: Component<Coordinate>;
|
||||
}
|
||||
|
||||
interface Entity<C = ObjectMap<Component>> extends ANode {
|
||||
components: C & DefaultComponents;
|
||||
isPlaying: boolean;
|
||||
object3D: THREE.Object3D;
|
||||
object3DMap: ObjectMap<THREE.Object3D>;
|
||||
sceneEl?: Scene;
|
||||
|
||||
addState(name: string): void;
|
||||
flushToDOM(recursive?: boolean): void;
|
||||
/**
|
||||
* @deprecated since 0.4.0
|
||||
*/
|
||||
getComputedAttribute(attr: string): Component;
|
||||
getDOMAttribute(attr: string): any;
|
||||
getObject3D(type: string): THREE.Object3D;
|
||||
getOrCreateObject3D(type: string, construct: any): THREE.Object3D;
|
||||
is(stateName: string): boolean;
|
||||
pause(): void;
|
||||
system: System;
|
||||
play(): void;
|
||||
setObject3D(type: string, obj: THREE.Object3D): void;
|
||||
removeAttribute(attr: string, property?: string): void;
|
||||
removeObject3D(type: string): void;
|
||||
removeState(stateName: string): void;
|
||||
|
||||
// getAttribute specific usages
|
||||
getAttribute(type: string): any;
|
||||
getAttribute(type: 'position' | 'rotation' | 'scale'): Coordinate;
|
||||
|
||||
// setAttribute specific usages
|
||||
setAttribute(attr: string, value: any): void;
|
||||
setAttribute(attr: string, property: string, componentAttrValue?: any): void;
|
||||
setAttribute(type: 'position' | 'rotation' | 'scale', value: Coordinate): void;
|
||||
|
||||
// addEventListener specific usages
|
||||
addEventListener<K extends keyof EntityEventMap>(type: K, listener: (event: Event & EntityEventMap[K]) => void, useCapture?: boolean): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
type DetailEvent<D> = Event & {
|
||||
detail: D;
|
||||
target: EventTarget & Entity;
|
||||
pause(): void;
|
||||
};
|
||||
}
|
||||
|
||||
interface EntityEventMap {
|
||||
'child-attached': DetailEvent<{ el: Element | Entity }>;
|
||||
'child-detached': DetailEvent<{ el: Element | Entity }>;
|
||||
'componentchanged': DetailEvent<{
|
||||
name: string,
|
||||
id: string
|
||||
}>;
|
||||
'componentremoved': DetailEvent<{
|
||||
name: string,
|
||||
id: string,
|
||||
newData: any,
|
||||
oldData: any
|
||||
}>;
|
||||
'loaded': EventListener;
|
||||
'pause': EventListener;
|
||||
'play': EventListener;
|
||||
'stateadded': DetailEvent<{ state: string }>;
|
||||
'stateremoved': DetailEvent<{ state: string }>;
|
||||
'schemachanged': DetailEvent<{ componentName: string }>;
|
||||
}
|
||||
export interface ComponentDescriptor<T extends Component = Component> {
|
||||
Component: ComponentConstructor<T>;
|
||||
dependencies: string[] | undefined;
|
||||
multiple: boolean | undefined;
|
||||
|
||||
interface Geometry {
|
||||
// internal APIs2
|
||||
// parse
|
||||
// parseAttrValueForCache
|
||||
// schema
|
||||
// stringify
|
||||
// type
|
||||
}
|
||||
|
||||
export interface Coordinate {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
export interface DefaultComponents {
|
||||
position: Component<Coordinate>;
|
||||
rotation: Component<Coordinate>;
|
||||
scale: Component<Coordinate>;
|
||||
}
|
||||
|
||||
export interface Entity<C = ObjectMap<Component>> extends ANode {
|
||||
components: C & DefaultComponents;
|
||||
isPlaying: boolean;
|
||||
object3D: THREE.Object3D;
|
||||
object3DMap: ObjectMap<THREE.Object3D>;
|
||||
sceneEl?: Scene;
|
||||
|
||||
addState(name: string): void;
|
||||
flushToDOM(recursive?: boolean): void;
|
||||
/**
|
||||
* @deprecated since 0.4.0
|
||||
*/
|
||||
getComputedAttribute(attr: string): Component;
|
||||
getDOMAttribute(attr: string): any;
|
||||
getObject3D(type: string): THREE.Object3D;
|
||||
getOrCreateObject3D(type: string, construct: any): THREE.Object3D;
|
||||
is(stateName: string): boolean;
|
||||
pause(): void;
|
||||
play(): void;
|
||||
setObject3D(type: string, obj: THREE.Object3D): void;
|
||||
removeAttribute(attr: string, property?: string): void;
|
||||
removeObject3D(type: string): void;
|
||||
removeState(stateName: string): void;
|
||||
|
||||
// getAttribute specific usages
|
||||
getAttribute(type: string): any;
|
||||
getAttribute(type: 'position' | 'rotation' | 'scale'): Coordinate;
|
||||
|
||||
// setAttribute specific usages
|
||||
setAttribute(attr: string, value: any): void;
|
||||
setAttribute(attr: string, property: string, componentAttrValue?: any): void;
|
||||
setAttribute(type: 'position' | 'rotation' | 'scale', value: Coordinate): void;
|
||||
|
||||
// addEventListener specific usages
|
||||
addEventListener<K extends keyof EntityEventMap>(
|
||||
type: K,
|
||||
listener: (event: Event & EntityEventMap[K]) => void,
|
||||
useCapture?: boolean
|
||||
): void;
|
||||
addEventListener(
|
||||
type: string,
|
||||
listener: EventListenerOrEventListenerObject,
|
||||
useCapture?: boolean
|
||||
): void;
|
||||
}
|
||||
|
||||
export type DetailEvent<D> = Event & {
|
||||
detail: D;
|
||||
target: EventTarget & Entity;
|
||||
};
|
||||
|
||||
export interface EntityEventMap {
|
||||
'child-attached': DetailEvent<{ el: Element | Entity }>;
|
||||
'child-detached': DetailEvent<{ el: Element | Entity }>;
|
||||
componentchanged: DetailEvent<{
|
||||
name: string;
|
||||
geometry: THREE.Geometry;
|
||||
schema: Schema<any>;
|
||||
id: string;
|
||||
}>;
|
||||
componentremoved: DetailEvent<{
|
||||
name: string;
|
||||
id: string;
|
||||
newData: any;
|
||||
oldData: any;
|
||||
}>;
|
||||
loaded: EventListener;
|
||||
pause: EventListener;
|
||||
play: EventListener;
|
||||
stateadded: DetailEvent<{ state: string }>;
|
||||
stateremoved: DetailEvent<{ state: string }>;
|
||||
schemachanged: DetailEvent<{ componentName: string }>;
|
||||
}
|
||||
|
||||
init(this: this, data: { [P in keyof this['schema']]: any }): void;
|
||||
// Would like the above to be:
|
||||
// init?(this: this, data?: { [P in keyof T['schema']]: T['schema'][P]['default'] } ): void;
|
||||
// I think this is prevented by the following issue: https://github.com/Microsoft/TypeScript/issues/21760.
|
||||
}
|
||||
export interface Geometry<T = any> {
|
||||
data: T;
|
||||
name: string;
|
||||
geometry: THREE.Geometry;
|
||||
schema: Schema<any>;
|
||||
|
||||
interface GeometryConstructor<T extends Geometry> {
|
||||
new (): T;
|
||||
}
|
||||
init(data: any): void;
|
||||
}
|
||||
|
||||
type GeometryDefinition<T extends Geometry = Geometry> = Partial<T>;
|
||||
export interface GeometryConstructor<T extends object = object> {
|
||||
new (): T & Geometry;
|
||||
}
|
||||
|
||||
interface GeometryDescriptor<T extends Geometry = Geometry> {
|
||||
Geometry: GeometryConstructor<T>;
|
||||
schema: Schema;
|
||||
}
|
||||
export interface GeometryDescriptor<T extends Geometry = Geometry> {
|
||||
Geometry: GeometryConstructor<T>;
|
||||
schema: Schema;
|
||||
}
|
||||
|
||||
type MultiPropertySchema<T extends { [key: string ]: any }> = {
|
||||
[P in keyof T]: SinglePropertySchema<T[P]> | T[P];
|
||||
export type MultiPropertySchema<T extends object> = {
|
||||
[P in keyof T]: SinglePropertySchema<T[P]> | T[P]
|
||||
};
|
||||
|
||||
export type PropertyTypes =
|
||||
| 'array'
|
||||
| 'asset'
|
||||
| 'audio'
|
||||
| 'boolean'
|
||||
| 'color'
|
||||
| 'int'
|
||||
| 'map'
|
||||
| 'model'
|
||||
| 'number'
|
||||
| 'selector'
|
||||
| 'selectorAll'
|
||||
| 'string'
|
||||
| 'vec2'
|
||||
| 'vec3'
|
||||
| 'vec4';
|
||||
|
||||
export type SceneEvents = 'enter-vr' | 'exit-vr' | 'loaded' | 'renderstart';
|
||||
|
||||
export interface Scene extends Entity {
|
||||
behaviors: Behavior[];
|
||||
camera: THREE.Camera;
|
||||
canvas: HTMLCanvasElement;
|
||||
effect: THREE.VREffect;
|
||||
isMobile: boolean;
|
||||
object3D: THREE.Scene;
|
||||
renderer: THREE.WebGLRenderer;
|
||||
renderStarted: boolean;
|
||||
systems: ObjectMap<System>;
|
||||
time: number;
|
||||
|
||||
enterVR(): Promise<void> | void;
|
||||
exitVR(): Promise<void> | void;
|
||||
reload(): void;
|
||||
|
||||
addEventListener(
|
||||
type: string,
|
||||
listener: EventListenerOrEventListenerObject,
|
||||
useCapture?: boolean
|
||||
): void;
|
||||
addEventListener(type: SceneEvents, listener: EventListener, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
export type Schema<T extends object = object> = SinglePropertySchema<T> | MultiPropertySchema<T>;
|
||||
|
||||
export interface SchemaUtils {
|
||||
isSingleProperty(schema: Schema): boolean;
|
||||
process(schema: Schema): boolean;
|
||||
}
|
||||
|
||||
export interface Shader {
|
||||
name: string;
|
||||
data: object;
|
||||
schema: Schema<this['data']>;
|
||||
material: THREE.Material;
|
||||
vertexShader: string;
|
||||
fragmentShader: string;
|
||||
|
||||
init(data?: this['data']): void;
|
||||
tick?(time: number, timeDelta: number): void;
|
||||
update(oldData: this['data']): void;
|
||||
}
|
||||
|
||||
export interface ShaderConstructor<T extends object> {
|
||||
new (): T;
|
||||
}
|
||||
|
||||
export interface ShaderDescriptor<T extends Shader = Shader> {
|
||||
Shader: ShaderConstructor<T>;
|
||||
schema: Schema;
|
||||
}
|
||||
|
||||
export interface SinglePropertySchema<T> {
|
||||
type?: PropertyTypes;
|
||||
default?: T;
|
||||
parse?(value: string): T;
|
||||
stringify?(value: T): string;
|
||||
}
|
||||
|
||||
export interface System<T extends object = any> {
|
||||
data: T;
|
||||
schema: Schema<T>;
|
||||
init(): void;
|
||||
pause(): void;
|
||||
play(): void;
|
||||
tick?(t: number, dt: number): void;
|
||||
}
|
||||
|
||||
export interface SystemConstructor<T extends object = object> {
|
||||
new (scene: Scene): T & System;
|
||||
}
|
||||
|
||||
export interface Utils {
|
||||
coordinates: {
|
||||
isCoordinate(value: string): boolean;
|
||||
parse(value: string): Coordinate;
|
||||
stringify(coord: Coordinate): string;
|
||||
};
|
||||
entity: {
|
||||
getComponentProperty(entity: Entity, componentName: string, delimiter?: string): any;
|
||||
setComponentProperty(
|
||||
entity: Entity,
|
||||
componentName: string,
|
||||
value: any,
|
||||
delimiter?: string
|
||||
): void;
|
||||
};
|
||||
styleParser: {
|
||||
parse(value: string): object;
|
||||
stringify(data: object): string;
|
||||
};
|
||||
deepEqual(a: any, b: any): boolean;
|
||||
diff(a: object, b: object): object;
|
||||
extend(target: object, ...source: object[]): object;
|
||||
extendDeep(target: object, ...source: object[]): object;
|
||||
|
||||
interface PrimitiveDefinition {
|
||||
defaultComponents?: any; // TODO cleanup type
|
||||
deprecated?: boolean;
|
||||
mappings?: any; // TODO cleanup type
|
||||
transforms?: any; // TODO cleanup type
|
||||
}
|
||||
throttle(
|
||||
tickFunction: () => void,
|
||||
minimumInterval: number,
|
||||
optionalContext?: {}
|
||||
): (t: number, dt: number) => void;
|
||||
throttleTick(
|
||||
tickFunction: (t: number, dt: number) => void,
|
||||
minimumInterval: number,
|
||||
optionalContext?: {}
|
||||
): (t: number, dt: number) => void;
|
||||
}
|
||||
|
||||
type PropertyTypes = 'array' | 'asset' | 'audio' | 'boolean' | 'color' |
|
||||
'int' | 'map' | 'model' | 'number' | 'selector' | 'selectorAll' |
|
||||
'string' | 'vec2' | 'vec3' | 'vec4';
|
||||
// Definitions
|
||||
// used as mixins to register functions to create classes (newable functions) in A-Frame
|
||||
export type ComponentDefinition<T extends object = object> = T & Partial<Component>;
|
||||
export type GeometryDefinition<T extends object = object, U = any> = T & Partial<Geometry<U>>;
|
||||
export type NodeDefinition<T extends object = object> = T & Partial<ANode>;
|
||||
export interface PrimitiveDefinition {
|
||||
defaultComponents?: any; // TODO cleanup type
|
||||
deprecated?: boolean;
|
||||
mappings?: any; // TODO cleanup type
|
||||
transforms?: any; // TODO cleanup type
|
||||
}
|
||||
export interface MinimalShaderDefinition {
|
||||
schema: Shader['schema'];
|
||||
}
|
||||
export type ShaderDefinition<T extends object = MinimalShaderDefinition & object> = T &
|
||||
Partial<Shader>;
|
||||
export type SystemDefinition<T extends object = object> = T & Partial<System>;
|
||||
|
||||
type SceneEvents = 'enter-vr' | 'exit-vr' | 'loaded' | 'renderstart';
|
||||
// root export
|
||||
export interface AFrame {
|
||||
AComponent: Component;
|
||||
AEntity: Entity;
|
||||
ANode: ANode;
|
||||
AScene: Scene;
|
||||
|
||||
interface Scene extends Entity {
|
||||
behaviors: Behavior[];
|
||||
camera: THREE.Camera;
|
||||
canvas: HTMLCanvasElement;
|
||||
effect: THREE.VREffect;
|
||||
isMobile: boolean;
|
||||
object3D: THREE.Scene;
|
||||
renderer: THREE.WebGLRenderer;
|
||||
renderStarted: boolean;
|
||||
systems: ObjectMap<System>;
|
||||
time: number;
|
||||
|
||||
enterVR(): Promise<void> | void;
|
||||
exitVR(): Promise<void> | void;
|
||||
reload(): void;
|
||||
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
addEventListener(type: SceneEvents, listener: EventListener, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
type Schema<T = { [key: string]: any }> = SinglePropertySchema<T> | MultiPropertySchema<T>;
|
||||
|
||||
interface SchemaUtils {
|
||||
isSingleProperty(schema: Schema): boolean;
|
||||
process(schema: Schema): boolean;
|
||||
}
|
||||
|
||||
interface Shader {
|
||||
name: string;
|
||||
data: { [key: string]: any };
|
||||
schema: Schema<this['data']>;
|
||||
material: THREE.Material;
|
||||
vertexShader: string;
|
||||
fragmentShader: string;
|
||||
|
||||
init(this: this, data?: this['data']): void;
|
||||
tick?(this: this, time: number, timeDelta: number): void;
|
||||
update(this: this, oldData: this['data']): void;
|
||||
}
|
||||
|
||||
interface ShaderConstructor<T extends Shader> {
|
||||
new (): T;
|
||||
}
|
||||
|
||||
type ShaderDefinition<T extends Shader = Shader> = Partial<T>;
|
||||
|
||||
interface ShaderDescriptor<T extends Shader = Shader> {
|
||||
Shader: ShaderConstructor<T>;
|
||||
schema: Schema;
|
||||
}
|
||||
|
||||
interface SinglePropertySchema<T> {
|
||||
type?: PropertyTypes;
|
||||
'default'?: T;
|
||||
parse?(value: string): T;
|
||||
stringify?(value: T): string;
|
||||
}
|
||||
|
||||
interface System {
|
||||
data: { [key: string]: any };
|
||||
schema: Schema<this['data']>;
|
||||
init(this: this): void;
|
||||
pause(this: this): void;
|
||||
play(this: this): void;
|
||||
tick?(this: this, t: number, dt: number): void;
|
||||
}
|
||||
|
||||
interface SystemConstructor<T extends System = System> {
|
||||
new (scene: Scene): T;
|
||||
}
|
||||
|
||||
type SystemDefinition<T extends System = System> = Partial<T>;
|
||||
|
||||
interface Utils {
|
||||
coordinates: {
|
||||
isCoordinate(value: string): boolean;
|
||||
parse(value: string): Coordinate;
|
||||
stringify(coord: Coordinate): string;
|
||||
components: ObjectMap<ComponentDescriptor>;
|
||||
geometries: ObjectMap<GeometryDescriptor>;
|
||||
primitives: {
|
||||
getMeshMixin(): {
|
||||
defaultComponents: { material: object };
|
||||
mappings: { [key: string]: any }; // TODO improve any type
|
||||
};
|
||||
entity: {
|
||||
getComponentProperty(entity: Entity, componentName: string, delimiter?: string): any;
|
||||
setComponentProperty(entity: Entity, componentName: string, value: any, delimiter?: string): void;
|
||||
};
|
||||
styleParser: {
|
||||
parse(value: string): object;
|
||||
stringify(data: object): string;
|
||||
};
|
||||
deepEqual(a: any, b: any): boolean;
|
||||
diff(a: object, b: object): object;
|
||||
extend(target: object, ... source: object[]): object;
|
||||
extendDeep(target: object, ... source: object[]): object;
|
||||
primitives: ObjectMap<Entity>;
|
||||
};
|
||||
scenes: Scene[];
|
||||
schema: SchemaUtils;
|
||||
shaders: ObjectMap<ShaderDescriptor>;
|
||||
systems: ObjectMap<SystemConstructor>;
|
||||
THREE: ThreeLib;
|
||||
TWEEN: TweenLib;
|
||||
utils: Utils;
|
||||
version: string;
|
||||
|
||||
throttle(tickFunction: () => void, minimumInterval: number, optionalContext?: {}): (t: number, dt: number) => void;
|
||||
throttleTick(tickFunction: (t: number, dt: number) => void, minimumInterval: number, optionalContext?: {}): (t: number, dt: number) => void;
|
||||
registerComponent<T extends object>(
|
||||
name: string,
|
||||
component: ComponentDefinition<T>
|
||||
): ComponentConstructor<T>;
|
||||
registerElement(name: string, element: object): void;
|
||||
registerGeometry<T extends object>(
|
||||
name: string,
|
||||
geometry: GeometryDefinition<T>
|
||||
): GeometryConstructor<T>;
|
||||
registerPrimitive(name: string, primitive: PrimitiveDefinition): void;
|
||||
registerShader<T extends MinimalShaderDefinition & object>(
|
||||
name: string,
|
||||
shader: ShaderDefinition<T>
|
||||
): ShaderConstructor<T>;
|
||||
registerSystem<T extends object>(
|
||||
name: string,
|
||||
definition: SystemDefinition<T>
|
||||
): SystemConstructor<T>;
|
||||
}
|
||||
|
||||
// module.exports
|
||||
export const AComponent: AFrame['AComponent'];
|
||||
export const AEntity: AFrame['AEntity'];
|
||||
export const ANode: AFrame['ANode'];
|
||||
export const AScene: AFrame['AScene'];
|
||||
export const components: AFrame['components'];
|
||||
export const geometries: AFrame['geometries'];
|
||||
export const primitives: AFrame['primitives'];
|
||||
export const scenes: AFrame['scenes'];
|
||||
export const schema: AFrame['schema'];
|
||||
export const shaders: AFrame['shaders'];
|
||||
export const systems: AFrame['systems'];
|
||||
export const THREE: AFrame['THREE'];
|
||||
export const TWEEN: AFrame['TWEEN'];
|
||||
export const utils: AFrame['utils'];
|
||||
export const version: AFrame['version'];
|
||||
export const registerComponent: AFrame['registerComponent'];
|
||||
export const registerElement: AFrame['registerElement'];
|
||||
export const registerGeometry: AFrame['registerGeometry'];
|
||||
export const registerPrimitive: AFrame['registerPrimitive'];
|
||||
export const registerShader: AFrame['registerShader'];
|
||||
export const registerSystem: AFrame['registerSystem'];
|
||||
|
||||
// global exports
|
||||
declare global {
|
||||
var hasNativeWebVRImplementation: boolean;
|
||||
|
||||
namespace AFRAME {
|
||||
const AComponent: AFrame['AComponent'];
|
||||
const AEntity: AFrame['AEntity'];
|
||||
const ANode: AFrame['ANode'];
|
||||
const AScene: AFrame['AScene'];
|
||||
const components: AFrame['components'];
|
||||
const geometries: AFrame['geometries'];
|
||||
const primitives: AFrame['primitives'];
|
||||
const scenes: AFrame['scenes'];
|
||||
const schema: AFrame['schema'];
|
||||
const shaders: AFrame['shaders'];
|
||||
const systems: AFrame['systems'];
|
||||
const THREE: AFrame['THREE'];
|
||||
const TWEEN: AFrame['TWEEN'];
|
||||
const utils: AFrame['utils'];
|
||||
const version: string;
|
||||
|
||||
const registerComponent: AFrame['registerComponent'];
|
||||
const registerElement: AFrame['registerElement'];
|
||||
const registerGeometry: AFrame['registerGeometry'];
|
||||
const registerPrimitive: AFrame['registerPrimitive'];
|
||||
const registerShader: AFrame['registerShader'];
|
||||
const registerSystem: AFrame['registerSystem'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom elements augment document methods to return custom HTML
|
||||
*/
|
||||
interface Document {
|
||||
createElement(tagName: string): Entity;
|
||||
querySelector(selectors: 'a-scene'): Scene;
|
||||
querySelector(selectors: string): Entity<any>;
|
||||
querySelectorAll(selectors: string): NodeListOf<Entity<any> | Element>;
|
||||
}
|
||||
|
||||
interface HTMLCollection extends HTMLCollectionBase {
|
||||
/**
|
||||
* Retrieves a select object or an object from an options collection.
|
||||
*/
|
||||
namedItem(name: string): Element | Entity | null;
|
||||
item(index: number): Element | Entity;
|
||||
[index: number]: Element | Entity;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,14 @@
|
||||
import {
|
||||
Component,
|
||||
Entity,
|
||||
MultiPropertySchema,
|
||||
System,
|
||||
SystemDefinition,
|
||||
THREE,
|
||||
Geometry,
|
||||
registerComponent
|
||||
} from 'aframe';
|
||||
|
||||
// Global
|
||||
const threeCamera = new AFRAME.THREE.Camera();
|
||||
AFRAME.TWEEN.Easing;
|
||||
@@ -16,7 +27,7 @@ entity.setAttribute('material', 'color', 'red');
|
||||
|
||||
entity.components['geometry'].data;
|
||||
|
||||
type MyEntity = AFrame.Entity<{
|
||||
type MyEntity = Entity<{
|
||||
camera: THREE.Camera;
|
||||
material: THREE.Material;
|
||||
sound: { pause(): void };
|
||||
@@ -33,29 +44,31 @@ entity.setAttribute('light', {
|
||||
intensity: 2.0
|
||||
});
|
||||
|
||||
entity.addEventListener('child-detached', (event) => {
|
||||
entity.addEventListener('child-detached', event => {
|
||||
event.detail;
|
||||
});
|
||||
|
||||
// Components
|
||||
|
||||
interface TestComponent extends AFrame.Component {
|
||||
multiply: (f: number) => number;
|
||||
// interface TestComponent extends Component {
|
||||
// multiply: (f: number) => number;
|
||||
//
|
||||
// data: {
|
||||
// myProperty: any[],
|
||||
// string: string,
|
||||
// num: number
|
||||
// };
|
||||
//
|
||||
// system: TestSystem;
|
||||
// }
|
||||
|
||||
data: {
|
||||
myProperty: any[],
|
||||
string: string,
|
||||
num: number
|
||||
};
|
||||
|
||||
system: TestSystem;
|
||||
}
|
||||
|
||||
const Component = AFRAME.registerComponent<TestComponent>('test-component', {
|
||||
const Component = registerComponent('test-component', {
|
||||
schema: {
|
||||
myProperty: {
|
||||
default: [],
|
||||
parse() { return [true]; },
|
||||
parse() {
|
||||
return [true];
|
||||
}
|
||||
},
|
||||
string: { type: 'string' },
|
||||
num: 0
|
||||
@@ -69,9 +82,9 @@ const Component = AFRAME.registerComponent<TestComponent>('test-component', {
|
||||
pause() {},
|
||||
play() {},
|
||||
|
||||
multiply(this: TestComponent, f: number) {
|
||||
multiply(f: number) {
|
||||
// Reference to system because both were registered with the same name.
|
||||
return f * this.data.num * this.system.data.counter;
|
||||
return f * this.data.num * this.system!.data.counter;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -81,13 +94,7 @@ scene.hasLoaded;
|
||||
|
||||
// System
|
||||
|
||||
interface TestSystem extends AFrame.System {
|
||||
data: {
|
||||
counter: number;
|
||||
};
|
||||
}
|
||||
|
||||
const testSystem: AFrame.SystemDefinition<TestSystem> = {
|
||||
const testSystem: SystemDefinition = {
|
||||
schema: {
|
||||
counter: 0
|
||||
},
|
||||
@@ -101,13 +108,7 @@ AFRAME.registerSystem('test-component', testSystem);
|
||||
|
||||
// Register Custom Geometry
|
||||
|
||||
interface TestGeometry extends AFrame.Geometry {
|
||||
schema: AFrame.MultiPropertySchema<{
|
||||
groupIndex: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
AFRAME.registerGeometry<TestGeometry>('a-test-geometry', {
|
||||
AFRAME.registerGeometry('a-test-geometry', {
|
||||
schema: {
|
||||
groupIndex: { default: 0 }
|
||||
},
|
||||
@@ -21,6 +21,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"aframe-tests.ts"
|
||||
"test/aframe-tests.ts",
|
||||
"test/aframe-io-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+6
-2
@@ -1128,7 +1128,7 @@ declare namespace algoliasearch {
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#facets
|
||||
*/
|
||||
facets?: string;
|
||||
facets?: string | string[];
|
||||
/**
|
||||
* Limit the number of facet values returned for each facet.
|
||||
* default: ""
|
||||
@@ -1375,7 +1375,7 @@ declare namespace algoliasearch {
|
||||
* Filter the query by a set of facets.
|
||||
* https://github.com/algolia/algoliasearch-client-js#facetfilters-deprecated
|
||||
*/
|
||||
facetFilters?: string;
|
||||
facetFilters?: string | string[]
|
||||
/**
|
||||
* If set to false, this query will not be taken into account in the analytics feature.
|
||||
* default true
|
||||
@@ -1421,6 +1421,10 @@ declare namespace algoliasearch {
|
||||
* The query for the search in this facet
|
||||
*/
|
||||
facetQuery: string;
|
||||
/**
|
||||
* The maximum number of facets to fetch
|
||||
*/
|
||||
maxFacetHits?: number;
|
||||
}
|
||||
|
||||
interface Response {
|
||||
|
||||
@@ -36,7 +36,9 @@ app.controller('Ctrl', ($scope: ng.IScope, blockUI: angular.blockUI.BlockUIServi
|
||||
blockUI.stop();
|
||||
blockUI.reset();
|
||||
blockUI.message("Hello Types");
|
||||
blockUI.done();
|
||||
blockUI.done(() => {
|
||||
console.log("blockUI stopped");
|
||||
});
|
||||
const b: boolean = blockUI.isBlocking();
|
||||
|
||||
const myBlockUI = blockUI.instances.get("myBlockUI");
|
||||
|
||||
Vendored
+29
-14
@@ -1,6 +1,8 @@
|
||||
// Type definitions for angular-block-ui 0.2
|
||||
// Project: https://github.com/McNull/angular-block-ui
|
||||
// Definitions by: Lasse Nørregaard <https://github.com/lassebn>, Stephan Classen <https://github.com/sclassen>, Soner Köksal <https://github.com/renjfk>
|
||||
// Definitions by: Lasse Nørregaard <https://github.com/lassebn>
|
||||
// Stephan Classen <https://github.com/sclassen>
|
||||
// Soner Köksal <https://github.com/renjfk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -48,6 +50,8 @@ declare module 'angular' {
|
||||
*
|
||||
* If you don't want this behaviour and want to do all the
|
||||
* blocking manually you can change this value to false.
|
||||
*
|
||||
* The default value is 'true'
|
||||
*/
|
||||
autoBlock?: boolean;
|
||||
|
||||
@@ -56,6 +60,8 @@ declare module 'angular' {
|
||||
* hide the overlay whenever an exception has occurred.
|
||||
*
|
||||
* You can set this value to false if you don't want this behaviour.
|
||||
*
|
||||
* The default value is 'true'
|
||||
*/
|
||||
resetOnException?: boolean;
|
||||
|
||||
@@ -74,33 +80,42 @@ declare module 'angular' {
|
||||
|
||||
/**
|
||||
* When the module is started it will inject the main block element
|
||||
* by adding the block-ui directive to the body element.
|
||||
* by adding the "block-ui" directive to the <body> element.
|
||||
*
|
||||
* Set this to false if there no need for any fullscreen blocking or if there's
|
||||
* more control required. For instance when your ng-app directive is a child
|
||||
* element of the body element it is impossible for the blockUI resolve the main
|
||||
* instance. In such a case the auto injection of the main block scope should
|
||||
* be disabled and the main block element should be relocated.
|
||||
*
|
||||
* The default value is 'true'
|
||||
*/
|
||||
autoInjectBodyBlock?: boolean;
|
||||
|
||||
/**
|
||||
* A string containing the default css classes, separated by spaces,
|
||||
* A string containing the default css classes (separated by spaces)
|
||||
* that should be applied to each block-ui element.
|
||||
*
|
||||
* The default value is `block-ui block-ui-anim-fade`
|
||||
* The default value is "block-ui block-ui-anim-fade"
|
||||
*/
|
||||
cssClass?: string;
|
||||
|
||||
/**
|
||||
* Whenever a user interface block is active, because the single page
|
||||
* application is still waiting for a response from the backend server,
|
||||
* the user can still navigate away using the back and forward buttons
|
||||
* of the browser.
|
||||
* While a user interface block is active the user can still navigate
|
||||
* away using the back and forward buttons of the browser.
|
||||
*
|
||||
* Callbacks registered to handle the responses from the server will
|
||||
* be executed even if a different view/controller is currently active.
|
||||
* By setting the blockBrowserNavigation property to true the
|
||||
* angular-block-ui module will prevent navigation while a fullscreen
|
||||
* Callbacks registered to handle responses from the server will
|
||||
* be executed even if a different view/controller is active at the
|
||||
* time the response arrives.
|
||||
*
|
||||
* You can set this value to true if you want to prevent navigation
|
||||
* with the browser back and forward buttons while a fullscreen
|
||||
* block is active.
|
||||
*
|
||||
* Programatic location changes via the $location service are still
|
||||
* allowed however.
|
||||
* The navigation block is disabled by default.
|
||||
*
|
||||
* The default value is 'false'
|
||||
*/
|
||||
blockBrowserNavigation?: boolean;
|
||||
}
|
||||
@@ -150,7 +165,7 @@ declare module 'angular' {
|
||||
* This can be useful whenever you wish to redirect the user
|
||||
* to a different location while there are still pending AJAX requests.
|
||||
*/
|
||||
done(): void;
|
||||
done(doneCallback: () => void): void;
|
||||
|
||||
/**
|
||||
* Allows the message shown in the overlay to be updated
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"angular-block-ui-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import * as antlr4 from 'antlr4';
|
||||
import * as autosuggest from 'antlr4-autosuggest';
|
||||
|
||||
class Antlr4JSLexer extends antlr4.Lexer {
|
||||
constructor(chars: antlr4.InputStream) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
class Antlr4JSParser extends antlr4.Parser {
|
||||
constructor(tokens: antlr4.CommonTokenStream) {
|
||||
super(tokens);
|
||||
}
|
||||
}
|
||||
|
||||
const autosuggester: autosuggest.AutoSuggester = autosuggest.autosuggester(Antlr4JSLexer, Antlr4JSParser);
|
||||
const suggestions: string[] = autosuggester.autosuggest('ABC');
|
||||
|
||||
const lowercase = autosuggest.autosuggester(Antlr4JSLexer, Antlr4JSParser, 'LOWER');
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for antlr4-autosuggest 0.0
|
||||
// Project: https://github.com/oranoran/antlr4-autosuggest-js
|
||||
// Definitions by: Jon Freedman <https://github.com/jonfreedman>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as antlr4 from 'antlr4';
|
||||
|
||||
export type CasePreference = 'LOWER' | 'UPPER' | 'BOTH';
|
||||
|
||||
export interface AutoSuggester {
|
||||
autosuggest: (inputText: string) => string[];
|
||||
}
|
||||
|
||||
export interface Constructor<T> {
|
||||
new (...args: any[]): T;
|
||||
}
|
||||
|
||||
export function autosuggester(lexerCtr: Constructor<antlr4.Lexer>, parserCtr: Constructor<antlr4.Parser>, casePref?: CasePreference | null): AutoSuggester;
|
||||
@@ -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",
|
||||
"antlr4-autosuggest-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -17,7 +17,6 @@ const config: Microsoft.ApplicationInsights.IConfig = {
|
||||
autoTrackPageVisitTime: true,
|
||||
disableExceptionTracking: false,
|
||||
disableAjaxTracking: false,
|
||||
disableFetchTracking: true,
|
||||
overridePageViewDuration: false,
|
||||
maxAjaxCallsPerView: -1,
|
||||
disableDataLossAnalysis: true,
|
||||
|
||||
+3
-3
@@ -1,7 +1,8 @@
|
||||
// Type definitions for ApplicationInsights-JS 1.0
|
||||
// Project: https://github.com/Microsoft/ApplicationInsights-JS
|
||||
// Definitions by: Kamil Szostak <https://github.com/kamilszostak>
|
||||
// Mark Wolff <https://github.com/markwolff>
|
||||
// Definitions by: Mark Wolff <https://github.com/markwolff>
|
||||
// Piyali Jana <https://github.com/jpiyali>
|
||||
// Basal Rustum <https://github.com/barustum>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module AI {
|
||||
@@ -561,7 +562,6 @@ declare module Microsoft.ApplicationInsights {
|
||||
samplingPercentage?: number;
|
||||
autoTrackPageVisitTime?: boolean;
|
||||
disableAjaxTracking?: boolean;
|
||||
disableFetchTracking?: boolean;
|
||||
overridePageViewDuration?: boolean;
|
||||
maxAjaxCallsPerView?: number;
|
||||
disableDataLossAnalysis?: boolean;
|
||||
|
||||
@@ -400,10 +400,10 @@ cognitoUserPoolEvent.request.session![0].challengeName === "DEVICE_SRP_AUTH";
|
||||
cognitoUserPoolEvent.request.session![0].challengeName === "DEVICE_PASSWORD_VERIFIER";
|
||||
cognitoUserPoolEvent.request.session![0].challengeName === "ADMIN_NO_SRP_AUTH";
|
||||
bool = cognitoUserPoolEvent.request.session![0].challengeResult;
|
||||
strOrUndefined = cognitoUserPoolEvent.request.session![0].challengeMetaData;
|
||||
strOrUndefined = cognitoUserPoolEvent.request.session![0].challengeMetadata;
|
||||
strOrUndefined = cognitoUserPoolEvent.request.challengeName;
|
||||
str = cognitoUserPoolEvent.request.privateChallengeParameters!["answer"];
|
||||
str = cognitoUserPoolEvent.request.challengeAnswer!["answer"];
|
||||
str = cognitoUserPoolEvent.request.challengeAnswer!;
|
||||
boolOrUndefined = cognitoUserPoolEvent.response.answerCorrect;
|
||||
strOrUndefined = cognitoUserPoolEvent.response.smsMessage;
|
||||
strOrUndefined = cognitoUserPoolEvent.response.emailMessage;
|
||||
@@ -413,7 +413,7 @@ boolOrUndefined = cognitoUserPoolEvent.response.issueTokens;
|
||||
boolOrUndefined = cognitoUserPoolEvent.response.failAuthentication;
|
||||
str = cognitoUserPoolEvent.response.publicChallengeParameters!["captchaUrl"];
|
||||
str = cognitoUserPoolEvent.response.privateChallengeParameters!["answer"];
|
||||
strOrUndefined = cognitoUserPoolEvent.response.challengeMetaData;
|
||||
strOrUndefined = cognitoUserPoolEvent.response.challengeMetadata;
|
||||
boolOrUndefined = cognitoUserPoolEvent.response.answerCorrect;
|
||||
|
||||
// CloudFormation Custom Resource
|
||||
@@ -581,7 +581,7 @@ const CodePipelineEvent: AWSLambda.CodePipelineEvent = {
|
||||
CodePipelineEvent["CodePipeline.job"].data.encryptionKey = { type: 'KMS', id: 'key' };
|
||||
|
||||
/* CloudFront events, see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */
|
||||
const CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = {
|
||||
const CloudFrontRequestWithCustomOriginEvent: AWSLambda.CloudFrontRequestEvent = {
|
||||
Records: [
|
||||
{
|
||||
cf: {
|
||||
@@ -630,7 +630,44 @@ const CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = {
|
||||
"TLSv1",
|
||||
"TLSv1.1"
|
||||
]
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const CloudFrontRequestWithS3OriginEvent: AWSLambda.CloudFrontRequestEvent = {
|
||||
Records: [
|
||||
{
|
||||
cf: {
|
||||
config: {
|
||||
distributionDomainName: "d123.cloudfront.net",
|
||||
distributionId: "EDFDVBD6EXAMPLE",
|
||||
eventType: "viewer-request",
|
||||
requestId: "MRVMF7KydIvxMWfJIglgwHQwZsbG2IhRJ07sn9AkKUFSHS9EXAMPLE=="
|
||||
},
|
||||
request: {
|
||||
clientIp: "2001:0db8:85a3:0:0:8a2e:0370:7334",
|
||||
method: "GET",
|
||||
uri: "/picture.jpg",
|
||||
querystring: "size=large",
|
||||
headers: {
|
||||
host: [
|
||||
{
|
||||
key: "Host",
|
||||
value: "d111111abcdef8.cloudfront.net"
|
||||
}
|
||||
],
|
||||
"user-agent": [
|
||||
{
|
||||
key: "User-Agent",
|
||||
value: "curl/7.51.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
origin: {
|
||||
s3: {
|
||||
authMethod: "origin-access-identity",
|
||||
customHeaders: {
|
||||
@@ -812,6 +849,56 @@ apiGtwProxyHandler = proxyHandler;
|
||||
const codePipelineHandler: AWSLambda.CodePipelineHandler = (event: AWSLambda.CodePipelineEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
|
||||
|
||||
const cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => {
|
||||
event = CloudFrontRequestWithCustomOriginEvent;
|
||||
// $ExpectType CloudFrontRequestEvent
|
||||
event;
|
||||
let request = event.Records[0].cf.request;
|
||||
|
||||
let s3Origin: AWSLambda.CloudFrontS3Origin = {
|
||||
authMethod: 'none',
|
||||
customHeaders: {},
|
||||
domainName: 'example.com',
|
||||
path: '/',
|
||||
region: 'us-east-1'
|
||||
};
|
||||
|
||||
if (request.origin && request.origin.custom) {
|
||||
request.origin.custom.domainName;
|
||||
request.origin.custom.domainName = "example2.com";
|
||||
|
||||
// $ExpectError
|
||||
s3Origin = request.origin.s3;
|
||||
|
||||
// $ExpectError
|
||||
request.origin.s3.path = '/';
|
||||
}
|
||||
|
||||
let customOrigin: AWSLambda.CloudFrontCustomOrigin = {
|
||||
customHeaders: {},
|
||||
domainName: 'example.com',
|
||||
keepaliveTimeout: 60,
|
||||
path: '/',
|
||||
port: 80,
|
||||
protocol: 'http',
|
||||
readTimeout: 30,
|
||||
sslProtocols: []
|
||||
};
|
||||
|
||||
event = CloudFrontRequestWithS3OriginEvent;
|
||||
// $ExpectType CloudFrontRequestEvent
|
||||
event;
|
||||
request = event.Records[0].cf.request;
|
||||
if (request.origin && request.origin.s3) {
|
||||
request.origin.s3.path;
|
||||
request.origin.s3.path = "/new_path";
|
||||
|
||||
// $ExpectError
|
||||
customOrigin = request.origin.custom;
|
||||
|
||||
// $ExpectError
|
||||
request.origin.custom.path = '/';
|
||||
}
|
||||
|
||||
cb();
|
||||
cb(null);
|
||||
cb(new Error(''));
|
||||
|
||||
Vendored
+31
-3
@@ -21,6 +21,7 @@
|
||||
// Jeremy Nagel <https://github.com/jeznag>
|
||||
// Louis Larry <https://github.com/louislarry>
|
||||
// Daniel Papukchiev <https://github.com/dpapukchiev>
|
||||
// Oliver Hookins <https://github.com/ohookins>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -250,11 +251,11 @@ export interface CognitoUserPoolTriggerEvent {
|
||||
session?: Array<{
|
||||
challengeName: "CUSTOM_CHALLENGE" | "PASSWORD_VERIFIER" | "SMS_MFA" | "DEVICE_SRP_AUTH" | "DEVICE_PASSWORD_VERIFIER" | "ADMIN_NO_SRP_AUTH";
|
||||
challengeResult: boolean;
|
||||
challengeMetaData?: string;
|
||||
challengeMetadata?: string;
|
||||
}>;
|
||||
challengeName?: string;
|
||||
privateChallengeParameters?: { [key: string]: string };
|
||||
challengeAnswer?: { [key: string]: string };
|
||||
challengeAnswer?: string;
|
||||
};
|
||||
response: {
|
||||
autoConfirmUser?: boolean;
|
||||
@@ -266,7 +267,7 @@ export interface CognitoUserPoolTriggerEvent {
|
||||
failAuthentication?: boolean;
|
||||
publicChallengeParameters?: { [key: string]: string };
|
||||
privateChallengeParameters?: { [key: string]: string };
|
||||
challengeMetaData?: string;
|
||||
challengeMetadata?: string;
|
||||
answerCorrect?: boolean;
|
||||
};
|
||||
}
|
||||
@@ -561,6 +562,9 @@ export interface CodePipelineEvent {
|
||||
/**
|
||||
* CloudFront events
|
||||
* http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html
|
||||
* Bear in mind that the "example" event structure in the page above includes
|
||||
* both an S3 and a Custom origin, which is not strictly allowed. Only one
|
||||
* of these per event may be present.
|
||||
*/
|
||||
export interface CloudFrontHeaders {
|
||||
[name: string]: Array<{
|
||||
@@ -569,6 +573,29 @@ export interface CloudFrontHeaders {
|
||||
}>;
|
||||
}
|
||||
|
||||
export type CloudFrontOrigin =
|
||||
| { s3: CloudFrontS3Origin, custom?: never }
|
||||
| { custom: CloudFrontCustomOrigin, s3?: never };
|
||||
|
||||
export interface CloudFrontCustomOrigin {
|
||||
customHeaders: CloudFrontHeaders;
|
||||
domainName: string;
|
||||
keepaliveTimeout: number;
|
||||
path: string;
|
||||
port: number;
|
||||
protocol: 'http' | 'https';
|
||||
readTimeout: number;
|
||||
sslProtocols: string[];
|
||||
}
|
||||
|
||||
export interface CloudFrontS3Origin {
|
||||
authMethod: 'origin-access-identity' | 'none';
|
||||
customHeaders: CloudFrontHeaders;
|
||||
domainName: string;
|
||||
path: string;
|
||||
region: string;
|
||||
}
|
||||
|
||||
export interface CloudFrontResponse {
|
||||
status: string;
|
||||
statusDescription: string;
|
||||
@@ -581,6 +608,7 @@ export interface CloudFrontRequest {
|
||||
uri: string;
|
||||
querystring: string;
|
||||
headers: CloudFrontHeaders;
|
||||
origin?: CloudFrontOrigin;
|
||||
}
|
||||
|
||||
export interface CloudFrontEvent {
|
||||
|
||||
@@ -5,6 +5,9 @@ async function run() {
|
||||
const server = new Server({ port: 8000 });
|
||||
await server.register(bell);
|
||||
|
||||
bell.simulate(async () => ({}));
|
||||
bell.simulate(() => ({}));
|
||||
|
||||
server.auth.strategy('arcgisonline', 'bell', {
|
||||
provider: 'twitter',
|
||||
password: 'some cookie password',
|
||||
|
||||
Vendored
+2
-5
@@ -1,4 +1,4 @@
|
||||
// Type definitions for bell 9.1
|
||||
// Type definitions for bell 9.3
|
||||
// Project: https://github.com/hapijs/bell
|
||||
// Definitions by: Simon Schick <https://github.com/SimonSchick>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -62,10 +62,7 @@ export type Provider =
|
||||
'wordpress' |
|
||||
'yahoo';
|
||||
|
||||
export type RequestPassThrough = (
|
||||
request: Request,
|
||||
next: (err: Error | null, credentials: AuthCredentials) => void,
|
||||
) => void;
|
||||
export type RequestPassThrough = (request: Request) => PromiseLike<AuthCredentials> | AuthCredentials;
|
||||
|
||||
export interface OptionalOptions {
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { fromBase58 } from 'bip32';
|
||||
|
||||
const node = fromBase58("xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi");
|
||||
|
||||
const child = node.derivePath('m/0');
|
||||
|
||||
const grandchild = child.derive(2);
|
||||
|
||||
grandchild.toWIF() === 'Kxtby4wzfHeCaRXma16dBNLgUE7Ct3Xkb6sRs3aZ56Bmtf1rcNWs';
|
||||
Vendored
+67
@@ -0,0 +1,67 @@
|
||||
// Type definitions for bip32 1.0
|
||||
// Project: https://github.com/bitcoinjs/bip32#readme
|
||||
// Definitions by: My Self <https://github.com/me>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
/// <reference types="node" />
|
||||
|
||||
export interface NetworkType {
|
||||
wif: number; // UInt8
|
||||
bip32: {
|
||||
public: number; // UInt32
|
||||
private: number; // UInt32
|
||||
};
|
||||
}
|
||||
|
||||
export class BIP32 {
|
||||
private constructor(d: Buffer, Q: Buffer, chainCode: Buffer, network: NetworkType);
|
||||
|
||||
identifier: Buffer;
|
||||
fingerprint: Buffer;
|
||||
privateKey: Buffer;
|
||||
publicKey: Buffer;
|
||||
|
||||
private depth: number;
|
||||
private index: number;
|
||||
private parentFingerprint: number;
|
||||
private network: NetworkType;
|
||||
|
||||
isNeutered(): boolean;
|
||||
neutered(): BIP32;
|
||||
toBase58(): string;
|
||||
toWIF(): string;
|
||||
derive(index: number): BIP32;
|
||||
deriveHardened(index: number): BIP32;
|
||||
derivePath(path: string): BIP32;
|
||||
sign(hash: Buffer): Buffer;
|
||||
verify(hash: Buffer, signature: Buffer): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a node
|
||||
* @param string base58 encoded string
|
||||
* @param network network type of the node
|
||||
*/
|
||||
export function fromBase58(string: string, network?: NetworkType): BIP32;
|
||||
|
||||
/**
|
||||
* Returns a hardened node
|
||||
* @param privateKey node private key
|
||||
* @param chainCode 256-bits entropy extension
|
||||
* @param network network type of the node
|
||||
*/
|
||||
export function fromPrivateKey(privateKey: Buffer, chainCode: Buffer, network?: NetworkType): BIP32;
|
||||
|
||||
/**
|
||||
* Returns a non-hardened node
|
||||
* @param publicKey node public key
|
||||
* @param chainCode 256-bits entropy extension
|
||||
* @param network network type of the node
|
||||
*/
|
||||
export function fromPublicKey(publicKey: Buffer, chainCode: Buffer, network?: NetworkType): BIP32;
|
||||
|
||||
/**
|
||||
* Returns a hardened node
|
||||
* @param seed seed encoding node info
|
||||
* @param network network type of the node
|
||||
*/
|
||||
export function fromSeed(seed: Buffer, network?: NetworkType): BIP32;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bip32-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -1,4 +1,3 @@
|
||||
import bigi = require('bigi');
|
||||
import bitcoin = require('bitcoinjs-lib');
|
||||
|
||||
// For testing only
|
||||
@@ -8,19 +7,18 @@ function rng() {
|
||||
|
||||
// Generate a random bitcoin address
|
||||
const keyPair1 = bitcoin.ECPair.makeRandom({rng});
|
||||
const address = keyPair1.getAddress();
|
||||
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair1.publicKey });
|
||||
keyPair1.toWIF();
|
||||
|
||||
// Generate an address from a SHA256 hash
|
||||
const hash = bitcoin.crypto.sha256(Buffer.from('correct horse battery staple', 'utf8'));
|
||||
const d = bigi.fromBuffer(hash);
|
||||
const keyPair2 = new bitcoin.ECPair(d);
|
||||
const keyPair2 = bitcoin.ECPair.fromPrivateKey(hash);
|
||||
|
||||
// Generate a random keypair for alternative networks
|
||||
const keyPair3 = bitcoin.ECPair.makeRandom({network: bitcoin.networks.litecoin, rng});
|
||||
const keyPair3 = bitcoin.ECPair.makeRandom({network: bitcoin.networks.testnet, rng});
|
||||
keyPair3.toWIF();
|
||||
keyPair3.getAddress();
|
||||
const network = keyPair3.getNetwork();
|
||||
bitcoin.payments.p2pkh({ pubkey: keyPair3.publicKey });
|
||||
const network = keyPair3.network;
|
||||
|
||||
// Test TransactionBuilder and Transaction
|
||||
const txb = new bitcoin.TransactionBuilder();
|
||||
@@ -41,22 +39,3 @@ bitcoin.address.toBase58Check(rsBase58Check.hash, rsBase58Check.version);
|
||||
bitcoin.address.toBech32(rsBech32.data, rsBech32.version, rsBech32.prefix);
|
||||
bitcoin.address.toOutputScript(address);
|
||||
bitcoin.address.toOutputScript(address, network);
|
||||
|
||||
const redeemScript = bitcoin.script.multisig.output.encode(
|
||||
2,
|
||||
[
|
||||
new Buffer('12345678901234567890123456789012'),
|
||||
new Buffer('12345678901234567890123456789012'),
|
||||
new Buffer('12345678901234567890123456789012'),
|
||||
]
|
||||
);
|
||||
bitcoin.script.scriptHash.input.encode(
|
||||
bitcoin.script.multisig.input.encodeStack(
|
||||
[
|
||||
new Buffer('12345678901234567890123456789012'),
|
||||
new Buffer('12345678901234567890123456789012'),
|
||||
],
|
||||
redeemScript,
|
||||
),
|
||||
redeemScript,
|
||||
);
|
||||
|
||||
Vendored
+48
-138
@@ -1,4 +1,4 @@
|
||||
// Type definitions for bitcoinjs-lib 3.4
|
||||
// Type definitions for bitcoinjs-lib 4.0
|
||||
// Project: https://github.com/bitcoinjs/bitcoinjs-lib
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Daniel <https://github.com/dlebrecht>
|
||||
@@ -12,8 +12,6 @@
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import BigInteger = require('bigi');
|
||||
|
||||
export interface Out {
|
||||
script: Buffer;
|
||||
value: number;
|
||||
@@ -68,29 +66,23 @@ export class Block {
|
||||
}
|
||||
|
||||
export class ECPair {
|
||||
constructor(d: BigInteger, Q?: null, options?: { compressed?: boolean, network?: Network });
|
||||
|
||||
constructor(d: null | undefined, Q: any, options?: { compressed?: boolean, network?: Network }); // Q should be ECPoint, but not sure how to define such type
|
||||
|
||||
d: BigInteger;
|
||||
|
||||
readonly compressed: boolean;
|
||||
|
||||
readonly privateKey: Buffer;
|
||||
|
||||
readonly publicKey: Buffer;
|
||||
|
||||
readonly network: Network;
|
||||
|
||||
getAddress(): string;
|
||||
|
||||
getNetwork(): Network;
|
||||
|
||||
getPublicKeyBuffer(): Buffer;
|
||||
|
||||
sign(hash: Buffer): ECSignature;
|
||||
sign(hash: Buffer): Buffer;
|
||||
|
||||
toWIF(): string;
|
||||
|
||||
verify(hash: Buffer, signature: ECSignature): boolean;
|
||||
verify(hash: Buffer, signature: Buffer): boolean;
|
||||
|
||||
static fromPublicKeyBuffer(buffer: Buffer, network: Network): ECPair;
|
||||
static fromPrivateKey(buffer: Buffer, options?: { compressed?: boolean, network?: Network }): ECPair;
|
||||
|
||||
static fromPublicKey(buffer: Buffer, options?: { compressed?: boolean, network?: Network }): ECPair;
|
||||
|
||||
static fromWIF(string: string, network?: Network): ECPair;
|
||||
|
||||
@@ -99,66 +91,6 @@ export class ECPair {
|
||||
|
||||
export type Rng = (size: number) => Buffer;
|
||||
|
||||
export class ECSignature {
|
||||
constructor(r: BigInteger, s: BigInteger);
|
||||
|
||||
toCompact(i: number, compressed: boolean): Buffer;
|
||||
|
||||
toDER(): Buffer;
|
||||
|
||||
toScriptSignature(hashType: number): Buffer;
|
||||
|
||||
static fromDER(buffer: Buffer): ECSignature;
|
||||
|
||||
static parseCompact(buffer: Buffer): { compressed: boolean, i: number, signature: ECSignature };
|
||||
|
||||
static parseScriptSignature(buffer: Buffer): { signature: ECSignature, hashType: number };
|
||||
}
|
||||
|
||||
export class HDNode {
|
||||
constructor(keyPair: ECPair, chainCode: Buffer);
|
||||
|
||||
keyPair: ECPair;
|
||||
|
||||
derive(index: number): HDNode;
|
||||
|
||||
deriveHardened(index: number): HDNode;
|
||||
|
||||
derivePath(path: string): HDNode;
|
||||
|
||||
getAddress(): string;
|
||||
|
||||
getFingerprint(): Buffer;
|
||||
|
||||
getIdentifier(): Buffer;
|
||||
|
||||
getNetwork(): Network;
|
||||
|
||||
getPublicKeyBuffer(): Buffer;
|
||||
|
||||
isNeutered(): boolean;
|
||||
|
||||
neutered(): HDNode;
|
||||
|
||||
sign(hash: Buffer): ECSignature;
|
||||
|
||||
toBase58(): string;
|
||||
|
||||
verify(hash: Buffer, signature: ECSignature): boolean;
|
||||
|
||||
static HIGHEST_BIT: number;
|
||||
|
||||
static LENGTH: number;
|
||||
|
||||
static fromBase58(string: string, networks?: Network[] | Network): HDNode;
|
||||
|
||||
static fromSeedBuffer(seed: Buffer, network?: Network): HDNode;
|
||||
|
||||
static fromSeedHex(hex: string, network?: Network): HDNode;
|
||||
|
||||
static MASTER_SECRET: Buffer;
|
||||
}
|
||||
|
||||
export class Transaction {
|
||||
version: number;
|
||||
locktime: number;
|
||||
@@ -236,9 +168,6 @@ export interface Input {
|
||||
}
|
||||
|
||||
export class TransactionBuilder {
|
||||
tx: Transaction;
|
||||
inputs: Input[];
|
||||
|
||||
constructor(network?: Network, maximumFeeRate?: number);
|
||||
|
||||
addInput(txhash: Buffer | string | Transaction, vout: number, sequence?: number, prevOutScript?: Buffer): number;
|
||||
@@ -261,7 +190,6 @@ export class TransactionBuilder {
|
||||
|
||||
export const networks: {
|
||||
bitcoin: Network;
|
||||
litecoin: Network;
|
||||
testnet: Network;
|
||||
};
|
||||
|
||||
@@ -391,7 +319,7 @@ export namespace address {
|
||||
/** @since 3.2.0 */
|
||||
function fromBech32(address: string): { data: Buffer, prefix: string, version: number };
|
||||
|
||||
function fromOutputScript(outputScript: Buffer, network?: Network): string;
|
||||
function fromOutputScript(output: Buffer, network?: Network): string;
|
||||
|
||||
function toBase58Check(hash: Buffer, version: number): string;
|
||||
|
||||
@@ -401,26 +329,6 @@ export namespace address {
|
||||
function toOutputScript(address: string, network?: Network): Buffer;
|
||||
}
|
||||
|
||||
export namespace bufferutils {
|
||||
function pushDataSize(i: number): number;
|
||||
|
||||
function readPushDataInt(buffer: Buffer, offset: number): { opcode: number, number: number, size: number };
|
||||
|
||||
function readUInt64LE(buffer: Buffer, offset: number): number;
|
||||
|
||||
function readVarInt(buffer: Buffer, offset: number): { number: number, size: number };
|
||||
|
||||
function varIntBuffer(number: number, buffer: Buffer, offset: number): Buffer;
|
||||
|
||||
function varIntSize(number: number): number;
|
||||
|
||||
function writePushDataInt(buffer: Buffer, number: number, offset: number): number;
|
||||
|
||||
function writeUInt64LE(buffer: Buffer, value: number, offset: number): number;
|
||||
|
||||
function writeVarInt(buffer: Buffer, number: number, offset: number): number;
|
||||
}
|
||||
|
||||
export namespace crypto {
|
||||
function hash160(buffer: Buffer): Buffer;
|
||||
|
||||
@@ -449,7 +357,7 @@ export namespace script {
|
||||
|
||||
function isCanonicalPubKey(buffer: Buffer): boolean;
|
||||
|
||||
function isCanonicalSignature(buffer: Buffer): boolean;
|
||||
function isCanonicalScriptSignature(buffer: Buffer): boolean;
|
||||
|
||||
function isDefinedHashType(hashType: any): boolean;
|
||||
|
||||
@@ -465,66 +373,48 @@ export namespace script {
|
||||
function encode(number: number): Buffer;
|
||||
}
|
||||
|
||||
namespace signature {
|
||||
function decode(buffer: Buffer): { signature: Buffer, hashType: number };
|
||||
|
||||
function encode(signature: Buffer, hashType: number): Buffer;
|
||||
}
|
||||
|
||||
const multisig: {
|
||||
input: {
|
||||
check(script: Buffer, allowIncomplete: boolean): boolean;
|
||||
decode(buffer: Buffer): Array<Buffer | number>;
|
||||
decodeStack(stack: Buffer[], allowIncomplete: boolean): Array<Buffer | number>;
|
||||
encode(signatures: Buffer[], scriptPubKey: Buffer): Buffer;
|
||||
encodeStack(signatures: Buffer[], scriptPubKey: Buffer): Buffer[];
|
||||
};
|
||||
output: {
|
||||
check(script: Buffer, allowIncomplete: boolean): boolean;
|
||||
decode(buffer: Buffer, allowIncomplete: boolean): { m: number; pubKeys: Array<Buffer | number> };
|
||||
encode(m: number, pubKeys: Array<Buffer | number>): Buffer;
|
||||
};
|
||||
};
|
||||
|
||||
const pubKey: {
|
||||
input: {
|
||||
check(script: Buffer): boolean;
|
||||
decode(buffer: Buffer): Array<Buffer | number>;
|
||||
decodeStack(stack: Buffer[]): Array<Buffer | number>;
|
||||
encode(signature: Buffer): Buffer;
|
||||
encodeStack(signature: Buffer): Buffer[];
|
||||
};
|
||||
|
||||
output: {
|
||||
check(script: Buffer): boolean;
|
||||
decode(buffer: Buffer): Buffer | number;
|
||||
encode(pubKey: Buffer): Buffer;
|
||||
};
|
||||
};
|
||||
|
||||
const pubKeyHash: {
|
||||
input: {
|
||||
check(script: Buffer): boolean;
|
||||
decode(buffer: Buffer): { signature: Buffer; pubKey: Buffer };
|
||||
decodeStack(stack: Buffer[]): { signature: Buffer; pubKey: Buffer };
|
||||
encode(signature: Buffer, pubKey: Buffer): Buffer;
|
||||
encodeStack(signature: Buffer, pubKey: Buffer): [Buffer, Buffer];
|
||||
};
|
||||
|
||||
output: {
|
||||
check(script: Buffer): boolean;
|
||||
decode(buffer: Buffer): Buffer;
|
||||
encode(pubKeyHash: Buffer): Buffer;
|
||||
};
|
||||
};
|
||||
|
||||
const scriptHash: {
|
||||
input: {
|
||||
check(script: Buffer, allowIncomplete: boolean): boolean;
|
||||
decode(buffer: Buffer): { redeemScriptStack: Buffer[]; redeemScript: Buffer };
|
||||
decodeStack(stack: Buffer[]): { redeemScriptStack: Buffer[]; redeemScript: Buffer };
|
||||
encode(redeemScriptSig: Array<Buffer | number>, redeemScript: Buffer): Buffer;
|
||||
encodeStack(redeemScriptStack: Buffer[], redeemScript: Buffer): Buffer[];
|
||||
};
|
||||
|
||||
output: {
|
||||
check(script: Buffer): boolean;
|
||||
decode(buffer: Buffer): Buffer;
|
||||
encode(scriptHash: Buffer): Buffer;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -539,36 +429,56 @@ export namespace script {
|
||||
const witnessPubKeyHash: {
|
||||
input: {
|
||||
check(script: Buffer): boolean;
|
||||
decodeStack(stack: Buffer[]): { signature: Buffer; pubKey: Buffer };
|
||||
encodeStack(signature: Buffer, pubKey: Buffer): [Buffer, Buffer];
|
||||
};
|
||||
|
||||
output: {
|
||||
check(script: Buffer): boolean;
|
||||
decode(buffer: Buffer): Buffer;
|
||||
encode(pubKeyHash: Buffer): Buffer;
|
||||
};
|
||||
};
|
||||
|
||||
const witnessScriptHash: {
|
||||
input: {
|
||||
check(script: Buffer, allowIncomplete: boolean): boolean;
|
||||
decodeStack(stack: Buffer[]): { redeemScriptStack: Buffer[]; redeemScript: Buffer };
|
||||
encodeStack(redeemScriptStack: Buffer[], redeemScript: Buffer): Buffer[];
|
||||
};
|
||||
|
||||
output: {
|
||||
check(script: Buffer): boolean;
|
||||
decode(buffer: Buffer): Buffer;
|
||||
encode(scriptHash: Buffer): Buffer;
|
||||
};
|
||||
};
|
||||
|
||||
const nullData: {
|
||||
output: {
|
||||
check(script: Buffer): boolean;
|
||||
decode(buffer: Buffer): Buffer;
|
||||
encode(data: Buffer): Buffer;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export namespace payments {
|
||||
function p2data(a: { network?: Network, output?: Buffer, data?: Buffer[] }, opts?: { validate?: boolean }):
|
||||
{ output: Buffer, data: Buffer[] };
|
||||
|
||||
function p2ms(a: { network?: Network, m?: number, n?: number, output?: Buffer, pubkeys?: Buffer[], signatures?: Buffer[], input?: Buffer }, opts?: { validate?: boolean }):
|
||||
{ output: Buffer, m: number, n: number, pubkeys: Buffer[], signatures: Buffer[], input: Buffer, witness: Buffer[] };
|
||||
|
||||
function p2pk(a: { input?: Buffer, network?: Network, output?: Buffer, pubkey?: Buffer, signature?: Buffer }, opts?: { validate?: boolean }):
|
||||
{ output: Buffer, pubkey: Buffer, signature: Buffer, input: Buffer, witness: Buffer[] };
|
||||
|
||||
function p2pkh(a: { address?: string, hash?: Buffer, input?: Buffer, network?: Network, output?: Buffer, pubkey?: Buffer, signature?: Buffer }, opts?: { validate?: boolean }):
|
||||
{ address: string, hash: Buffer, output: Buffer, pubkey: Buffer, signature: Buffer, input: Buffer, witness: Buffer[] };
|
||||
|
||||
function p2sh(a: { address?: string, hash?: Buffer, input?: Buffer, network?: Network, output?: Buffer, witness?: Buffer[], redeem?: Redeem }, opts?: { validate?: boolean }):
|
||||
{ address: string, hash: Buffer, output: Buffer, redeem: Redeem, input: Buffer, witness: Buffer[] };
|
||||
|
||||
function p2wpkh(a: { address?: string, hash?: Buffer, input?: Buffer, network?: Network, output?: Buffer, pubkey?: Buffer, signature?: Buffer, witness?: Buffer[] },
|
||||
opts?: { validate?: boolean }): { address: string, hash: Buffer, output: Buffer, pubkey: Buffer, signature: Buffer, input: Buffer, witness: Buffer[] };
|
||||
|
||||
function p2wsh(a: { address?: string, hash?: Buffer, input?: Buffer, network?: Network, output?: Buffer, witness?: Buffer[], redeem?: Redeem }, opts?: { validate?: boolean }):
|
||||
{ address: string, hash: Buffer, output: Buffer, redeem: Redeem, input: Buffer, witness: Buffer[] };
|
||||
|
||||
class Redeem {
|
||||
input?: Buffer;
|
||||
network?: Network;
|
||||
output?: Buffer;
|
||||
witness?: Buffer[];
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function and(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
import bitsAnd from './and';
|
||||
import bitsNor from './nor';
|
||||
import bitsNot from './not';
|
||||
import bitsOr from './or';
|
||||
import bitsReduceAnd from './reduce-and';
|
||||
import bitsReduceNand from './reduce-nand';
|
||||
import bitsReduceNor from './reduce-nor';
|
||||
import bitsReduceOr from './reduce-or';
|
||||
import bitsReduceXnor from './reduce-xnor';
|
||||
import bitsReduceXor from './reduce-xor';
|
||||
import bitsToBoolean from './to-boolean';
|
||||
import bitsToString from './to-string';
|
||||
import bitsXnor from './xnor';
|
||||
import bitsXor from './xor';
|
||||
|
||||
declare namespace bits {
|
||||
const and: typeof bitsAnd;
|
||||
const nor: typeof bitsNor;
|
||||
const not: typeof bitsNot;
|
||||
const or: typeof bitsOr;
|
||||
const reduceAnd: typeof bitsReduceAnd;
|
||||
const reduceNand: typeof bitsReduceNand;
|
||||
const reduceNor: typeof bitsReduceNor;
|
||||
const reduceOr: typeof bitsReduceOr;
|
||||
const reduceXnor: typeof bitsReduceXnor;
|
||||
const reduceXor: typeof bitsReduceXor;
|
||||
const toBoolean: typeof bitsToBoolean;
|
||||
const toString: typeof bitsToString;
|
||||
const xnor: typeof bitsXnor;
|
||||
const xor: typeof bitsXor;
|
||||
}
|
||||
|
||||
export default bits;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function nand(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function nor(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function not(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function or(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function reduceAnd(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function reduceNand(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function reduceNor(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function reduceOr(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function reduceXnor(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function reduceXor(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export default function toBoolean(
|
||||
bits: ReadonlyArray<number>
|
||||
): ReadonlyArray<boolean>;
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export default function toString(
|
||||
bit: ReadonlyArray<number>,
|
||||
spacing?: number,
|
||||
spacer?: string
|
||||
): string;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function xnor(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function xor(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
@@ -0,0 +1,56 @@
|
||||
// Demonstrating cherry-picking
|
||||
import bitwise from 'bitwise';
|
||||
|
||||
import bits from 'bitwise/bits';
|
||||
import toBoolean from 'bitwise/bits/to-boolean';
|
||||
|
||||
import buffer from 'bitwise/buffer';
|
||||
import create from 'bitwise/buffer/create';
|
||||
|
||||
import byte from 'bitwise/byte';
|
||||
import read from 'bitwise/byte/read';
|
||||
|
||||
import integer from 'bitwise/integer';
|
||||
import setBit from 'bitwise/integer/set-bit';
|
||||
|
||||
import nibble from 'bitwise/nibble';
|
||||
import nibbleRead from 'bitwise/nibble/read';
|
||||
|
||||
import string from 'bitwise/string';
|
||||
import toBits from 'bitwise/string/to-bits';
|
||||
|
||||
// Testing basic functions
|
||||
const testBits = [0, 1, 1, 0, 1];
|
||||
|
||||
// $ExpectType string
|
||||
bitwise.bits.toString(testBits);
|
||||
|
||||
// $ExpectType ReadonlyArray<boolean>
|
||||
bits.toBoolean(testBits);
|
||||
// $ExpectType ReadonlyArray<boolean>
|
||||
toBoolean(testBits);
|
||||
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
byte.read(12);
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
read(12);
|
||||
|
||||
// $ExpectType Buffer
|
||||
buffer.create(testBits);
|
||||
// $ExpectType Buffer
|
||||
create(testBits);
|
||||
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
integer.setBit(12, 1, 0);
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
setBit(12, 1, 0);
|
||||
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
nibble.read(15);
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
nibbleRead(15);
|
||||
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
string.toBits('10 10 12$%_.0');
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
toBits('10 10 12$%_.0');
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function and(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function create(bits: ReadonlyArray<number>): Buffer;
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
import bufferAnd from './and';
|
||||
import bufferCreate from './create';
|
||||
import bufferModify from './modify';
|
||||
import bufferNand from './nand';
|
||||
import bufferNor from './nor';
|
||||
import bufferNot from './not';
|
||||
import bufferOr from './or';
|
||||
import bufferRead from './read';
|
||||
import bufferReadCInt from './read-c-int';
|
||||
import bufferReadInt from './read-int';
|
||||
import bufferReadUInt from './read-u-int';
|
||||
import bufferXnor from './xnor';
|
||||
import bufferXor from './xor';
|
||||
|
||||
declare namespace buffer {
|
||||
const and: typeof bufferAnd;
|
||||
const create: typeof bufferCreate;
|
||||
const modify: typeof bufferModify;
|
||||
const nand: typeof bufferNand;
|
||||
const nor: typeof bufferNor;
|
||||
const not: typeof bufferNot;
|
||||
const or: typeof bufferOr;
|
||||
const read: typeof bufferRead;
|
||||
const readCInt: typeof bufferReadCInt;
|
||||
const readInt: typeof bufferReadInt;
|
||||
const readUInt: typeof bufferReadUInt;
|
||||
const xnor: typeof bufferXnor;
|
||||
const xor: typeof bufferXor;
|
||||
}
|
||||
|
||||
export default buffer;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function modify(
|
||||
buffer: Buffer,
|
||||
newBits: ReadonlyArray<number>,
|
||||
bitOffset?: number
|
||||
): void;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function nand(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function nor(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping: boolean
|
||||
): Buffer;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function not(buffer: Buffer): Buffer;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function or(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function readCInt(
|
||||
buffer: Buffer,
|
||||
bitOffset?: number,
|
||||
bitLength?: number
|
||||
): number;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function readInt(
|
||||
buffer: Buffer,
|
||||
bitOffset?: number,
|
||||
bitLength?: number
|
||||
): number;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function readUInt(
|
||||
buffer: Buffer,
|
||||
bitOffset?: number,
|
||||
bitLength?: number
|
||||
): number;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function read(
|
||||
buffer: Buffer,
|
||||
bitOffset?: number,
|
||||
bitLength?: number
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function xnor(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function xor(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
import byteRead from './read';
|
||||
import byteWrite from './write';
|
||||
|
||||
declare namespace byte {
|
||||
const read: typeof byteRead;
|
||||
const write: typeof byteWrite;
|
||||
}
|
||||
|
||||
export default byte;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function read(byte: number): ReadonlyArray<number>;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function write(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for bitwise 1.5
|
||||
// Project: https://github.com/dodekeract/bitwise
|
||||
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import bitwiseBits from './bits';
|
||||
import bitwiseBuffer from './buffer';
|
||||
import bitwiseByte from './byte';
|
||||
import bitwiseInteger from './integer';
|
||||
import bitwiseNibble from './nibble';
|
||||
import bitwiseString from './string';
|
||||
|
||||
declare namespace bitwise {
|
||||
const bits: typeof bitwiseBits;
|
||||
const buffer: typeof bitwiseBuffer;
|
||||
const byte: typeof bitwiseByte;
|
||||
const integer: typeof bitwiseInteger;
|
||||
const nibble: typeof bitwiseNibble;
|
||||
const string: typeof bitwiseString;
|
||||
}
|
||||
|
||||
export default bitwise;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function getBit(number: number, position: number): number;
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
import integerGetBit from './get-bit';
|
||||
import integerSetBit from './set-bit';
|
||||
import integerToggleBit from './toggle-bit';
|
||||
|
||||
declare namespace integer {
|
||||
const getBit: typeof integerGetBit;
|
||||
const setBit: typeof integerSetBit;
|
||||
const toggleBit: typeof integerToggleBit;
|
||||
}
|
||||
|
||||
export default integer;
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export default function setBit(
|
||||
number: number,
|
||||
position: number,
|
||||
value: number
|
||||
): ReadonlyArray<number>;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
export default function toggleBit(
|
||||
number: number,
|
||||
position: number
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
import nibbleRead from './read';
|
||||
import nibbleWrite from './write';
|
||||
|
||||
declare namespace nibble {
|
||||
const read: typeof nibbleRead;
|
||||
const write: typeof nibbleWrite;
|
||||
}
|
||||
|
||||
export default nibble;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function read(nibble: number): ReadonlyArray<number>;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function write(nibble: ReadonlyArray<number>): number;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
import stringToBits from './to-bits';
|
||||
|
||||
declare namespace string {
|
||||
const toBits: typeof stringToBits;
|
||||
}
|
||||
|
||||
export default string;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function toBits(string: string): ReadonlyArray<number>;
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bitwise-tests.ts",
|
||||
"bits/and.d.ts",
|
||||
"bits/index.d.ts",
|
||||
"bits/nand.d.ts",
|
||||
"bits/nor.d.ts",
|
||||
"bits/not.d.ts",
|
||||
"bits/or.d.ts",
|
||||
"bits/reduce-and.d.ts",
|
||||
"bits/reduce-nand.d.ts",
|
||||
"bits/reduce-nor.d.ts",
|
||||
"bits/reduce-or.d.ts",
|
||||
"bits/reduce-xnor.d.ts",
|
||||
"bits/reduce-xor.d.ts",
|
||||
"bits/to-boolean.d.ts",
|
||||
"bits/to-string.d.ts",
|
||||
"bits/xnor.d.ts",
|
||||
"bits/xor.d.ts",
|
||||
"buffer/and.d.ts",
|
||||
"buffer/create.d.ts",
|
||||
"buffer/modify.d.ts",
|
||||
"buffer/nand.d.ts",
|
||||
"buffer/nor.d.ts",
|
||||
"buffer/not.d.ts",
|
||||
"buffer/or.d.ts",
|
||||
"buffer/read-c-int.d.ts",
|
||||
"buffer/read-int.d.ts",
|
||||
"buffer/read-u-int.d.ts",
|
||||
"buffer/read.d.ts",
|
||||
"buffer/xnor.d.ts",
|
||||
"buffer/xor.d.ts",
|
||||
"byte/index.d.ts",
|
||||
"byte/read.d.ts",
|
||||
"byte/write.d.ts",
|
||||
"integer/get-bit.d.ts",
|
||||
"integer/index.d.ts",
|
||||
"integer/set-bit.d.ts",
|
||||
"integer/toggle-bit.d.ts",
|
||||
"nibble/index.d.ts",
|
||||
"nibble/read.d.ts",
|
||||
"nibble/write.d.ts",
|
||||
"string/index.d.ts",
|
||||
"string/to-bits.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import xor = require('buffer-xor');
|
||||
|
||||
// $ExpectType Buffer
|
||||
xor(Buffer.from('a'), Buffer.from('b'));
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// Type definitions for buffer-xor 2.0
|
||||
// Project: https://github.com/crypto-browserify/buffer-xor
|
||||
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types = "node" />
|
||||
|
||||
declare function xor(a: Buffer, b: Buffer): Buffer;
|
||||
|
||||
export = xor;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"buffer-xor-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+7
@@ -454,6 +454,13 @@ declare module CANNON {
|
||||
type?: number;
|
||||
linearDamping?: number;
|
||||
angularDamping?: number;
|
||||
allowSleep?: boolean;
|
||||
sleepSpeedLimit?: number;
|
||||
sleepTimeLimit?: number;
|
||||
collisionFilterGroup?: number;
|
||||
collisionFilterMask?: number;
|
||||
fixedRotation?: boolean;
|
||||
shape?: Shape;
|
||||
}
|
||||
|
||||
export class Body extends EventTarget {
|
||||
|
||||
Vendored
+22
-3
@@ -797,6 +797,22 @@ declare namespace Cesium {
|
||||
isLeapSecond: boolean;
|
||||
}
|
||||
|
||||
class HeadingPitchRoll {
|
||||
heading: number;
|
||||
pitch: number;
|
||||
roll: number;
|
||||
constructor(heading?: number, pitch?: number, roll?: number);
|
||||
static clone(headingPitchRoll: HeadingPitchRoll, result?: HeadingPitchRoll): HeadingPitchRoll;
|
||||
static equals(left: HeadingPitchRoll | null | undefined, right: HeadingPitchRoll | null | undefined): boolean;
|
||||
static equalsEpsilon(left: HeadingPitchRoll | null | undefined, right: HeadingPitchRoll | null | undefined, relativeEpsilon: number, absoluteEpsilon?: number): boolean;
|
||||
static fromDegrees(heading: number, pitch: number, roll: number, result?: HeadingPitchRoll): HeadingPitchRoll;
|
||||
static fromQuaternion(quaternion: Quaternion, result?: HeadingPitchRoll): HeadingPitchRoll;
|
||||
clone(result?: HeadingPitchRoll): HeadingPitchRoll;
|
||||
equals(right: HeadingPitchRoll | null | undefined): boolean;
|
||||
equalsEpsilon(right: HeadingPitchRoll | null | undefined, relativeEpsilon: number, absoluteEpsilon?: number): boolean;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
class HeightmapTerrainData {
|
||||
waterMask: Uint8Array | HTMLImageElement | HTMLCanvasElement;
|
||||
constructor(options: {
|
||||
@@ -959,6 +975,7 @@ declare namespace Cesium {
|
||||
static fromArray(array: number[], startingIndex?: number, result?: Matrix3): Matrix3;
|
||||
static fromColumnMajorArray(values: number[], result?: Matrix3): Matrix3;
|
||||
static fromRowMajorArray(values: number[], result?: Matrix3): Matrix3;
|
||||
static fromHeadingPitchRoll(headingPitchRoll: HeadingPitchRoll, result?: Matrix3): Matrix3;
|
||||
static fromQuaternion(quaternion: Quaternion): Matrix3;
|
||||
static fromScale(scale: Cartesian3, result?: Matrix3): Matrix3;
|
||||
static fromUniformScale(scale: number, result?: Matrix3): Matrix3;
|
||||
@@ -1236,7 +1253,7 @@ declare namespace Cesium {
|
||||
toString(): string;
|
||||
static fromAxisAngle(axis: Cartesian3, angle: number, result?: Quaternion): Quaternion;
|
||||
static fromRotationMatrix(matrix: Matrix3, result?: Quaternion): Quaternion;
|
||||
static fromHeadingPitchRoll(heading: number, pitch: number, roll: number, result: Quaternion): Quaternion;
|
||||
static fromHeadingPitchRoll(headingPitchRoll: HeadingPitchRoll, result?: Quaternion): Quaternion;
|
||||
static pack(value: Quaternion, array: number[], startingIndex?: number): number[];
|
||||
static unpack(array: number[], startingIndex?: number, result?: Quaternion): Quaternion;
|
||||
static convertPackedArrayForInterpolation(packedArray: number[], startingIndex?: number, lastIndex?: number, result?: number[]): void;
|
||||
@@ -4880,13 +4897,15 @@ declare namespace Cesium {
|
||||
function eastNorthUpToFixedFrame(origin: Cartesian3, ellipsoid?: Ellipsoid, result?: Matrix4): Matrix4;
|
||||
function northEastDownToFixedFrame(origin: Cartesian3, ellipsoid?: Ellipsoid, result?: Matrix4): Matrix4;
|
||||
function northUpEastToFixedFrame(origin: Cartesian3, ellipsoid?: Ellipsoid, result?: Matrix4): Matrix4;
|
||||
function headingPitchRollToFixedFrame(origin: Cartesian3, heading: number, pitch: number, roll: number, ellipsoid?: Ellipsoid, result?: Matrix4): Matrix4;
|
||||
function headingPitchRollQuaternion(origin: Cartesian3, heading: number, pitch: number, roll: number, ellipsoid?: Ellipsoid, result?: Quaternion): Quaternion;
|
||||
function headingPitchRollToFixedFrame(origin: Cartesian3, headingPitchRoll: HeadingPitchRoll, ellipsoid?: Ellipsoid, fixedFrameTransform?: LocalFrameToFixedFrame, result?: Matrix4): Matrix4;
|
||||
function headingPitchRollQuaternion(origin: Cartesian3, headingPitchRoll: HeadingPitchRoll, ellipsoid?: Ellipsoid, fixedFrameTransform?: LocalFrameToFixedFrame,
|
||||
result?: Quaternion): Quaternion;
|
||||
function computeTemeToPseudoFixedMatrix(date: JulianDate, result?: Matrix3): Matrix3;
|
||||
function preloadIcrfFixed(timeInterval: TimeInterval): Promise<void>;
|
||||
function computeIcrfToFixedMatrix(date: JulianDate, result?: Matrix3): Matrix3;
|
||||
function computeFixedToIcrfMatrix(date: JulianDate, result?: Matrix3): Matrix3;
|
||||
function pointToWindowCoordinates(modelViewProjectionMatrix: Matrix4, viewportTransformation: Matrix4, point: Cartesian3, result?: Cartesian2): Cartesian2;
|
||||
type LocalFrameToFixedFrame = (origin: Cartesian3, ellipsoid?: Ellipsoid, result?: Matrix4) => Matrix4;
|
||||
}
|
||||
|
||||
namespace TridiagonalSystemSolver {
|
||||
|
||||
@@ -46,3 +46,7 @@ const entity = new Cesium.Entity({
|
||||
})
|
||||
});
|
||||
viewer.entities.add(entity);
|
||||
|
||||
const hpr = new Cesium.HeadingPitchRoll(1.0, 2.2, 3.4);
|
||||
const quat: Cesium.Quaternion = Cesium.Quaternion.fromHeadingPitchRoll(hpr);
|
||||
const matrix: Cesium.Matrix3 = Cesium.Matrix3.fromHeadingPitchRoll(hpr);
|
||||
|
||||
@@ -48,3 +48,7 @@ const entity = new Cesium.Entity({
|
||||
})
|
||||
});
|
||||
viewer.entities.add(entity);
|
||||
|
||||
const hpr = new Cesium.HeadingPitchRoll(1.0, 2.2, 3.4);
|
||||
const quat: Cesium.Quaternion = Cesium.Quaternion.fromHeadingPitchRoll(hpr);
|
||||
const matrix: Cesium.Matrix3 = Cesium.Matrix3.fromHeadingPitchRoll(hpr);
|
||||
|
||||
Vendored
+4
-1
@@ -8,7 +8,6 @@
|
||||
// Joseph Page <https://github.com/josefpaij>
|
||||
// Dan Manastireanu <https://github.com/danmana>
|
||||
// Guillaume Rodriguez <https://github.com/guillaume-ro-fr>
|
||||
// Sergey Rubanov <https://github.com/chicoxyzzy>
|
||||
// Simon Archer <https://github.com/archy-bold>
|
||||
// Ken Elkabany <https://github.com/braincore>
|
||||
// Slavik Nychkalo <https://github.com/gebeto>
|
||||
@@ -159,6 +158,8 @@ interface Model {
|
||||
tension: number;
|
||||
x: number;
|
||||
y: number;
|
||||
base: number;
|
||||
head: number;
|
||||
}
|
||||
|
||||
declare namespace Chart {
|
||||
@@ -390,6 +391,8 @@ declare namespace Chart {
|
||||
easing?: string;
|
||||
onProgress?(chart: any): void;
|
||||
onComplete?(chart: any): void;
|
||||
animateRotate?: boolean;
|
||||
animateScale?: boolean;
|
||||
}
|
||||
|
||||
interface ChartElementsOptions {
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
import * as chessjs from "chess.js";
|
||||
|
||||
const fen = "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1";
|
||||
|
||||
// --- constructors --- \\
|
||||
|
||||
// $ExpectType ChessInstance
|
||||
chessjs.Chess(fen);
|
||||
|
||||
// $ExpectType ChessInstance
|
||||
const chess = new chessjs.Chess();
|
||||
|
||||
// $ExpectType "w"
|
||||
chess.WHITE;
|
||||
|
||||
// $ExpectType "b"
|
||||
chess.BLACK;
|
||||
|
||||
// $ExpectType "p"
|
||||
chess.PAWN;
|
||||
|
||||
// $ExpectType "n"
|
||||
chess.KNIGHT;
|
||||
|
||||
// $ExpectType "b"
|
||||
chess.BISHOP;
|
||||
|
||||
// $ExpectType "r"
|
||||
chess.ROOK;
|
||||
|
||||
// $ExpectType "q"
|
||||
chess.QUEEN;
|
||||
|
||||
// $ExpectType "k"
|
||||
chess.KING;
|
||||
|
||||
// tslint:disable-next-line:max-line-length
|
||||
// $ExpectType ["a8", "b8", "c8", "d8", "e8", "f8", "g8", "h8", "a7", "b7", "c7", "d7", "e7", "f7", "g7", "h7", "a6", "b6", "c6", "d6", "e6", "f6", "g6", "h6", "a5", "b5", "c5", "d5", "e5", "f5", "g5", "h5", "a4", "b4", "c4", "d4", "e4", "f4", "g4", "h4", "a3", "b3", "c3", "d3", "e3", "f3", "g3", "h3", "a2", "b2", "c2", "d2", "e2", "f2", "g2", "h2", "a1", "b1", "c1", "d1", "e1", "f1", "g1", "h1"]
|
||||
chess.SQUARES;
|
||||
|
||||
// $ExpectType { NORMAL: "n"; CAPTURE: "c"; BIG_PAWN: "b"; EP_CAPTURE: "e"; PROMOTION: "p"; KSIDE_CASTLE: "k"; QSIDE_CASTLE: "q"; }
|
||||
chess.FLAGS;
|
||||
|
||||
// $ExpectType void
|
||||
chess.reset();
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.load(fen);
|
||||
|
||||
// -- moves -- \\
|
||||
|
||||
// $ExpectType Move[]
|
||||
chess.moves({ verbose: true });
|
||||
|
||||
// $ExpectType string[]
|
||||
chess.moves({ verbose: false });
|
||||
|
||||
// $ExpectType Move[]
|
||||
chess.moves({ square: "e2", verbose: true });
|
||||
|
||||
// $ExpectType string[]
|
||||
chess.moves({ square: "e2", verbose: false });
|
||||
|
||||
// $ExpectType string[]
|
||||
chess.moves({ square: "e2" });
|
||||
|
||||
// $ExpectType string[]
|
||||
chess.moves({});
|
||||
|
||||
// $ExpectType string[]
|
||||
chess.moves();
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.in_check();
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.in_checkmate();
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.in_stalemate();
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.in_draw();
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.insufficient_material();
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.in_threefold_repetition();
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.game_over();
|
||||
|
||||
// $ExpectType { valid: boolean; error_number: number; error: string; }
|
||||
chess.validate_fen(fen);
|
||||
|
||||
// $ExpectType string
|
||||
chess.fen();
|
||||
|
||||
// --- pgn --- \\
|
||||
|
||||
// $ExpectType string
|
||||
chess.pgn({ max_width: 80, newline_char: '\n' });
|
||||
|
||||
// $ExpectType string
|
||||
chess.pgn({ max_width: 120 });
|
||||
|
||||
// $ExpectType string
|
||||
chess.pgn({ newline_char: '\r\n' });
|
||||
|
||||
// $ExpectType string
|
||||
chess.pgn({});
|
||||
|
||||
// $ExpectType string
|
||||
const pgn = chess.pgn();
|
||||
|
||||
// --- load_pgn --- \\
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.load_pgn(pgn, { newline_char: '\n', sloppy: true });
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.load_pgn(pgn, { newline_char: '\r\n' });
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.load_pgn(pgn, { sloppy: true });
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.load_pgn(pgn, {});
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.load_pgn(pgn);
|
||||
|
||||
// $ExpectType { [key: string]: string | undefined; }
|
||||
chess.header('White', 'Morphy', 'Black', 'Anderssen', 'Date', '1858-??-??');
|
||||
|
||||
// $ExpectType string
|
||||
chess.ascii();
|
||||
|
||||
// $ExpectType "w" | "b"
|
||||
chess.turn();
|
||||
|
||||
// --- move --- \\
|
||||
|
||||
// $ExpectType Move | null
|
||||
chess.move('e3');
|
||||
|
||||
// $ExpectType Move | null
|
||||
chess.move('e3', {});
|
||||
|
||||
// $ExpectType Move | null
|
||||
chess.move('e3', { sloppy: true });
|
||||
|
||||
// $ExpectType Move | null
|
||||
chess.move('e3', { sloppy: false });
|
||||
|
||||
// $ExpectType Move | null
|
||||
chess.move({ from: 'e2', to: 'e3' });
|
||||
|
||||
// $ExpectType Move | null
|
||||
chess.move({ from: 'e2', to: 'e3', promotion: 'q' });
|
||||
|
||||
// $ExpectType Move | null
|
||||
chess.move({ from: 'e2', to: 'e3' });
|
||||
|
||||
// $ExpectType Move | null
|
||||
chess.move({ from: 'e2', to: 'e3', promotion: 'q' });
|
||||
|
||||
// $ExpectType Move | null
|
||||
chess.undo();
|
||||
|
||||
// $ExpectType void
|
||||
chess.clear();
|
||||
|
||||
// $ExpectType boolean
|
||||
chess.put({ type: "p", color: "b" }, 'a5');
|
||||
|
||||
// $ExpectType Piece | null
|
||||
chess.get("a5");
|
||||
|
||||
// $ExpectType Piece | null
|
||||
chess.remove("a5");
|
||||
|
||||
// $ExpectType "light" | "dark"
|
||||
chess.square_color("a5");
|
||||
|
||||
// $ExpectType "light" | "dark" | null
|
||||
chess.square_color("invalid square string");
|
||||
|
||||
// --- history --- \\
|
||||
|
||||
// $ExpectType string[]
|
||||
chess.history();
|
||||
|
||||
// $ExpectType string[]
|
||||
chess.history({});
|
||||
|
||||
// $ExpectType string[]
|
||||
chess.history({ verbose: false });
|
||||
|
||||
// $ExpectType Move[]
|
||||
chess.history({ verbose: true });
|
||||
Vendored
+530
@@ -0,0 +1,530 @@
|
||||
// Type definitions for chess.js 0.10
|
||||
// Project: https://github.com/jhlywa/chess.js
|
||||
// Definitions by: Jacob Fischer <https://github.com/JacobFischer>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* One of the possible sqaures on a chess board in san format,
|
||||
* e.g. "a8" to "h1".
|
||||
*/
|
||||
export type Square =
|
||||
"a8" | "b8" | "c8" | "d8" | "e8" | "f8" | "g8" | "h8" |
|
||||
"a7" | "b7" | "c7" | "d7" | "e7" | "f7" | "g7" | "h7" |
|
||||
"a6" | "b6" | "c6" | "d6" | "e6" | "f6" | "g6" | "h6" |
|
||||
"a5" | "b5" | "c5" | "d5" | "e5" | "f5" | "g5" | "h5" |
|
||||
"a4" | "b4" | "c4" | "d4" | "e4" | "f4" | "g4" | "h4" |
|
||||
"a3" | "b3" | "c3" | "d3" | "e3" | "f3" | "g3" | "h3" |
|
||||
"a2" | "b2" | "c2" | "d2" | "e2" | "f2" | "g2" | "h2" |
|
||||
"a1" | "b1" | "c1" | "d1" | "e1" | "f1" | "g1" | "h1"
|
||||
;
|
||||
|
||||
/**
|
||||
* Partial data about a chess move including the from and to square, and if a
|
||||
* promotion occured.
|
||||
*/
|
||||
export interface ShortMove {
|
||||
/**
|
||||
* The location the piece is moving from.
|
||||
* Must be in san format, e.g "h8"
|
||||
*/
|
||||
from: Square;
|
||||
|
||||
/**
|
||||
* The location the piece is moving to.
|
||||
* Must be in san format, e.g "a1"
|
||||
*/
|
||||
to: Square;
|
||||
|
||||
/**
|
||||
* If this move results in a promotion, this will have the unit promotion.
|
||||
* - "n" for Knight
|
||||
* - "b" for Bishop
|
||||
* - "r" for Rook
|
||||
* - "q" for Queen
|
||||
*/
|
||||
promotion?: "n" | "b" | "r" | "q";
|
||||
}
|
||||
|
||||
/**
|
||||
* The full data about a chess move
|
||||
*/
|
||||
export interface Move extends ShortMove {
|
||||
/**
|
||||
* The color of the piece that moved
|
||||
* - "b" for Black
|
||||
* - "w" for White
|
||||
*/
|
||||
color: "b" | "w";
|
||||
|
||||
/** Flags indicating what occurred, combined into one string */
|
||||
flags: string;
|
||||
|
||||
/**
|
||||
* The type of the piece that moved
|
||||
* - "p" for Pawn
|
||||
* - "n" for Knight
|
||||
* - "b" for Bishop
|
||||
* - "r" for Rook
|
||||
* - "q" for Queen
|
||||
* - "k" for King
|
||||
*/
|
||||
piece: "p" | "n" | "b" | "r" | "q" | "k";
|
||||
|
||||
/** The Standard Algebraic Notation (SAN) representation of the move */
|
||||
san: string;
|
||||
|
||||
/**
|
||||
* If an enemy piece was captured this is their type.
|
||||
* - "p" for Pawn
|
||||
* - "n" for Knight
|
||||
* - "b" for Bishop
|
||||
* - "r" for Rook
|
||||
* - "q" for Queen
|
||||
*/
|
||||
captured?: "p" | "n" | "b" | "r" | "q";
|
||||
}
|
||||
|
||||
export interface Piece {
|
||||
/**
|
||||
* The type of the piece to place
|
||||
* - "p" for Pawn
|
||||
* - "n" for Knight
|
||||
* - "b" for Bishop
|
||||
* - "r" for Rook
|
||||
* - "q" for Queen
|
||||
* - "k" for King
|
||||
*/
|
||||
type: "p" | "n" | "b" | "r" | "q" | "k";
|
||||
|
||||
/**
|
||||
* The color of the piece
|
||||
* - "b" for Black
|
||||
* - "w" for White
|
||||
*/
|
||||
color: "b" | "w";
|
||||
}
|
||||
|
||||
export interface ChessInstance {
|
||||
/** The string that represents the White color side */
|
||||
readonly WHITE: "w";
|
||||
|
||||
/** The string that represents the Black color side */
|
||||
readonly BLACK: "b";
|
||||
|
||||
/** The string that represents a Pawn */
|
||||
readonly PAWN: "p";
|
||||
|
||||
/** The string that represents a Knight */
|
||||
readonly KNIGHT: "n";
|
||||
/** The string that represents a Bishop */
|
||||
readonly BISHOP: "b";
|
||||
|
||||
/** The string that represents a Rook */
|
||||
readonly ROOK: "r";
|
||||
|
||||
/** The string that represents a Queen */
|
||||
readonly QUEEN: "q";
|
||||
|
||||
/** The string that represents a King */
|
||||
readonly KING: "k";
|
||||
|
||||
/** A list of all the squares in the game, from "a1" to "h8" */
|
||||
readonly SQUARES: [
|
||||
"a8", "b8", "c8", "d8", "e8", "f8", "g8", "h8",
|
||||
"a7", "b7", "c7", "d7", "e7", "f7", "g7", "h7",
|
||||
"a6", "b6", "c6", "d6", "e6", "f6", "g6", "h6",
|
||||
"a5", "b5", "c5", "d5", "e5", "f5", "g5", "h5",
|
||||
"a4", "b4", "c4", "d4", "e4", "f4", "g4", "h4",
|
||||
"a3", "b3", "c3", "d3", "e3", "f3", "g3", "h3",
|
||||
"a2", "b2", "c2", "d2", "e2", "f2", "g2", "h2",
|
||||
"a1", "b1", "c1", "d1", "e1", "f1", "g1", "h1"
|
||||
];
|
||||
|
||||
/** Flags used to build flag strings for moves */
|
||||
readonly FLAGS: {
|
||||
/** a non-capture */
|
||||
NORMAL: "n",
|
||||
/** a standard capture */
|
||||
CAPTURE: "c",
|
||||
/** a pawn push of two squares */
|
||||
BIG_PAWN: "b",
|
||||
/** an en passant capture */
|
||||
EP_CAPTURE: "e",
|
||||
/** a promotion */
|
||||
PROMOTION: "p",
|
||||
/** kingside castling */
|
||||
KSIDE_CASTLE: "k",
|
||||
/** queenside castling */
|
||||
QSIDE_CASTLE: "q",
|
||||
};
|
||||
|
||||
/**
|
||||
* The board is cleared, and the FEN string is loaded.
|
||||
* Returns true if the position was successfully loaded, otherwise false
|
||||
* @param fen the fen formatted string to load
|
||||
* @returns true if the position was successfully loaded, otherwise
|
||||
* false
|
||||
*/
|
||||
load(fen: string): boolean;
|
||||
|
||||
/**
|
||||
* Reset the board to the initial starting position.
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
/**
|
||||
* Returns a list of legal moves from the current position.
|
||||
* The function takes an optional parameter which controls the
|
||||
* single-square move generation and verbosity.
|
||||
* @param options an optional parameter which controls the single-square
|
||||
* move generation and verbosity.
|
||||
* @returns The list of all valid moves, either in SAN format, or as
|
||||
* verbose objects.
|
||||
*/
|
||||
moves(options: {
|
||||
/** Set to true to return verbose move objects instead of strings */
|
||||
verbose: true;
|
||||
/**
|
||||
* The string to test if it is a valid move, if it is not then an
|
||||
* empty array is returned
|
||||
*/
|
||||
square?: string;
|
||||
}): Move[];
|
||||
|
||||
/**
|
||||
* Returns a list of legal moves from the current position.
|
||||
* The function takes an optional parameter which controls the
|
||||
* single-square move generation and verbosity.
|
||||
* @param options an optional parameter which controls the single-square
|
||||
* move generation and verbosity.
|
||||
* @returns The list of all valid moves, either in SAN format, or as
|
||||
* verbose objects.
|
||||
*/
|
||||
moves(options?: {
|
||||
/** Set to true to return verbose move objects instead of strings */
|
||||
verbose?: false;
|
||||
/**
|
||||
* The string to test if it is a valid move, if it is not then an
|
||||
* empty array is returned
|
||||
*/
|
||||
square?: string;
|
||||
}): string[];
|
||||
|
||||
/**
|
||||
* Returns a list of legal moves from the current position.
|
||||
* The function takes an optional parameter which controls the
|
||||
* single-square move generation and verbosity.
|
||||
* @param options an optional parameter which controls the single-square
|
||||
* move generation and verbosity.
|
||||
* @returns The list of all valid moves, either in SAN format, or as
|
||||
* verbose objects.
|
||||
*/
|
||||
moves(options?: {
|
||||
/** Set to true to return verbose move objects instead of strings */
|
||||
verbose?: boolean;
|
||||
/**
|
||||
* The string to test if it is a valid move, if it is not then an
|
||||
* empty array is returned
|
||||
*/
|
||||
square?: string;
|
||||
}): string[] | Move[];
|
||||
|
||||
/**
|
||||
* Returns true or false if the side to move is in check.
|
||||
* @returns true or false if the side to move is in check.
|
||||
*/
|
||||
in_check(): boolean;
|
||||
|
||||
/**
|
||||
* Returns true or false if the side to move has been checkmated.
|
||||
* @returns true or false if the side to move has been checkmated.
|
||||
*/
|
||||
in_checkmate(): boolean;
|
||||
/**
|
||||
* Returns true or false if the side to move has been stalemated.
|
||||
* @returns true or false if the side to move has been stalemated.
|
||||
*/
|
||||
in_stalemate(): boolean;
|
||||
|
||||
/**
|
||||
* Returns true or false if the game is drawn (50-move rule or
|
||||
* insufficient material).
|
||||
* @returns true or false if the game is drawn (50-move rule or
|
||||
* insufficient material).
|
||||
*/
|
||||
in_draw(): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the game is drawn due to insufficient material
|
||||
* (K vs. K, K vs. KB, or K vs. KN); otherwise false.
|
||||
* @returns True if the game is drawn due to insufficient material
|
||||
* (K vs. K, K vs. KB, or K vs. KN); otherwise false.
|
||||
*/
|
||||
insufficient_material(): boolean;
|
||||
|
||||
/**
|
||||
* Returns true or false if the current board position has occurred three
|
||||
* or more times.
|
||||
* @returns true or false if the current board position has occurred three
|
||||
* or more times.
|
||||
*/
|
||||
in_threefold_repetition(): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the game has ended via checkmate, stalemate, draw,
|
||||
* threefold repetition, or insufficient material.
|
||||
* Otherwise, returns false.
|
||||
* @returns True if the game has ended via checkmate, stalemate, draw,
|
||||
* threefold repetition, or insufficient material. Otherwise, returns
|
||||
* false.
|
||||
*/
|
||||
game_over(): boolean;
|
||||
|
||||
/**
|
||||
* Returns a validation object specifying validity or the errors found
|
||||
* within the FEN string.
|
||||
* @param fen the fen formatted string to validate
|
||||
*/
|
||||
validate_fen(fen: string): {
|
||||
/** Indicates if the fen is valid or not. */
|
||||
valid: boolean;
|
||||
|
||||
/**
|
||||
* If not valid, then this will a type of error used internally in
|
||||
* chess.js. Otherwise 0.
|
||||
*/
|
||||
error_number: number;
|
||||
|
||||
/**
|
||||
* The string "No errors." if valid. Otherwise a string explaining why
|
||||
* it is not valid.
|
||||
*/
|
||||
error: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the FEN string for the current position.
|
||||
* @returns the FEN string for the current position.
|
||||
*/
|
||||
fen(): string;
|
||||
|
||||
/**
|
||||
* Returns the game in PGN format.
|
||||
* Options is an optional parameter which may include max width and/or a
|
||||
* newline character settings.
|
||||
* @param options optional object which may include max width and/or a
|
||||
* newline character settings.
|
||||
* @returns the current game state in PGN format.
|
||||
*/
|
||||
pgn(options?: {
|
||||
/** the maximum width of a line */
|
||||
max_width?: number,
|
||||
/** Specific newline character */
|
||||
newline_char?: string;
|
||||
}): string;
|
||||
|
||||
/**
|
||||
* Load the moves of a game stored in Portable Game Notation.
|
||||
* @param pgn the pgn should be a string in Portable Game Notation.
|
||||
* @param options An optional object which may contain a string
|
||||
* newline_char and a boolean sloppy.
|
||||
* @returns The method will return true if the PGN was parsed successfully,
|
||||
* otherwise false.
|
||||
*/
|
||||
load_pgn(pgn: string, options?: {
|
||||
/**
|
||||
* The newline_char is a string representation of a valid RegExp
|
||||
* fragment and is used to process the PGN.
|
||||
* It defaults to \r?\n.
|
||||
* Special characters should not be pre-escaped, but any literal
|
||||
* special characters should be escaped as is normal for a RegExp.
|
||||
* Keep in mind that backslashes in JavaScript strings must
|
||||
* themselves be escaped.
|
||||
* Avoid using a newline_char that may occur elsewhere in a PGN,
|
||||
* such as . or x, as this will result in unexpected behavior.
|
||||
*/
|
||||
newline_char?: string;
|
||||
|
||||
/**
|
||||
* The sloppy flag is a boolean that permits chess.js to parse moves in
|
||||
* non-standard notations.
|
||||
* See .move documentation for more information about non-SAN
|
||||
* notations.
|
||||
*/
|
||||
sloppy?: boolean;
|
||||
}): boolean;
|
||||
|
||||
/**
|
||||
* Allows header information to be added to PGN output.
|
||||
* Any number of key/value pairs can be passed to .header(), with each
|
||||
* first arg being treated as a header key, and each second as the value.
|
||||
* @param args (optional) Header pairs to store in the header.
|
||||
* @returns The current header information after storing any values.
|
||||
*/
|
||||
header(...args: string[]): { [key: string]: string | undefined };
|
||||
|
||||
/**
|
||||
* Returns a string containing an ASCII diagram of the current position.
|
||||
* @returns A string containing an ASCII diagram of the current position.
|
||||
*/
|
||||
ascii(): string;
|
||||
|
||||
/**
|
||||
* Returns the current side to move.
|
||||
* @returns "b" if Black is the side to move, otherwise "w" for White.
|
||||
*/
|
||||
turn(): "b" | "w";
|
||||
|
||||
/**
|
||||
* Attempts to make a move on the board, returning a move object if the
|
||||
* move was legal, otherwise null.
|
||||
* The .move function can be called two ways, by passing a string in
|
||||
* Standard Algebraic Notation (SAN),
|
||||
* Or by passing .move() a move object (only the 'to', 'from', and when
|
||||
* necessary 'promotion', fields are needed).
|
||||
* @param move Must be either a string in Standard Algebraic Notation
|
||||
* (SAN), or a move object (only the 'to', 'from', and when necessary
|
||||
* 'promotion', fields are needed)
|
||||
* @param options An optional sloppy flag can be used to parse a variety of
|
||||
* non-standard move notations:
|
||||
* @returns The move as a full object is returned if the move was valid,
|
||||
* and the chess board's state changes.
|
||||
* If the move was invalid, null is returned and the state does not update.
|
||||
*/
|
||||
move(move: string | ShortMove, options?: {
|
||||
/**
|
||||
* An optional sloppy flag can be used to parse a variety of
|
||||
* non-standard move notations.
|
||||
*/
|
||||
sloppy?: boolean;
|
||||
}): Move | null;
|
||||
|
||||
/**
|
||||
* Take back the last half-move, returning a move object if successful,
|
||||
* otherwise null.
|
||||
* @returns the move object that was undone if successful, otherwise null.
|
||||
*/
|
||||
undo(): Move | null;
|
||||
|
||||
/**
|
||||
* Clears the board of all pieces.
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
/**
|
||||
* Place a piece on the square where piece is an object with the form
|
||||
* { type: ..., color: ... }.
|
||||
* put() will fail when passed an invalid piece or square, or when two
|
||||
* or more kings of the same color are placed.
|
||||
* @param piece the piece to put somewhere on the game board.
|
||||
* @param square the square on the chess board to place the piece at.
|
||||
* @returns true if the piece was successfully placed, otherwise, the
|
||||
* board remains unchanged and false is returned.
|
||||
*/
|
||||
put(piece: Piece, square: Square): boolean;
|
||||
|
||||
/**
|
||||
* Returns the piece on the square
|
||||
* @param square the square to get the piece on.
|
||||
* @returns null if no piece is on that square, or it is not a valid
|
||||
* square. Otherwise a piece object.
|
||||
*/
|
||||
get(square: Square): Piece | null;
|
||||
|
||||
/**
|
||||
* Remove and return the piece on square.
|
||||
* @param square the square to remove the piece from, e.g. "b6"
|
||||
* @returns null if no piece was removed, otherwise an object with the
|
||||
* removed piece's type and color.
|
||||
*/
|
||||
remove(square: Square): Piece | null;
|
||||
|
||||
// This is a debugging utility, and is not documented in their readme.
|
||||
// So it is not included in these type definitions.
|
||||
// perft(depth: number): number,
|
||||
|
||||
/**
|
||||
* Returns the color of the square ('light' or 'dark').
|
||||
* @param square the square to check if it is light or dark.
|
||||
* @returns "light" if a light square, "dark" if a dark square, or null if
|
||||
* not a valid square.
|
||||
*/
|
||||
square_color(square: Square): "light" | "dark";
|
||||
|
||||
/**
|
||||
* Returns the color of the square ('light' or 'dark').
|
||||
* @param square the square to check if it is light or dark.
|
||||
* @returns "light" if a light square, "dark" if a dark square, or null if
|
||||
* not a valid square.
|
||||
*/
|
||||
square_color(square: string): "light" | "dark" | null;
|
||||
|
||||
/**
|
||||
* Returns a list containing the moves of the current game.
|
||||
* Options is an optional parameter which may contain a 'verbose' flag.
|
||||
* See .moves() for a description of the verbose move fields.
|
||||
* @param options an optional parameter which may contain a 'verbose' flag.
|
||||
* @returns a list of all moves of the current game. They will be strings
|
||||
* if not passed the verbose flag.
|
||||
*/
|
||||
history(options?: {
|
||||
/**
|
||||
* Pass true if you want this function to output verbose objects
|
||||
* instead of strings.
|
||||
*/
|
||||
verbose?: false;
|
||||
}): string[];
|
||||
|
||||
/**
|
||||
* Returns a list containing the moves of the current game.
|
||||
* Options is an optional parameter which may contain a 'verbose' flag.
|
||||
* See .moves() for a description of the verbose move fields.
|
||||
* @param options an optional parameter which may contain a 'verbose' flag.
|
||||
* @returns a list of all moves of the current game. They will be strings
|
||||
* if not passed the verbose flag.
|
||||
*/
|
||||
history(options: {
|
||||
/**
|
||||
* Pass true if you want this function to output verbose objects
|
||||
* instead of strings.
|
||||
*/
|
||||
verbose: true;
|
||||
}): Move[];
|
||||
|
||||
/**
|
||||
* Returns a list containing the moves of the current game.
|
||||
* Options is an optional parameter which may contain a 'verbose' flag.
|
||||
* See .moves() for a description of the verbose move fields.
|
||||
* @param options an optional parameter which may contain a 'verbose' flag.
|
||||
* @returns a list of all moves of the current game. They will be strings
|
||||
* if not passed the verbose flag.
|
||||
*/
|
||||
history(options?: {
|
||||
/**
|
||||
* Pass true if you want this function to output verbose objects
|
||||
* instead of strings.
|
||||
*/
|
||||
verbose?: boolean;
|
||||
}): string[] | Move[];
|
||||
}
|
||||
|
||||
/**
|
||||
* The chess.js function that is used to build chess game instances.
|
||||
* It can be used with or without `new` to build your instance. Both variants
|
||||
* work the same.
|
||||
*/
|
||||
export const Chess: {
|
||||
/**
|
||||
* The Chess() constructor takes an optional parameter which specifies
|
||||
* the board configuration in Forsyth-Edwards Notation.
|
||||
* @param fen specifies the board configuration in Forsyth-Edwards Notation.
|
||||
*/
|
||||
(fen?: string): ChessInstance;
|
||||
|
||||
/**
|
||||
* The Chess() constructor takes an optional parameter which specifies
|
||||
* the board configuration in Forsyth-Edwards Notation.
|
||||
* @param fen specifies the board configuration in Forsyth-Edwards Notation.
|
||||
*/
|
||||
new (fen?: string): ChessInstance;
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"chess.js-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+75
-74
@@ -1,6 +1,7 @@
|
||||
// Type definitions for Chrome Cast application development
|
||||
// Project: https://developers.google.com/cast/
|
||||
// Definitions by: Thomas Stig Jacobsen <https://github.com/eXeDK>
|
||||
// Stefan Ullinger <https://github.com/stefanullinger>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
////////////////////
|
||||
@@ -194,7 +195,7 @@ declare namespace chrome.cast {
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
|
||||
export interface ApiConfig {
|
||||
export class ApiConfig {
|
||||
/**
|
||||
* @param {!chrome.cast.SessionRequest} sessionRequest
|
||||
* @param {function(!chrome.cast.Session)} sessionListener
|
||||
@@ -205,13 +206,13 @@ declare namespace chrome.cast {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ApiConfig
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
sessionRequest: chrome.cast.SessionRequest,
|
||||
sessionListener: (session: chrome.cast.Session) => void,
|
||||
receiverListener: (receiverAvailability: chrome.cast.ReceiverAvailability) => void,
|
||||
autoJoinPolicy?: chrome.cast.AutoJoinPolicy,
|
||||
defaultActionPolicy?: chrome.cast.DefaultActionPolicy
|
||||
): ApiConfig;
|
||||
);
|
||||
|
||||
sessionRequest: chrome.cast.SessionRequest;
|
||||
sessionListener: (session: chrome.cast.Session) => void;
|
||||
@@ -220,7 +221,7 @@ declare namespace chrome.cast {
|
||||
defaultActionPolicy: chrome.cast.DefaultActionPolicy;
|
||||
}
|
||||
|
||||
export interface Error {
|
||||
export class Error {
|
||||
/**
|
||||
* @param {!chrome.cast.ErrorCode} code
|
||||
* @param {string=} opt_description
|
||||
@@ -228,11 +229,11 @@ declare namespace chrome.cast {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Error
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
code: chrome.cast.ErrorCode,
|
||||
description?: string,
|
||||
details?: Object
|
||||
): Error;
|
||||
);
|
||||
|
||||
code: chrome.cast.ErrorCode;
|
||||
description?: string;
|
||||
@@ -253,22 +254,22 @@ declare namespace chrome.cast {
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export interface SenderApplication {
|
||||
export class SenderApplication {
|
||||
/**
|
||||
* @param {!chrome.cast.SenderPlatform} platform
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SenderApplication
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
platform: chrome.cast.SenderPlatform
|
||||
): SenderApplication;
|
||||
);
|
||||
|
||||
platform: chrome.cast.SenderPlatform;
|
||||
url?: string;
|
||||
packageId?: string;
|
||||
}
|
||||
|
||||
export interface SessionRequest {
|
||||
export class SessionRequest {
|
||||
/**
|
||||
* @param {string} appId
|
||||
* @param {!Array<chrome.cast.Capability>=} opt_capabilities
|
||||
@@ -276,11 +277,11 @@ declare namespace chrome.cast {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SessionRequest
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
appId: string,
|
||||
capabilities?: Array<chrome.cast.Capability>,
|
||||
timeout?: number
|
||||
): SessionRequest;
|
||||
);
|
||||
|
||||
appId: string;
|
||||
capabilities: Array<chrome.cast.Capability>;
|
||||
@@ -288,7 +289,7 @@ declare namespace chrome.cast {
|
||||
language?: string;
|
||||
}
|
||||
|
||||
export interface Session {
|
||||
export class Session {
|
||||
/**
|
||||
* @param {string} sessionId
|
||||
* @param {string} appId
|
||||
@@ -298,13 +299,13 @@ declare namespace chrome.cast {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Session
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
sessionId: string,
|
||||
appId: string,
|
||||
displayName: string,
|
||||
appImages: Array<chrome.cast.Image>,
|
||||
receiver: chrome.cast.Receiver
|
||||
): Session;
|
||||
);
|
||||
|
||||
sessionId: string;
|
||||
appId: string;
|
||||
@@ -438,7 +439,7 @@ declare namespace chrome.cast {
|
||||
): void
|
||||
}
|
||||
|
||||
export interface Receiver {
|
||||
export class Receiver {
|
||||
/**
|
||||
* @param {string} label
|
||||
* @param {string} friendlyName
|
||||
@@ -447,12 +448,12 @@ declare namespace chrome.cast {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Receiver
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
label: string,
|
||||
friendlyName: string,
|
||||
capabilities?: Array<chrome.cast.Capability>,
|
||||
volume?: chrome.cast.Volume
|
||||
): Receiver;
|
||||
);
|
||||
|
||||
label: string;
|
||||
friendlyName: string;
|
||||
@@ -462,33 +463,33 @@ declare namespace chrome.cast {
|
||||
displayStatus: chrome.cast.ReceiverDisplayStatus;
|
||||
}
|
||||
|
||||
export interface ReceiverDisplayStatus {
|
||||
export class ReceiverDisplayStatus {
|
||||
/**
|
||||
* @param {string} statusText
|
||||
* @param {!Array<chrome.cast.Image>} appImages
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverDisplayStatus
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
statusText: string,
|
||||
appImages: Array<chrome.cast.Image>
|
||||
): ReceiverDisplayStatus;
|
||||
);
|
||||
|
||||
statusText: string;
|
||||
appImages: Array<chrome.cast.Image>;
|
||||
}
|
||||
|
||||
export interface Volume {
|
||||
export class Volume {
|
||||
/**
|
||||
* @param {?number=} opt_level
|
||||
* @param {?boolean=} opt_muted
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Volume
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
level?: number,
|
||||
muted?: boolean
|
||||
): Volume;
|
||||
);
|
||||
|
||||
level?: number;
|
||||
muted?: boolean;
|
||||
@@ -574,15 +575,15 @@ declare namespace chrome.cast.media {
|
||||
ALL_AND_SHUFFLE = "REPEAT_ALL_AND_SHUFFLE"
|
||||
}
|
||||
|
||||
export interface QueueItem {
|
||||
export class QueueItem {
|
||||
/**
|
||||
* @param {!chrome.cast.media.MediaInfo} mediaInfo
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueItem
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
mediaInfo: chrome.cast.media.MediaInfo
|
||||
): QueueItem;
|
||||
);
|
||||
|
||||
activeTrackIds: Array<Number>;
|
||||
autoplay: boolean;
|
||||
@@ -593,15 +594,15 @@ declare namespace chrome.cast.media {
|
||||
startTime: number;
|
||||
}
|
||||
|
||||
export interface QueueLoadRequest {
|
||||
export class QueueLoadRequest {
|
||||
/**
|
||||
* @param {!Array<chrome.cast.media.QueueItem>} items
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueLoadRequest
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
items: Array<chrome.cast.media.QueueItem>
|
||||
): QueueLoadRequest;
|
||||
);
|
||||
|
||||
customData: Object;
|
||||
items: Array<chrome.cast.media.QueueItem>;
|
||||
@@ -609,59 +610,59 @@ declare namespace chrome.cast.media {
|
||||
startIndex: number;
|
||||
}
|
||||
|
||||
export interface QueueInsertItemsRequest {
|
||||
export class QueueInsertItemsRequest {
|
||||
/**
|
||||
* @param {!Array<chrome.cast.media.QueueItem>}
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueInsertItemsRequest
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
itemsToInsert: Array<chrome.cast.media.QueueItem>
|
||||
): QueueInsertItemsRequest;
|
||||
);
|
||||
|
||||
customData: Object;
|
||||
insertBefore: number;
|
||||
items: Array<chrome.cast.media.QueueItem>;
|
||||
}
|
||||
|
||||
export interface QueueRemoveItemsRequest {
|
||||
export class QueueRemoveItemsRequest {
|
||||
/**
|
||||
* @param {!Array<number>}
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueRemoveItemsRequest
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
itemIdsToRemove: Array<number>
|
||||
): QueueRemoveItemsRequest;
|
||||
);
|
||||
|
||||
customData: Object;
|
||||
itemIds: Array<number>;
|
||||
}
|
||||
|
||||
export interface QueueReorderItemsRequest {
|
||||
export class QueueReorderItemsRequest {
|
||||
/**
|
||||
* @param {!Array<number>}
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueReorderItemsRequest
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
itemIdsToReorder: Array<number>
|
||||
): QueueReorderItemsRequest;
|
||||
);
|
||||
|
||||
customData: Object;
|
||||
insertBefore: number;
|
||||
itemIds: Array<number>;
|
||||
}
|
||||
|
||||
export interface QueueUpdateItemsRequest {
|
||||
export class QueueUpdateItemsRequest {
|
||||
/**
|
||||
* @param {!Array<chrome.cast.media.QueueItem>}
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueUpdateItemsRequest
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
itemsToUpdate: Array<chrome.cast.media.QueueItem>
|
||||
): QueueUpdateItemsRequest;
|
||||
);
|
||||
|
||||
customData: Object;
|
||||
item: Array<chrome.cast.media.QueueItem>;
|
||||
@@ -736,67 +737,67 @@ declare namespace chrome.cast.media {
|
||||
ITALIC = "ITALIC"
|
||||
}
|
||||
|
||||
export interface GetStatusRequest {
|
||||
export class GetStatusRequest {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GetStatusRequest
|
||||
*/
|
||||
new(): GetStatusRequest;
|
||||
constructor();
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
|
||||
export interface PauseRequest {
|
||||
export class PauseRequest {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PauseRequest
|
||||
*/
|
||||
new(): PauseRequest;
|
||||
constructor();
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
|
||||
export interface PlayRequest {
|
||||
export class PlayRequest {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayRequest
|
||||
*/
|
||||
new(): PlayRequest;
|
||||
constructor();
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
|
||||
export interface SeekRequest {
|
||||
export class SeekRequest {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.SeekRequest
|
||||
*/
|
||||
new(): SeekRequest;
|
||||
constructor();
|
||||
|
||||
currentTime: number;
|
||||
resumeState: chrome.cast.media.ResumeState;
|
||||
customData: Object;
|
||||
}
|
||||
|
||||
export interface StopRequest {
|
||||
export class StopRequest {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StopRequest
|
||||
*/
|
||||
new(): StopRequest;
|
||||
constructor();
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
|
||||
export interface VolumeRequest {
|
||||
export class VolumeRequest {
|
||||
/**
|
||||
* @param {!chrome.cast.Volume} volume
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.VolumeRequest
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
volume: chrome.cast.Volume
|
||||
): VolumeRequest;
|
||||
);
|
||||
|
||||
volume: chrome.cast.Volume;
|
||||
customData: Object;
|
||||
@@ -819,17 +820,17 @@ declare namespace chrome.cast.media {
|
||||
media: chrome.cast.media.MediaInfo;
|
||||
}
|
||||
|
||||
export interface EditTracksInfoRequest {
|
||||
export class EditTracksInfoRequest {
|
||||
/**
|
||||
* @param {Array<number>=} opt_activeTrackIds
|
||||
* @param {chrome.cast.media.TextTrackStyle=} opt_textTrackStyle
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.EditTracksInfoRequest
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
activeTrackIds?: Array<number>,
|
||||
textTrackStyle?: chrome.cast.media.TextTrackStyle
|
||||
): EditTracksInfoRequest;
|
||||
);
|
||||
|
||||
activeTrackIds: Array<number>;
|
||||
textTrackStyle: chrome.cast.media.TextTrackStyle;
|
||||
@@ -847,12 +848,12 @@ declare namespace chrome.cast.media {
|
||||
type: chrome.cast.media.MetadataType;
|
||||
}
|
||||
|
||||
export interface MovieMediaMetadata {
|
||||
export class MovieMediaMetadata {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MovieMediaMetadata
|
||||
*/
|
||||
new(): MovieMediaMetadata;
|
||||
constructor();
|
||||
|
||||
images: Array<chrome.cast.Image>;
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
@@ -866,12 +867,12 @@ declare namespace chrome.cast.media {
|
||||
type: chrome.cast.media.MetadataType;
|
||||
}
|
||||
|
||||
export interface TvShowMediaMetadata {
|
||||
export class TvShowMediaMetadata {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TvShowMediaMetadata
|
||||
*/
|
||||
new(): TvShowMediaMetadata;
|
||||
constructor();
|
||||
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
seriesTitle: string;
|
||||
@@ -893,12 +894,12 @@ declare namespace chrome.cast.media {
|
||||
releaseYear: number;
|
||||
}
|
||||
|
||||
export interface MusicTrackMediaMetadata {
|
||||
export class MusicTrackMediaMetadata {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MusicTrackMediaMetadata
|
||||
*/
|
||||
new(): MusicTrackMediaMetadata;
|
||||
constructor();
|
||||
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
albumName: string;
|
||||
@@ -920,12 +921,12 @@ declare namespace chrome.cast.media {
|
||||
releaseYear: number;
|
||||
}
|
||||
|
||||
export interface PhotoMediaMetadata {
|
||||
export class PhotoMediaMetadata {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PhotoMediaMetadata
|
||||
*/
|
||||
new(): PhotoMediaMetadata;
|
||||
constructor();
|
||||
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
title: string;
|
||||
@@ -964,17 +965,17 @@ declare namespace chrome.cast.media {
|
||||
customData: Object;
|
||||
}
|
||||
|
||||
export interface Media {
|
||||
export class Media {
|
||||
/**
|
||||
* @param {string} sessionId
|
||||
* @param {number} mediaSessionId
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.Media
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
sessionId: string,
|
||||
mediaSessionId: number
|
||||
): Media;
|
||||
);
|
||||
|
||||
activeTrackIds: Array<number>;
|
||||
currentItemId: number;
|
||||
@@ -1210,17 +1211,17 @@ declare namespace chrome.cast.media {
|
||||
|
||||
}
|
||||
|
||||
export interface Track {
|
||||
export class Track {
|
||||
/**
|
||||
* @param {number} trackId
|
||||
* @param {!chrome.cast.media.TrackType} trackType
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.Track
|
||||
*/
|
||||
new(
|
||||
constructor(
|
||||
trackId: number,
|
||||
trackType: chrome.cast.media.TrackType
|
||||
): Track;
|
||||
);
|
||||
|
||||
trackId: number;
|
||||
trackContentId: string;
|
||||
@@ -1232,12 +1233,12 @@ declare namespace chrome.cast.media {
|
||||
customData: Object;
|
||||
}
|
||||
|
||||
export interface TextTrackStyle {
|
||||
export class TextTrackStyle {
|
||||
/**
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackStyle
|
||||
*/
|
||||
new(): TextTrackStyle;
|
||||
constructor();
|
||||
|
||||
foregroundColor: string;
|
||||
backgroundColor: string;
|
||||
|
||||
Vendored
+1
@@ -51,4 +51,5 @@ export interface CleaveOptions {
|
||||
noImmediatePrefix?: boolean;
|
||||
rawValueTrimPrefix?: boolean;
|
||||
uppercase?: boolean;
|
||||
onValueChanged?(event: any): void;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -64,7 +64,7 @@ export class Node {
|
||||
/**
|
||||
* either Bullet or Ordered (or undefined).
|
||||
*/
|
||||
listType: 'Bullet' | 'Ordered';
|
||||
listType: 'bullet' | 'ordered';
|
||||
/**
|
||||
* true if list is tight
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import quantile = require('compute-quantile');
|
||||
|
||||
// $ExpectType number
|
||||
quantile([1, 2, 3], 0.5);
|
||||
|
||||
// $ExpectType number
|
||||
quantile([1, 2, 3], 0.5, undefined);
|
||||
|
||||
// $ExpectType number
|
||||
quantile([1, 2, 3], 0.5, {});
|
||||
|
||||
// $ExpectType number
|
||||
quantile([1, 2, 3], 0.5, { sorted: true });
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// Type definitions for compute-quantile 1.0
|
||||
// Project: https://github.com/compute-io/quantile
|
||||
// Definitions by: mrmlnc <https://github.com/mrmlnc>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Computes a quantile for a numeric array.
|
||||
*/
|
||||
declare function quantile(array: ArrayLike<number>, quantile: number, options?: quantile.Options): number;
|
||||
|
||||
declare namespace quantile {
|
||||
interface Options {
|
||||
/**
|
||||
* If the input `array` is already sorted in `__ascending__` order, you can set the `sorted` option to `true`.
|
||||
*
|
||||
* @default
|
||||
* false
|
||||
*/
|
||||
sorted?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = quantile;
|
||||
@@ -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",
|
||||
"compute-quantile-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+3
-3
@@ -104,12 +104,12 @@ declare namespace connectMongo {
|
||||
}
|
||||
|
||||
export class MongoStore extends session.Store {
|
||||
get: (sid: string, callback: (err: any, session: Express.Session | null) => void) => void;
|
||||
set: (sid: string, session: Express.Session, callback?: (err: any) => void) => void;
|
||||
get: (sid: string, callback: (err: any, session: Express.SessionData | null) => void) => void;
|
||||
set: (sid: string, session: Express.SessionData, callback?: (err: any) => void) => void;
|
||||
destroy: (sid: string, callback?: (err: any) => void) => void;
|
||||
length: (callback: (err: any, length: number) => void) => void;
|
||||
clear: (callback?: (err?: any) => void) => void;
|
||||
touch: (sid: string, session: Express.Session, callback?: (err: any) => void) => void;
|
||||
touch: (sid: string, session: Express.SessionData, callback?: (err: any) => void) => void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+6
-1
@@ -15,7 +15,7 @@ declare namespace CookieSessionInterfaces {
|
||||
/**
|
||||
* The name of the cookie to set, defaults to session.
|
||||
*/
|
||||
name: string;
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* The list of keys to use to sign & verify cookie values. Set cookies are always signed with keys[0], while the other keys are valid for verification, allowing for key rotation.
|
||||
@@ -47,6 +47,11 @@ declare namespace CookieSessionInterfaces {
|
||||
*/
|
||||
domain?: string;
|
||||
|
||||
/**
|
||||
* a boolean or string indicating whether the cookie is a "same site" cookie (false by default). This can be set to 'strict', 'lax', or true (which maps to 'strict').
|
||||
*/
|
||||
sameSite?: "strict" | "lax" | boolean;
|
||||
|
||||
/**
|
||||
* a boolean indicating whether the cookie is only to be sent over HTTPS (false by default for HTTP, true by default for HTTPS).
|
||||
*/
|
||||
|
||||
@@ -105,15 +105,7 @@ declare const wrongPromise: Promise<number>;
|
||||
</PromiseSubscription>;
|
||||
|
||||
// $ExpectError
|
||||
const MismatchSubscription = createSubscription({
|
||||
getCurrentValue: (a: number) => null,
|
||||
subscribe: (a: string, callback) => (() => undefined)
|
||||
});
|
||||
const MismatchSubscription = createSubscription({ getCurrentValue: (a: number) => null, subscribe: (a: string, callback) => (() => undefined) });
|
||||
|
||||
// $ExpectError
|
||||
const NoUnsubscribe = createSubscription({
|
||||
getCurrentValue: (a: number) => a,
|
||||
subscribe: (a: number, callback) => {
|
||||
// oops, should've returned a callback here
|
||||
}
|
||||
});
|
||||
const NoUnsubscribe = createSubscription({ getCurrentValue: (a: number) => a, subscribe: (a: number, callback) => { /* oops, should've returned a callback here */ }});
|
||||
|
||||
Vendored
+25
-17
@@ -1,31 +1,39 @@
|
||||
// Type definitions for Credit Card Type v5.0.0
|
||||
// Type definitions for Credit Card Type v7.0.0
|
||||
// Project: https://github.com/braintree/credit-card-type
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
declare namespace creditCardType {
|
||||
|
||||
type CardBrand = "american-express" | "diners-club" | "discover" | "jcb" | "maestro" | "master-card" | "unionpay" | "visa"
|
||||
type CardBrand =
|
||||
| "american-express"
|
||||
| "diners-club"
|
||||
| "discover"
|
||||
| "jcb"
|
||||
| "maestro"
|
||||
| "mastercard"
|
||||
| "unionpay"
|
||||
| "visa";
|
||||
|
||||
interface CreditCardTypeInfo {
|
||||
niceType?: string
|
||||
type?: CardBrand
|
||||
prefixPattern?: RegExp
|
||||
exactPattern?: RegExp
|
||||
gaps?: Array<number>
|
||||
lengths?: Array<number>
|
||||
niceType?: string;
|
||||
type?: CardBrand;
|
||||
prefixPattern?: RegExp;
|
||||
exactPattern?: RegExp;
|
||||
gaps?: Array<number>;
|
||||
lengths?: Array<number>;
|
||||
code?: {
|
||||
name?: string
|
||||
size?: number
|
||||
}
|
||||
name?: string;
|
||||
size?: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface CreditCardType {
|
||||
(number: string): Array<CreditCardTypeInfo>
|
||||
getTypeInfo (type: string): CreditCardTypeInfo
|
||||
types: { [type: string]: string }
|
||||
(number: string): Array<CreditCardTypeInfo>;
|
||||
getTypeInfo(type: string): CreditCardTypeInfo;
|
||||
types: { [type: string]: string };
|
||||
}
|
||||
}
|
||||
|
||||
declare const creditCardType: creditCardType.CreditCardType
|
||||
export = creditCardType
|
||||
declare const creditCardType: creditCardType.CreditCardType;
|
||||
export = creditCardType;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user