Resolve conflict

This commit is contained in:
Donam Kim
2018-09-11 13:08:47 +10:00
104 changed files with 8235 additions and 5155 deletions
+437 -306
View File
@@ -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 }
},
+3 -2
View File
@@ -21,6 +21,7 @@
},
"files": [
"index.d.ts",
"aframe-tests.ts"
"test/aframe-tests.ts",
"test/aframe-io-tests.ts"
]
}
}
+6 -2
View File
@@ -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 {
+9
View File
@@ -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';
+67
View File
@@ -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;
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+22 -3
View File
@@ -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 {
+4
View File
@@ -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);
+4
View File
@@ -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);
+2
View File
@@ -158,6 +158,8 @@ interface Model {
tension: number;
x: number;
y: number;
base: number;
head: number;
}
declare namespace Chart {
+118
View File
@@ -0,0 +1,118 @@
/**
* TypeScript definition tests for d3-delaunay module
*
* Note: These tests are intended to test the definitions only
* in the sense of typing and call signature consistency. They
* are not intended as functional tests.
*/
import * as d3 from 'd3-delaunay';
// Test Delaunay class
const constructedDelaunay = new d3.Delaunay([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
const defaultDelaunayFromArray: d3.Delaunay<[number, number]> = d3.Delaunay.from([[0, 0], [1, 0], [0, 1], [1, 1]]);
const defaultDelaunayFromIterator = d3.Delaunay.from((function*() {
yield [0, 0];
yield [1, 0];
yield [0, 1];
yield [1, 1];
})());
const customDelaunayFromArray = d3.Delaunay.from({length: 4}, (d, i) => i & 1, (d, i) => (i >> 1) & 1);
const customDelaunayFromIterator = d3.Delaunay.from((function*() {
yield {x: 0, y: 0};
yield {x: 1, y: 0};
yield {x: 0, y: 1};
yield {x: 1, y: 1};
})(), p => p.x, p => p.y);
const {points, halfedges, hull, triangles} = defaultDelaunayFromArray;
for (let i = 0, l = points.length; i < l; i++) {
typeof(points[i]);
}
for (let i = 0, l = halfedges.length; i < l; i++) {
const j = halfedges[i];
const ti = triangles[i];
const tj = triangles[j];
const pix = points[ti * 2];
const piy = points[ti * 2 + 1];
const pjx = points[tj * 2];
const pjy = points[tj * 2 + 1];
}
for (let n = hull.next; n !== hull; n = n.next) {
const i: number = n.i;
const x: number = n.x;
const y: number = n.y;
const t: number = n.t;
const next: d3.Delaunay.Node = n.next;
const prev: d3.Delaunay.Node = n.prev;
const removed: boolean = n.removed;
}
for (let i = 0, l = triangles.length; i < l; i++) {
const t0 = triangles[i * 3 + 0];
const t1 = triangles[i * 3 + 1];
const t2 = triangles[i * 3 + 2];
const p0x = points[t0 * 2];
const p0y = points[t0 * 2 + 1];
const p1x = points[t1 * 2];
const p1y = points[t1 * 2 + 1];
const p2x = points[t2 * 2];
const p2y = points[t2 * 2 + 1];
}
const findClosest = defaultDelaunayFromArray.find(0.5, 0.5);
for (const neighbor of defaultDelaunayFromArray.neighbors(0)) {
typeof(neighbor);
}
const render: string = defaultDelaunayFromArray.render();
const renderHull: string = defaultDelaunayFromArray.renderHull();
const renderTriangle: string = defaultDelaunayFromArray.renderTriangle(0);
const renderPoints: string = defaultDelaunayFromArray.renderPoints();
const renderPointsRadius: string = defaultDelaunayFromArray.renderPoints(void 0, 3);
for (const p of defaultDelaunayFromArray.hullPolygon()) {
const x = p[0];
const y = p[1];
}
for (const poly of defaultDelaunayFromArray.trianglePolygons()) {
for (const p of poly) {
const x = p[0];
const y = p[1];
}
}
for (const p of defaultDelaunayFromArray.trianglePolygon(0)) {
const x = p[0];
const y = p[1];
}
// Test Voronoi class
const v = defaultDelaunayFromArray.voronoi();
const {circumcenters, vectors} = v;
const d: d3.Delaunay<[number, number]> = v.delaunay;
for (let i = 0, l = circumcenters.length; i < l; i++) {
const x: number = circumcenters[i * 2];
const y: number = circumcenters[i * 2 + 1];
}
for (let i = 0, l = vectors.length; i < l; i++) {
const vx: number = vectors[i * 4];
const vy: number = vectors[i * 4 + 1];
const wx: number = vectors[i * 4 + 2];
const wy: number = vectors[i * 4 + 3];
}
const xmin: number = v.xmin;
const ymin: number = v.ymin;
const xmax: number = v.xmax;
const ymax: number = v.ymax;
const contains: boolean = v.contains(0, 0.5, 0.5);
const vrender: string = v.render();
const vrenderBounds: string = v.renderBounds();
const renderCell: string = v.renderCell(0);
for (const poly of v.cellPolygons()) {
for (const p of poly) {
const x = p[0];
const y = p[1];
}
}
for (const p of v.cellPolygon(0)) {
const x = p[0];
const y = p[1];
}
+359
View File
@@ -0,0 +1,359 @@
// Type definitions for d3-delaunay 4.1
// Project: https://github.com/d3/d3-delaunay
// Definitions by: Bradley Odell <https://github.com/BTOdell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Delaunay triangulation
*/
export class Delaunay<P> {
/**
* The coordinates of the points as an array [x0, y0, x1, y1, ...].
* Typically, this is a Float64Array, however you can use any array-like type in the constructor.
*/
points: ArrayLike<number>;
/**
* The halfedge indices as an Int32Array [j0, j1, ...].
* For each index 0 <= i < halfedges.length, there is a halfedge from triangle vertex j = halfedges[i] to triangle vertex i.
*/
halfedges: Int32Array;
/**
* An arbitrary node on the convex hull.
* The convex hull is represented as a circular doubly-linked list of nodes.
*/
hull: Delaunay.Node;
/**
* The triangle vertex indices as an Uint32Array [i0, j0, k0, i1, j1, k1, ...].
* Each contiguous triplet of indices i, j, k forms a counterclockwise triangle.
* The coordinates of the triangle's points can be found by going through 'points'.
*/
triangles: Uint32Array;
/**
* The incoming halfedge indexes as a Int32Array [e0, e1, e2, ...].
* For each point i, inedges[i] is the halfedge index e of an incoming halfedge.
* For coincident points, the halfedge index is -1; for points on the convex hull, the incoming halfedge is on the convex hull; for other points, the choice of incoming halfedge is arbitrary.
*/
inedges: Int32Array;
/**
* The outgoing halfedge indexes as a Int32Array [e0, e1, e2, ...].
* For each point i on the convex hull, outedges[i] is the halfedge index e of the corresponding outgoing halfedge; for other points, the halfedge index is -1.
*/
outedges: Int32Array;
/**
* Returns the Delaunay triangulation for the given flat array [x0, y0, x1, y1, …] of points.
*/
constructor(points: ArrayLike<number>);
/**
* Returns the Delaunay triangulation for the given array or iterable of points where each point is an array in the form: [x, y].
*/
static from(points: ArrayLike<Delaunay.Point>|Iterable<Delaunay.Point>): Delaunay<Delaunay.Point>;
/**
* Returns the Delaunay triangulation for the given array or iterable of points.
* Otherwise, the getX and getY functions are invoked for each point in order, and must return the respective x- and y-coordinate for each point.
* If that is specified, the functions getX and getY are invoked with that as this.
* (See Array.from for reference.)
*/
static from<P>(points: ArrayLike<P>|Iterable<P>,
getX: Delaunay.GetCoordinate<P, ArrayLike<P>|Iterable<P>>,
getY: Delaunay.GetCoordinate<P, ArrayLike<P>|Iterable<P>>,
that?: any): Delaunay<P>;
/**
* Returns the index of the input point that is closest to the specified point ⟨x, y⟩.
* The search is started at the specified point i. If i is not specified, it defaults to zero.
*/
find(x: number, y: number, i?: number): number;
/**
* Returns an iterable over the indexes of the neighboring points to the specified point i.
* The iterable is empty if i is a coincident point.
*/
neighbors(i: number): IterableIterator<number>;
/**
* Returns the closed polygon [[x0, y0], [x1, y1], ..., [x0, y0]] representing the convex hull.
*/
hullPolygon(): Delaunay.Polygon;
/**
* Returns the closed polygon [[x0, y0], [x1, y1], [x2, y2], [x0, y0]] representing the triangle i.
*/
trianglePolygon(i: number): Delaunay.Triangle;
/**
* Returns an iterable over the polygons for each triangle, in order.
*/
trianglePolygons(): IterableIterator<Delaunay.Triangle>;
/**
* Renders the edges of the Delaunay triangulation to an SVG path string.
*/
render(): string;
/**
* Renders the edges of the Delaunay triangulation to the specified context.
* The specified context must implement the context.moveTo and context.lineTo methods from the CanvasPathMethods API.
*/
render(context: Delaunay.MoveContext & Delaunay.LineContext): void;
/**
* Renders the convex hull of the Delaunay triangulation to an SVG path string.
*/
renderHull(): string;
/**
* Renders the convex hull of the Delaunay triangulation to the specified context.
* The specified context must implement the context.moveTo and context.lineTo methods from the CanvasPathMethods API.
*/
renderHull(context: Delaunay.MoveContext & Delaunay.LineContext): void;
/**
* Renders triangle i of the Delaunay triangulation to an SVG path string.
*/
renderTriangle(i: number): string;
/**
* Renders triangle i of the Delaunay triangulation to the specified context.
* The specified context must implement the context.moveTo, context.lineTo and context.closePath methods from the CanvasPathMethods API.
*/
renderTriangle(i: number, context: Delaunay.MoveContext & Delaunay.LineContext & Delaunay.ClosableContext): void;
/**
* Renders the input points of the Delaunay triangulation to an SVG path string as circles with radius 2.
*/
renderPoints(): string;
/**
* Renders the input points of the Delaunay triangulation to an SVG path string as circles with the specified radius.
*/
renderPoints(context: undefined, radius: number): string;
/**
* Renders the input points of the Delaunay triangulation to the specified context as circles with the specified radius.
* If radius is not specified, it defaults to 2.
* The specified context must implement the context.moveTo and context.arc methods from the CanvasPathMethods API.
*/
renderPoints(context: Delaunay.MoveContext & Delaunay.ArcContext, radius?: number): void;
/**
* Returns the Voronoi diagram for the associated points.
* When rendering, the diagram will be clipped to the specified bounds = [xmin, ymin, xmax, ymax].
* If bounds is not specified, it defaults to [0, 0, 960, 500].
* See To Infinity and Back Again for an interactive explanation of Voronoi cell clipping.
*/
voronoi(bounds?: Delaunay.Bounds): Voronoi<P>;
}
export namespace Delaunay {
/**
* A point represented as an array tuple [x, y].
*/
type Point = number[];
/**
* A closed polygon [[x0, y0], [x1, y1], [x2, y2], [x0, y0]] representing a triangle.
*/
type Triangle = Point[];
/**
* A closed polygon [[x0, y0], [x1, y1], ..., [x0, y0]].
*/
type Polygon = Point[];
/**
* A rectangular area [x, y, width, height].
*/
type Bounds = number[];
/**
* A function to extract a x- or y-coordinate from the specified point.
*/
type GetCoordinate<P, PS> = (point: P, i: number, points: PS) => number;
/**
* A point node on a convex hull (represented as a circular linked list).
*/
interface Node {
/**
* The index of the associated point.
*/
i: number;
/**
* The x-coordinate of the associated point.
*/
x: number;
/**
* The y-coordinate of the associated point.
*/
y: number;
/**
* The index of the (incoming or outgoing?) associated halfedge.
*/
t: number;
/**
* The previous node on the hull.
*/
prev: Node;
/**
* The next node on the hull.
*/
next: Node;
/**
* Whether the node has been removed from the linked list.
*/
removed: boolean;
}
/**
* An interface for the rect() method of the CanvasPathMethods API.
*/
interface RectContext {
/**
* rect() method of the CanvasPathMethods API.
*/
rect(x: number, y: number, width: number, height: number): void;
}
/**
* An interface for the moveTo() method of the CanvasPathMethods API.
*/
interface MoveContext {
/**
* moveTo() method of the CanvasPathMethods API.
*/
moveTo(x: number, y: number): void;
}
/**
* An interface for the lineTo() method of the CanvasPathMethods API.
*/
interface LineContext {
/**
* lineTo() method of the CanvasPathMethods API.
*/
lineTo(x: number, y: number): void;
}
/**
* An interface for the arc() method of the CanvasPathMethods API.
*/
interface ArcContext {
/**
* arc() method of the CanvasPathMethods API.
*/
arc(x: number, y: number, radius: number,
startAngle: number, endAngle: number,
counterclockwise?: boolean): void;
}
/**
* An interface for the closePath() method of the CanvasPathMethods API.
*/
interface ClosableContext {
/**
* closePath() method of the CanvasPathMethods API.
*/
closePath(): void;
}
}
/**
* Voronoi regions
*/
export class Voronoi<P> {
/**
* The Voronoi diagram’s associated Delaunay triangulation.
*/
delaunay: Delaunay<P>;
/**
* The circumcenters of the Delaunay triangles [cx0, cy0, cx1, cy1, ...].
* Each contiguous pair of coordinates cx, cy is the circumcenter for the corresponding triangle.
* These circumcenters form the coordinates of the Voronoi cell polygons.
*/
circumcenters: Float64Array;
/**
* An array [vx0, vy0, wx0, wy0, ...] where each non-zero quadruple describes an open (infinite) cell
* on the outer hull, giving the directions of two open half-lines.
*/
vectors: Float64Array;
/**
* The bounds of the viewport [xmin, ymin, xmax, ymax] for rendering the Voronoi diagram.
* These values only affect the rendering methods (voronoi.render, voronoi.renderBounds, cell.render).
*/
xmin: number;
ymin: number;
xmax: number;
ymax: number;
/**
* Internally used to implement Delaunay#voronoi.
*/
constructor(delaunay: Delaunay<P>, bounds: Delaunay.Bounds);
/**
* Returns true if the cell with the specified index i contains the specified point ⟨x, y⟩.
* (This method is not affected by the associated Voronoi diagram’s viewport bounds.)
*/
contains(i: number, x: number, y: number): boolean;
/**
* Returns the convex, closed polygon [[x0, y0], [x1, y1], ..., [x0, y0]] representing the cell for the specified point i.
*/
cellPolygon(i: number): Delaunay.Polygon;
/**
* Returns an iterable over the polygons for each cell, in order.
*/
cellPolygons(): IterableIterator<Delaunay.Polygon>;
/**
* Renders the mesh of Voronoi cells to an SVG path string.
*/
render(): string;
/**
* Renders the mesh of Voronoi cells to the specified context.
* The specified context must implement the context.moveTo and context.lineTo methods from the CanvasPathMethods API.
*/
render(context: Delaunay.MoveContext & Delaunay.LineContext): void;
/**
* Renders the viewport extent to an SVG path string.
*/
renderBounds(): string;
/**
* Renders the viewport extent to the specified context.
* The specified context must implement the context.rect method from the CanvasPathMethods API.
* Equivalent to context.rect(voronoi.xmin, voronoi.ymin, voronoi.xmax - voronoi.xmin, voronoi.ymax - voronoi.ymin).
*/
renderBounds(context: Delaunay.RectContext): void;
/**
* Renders the cell with the specified index i to an SVG path string.
*/
renderCell(i: number): string;
/**
* Renders the cell with the specified index i to the specified context.
* The specified context must implement the context.moveTo, context.lineTo, and context.closePath methods from the CanvasPathMethods API.
*/
renderCell(i: number, context: Delaunay.MoveContext & Delaunay.LineContext & Delaunay.ClosableContext): void;
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-delaunay-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+12 -8
View File
@@ -1,9 +1,12 @@
import * as Delaunator from 'delaunator';
import { Points, GetPoint } from 'delaunator';
// Zipped points [x0, y0, x1, y1, ...]
const zippedPoints = [168, 180, 168, 178, 168, 179, 168, 181, 168, 183, 167, 183, 167, 184];
const zipped = new Delaunator(zippedPoints);
// Default [x, y]
const points: Points = [[168, 180], [168, 178], [168, 179], [168, 181], [168, 183], [167, 183], [167, 184]];
const d = new Delaunator(points);
const defaultPoints = [[168, 180], [168, 178], [168, 179], [168, 181], [168, 183], [167, 183], [167, 184]];
const d = Delaunator.from(defaultPoints);
// Custom getX & getY
interface CustomPoint {
@@ -15,17 +18,18 @@ const customPoints = [{x: 168, y: 180}, {x: 168, y: 178}, {x: 168, y: 179}, {x:
const getX = (point: CustomPoint) => point.x;
const getY = (point: CustomPoint) => point.y;
new Delaunator(customPoints, point => point.x, point => point.y);
new Delaunator(customPoints, getX, getY);
Delaunator.from(customPoints, point => point.x, point => point.y);
Delaunator.from(customPoints, getX, getY);
// To get the coordinates of all triangles, use:
const triangles = d.triangles;
const halfedges = d.halfedges;
const hull = d.hull;
const coordinates: number[][][] = [];
for (let i = 0; i < triangles.length; i += 3) {
coordinates.push([
points[triangles[i]],
points[triangles[i + 1]],
points[triangles[i + 2]]
defaultPoints[triangles[i]],
defaultPoints[triangles[i + 1]],
defaultPoints[triangles[i + 2]]
]);
}
+32 -12
View File
@@ -1,13 +1,14 @@
// Type definitions for delaunator 1.0
// Type definitions for delaunator 2.0
// Project: https://github.com/mapbox/delaunator#readme
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
// Bradley Odell <https://github.com/BTOdell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Delaunator<T> {
declare class Delaunator<P> {
/**
* A flat Int32Array array of triangle vertex indices (each group of three numbers forms a triangle). All triangles are directed counterclockwise.
* A flat Uint32Array array of triangle vertex indices (each group of three numbers forms a triangle). All triangles are directed counterclockwise.
*/
triangles: Int32Array;
triangles: Uint32Array;
/**
* A flat Int32Array array of triangle half-edge indices that allows you to traverse the triangulation.
@@ -19,17 +20,36 @@ declare class Delaunator<T> {
halfedges: Int32Array;
/**
* Constructs a delaunay triangulation object given an array of points ([x, y] by default). Duplicate points are skipped.
* A circular doubly-linked list that holds a convex hull of the delaunay triangulation.
*/
constructor(points: Delaunator.Points);
constructor(points: T[], getX: Delaunator.GetPoint<T>, getY: Delaunator.GetPoint<T>);
hull: Delaunator.Node;
/**
* Constructs a delaunay triangulation object given a typed array of point coordinates of the form: [x0, y0, x1, y1, ...].
*/
constructor(points: ArrayLike<number>);
/**
* Constructs a delaunay triangulation object given an array of points (e.g. [x, y]). Duplicate points are skipped.
*/
static from(points: ArrayLike<ArrayLike<number>>): Delaunator<ArrayLike<number>>;
/**
* Constructs a delaunay triangulation object given an array of custom points. Duplicate points are skipped.
*/
static from<P>(points: ArrayLike<P>, getX: (point: P) => number, getY: (point: P) => number): Delaunator<P>;
}
declare namespace Delaunator {
type Point = number[];
type Points = Point[];
type Triangles = Int32Array;
type HalfEdges = Int32Array;
type GetPoint<T> = (point: T) => number;
interface Node {
i: number;
x: number;
y: number;
t: number;
prev: Node|null;
next: Node|null;
removed: boolean;
}
}
export = Delaunator;
+1 -4
View File
@@ -1,6 +1,3 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-duplicate-imports": false
}
"extends": "dtslint/dt.json"
}
+3
View File
@@ -8,6 +8,7 @@
// Willis Plummer <https://github.com/willisplummer>
// Santiago Vilar <https://github.com/smvilar>
// Ulf Schwekendiek <https://github.com/sulf>
// Pablo Varela <https://github.com/pablopunk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -950,6 +951,7 @@ import Editor = Draft.Component.Base.DraftEditor;
import EditorProps = Draft.Component.Base.DraftEditorProps;
import EditorBlock = Draft.Component.Components.DraftEditorBlock;
import EditorState = Draft.Model.ImmutableData.EditorState;
import EditorChangeType = Draft.Model.ImmutableData.EditorChangeType;
import CompositeDecorator = Draft.Model.Decorators.CompositeDraftDecorator;
import Entity = Draft.Model.Entity.DraftEntity;
@@ -999,6 +1001,7 @@ export {
EditorProps,
EditorBlock,
EditorState,
EditorChangeType,
CompositeDecorator,
Entity,
+11 -8
View File
@@ -1708,14 +1708,18 @@ declare module 'ember' {
/**
* Sets the provided key or path to the value.
*/
set<K extends keyof this>(key: K, value: UnwrapComputedPropertySetter<this[K]>): UnwrapComputedPropertySetter<this[K]>;
set<K extends keyof this>(key: K, value: this[K]): this[K];
set<T>(key: keyof this, value: T): T;
/**
* Sets a list of properties at once. These properties are set inside
* a single `beginPropertyChanges` and `endPropertyChanges` batch, so
* observers will be buffered.
*/
setProperties<K extends keyof this>(
hash: Pick<UnwrapComputedPropertySetters<this>, K>
hash: Pick<this, K>
): Pick< UnwrapComputedPropertySetters<this>, K>;
setProperties<K extends keyof this>(
hash: {[KK in K]: any}
): Pick< UnwrapComputedPropertySetters<this>, K>;
/**
* Convenience method to call `propertyWillChange` and `propertyDidChange` in
@@ -3118,22 +3122,22 @@ declare module 'ember' {
/**
* A value is blank if it is empty or a whitespace string.
*/
function isBlank(obj: any): boolean;
function isBlank(obj?: any): boolean;
/**
* Verifies that a value is `null` or an empty string, empty array,
* or empty function.
*/
function isEmpty(obj: any): boolean;
function isEmpty(obj?: any): boolean;
/**
* Returns true if the passed value is null or undefined. This avoids errors
* from JSLint complaining about use of ==, which can be technically
* confusing.
*/
function isNone(obj: any): obj is null | undefined;
function isNone(obj?: any): obj is null | undefined;
/**
* A value is present if it not `isBlank`.
*/
function isPresent(obj: any): boolean;
function isPresent(obj?: any): boolean;
/**
* Merge the contents of two objects together into the first object.
* @deprecated Use Object.assign
@@ -3282,7 +3286,7 @@ declare module 'ember' {
/**
* Returns a consistent type for the passed object.
*/
function typeOf(item: any): string;
function typeOf(item?: any): string;
/**
* Copy properties from a source object to a target object.
* @deprecated Use Object.assign
@@ -3865,7 +3869,6 @@ declare module '@ember/string' {
export const classify: typeof Ember.String.classify;
export const dasherize: typeof Ember.String.dasherize;
export const decamelize: typeof Ember.String.decamelize;
export const fmt: typeof Ember.String.fmt;
export const htmlSafe: typeof Ember.String.htmlSafe;
export const isHTMLSafe: typeof Ember.String.isHTMLSafe;
export const loc: typeof Ember.String.loc;
+24
View File
@@ -25,3 +25,27 @@ class MyObject31 extends Ember.Object {
super(properties);
}
}
class Foo extends Ember.Object.extend({
a: Ember.computed({
get() { return ''; },
set(key: string, newVal: string) { return ''; }
})
}) {
b = 5;
baz() {
let y = this.b; // $ExpectType number
let z = this.a; // $ExpectType ComputedProperty<string, string>
this.b = 10;
this.get('b').toFixed(4); // $ExpectType string
this.set('a', 'abc').split(','); // $ExpectType string[]
this.set('b', 10).toFixed(4); // $ExpectType string
this.setProperties({ b: 11 });
// this.setProperties({ b: '11' }); // $ExpectError
this.setProperties({
a: 'def',
b: 11
});
}
}
+30
View File
@@ -2,6 +2,11 @@ import Ember from 'ember';
import * as utils from '@ember/utils';
import { assertType } from "./lib/assert";
function testTypeOf() {
utils.typeOf(); // $ExpectType string
utils.typeOf({}); // $ExpectType string
}
function testIsNoneType() {
const maybeUndefined: string | undefined = 'not actually undefined';
if (utils.isNone(maybeUndefined)) {
@@ -9,6 +14,31 @@ function testIsNoneType() {
}
const anotherString = maybeUndefined + 'another string';
utils.isNone(); // $ExpectType boolean
}
function testIsBlank() {
utils.isBlank(); // $ExpectType boolean
utils.isBlank(''); // $ExpectType boolean
utils.isBlank('', ''); // $ExpectError
}
function testIsEmpty() {
utils.isEmpty(); // $ExpectType boolean
utils.isEmpty(''); // $ExpectType boolean
utils.isEmpty('', ''); // $ExpectError
}
function testIsPresent() {
utils.isPresent(); // $ExpectType boolean
utils.isPresent(''); // $ExpectType boolean
utils.isPresent('', ''); // $ExpectError
}
function testIsNone() {
utils.isNone(); // $ExpectType boolean
utils.isNone(''); // $ExpectType boolean
utils.isNone('', ''); // $ExpectError
}
function testMerge() {
@@ -1,4 +1,4 @@
import feathers, { Application } from '@feathersjs/feathers';
import feathers, { Application, HookContext } from '@feathersjs/feathers';
interface User {
id: number;
@@ -14,3 +14,12 @@ const app = feathers() as Application<Services>;
app.service('users').get(0).then(u => {
const user: User = u;
});
app.service('users').hooks({
before: {
all: (context: HookContext) => {
context.statusCode = 200;
context.dispatch = { test: 'true' };
}
}
});
+64 -7
View File
@@ -1,6 +1,8 @@
// Type definitions for @feathersjs/feathers 3.0
// Project: http://feathersjs.com/
// Definitions by: Jan Lohage <https://github.com/j2L4e>, Abraao Alves <https://github.com/AbraaoAlves>
// Definitions by: Jan Lohage <https://github.com/j2L4e>
// Abraao Alves <https://github.com/AbraaoAlves>
// Tim Mensch <https://github.com/TimMensch>
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
// TypeScript Version: 2.3
@@ -51,16 +53,71 @@ export type Hook = (hook: HookContext) => (Promise<HookContext | SkipSymbol | vo
export type SkipSymbol = symbol | '__feathersSkipHooks';
export interface HookContext<T = any> {
app?: Application;
/**
* A read only property that contains the Feathers application object. This can be used to
* retrieve other services (via context.app.service('name')) or configuration values.
*/
readonly app: Application;
/**
* A writeable property containing the data of a create, update and patch service
* method call.
*/
data?: T;
/**
* A writeable property with the error object that was thrown in a failed method call.
* It is only available in error hooks.
*/
error?: any;
/**
* A writeable property and the id for a get, remove, update and patch service
* method call. For remove, update and patch context.id can also be null when
* modifying multiple entries. In all other cases it will be undefined.
*/
id?: string | number;
method?: string;
params?: Params;
path?: string;
/**
* A read only property with the name of the service method (one of find, get,
* create, update, patch, remove).
*/
readonly method: string;
/**
* A writeable property that contains the service method parameters (including
* params.query).
*/
params: Params;
/**
* A read only property and contains the service name (or path) without leading or
* trailing slashes.
*/
readonly path: string;
/**
* A writeable property containing the result of the successful service method call.
* It is only available in after hooks.
*
* `context.result` can also be set in
*
* - A before hook to skip the actual service method (database) call
* - An error hook to swallow the error and return a result instead
*/
result?: T;
service: Service<T>;
type: 'before' | 'after' | 'error';
/**
* A read only property and contains the service this hook currently runs on.
*/
readonly service: Service<T>;
/**
* A writeable, optional property and contains a "safe" version of the data that
* should be sent to any client. If context.dispatch has not been set context.result
* will be sent to the client instead.
*/
dispatch?: T;
/**
* A writeable, optional property that allows to override the standard HTTP status
* code that should be returned.
*/
statusCode?: number;
/**
* A read only property with the hook type (one of before, after or error).
*/
readonly type: "before" | "after" | "error";
}
export interface HookMap {
+4 -1
View File
@@ -1,3 +1,6 @@
{
"extends": "dtslint/dt.json"
"extends": "dtslint/dt.json",
"rules": {
"file-name-casing": false
}
}
@@ -5,7 +5,7 @@ browser.nonexistentNS.unknownMethod(); // $ExpectError
browser.runtime.getManifest(); // $ExpectType WebExtensionManifest
browser.test; // $ExpectError
browser.manifest; // $ExpectError
browser._manifest; // $ExpectType typeof _manifest
browser._manifest; // $ExpectError
browser._manifest.WebExtensionLangpackManifest; // $ExpectError
browser._manifest.NativeManifest; // $ExpectError
+393 -482
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -130,20 +130,20 @@ export declare class FtpConnection extends events.EventEmitter {
*/
export interface FtpFileSystem {
unlink: (path: string, callback?: (err?: NodeJS.ErrnoException) => void) => void;
readdir: (path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void) => void;
readdir: (path: string, callback?: (err?: NodeJS.ErrnoException, files?: string[]) => void) => void;
mkdir: ((path: string, callback?: (err?: NodeJS.ErrnoException) => void) => void)
| ((path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void) => void)
| ((path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void) => void);
open: ((path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any) => void)
| ((path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any) => void)
| ((path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any) => void);
open: ((path: string, flags: string, callback?: (err?: NodeJS.ErrnoException, fd?: number) => any) => void)
| ((path: string, flags: string, mode: number, callback?: (err?: NodeJS.ErrnoException, fd?: number) => any) => void)
| ((path: string, flags: string, mode: string, callback?: (err?: NodeJS.ErrnoException, fd?: number) => any) => void);
close: (fd: number, callback?: (err?: NodeJS.ErrnoException) => void) => void;
rmdir: (path: string, callback?: (err?: NodeJS.ErrnoException) => void) => void;
rename: (oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void) => void;
/**
* specific object properties: { mode, isDirectory(), size, mtime }
*/
stat: (path: string, callback?: (err: NodeJS.ErrnoException, stats: fs.Stats) => any) => void;
stat: (path: string, callback?: (err?: NodeJS.ErrnoException, stats?: fs.Stats) => any) => void;
/**
* if useReadFile option is not set or is false
*/
@@ -0,0 +1,3 @@
import translate = require('google-translate-api');
translate('hello', { from: 'en', to: 'zh-tw' }); // $ExpectType Promise<TranslateResult>
+27
View File
@@ -0,0 +1,27 @@
// Type definitions for google-translate-api 2.3
// Project: https://github.com/matheuss/google-translate-api#readme
// Definitions by: maple3142 <https://github.com/maple3142>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface TranslateOption {
from?: string;
to?: string;
raw?: boolean;
}
interface TranslateResult {
text: string;
from: {
language: {
didYouMean: boolean;
iso: string;
}
text: {
autoCorrected: boolean;
value: string;
didYouMean: boolean;
}
};
raw: string;
}
declare function translate(text: string, options?: TranslateOption): Promise<TranslateResult>;
export = translate;
+16
View File
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": ["index.d.ts", "google-translate-api-tests.ts"]
}
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
"semicolon": true
}
}
+4 -8
View File
@@ -263,19 +263,15 @@ interface Recognizer
canEmit():boolean;
canRecognizeWith( otherRecognizer:Recognizer ):boolean;
dropRecognizeWith( otherRecognizer:Recognizer ):Recognizer;
dropRecognizeWith( otherRecognizer:string ):Recognizer;
dropRequireFailure( otherRecognizer:Recognizer ):Recognizer;
dropRequireFailure( otherRecognizer:string ):Recognizer;
dropRecognizeWith( otherRecognizer:Recognizer | Recognizer[] | string):Recognizer;
dropRequireFailure( otherRecognizer:Recognizer | Recognizer[] | string):Recognizer;
emit( input:HammerInput ):void;
getTouchAction():any[];
hasRequireFailures():boolean;
process( inputData:HammerInput ):string;
recognize( inputData:HammerInput ):void;
recognizeWith( otherRecognizer:Recognizer ):Recognizer;
recognizeWith( otherRecognizer:string ):Recognizer;
requireFailure( otherRecognizer:Recognizer ):Recognizer;
requireFailure( otherRecognizer:string ):Recognizer;
recognizeWith( otherRecognizer:Recognizer | Recognizer[] | string):Recognizer;
requireFailure( otherRecognizer:Recognizer | Recognizer[] | string):Recognizer;
reset():void;
set( options?:RecognizerOptions ):Recognizer;
tryEmit( input:HammerInput ):void;
+8 -10
View File
@@ -156,7 +156,6 @@ declare namespace Knex {
// Others
first: Select;
debug(enabled?: boolean): QueryBuilder;
pluck(column: string): QueryBuilder;
insert(data: any, returning?: string | string[]): QueryBuilder;
@@ -169,9 +168,6 @@ declare namespace Knex {
delete(returning?: string | string[]): QueryBuilder;
truncate(): QueryBuilder;
transacting(trx?: Transaction): QueryBuilder;
connection(connection: any): QueryBuilder;
clone(): QueryBuilder;
}
@@ -390,12 +386,14 @@ declare namespace Knex {
interface ChainableInterface extends Bluebird<any> {
toQuery(): string;
options(options: any): QueryBuilder;
stream(callback: (readable: stream.PassThrough) => any): Bluebird<any>;
options(options: { [key: string]: any }): this;
connection(connection: any): this;
debug(enabled: boolean): this;
transacting(trx: Transaction): this;
stream(handler: (readable: stream.PassThrough) => any): Bluebird<any>;
stream(options: { [key: string]: any }, handler: (readable: stream.PassThrough) => any): Bluebird<any>;
stream(options?: { [key: string]: any }): stream.PassThrough;
stream(options: { [key: string]: any }, callback: (readable: stream.PassThrough) => any): Bluebird<any>;
pipe(writable: any): stream.PassThrough;
exec(callback: Function): QueryBuilder;
pipe<T extends NodeJS.WritableStream>(writable: T, options?: { [key: string]: any }): stream.PassThrough;
}
interface Transaction extends Knex {
@@ -408,7 +406,7 @@ declare namespace Knex {
// Schema builder
//
interface SchemaBuilder extends Bluebird<any> {
interface SchemaBuilder extends ChainableInterface {
createTable(tableName: string, callback: (tableBuilder: CreateTableBuilder) => any): SchemaBuilder;
createTableIfNotExists(tableName: string, callback: (tableBuilder: CreateTableBuilder) => any): SchemaBuilder;
alterTable(tableName: string, callback: (tableBuilder: CreateTableBuilder) => any): SchemaBuilder;
+2 -10
View File
@@ -982,19 +982,11 @@ knex.select('name').from('users')
.where('id', '>', 20)
.andWhere('id', '<', 200)
.limit(10)
.offset(x)
.exec(function(err: any, rows: any[]) {
if (err) return console.error(err);
knex.select('id').from('nicknames').whereIn('nickname', rows.map((r: any) => r.name))
.exec(function(err: any, rows: any[]) {
if (err) return console.error(err);
console.log(rows);
});
});
.offset(x);
// Retrieve the stream:
var stream = knex.select('*').from('users').stream();
var writableStream: any;
var writableStream: NodeJS.WritableStream;
stream.pipe(writableStream);
// With options:
+104 -24
View File
@@ -5,7 +5,8 @@
// Clément Bourgeois <https://github.com/moonpyk>,
// Matt Brooks <https://github.com/EnableSoftware>,
// Benjamin Eckardt <https://github.com/BenjaminEckardt>,
// Mathias Lorenzen <https://github.com/ffMathy>
// Mathias Lorenzen <https://github.com/ffMathy>,
// Leonardo Lombardi <https://github.com/ltlombardi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -22,29 +23,108 @@ interface KnockoutObservableFunctions<T> {
interface KnockoutObservableArrayFunctions<T> {
// General Array functions
/**
* Returns the index of the first occurrence of a value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
*/
indexOf(searchElement: T, fromIndex?: number): number;
/**
* Returns a section of an array.
* @param start The beginning of the specified portion of the array.
* @param end The end of the specified portion of the array.
*/
slice(start: number, end?: number): T[];
/**
* Removes and returns all the remaining elements starting from a given index.
* @param start The zero-based location in the array from which to start removing elements.
*/
splice(start: number): T[];
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param start The zero-based location in the array from which to start removing elements.
* @param deleteCount The number of elements to remove.
* @param ...items Elements to insert into the array in place of the deleted elements.
*/
splice(start: number, deleteCount: number, ...items: T[]): T[];
/**
* Removes the last value from the array and returns it.
*/
pop(): T;
/**
* Adds a new item to the end of array.
* @param ...items Items to be added
*/
push(...items: T[]): void;
/**
* Removes the first value from the array and returns it.
*/
shift(): T;
/**
* Inserts a new item at the beginning of the array.
* @param ...items Items to be added
*/
unshift(...items: T[]): number;
/**
* Reverses the order of the array and returns the observableArray (not the underlying array).
*/
reverse(): KnockoutObservableArray<T>;
/**
* Sorts the array contents and returns the observableArray.
*/
sort(): KnockoutObservableArray<T>;
/**
* Sorts the array contents and returns the observableArray.
* @param compareFunction A function that returns negative value if first argument is smaller, positive value if second is smaller, or zero to treat them as equal.
*/
sort(compareFunction: (left: T, right: T) => number): KnockoutObservableArray<T>;
// Ko specific
/**
* Replaces the first value that equals oldItem with newItem
* @param oldItem Item to be replaced
* @param newItem Replacing item
*/
replace(oldItem: T, newItem: T): void;
/**
* Removes all values that equal item and returns them as an array.
* @param item The item to be removed
*/
remove(item: T): T[];
/**
* Removes all values and returns them as an array.
* @param removeFunction A function used to determine true if item should be removed and fasle otherwise
*/
remove(removeFunction: (item: T) => boolean): T[];
/**
* Removes all values that equal any of the supplied items
* @param items Items to be removed
*/
removeAll(items: T[]): T[];
/**
* Removes all values and returns them as an array.
*/
removeAll(): T[];
// Ko specific Usually relevant to Ruby on Rails developers only
/**
* Finds any objects in the array that equal someItem and gives them a special property called _destroy with value true.
* @param item Items to be marked with the property.
*/
destroy(item: T): void;
/**
* Finds any objects in the array filtered by a function and gives them a special property called _destroy with value true.
* @param destroyFunction A function used to determine which items should be marked with the property.
*/
destroy(destroyFunction: (item: T) => boolean): void;
/**
* Finds any objects in the array that equal suplied items and gives them a special property called _destroy with value true.
* @param items
*/
destroyAll(items: T[]): void;
/**
* Gives a special property called _destroy with value true to all objects in the array.
*/
destroyAll(): void;
}
@@ -116,16 +196,16 @@ interface KnockoutObservable<T> extends KnockoutSubscribable<T>, KnockoutObserva
(value: T): void;
peek(): T;
valueHasMutated?:{(): void;};
valueWillMutate?:{(): void;};
valueHasMutated?: { (): void; };
valueWillMutate?: { (): void; };
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservable<T>;
}
interface KnockoutComputedDefine<T> {
read(): T;
write? (value: T): void;
write?(value: T): void;
disposeWhenNodeIsRemoved?: Node;
disposeWhen? (): boolean;
disposeWhen?(): boolean;
owner?: any;
deferEvaluation?: boolean;
pure?: boolean;
@@ -206,17 +286,17 @@ interface KnockoutMemoization {
parseMemoText(memoText: string): string;
}
interface KnockoutVirtualElement {}
interface KnockoutVirtualElement { }
interface KnockoutVirtualElements {
allowedBindings: { [bindingName: string]: boolean; };
emptyNode(node: KnockoutVirtualElement ): void;
firstChild(node: KnockoutVirtualElement ): KnockoutVirtualElement;
insertAfter( container: KnockoutVirtualElement, nodeToInsert: Node, insertAfter: Node ): void;
emptyNode(node: KnockoutVirtualElement): void;
firstChild(node: KnockoutVirtualElement): KnockoutVirtualElement;
insertAfter(container: KnockoutVirtualElement, nodeToInsert: Node, insertAfter: Node): void;
nextSibling(node: KnockoutVirtualElement): Node;
prepend(node: KnockoutVirtualElement, toInsert: Node ): void;
setDomNodeChildren(node: KnockoutVirtualElement, newChildren: { length: number;[index: number]: Node; } ): void;
childNodes(node: KnockoutVirtualElement ): Node[];
prepend(node: KnockoutVirtualElement, toInsert: Node): void;
setDomNodeChildren(node: KnockoutVirtualElement, newChildren: { length: number;[index: number]: Node; }): void;
childNodes(node: KnockoutVirtualElement): Node[];
}
interface KnockoutExtenders {
@@ -365,12 +445,12 @@ interface KnockoutTemplateSources {
domElement: {
prototype: KnockoutTemplateSourcesDomElement
new (element: Element): KnockoutTemplateSourcesDomElement
new(element: Element): KnockoutTemplateSourcesDomElement
};
anonymousTemplate: {
prototype: KnockoutTemplateAnonymous;
new (element: Element): KnockoutTemplateAnonymous;
new(element: Element): KnockoutTemplateAnonymous;
};
}
@@ -478,7 +558,7 @@ interface KnockoutStatic {
prototype: KnockoutTemplateEngine;
new (): KnockoutTemplateEngine;
new(): KnockoutTemplateEngine;
};
//////////////////////////////////
@@ -503,7 +583,7 @@ interface KnockoutStatic {
prototype: KnockoutNativeTemplateEngine;
new (): KnockoutNativeTemplateEngine;
new(): KnockoutNativeTemplateEngine;
instance: KnockoutNativeTemplateEngine;
};
@@ -572,7 +652,7 @@ interface KnockoutStatic {
bindingProvider: {
instance: KnockoutBindingProvider;
new (): KnockoutBindingProvider;
new(): KnockoutBindingProvider;
}
/////////////////////////////////
@@ -631,7 +711,7 @@ declare namespace KnockoutComponentTypes {
interface Config {
viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule;
template: string | Node[]| DocumentFragment | TemplateElement | AMDModule;
template: string | Node[] | DocumentFragment | TemplateElement | AMDModule;
synchronous?: boolean;
}
@@ -672,16 +752,16 @@ declare namespace KnockoutComponentTypes {
}
interface Loader {
getConfig? (componentName: string, callback: (result: ComponentConfig | null) => void): void;
loadComponent? (componentName: string, config: ComponentConfig, callback: (result: Definition | null) => void): void;
loadTemplate? (componentName: string, templateConfig: any, callback: (result: Node[] | null) => void): void;
loadViewModel? (componentName: string, viewModelConfig: any, callback: (result: any) => void): void;
getConfig?(componentName: string, callback: (result: ComponentConfig | null) => void): void;
loadComponent?(componentName: string, config: ComponentConfig, callback: (result: Definition | null) => void): void;
loadTemplate?(componentName: string, templateConfig: any, callback: (result: Node[] | null) => void): void;
loadViewModel?(componentName: string, viewModelConfig: any, callback: (result: any) => void): void;
suppressLoaderExceptions?: boolean;
}
interface Definition {
template: Node[];
createViewModel? (params: any, options: { element: Node; }): any;
createViewModel?(params: any, options: { element: Node; }): any;
}
}
+14
View File
@@ -33,6 +33,7 @@ export class Document {
constructor(version?: number, encoding?: string);
errors: SyntaxError[];
validationErrors: ValidationError[];
child(idx: number): Element|null;
childNodes(): Element[];
@@ -45,6 +46,7 @@ export class Document {
root(newRoot: Node): Node;
toString(formatted?: boolean): string;
type(): 'document';
validate(xsdDoc: Document): boolean;
version(): string;
setDtd(name: string, ext: string, sys: string): void;
getDtd(): {
@@ -169,3 +171,15 @@ export interface SyntaxError {
str3: number|null;
int1: number|null;
}
export interface ValidationError extends Error {
domain: number|null;
code: number|null;
level: number|null;
line: number|null;
/**
* 1-based column number, 0 if not applicable/available.
*/
column: number;
}
+4
View File
@@ -62,3 +62,7 @@ const xmlDocWithNs = libxmljs.parseXml(xmlWithNs);
const gchildWithNs = xmlDocWithNs.get('//a:grandchild', {a: 'http://test.com/test'})!;
console.log(gchildWithNs.text()); // prints "grandchild content"
const validated: boolean = doc.validate(doc);
doc.validationErrors[0].message; // inherited from Error
doc.validationErrors[0].line;
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for mali-onerror 0.1
// Project: https://github.com/malijs/onerror
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import { Context } from "mali";
declare function onError(
fn: (err: Error, ctx: Context) => void
): (ctx: Context, next: () => Promise<void>) => Promise<void>; // ? next (I know it s a function)
export = onError;
+13
View File
@@ -0,0 +1,13 @@
import onError = require('mali-onerror');
import Mali = require('mali');
import path = require('path');
// Example mali app from Mali docs
const PROTO_PATH = path.resolve(__dirname, '../protos/helloworld.proto');
function errorLogger(err: Error, ctx: Mali.Context) {
console.log('Error on %s: %s', ctx.name, err.toString());
}
const app = new Mali(PROTO_PATH);
app.use(onError(errorLogger));
+19
View File
@@ -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",
"mali-onerror-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+1
View File
@@ -8,6 +8,7 @@
// Arda TANRIKULU <https://github.com/ardatan>
// Stefan Holzapfel <https://github.com/stefanholzapfel>
// Andrey Markeev <https://github.com/andrei-markeev>
// Leon Machens <https://github.com/lmachens>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
+1
View File
@@ -11,6 +11,7 @@ declare module "meteor/server-render" {
appendToBody?(html: string): void;
appendToElementById?(id: string, html: string): void;
renderIntoElementById?(id: string, html: string): void;
renderIntoElementById?(id: string, html: NodeJS.ReadableStream): void;
}
type Callback = (sink: Sink) => Promise <any> | any;
@@ -1,7 +1,6 @@
// This file is for tests that involve modules that don't have corresponding
// globals.
import { onPageLoad } from "meteor/server-render";
import { ServiceConfiguration } from "meteor/service-configuration";
import { WebApp } from "meteor/webapp";
+15
View File
@@ -0,0 +1,15 @@
import { onPageLoad } from "meteor/server-render";
import * as React from 'react';
import { renderToString, renderToNodeStream } from 'react-dom/server';
onPageLoad(sink => {
if (sink.renderIntoElementById) {
sink.renderIntoElementById("app", renderToString(<div>Hello World</div>));
}
});
onPageLoad(sink => {
if (sink.renderIntoElementById) {
sink.renderIntoElementById("app", renderToNodeStream(<div>Hello World</div>));
}
});
+4 -2
View File
@@ -15,7 +15,8 @@
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,
"jsx": "preserve"
},
"files": [
"accounts-base.d.ts",
@@ -61,6 +62,7 @@
"index.d.ts",
"test/meteor-tests.ts",
"test/globals/meteor-tests.ts",
"test/meteor-tests-module-only.ts"
"test/meteor-tests-module-only.ts",
"test/server-render.tsx"
]
}
+1 -1
View File
@@ -58,7 +58,7 @@ declare module "moment" {
interface Moment {
tz(): string | undefined;
tz(timezone: string, keepLocalTime?: boolean): Moment;
tz(timezone: string, keepLocalTime?: boolean): moment.Moment;
zoneAbbr(): string;
zoneName(): string;
}
+6 -1
View File
@@ -14,6 +14,7 @@
// Wan Bachtiar <https://github.com/sindbach>
// Geraldine Lemeur <https://github.com/geraldinelemeur>
// Jimmy Shimizu <https://github.com/jishi>
// Angela-1 <https://github.com/angela-1>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -208,6 +209,10 @@ export interface SocketOptions {
keepAliveInitialDelay?: number;
// TCP Connection timeout setting. default 0
connectTimeoutMS?: number;
// Version of IP stack. Can be 4, 6 or null. default: null.
// If null, will attempt to connect with IPv6, and will fall back to IPv4 on failure
// refer to http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html
family?: 4 | 6 | null;
// TCP Socket timeout setting. default 0
socketTimeoutMS?: number;
}
@@ -896,7 +901,7 @@ export interface CollectionAggregationOptions {
readPreference?: ReadPreference | string;
// Return the query as cursor, on 2.6 > it returns as a real cursor
// on pre 2.6 it returns as an emulated cursor.
cursor?: { batchSize: number };
cursor?: { batchSize?: number };
// Explain returns the aggregation execution plan (requires mongodb 2.6 >).
explain?: boolean;
// lets the server know if it can use disk to store
+1
View File
@@ -17,6 +17,7 @@ let options: mongodb.MongoClientOptions = {
poolSize: 1,
socketOptions: {},
family: 4,
reconnectTries: 123456,
reconnectInterval: 123456,
-1
View File
@@ -16,7 +16,6 @@ declare namespace addressparser {
*
* [{name: 'Name', address: 'address@domain'}]
*
* @param str Address field
* @return An array of address objects
*/
declare function addressparser(address: string): addressparser.Address[];
+17 -4
View File
@@ -2,7 +2,7 @@
import { EventEmitter } from 'events';
import * as net from 'net';
import { Writable } from 'stream';
import { Readable } from 'stream';
import * as tls from 'tls';
import * as shared from './shared';
@@ -181,7 +181,7 @@ declare class SMTPConnection extends EventEmitter {
/** Authenticate user */
login(auth: SMTPConnection.AuthenticationCredentials | SMTPConnection.AuthenticationOAuth2 | SMTPConnection.Credentials, callback: (err: SMTPConnection.SMTPError | null) => void): void;
/** Sends a message */
send(envelope: SMTPConnection.Envelope, message: string | Buffer | Writable, callback: (err: SMTPConnection.SMTPError | null, info: SMTPConnection.SentMessageInfo) => void): void;
send(envelope: SMTPConnection.Envelope, message: string | Buffer | Readable, callback: (err: SMTPConnection.SMTPError | null, info: SMTPConnection.SentMessageInfo) => void): void;
/** Resets connection state */
reset(callback: (err: Error | null) => void): void;
@@ -191,6 +191,14 @@ declare class SMTPConnection extends EventEmitter {
emit(event: 'connect' | 'end'): boolean;
emit(event: 'error', error: Error): boolean;
listenerCount(event: 'connect' | 'end' | 'error'): number;
listeners(event: 'connect' | 'end'): Array<() => void>;
listeners(event: 'error'): Array<(err: SMTPConnection.SMTPError) => void>;
off(event: 'connect' | 'end', listener: () => void): this;
off(event: 'error', listener: (err: SMTPConnection.SMTPError) => void): this;
on(event: 'connect' | 'end', listener: () => void): this;
on(event: 'error', listener: (err: SMTPConnection.SMTPError) => void): this;
@@ -203,8 +211,13 @@ declare class SMTPConnection extends EventEmitter {
prependOnceListener(event: 'connect' | 'end', listener: () => void): this;
prependOnceListener(event: 'error', listener: (err: SMTPConnection.SMTPError) => void): this;
listeners(event: 'connect' | 'end'): Array<() => void>;
listeners(event: 'error'): Array<(err: SMTPConnection.SMTPError) => void>;
rawListeners(event: 'connect' | 'end'): Array<() => void>;
rawListeners(event: 'error'): Array<(err: SMTPConnection.SMTPError) => void>;
removeAllListener(event: 'connect' | 'end' | 'error'): this;
removeListener(event: 'connect' | 'end', listener: () => void): this;
removeListener(event: 'error', listener: (err: SMTPConnection.SMTPError) => void): this;
}
export = SMTPConnection;
+9 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for passport-kakao 0.1
// Type definitions for passport-kakao 0.2
// Project: https://github.com/rotoshine/passport-kakao
// Definitions by: Park9eon <https://github.com/Park9eon>
// ZeroCho <https://github.com/zerocho>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -24,11 +25,18 @@ export interface StrategyOption {
customHeaders?: string;
}
export interface StrategyOptionWithRequest extends StrategyOption {
passReqToCallback: boolean;
}
export type VerifyFunction =
(accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void) => void;
export type VerifyFunctionWithRequest =
(req: express.Request, accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void) => void;
export class Strategy extends passport.Strategy {
constructor(options: StrategyOption, verify: VerifyFunction);
constructor(options: StrategyOptionWithRequest, verify: VerifyFunctionWithRequest);
authenticate(req: express.Request, options?: any): void;
userProfile: (accessToken: string, done: (error: any, user?: any) => void) => void;
+4 -3
View File
@@ -1,10 +1,11 @@
import {Strategy as KakaoStrategy } from 'passport-kakao';
import { Strategy as KakaoStrategy } from 'passport-kakao';
new KakaoStrategy({
clientID: 'client',
clientSecret: 'clientSecret',
callbackURL: 'callbackUrl'
callbackURL: 'callbackUrl',
},
(accessToken: string, refreshToken: string, profile: any, done: any) => {
// signUp or signIn
});
},
);
+9 -3
View File
@@ -1,6 +1,7 @@
// Type definitions for passport-naver 0.1
// Type definitions for passport-naver 0.2
// Project: https://github.com/naver/passport-naver
// Definitions by: Park9eon <https://github.com/Park9eon>
// ZeroCho <https://github.com/zerocho>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -34,11 +35,16 @@ export interface StrategyOption {
profileURL?: string;
}
export type VerifyFunction =
(accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void) => void;
export interface StrategyOptionWithRequest extends StrategyOption {
passReqToCallback: boolean;
}
export type VerifyFunction = (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void) => void;
export type VerifyFunctionWithRequest = (req: express.Request, accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void) => void;
export class Strategy extends passport.Strategy {
constructor(options: StrategyOption, verify: VerifyFunction);
constructor(options: StrategyOptionWithRequest, verify: VerifyFunctionWithRequest);
authenticate(req: express.Request, options?: any): void;
authorizationParams: (options: any) => any;
+4 -3
View File
@@ -1,10 +1,11 @@
import {Strategy as NaverStrategy } from 'passport-naver';
import { Strategy as NaverStrategy } from 'passport-naver';
new NaverStrategy({
clientID: 'client',
clientSecret: 'clientSecret',
callbackURL: 'callbackUrl'
callbackURL: 'callbackUrl',
},
(accessToken: string, refreshToken: string, profile: any, done: any) => {
// signUp or signIn
});
},
);
+2 -1
View File
@@ -186,7 +186,8 @@ export class Quill implements EventEmitter {
blur(): void;
focus(): void;
getBounds(index: number, length?: number): BoundsStatic;
getSelection(focus?: boolean): RangeStatic;
getSelection(focus: true): RangeStatic;
getSelection(focus?: false): RangeStatic | null;
hasFocus(): boolean;
setSelection(index: number, length: number, source?: Sources): void;
setSelection(range: RangeStatic, source?: Sources): void;
+27 -17
View File
@@ -4,6 +4,7 @@
// Austin Turner <https://github.com/paustint>
// Krzysztof Bezrąk <https://github.com/pikpok>
// Sebastian Silbermann <https://github.com/eps1lon>
// Paul Potsides <https://github.com/strongpauly>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -14,76 +15,85 @@ export type View = 'month' | 'week' | 'work_week' | 'day' | 'agenda';
export type Navigate = 'PREV' | 'NEXT' | 'TODAY' | 'DATE';
export type Event = object;
export interface Format {
export interface DateRange {
start: Date;
end: Date;
}
export type DateFormatFunction = (date: Date, culture?: string, localizer?: object) => string;
export type DateRangeFormatFunction = (range: DateRange, culture?: string, localizer?: object) => string;
export type DateFormat = string | DateFormatFunction;
export interface Formats {
/**
* Format for the day of the month heading in the Month view.
* e.g. "01", "02", "03", etc
*/
dateFormat?: string;
dateFormat?: DateFormat;
/**
* A day of the week format for Week and Day headings,
* e.g. "Wed 01/04"
*
*/
dayFormat?: string;
dayFormat?: DateFormat;
/**
* Week day name format for the Month week day headings,
* e.g: "Sun", "Mon", "Tue", etc
*
*/
weekdayFormat?: string;
weekdayFormat?: DateFormat;
/**
* The timestamp cell formats in Week and Time views, e.g. "4:00 AM"
*/
timeGutterFormat?: string;
timeGutterFormat?: DateFormat;
/**
* Toolbar header format for the Month view, e.g "2015 April"
*
*/
monthHeaderFormat?: string;
monthHeaderFormat?: DateFormat;
/**
* Toolbar header format for the Week views, e.g. "Mar 29 - Apr 04"
*/
dayRangeHeaderFormat?: string;
dayRangeHeaderFormat?: DateRangeFormatFunction;
/**
* Toolbar header format for the Day view, e.g. "Wednesday Apr 01"
*/
dayHeaderFormat?: string;
dayHeaderFormat?: DateFormat;
/**
* Toolbar header format for the Agenda view, e.g. "4/1/2015 — 5/1/2015"
*/
agendaHeaderFormat?: string;
agendaHeaderFormat?: DateFormat;
/**
* A time range format for selecting time slots, e.g "8:00am — 2:00pm"
*/
selectRangeFormat?: string;
selectRangeFormat?: DateRangeFormatFunction;
agendaDateFormat?: string;
agendaTimeFormat?: string;
agendaTimeRangeFormat?: string;
agendaDateFormat?: DateFormat;
agendaTimeFormat?: DateFormat;
agendaTimeRangeFormat?: DateRangeFormatFunction;
/**
* Time range displayed on events.
*/
eventTimeRangeFormat?: string;
eventTimeRangeFormat?: DateRangeFormatFunction;
/**
* An optional event time range for events that continue onto another day
*/
eventTimeRangeStartFormat?: string;
eventTimeRangeStartFormat?: DateRangeFormatFunction;
/**
* An optional event time range for events that continue from another day
*/
eventTimeRangeEndFormat?: string;
eventTimeRangeEndFormat?: DateRangeFormatFunction;
}
export interface HeaderProps {
@@ -179,7 +189,7 @@ export interface BigCalendarProps<T extends Event = Event> extends React.Props<B
max?: stringOrDate;
scrollToTime?: Date;
culture?: string;
formats?: Format;
formats?: Formats;
components?: Components;
messages?: Messages;
titleAccessor?: keyof T | ((event: T) => string);
@@ -1,7 +1,7 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
import * as ReactDOMServer from "react-dom/server";
import BigCalendar, { BigCalendarProps, Navigate, View } from "react-big-calendar";
import BigCalendar, { BigCalendarProps, Navigate, View, DateRange } from "react-big-calendar";
// Don't want to add this as a dependency, because it is only used for tests.
declare const moment: any;
@@ -81,7 +81,11 @@ class FullAPIExample extends React.Component<BigCalendarProps<CalendarEvent>> {
min={new Date()}
max={new Date()}
scrollToTime={new Date()}
formats={{}}
formats={{
dateFormat: "h a",
agendaDateFormat: (date: Date, culture?: string, localizer?: object) => "some-format",
dayRangeHeaderFormat: (range: DateRange, culture?: string, localizer?: object) => "some-format"
}}
messages={{}}
timeslots={24}
defaultView={'month'}
+20
View File
@@ -0,0 +1,20 @@
// Type definitions for react-currency-formatter 1.1
// Project: https://github.com/xDae/react-currency-formatter;
// Definitions by: Yury Pastushenko <https://github.com/pastushenkoy>
// Evgeniy Vasiliev <https://github.com/Jeka-Vasiliev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
interface CurrencyFormatterProps {
quantity: number;
currency?: string;
locale?: string;
pattern?: string;
decimal?: string;
group?: string;
}
declare const reactCurrencyFormatter: React.ComponentClass<CurrencyFormatterProps>;
export = reactCurrencyFormatter;
@@ -0,0 +1,13 @@
import * as React from 'react';
import * as CurrencyFormatter from 'react-currency-formatter';
interface Props {
price: number;
currency: string;
}
const ProductionPrice: React.SFC<Props> = (props: Props) => (
<CurrencyFormatter quantity={props.price} currency={props.currency} />
);
export default ProductionPrice;
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"jsx": "react",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-currency-formatter-tests.tsx"
]
}
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+14 -5
View File
@@ -1,21 +1,30 @@
// Type definitions for react-hammerjs 0.5
// Type definitions for react-hammerjs 1.0
// Project: https://github.com/JedWatson/react-hammerjs#readme
// Definitions by: Jason Unger <https://github.com/jsonunger>
// Cecchi MacNaughton <https://github.com/cecchi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as Hammer from 'hammerjs';
import * as React from 'react';
import * as Hammer from "hammerjs";
import * as React from "react";
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type HammerOptionsWithRecognizers = Omit<HammerOptions, 'recognizers'> & {
type HammerOptionsWithRecognizers = Omit<HammerOptions, "recognizers"> & {
recognizers?: { [gesture: string]: RecognizerOptions };
};
declare namespace ReactHammer {
interface ReactHammerProps {
direction?: number;
direction?:
| "DIRECTION_NONE"
| "DIRECTION_LEFT"
| "DIRECTION_RIGHT"
| "DIRECTION_UP"
| "DIRECTION_DOWN"
| "DIRECTION_HORIZONTAL"
| "DIRECTION_VERTICAL"
| "DIRECTION_ALL";
options?: HammerOptionsWithRecognizers;
recognizeWith?: { [gesture: string]: Recognizer | string };
vertical?: boolean;
+45
View File
@@ -0,0 +1,45 @@
// Type definitions for react-hammerjs 0.5
// Project: https://github.com/JedWatson/react-hammerjs#readme
// Definitions by: Jason Unger <https://github.com/jsonunger>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as Hammer from 'hammerjs';
import * as React from 'react';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type HammerOptionsWithRecognizers = Omit<HammerOptions, 'recognizers'> & {
recognizers?: { [gesture: string]: RecognizerOptions };
};
declare namespace ReactHammer {
interface ReactHammerProps {
direction?: number;
options?: HammerOptionsWithRecognizers;
recognizeWith?: { [gesture: string]: Recognizer | string };
vertical?: boolean;
action?: HammerListener;
onDoubleTap?: HammerListener;
onPan?: HammerListener;
onPanCancel?: HammerListener;
onPanEnd?: HammerListener;
onPanStart?: HammerListener;
onPinch?: HammerListener;
onPinchCancel?: HammerListener;
onPinchEnd?: HammerListener;
onPinchIn?: HammerListener;
onPinchStart?: HammerListener;
onPress?: HammerListener;
onPressUp?: HammerListener;
onRotate?: HammerListener;
onRotateCancel?: HammerListener;
onRotateEnd?: HammerListener;
onRotateMove?: HammerListener;
onRotateStart?: HammerListener;
onSwipe?: HammerListener;
onTap?: HammerListener;
}
}
declare const ReactHammer: React.ComponentClass<ReactHammer.ReactHammerProps>;
export = ReactHammer;
@@ -0,0 +1,17 @@
import * as React from 'react';
import Hammer from 'react-hammerjs';
class ReactHammer extends React.Component<Hammer.ReactHammerProps> {
swipe: Hammer.ReactHammerProps['onSwipe'] = input => {
console.log(input.deltaX);
}
render() {
const { children, ...props } = this.props;
return (
<Hammer onSwipe={this.swipe} {...props}>
{children}
</Hammer>
);
}
}
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6", "dom"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": ["../../"],
"paths": {
"react-hammerjs": ["react-hammerjs/v0"]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"esModuleInterop": true
},
"files": ["index.d.ts", "react-hammerjs-tests.tsx"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+5 -2
View File
@@ -1,11 +1,14 @@
// Type definitions for react-native-material-ui 1.30
// Type definitions for react-native-material-ui 1.31
// Project: https://github.com/xotahal/react-native-material-ui
// Definitions by: Kyle Roach <https://github.com/iRoachie>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { Component } from 'react';
import { ViewStyle, TextStyle, Image } from 'react-native';
import { StyleProp, ViewStyle as ViewStyleRaw, TextStyle as TextStyleRaw, Image } from 'react-native';
export type ViewStyle = StyleProp<ViewStyleRaw>;
export type TextStyle = StyleProp<TextStyleRaw>;
export interface ActionButtonProps {
actions?: string[] | JSX.Element[] | Array<{
+3 -3
View File
@@ -8465,8 +8465,8 @@ export namespace Animated {
export function parallel(animations: Array<CompositeAnimation>, config?: ParallelConfig): CompositeAnimation;
type Mapping = { [key: string]: Mapping } | AnimatedValue;
interface EventConfig {
listener?: ValueListenerCallback;
interface EventConfig<T> {
listener?: (event?: NativeSyntheticEvent<T>) => void;
useNativeDriver?: boolean;
}
@@ -8486,7 +8486,7 @@ export namespace Animated {
* ]),
*```
*/
export function event(argMapping: Array<Mapping | null>, config?: EventConfig): (...args: any[]) => void;
export function event<T>(argMapping: Array<Mapping | null>, config?: EventConfig<T>): (...args: any[]) => void;
/**
* Make any React component Animatable. Used to create `Animated.View`, etc.
+13 -2
View File
@@ -1,6 +1,6 @@
import * as React from "react-native";
import * as React from "react";
import { Animated, View } from "react-native";
import { Animated, View, NativeSyntheticEvent, NativeScrollEvent } from "react-native";
function TestAnimatedAPI() {
// Value
@@ -63,6 +63,17 @@ function TestAnimatedAPI() {
Animated.stagger(100, [spring1, springXY]);
const listener = (e?: NativeSyntheticEvent<NativeScrollEvent>) => {
if (e) {
console.warn(e.nativeEvent.contentOffset.y);
}
};
Animated.event(
[{ nativeEvent: { contentOffset: { y: v1 } } }],
{ useNativeDriver: true, listener },
);
return (
<View>
<Animated.View
+1 -1
View File
@@ -1036,7 +1036,7 @@ declare namespace React {
itemRef?: string;
results?: number;
security?: string;
unselectable?: boolean;
unselectable?: 'on' | 'off';
}
// All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/
+1
View File
@@ -400,6 +400,7 @@ const htmlAttr: React.HTMLProps<HTMLElement> = {
dangerouslySetInnerHTML: {
__html: "<strong>STRONG</strong>"
},
unselectable: 'on',
'aria-atomic': false,
'aria-checked': 'true',
'aria-colcount': 7,
+6 -2
View File
@@ -7,6 +7,7 @@
// Kurt Preston <https://github.com/KurtPreston>
// Tim Chen <https://github.com/timc13>
// Pat Gaffney <https://github.com/patrickrgaffney>
// Prabodh Tiwari <https://github.com/prabodht>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
@@ -240,15 +241,18 @@ import {
UncontrolledAlert as UncontrolledAlert_,
UncontrolledButtonDropdown as UncontrolledButtonDropdown_,
UncontrolledDropdown as UncontrolledDropdown_,
UncontrolledTooltip as UncontrolledTooltip_
UncontrolledTooltip as UncontrolledTooltip_,
UncontrolledCollapse as UncontrolledCollapse_
} from './lib/Uncontrolled';
export class UncontrolledAlert<T = {}> extends UncontrolledAlert_<T> {}
export class UncontrolledButtonDropdown<T = {}> extends UncontrolledButtonDropdown_<T> {}
export class UncontrolledDropdown<T = {}> extends UncontrolledDropdown_<T> {}
export class UncontrolledTooltip<T = {}> extends UncontrolledTooltip_<T> {}
export class UncontrolledCollapse<T = {}> extends UncontrolledCollapse_<T> {}
export {
UncontrolledButtonDropdownProps,
UncontrolledAlertProps,
UncontrolledDropdownProps,
UncontrolledTooltipProps
UncontrolledTooltipProps,
UncontrolledCollapseProps
} from './lib/Uncontrolled';
+11
View File
@@ -20,5 +20,16 @@ export type CollapseProps<T = {}> = React.HTMLProps<HTMLElement> & {
onExited?: () => void;
} & T;
export type UncontrolledProps<T = {}> = React.HTMLProps<HTMLElement> & {
isOpen?: boolean;
className?: string;
cssModule?: CSSModule;
tag?: React.ReactType;
navbar?: boolean;
toggle?: () => void;
} & T;
export type UncontrolledCollapseProps<T = {}> = UncontrolledProps<T>;
declare class Collapse<T = {[key: string]: any}> extends React.Component<CollapseProps<T>> {}
export default Collapse;
+3
View File
@@ -4,13 +4,16 @@ import { UncontrolledAlertProps } from './Alert';
import { UncontrolledButtonDropdownProps } from './ButtonDropdown';
import { UncontrolledDropdownProps } from './Dropdown';
import { UncontrolledTooltipProps } from './Tooltip';
import { UncontrolledCollapseProps } from './Collapse';
export class UncontrolledAlert<T = {}> extends React.Component<UncontrolledAlertProps<T>> {}
export class UncontrolledButtonDropdown<T = {}> extends React.Component<UncontrolledButtonDropdownProps<T>> {}
export class UncontrolledDropdown<T = {}> extends React.Component<UncontrolledDropdownProps<T>> {}
export class UncontrolledTooltip<T = {}> extends React.Component<UncontrolledTooltipProps<T>> {}
export class UncontrolledCollapse<T = {}> extends React.Component<UncontrolledCollapseProps<T>> {}
export { UncontrolledAlertProps } from './Alert';
export { UncontrolledButtonDropdownProps } from './ButtonDropdown';
export { UncontrolledDropdownProps } from './Dropdown';
export { UncontrolledTooltipProps } from './Tooltip';
export { UncontrolledCollapseProps } from './Collapse';
+25
View File
@@ -74,6 +74,7 @@ import {
UncontrolledButtonDropdown,
UncontrolledDropdown,
UncontrolledTooltip,
UncontrolledCollapse,
TabContent,
Table,
Tag,
@@ -3741,6 +3742,7 @@ function Example117() {
<UncontrolledButtonDropdown ref={ref}/>;
<UncontrolledDropdown ref={ref}/>;
<UncontrolledTooltip ref={ref} target={null as any}/>;
<UncontrolledCollapse ref={ref} target={null as any}/>;
}
function Example118() {
@@ -3831,6 +3833,7 @@ import { UncontrolledAlert as UncontrolledAlert_ } from './lib/Uncontrolled'; /*
import { UncontrolledButtonDropdown as UncontrolledButtonDropdown_ } from './lib/Uncontrolled'; /* tslint:disable-line: no-relative-import-in-test no-duplicate-imports */
import { UncontrolledDropdown as UncontrolledDropdown_ } from './lib/Uncontrolled'; /* tslint:disable-line: no-relative-import-in-test no-duplicate-imports */
import { UncontrolledTooltip as UncontrolledTooltip_ } from './lib/Uncontrolled'; /* tslint:disable-line: no-relative-import-in-test no-duplicate-imports */
import { UncontrolledCollapse as UncontrolledCollapse_ } from './lib/Uncontrolled'; /* tslint:disable-line: no-relative-import-in-test no-duplicate-imports */
function AnyPropExample() {
return (
@@ -3913,6 +3916,7 @@ function AnyPropExample() {
<UncontrolledButtonDropdown_ foo={1} bar={false} foobar="example" />
<UncontrolledDropdown_ foo={1} bar={false} foobar="example" />
<UncontrolledTooltip_ foo={1} bar={false} foobar="example" target="" />
<UncontrolledCollapse_ foo={1} bar={false} foobar="example" target="" />
</React.Fragment >
);
}
@@ -4000,6 +4004,7 @@ class UncontrolledAlertGeneric extends UncontrolledAlert<GenericInterface> {}
class UncontrolledButtonDropdownGeneric extends UncontrolledButtonDropdown<GenericInterface> {}
class UncontrolledDropdownGeneric extends UncontrolledDropdown<GenericInterface> {}
class UncontrolledTooltipGeneric extends UncontrolledTooltip<GenericInterface> {}
class UncontrolledCollapseGeneric extends UncontrolledCollapse<GenericInterface> {}
function GenericPropExample() {
return (
@@ -4082,6 +4087,7 @@ function GenericPropExample() {
<UncontrolledButtonDropdownGeneric foo={1} bar={false} foobar="example" />
<UncontrolledDropdownGeneric foo={1} bar={false} foobar="example" />
<UncontrolledTooltipGeneric foo={1} bar={false} foobar="example" target="" />
<UncontrolledCollapseGeneric foo={1} bar={false} foobar="example" target="" />
</React.Fragment >
);
}
@@ -4264,3 +4270,22 @@ class Example122 extends React.Component<any, any> {
);
}
}
function Example123() {
return(
<div>
<Button color="primary" id="toggler" style={{ marginBottom: '1rem' }}>
Toggle
</Button>
<UncontrolledCollapse toggler="#toggler">
<Card>
<CardBody>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Nesciunt magni, voluptas debitis
similique porro a molestias consequuntur earum odio officiis natus, amet hic, iste sed
dignissimos esse fuga! Minus, alias.
</CardBody>
</Card>
</UncontrolledCollapse>
</div>
);
}
+2 -2
View File
@@ -19,8 +19,8 @@ declare module 'recompose' {
type predicate<T> = mapper<T, boolean>;
type predicateDiff<T> = (current: T, next: T) => boolean
// Diff / Omit taken from https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-311923766
type Omit<T, K extends keyof T> = Pick<T, ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never, [x: number]: never })[keyof T]>;
// Diff / Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
interface Observer<T>{
next(props: T): void;
+7 -4
View File
@@ -29,12 +29,15 @@ let options: sanitize.IOptions = {
allowedSchemesByTag: {
'a': ['http', 'https']
},
allowProtocolRelative: false,
parser: {
decodeEntities: true
}
allowProtocolRelative: false
};
let unsafe = '<div><script>alert("hello");</script></div>';
let safe = sanitize(unsafe, options);
options.parser = {
decodeEntities: true
};
safe = sanitize(unsafe, options);
+1 -1
View File
@@ -1350,7 +1350,7 @@ declare namespace Stripe {
livemode: boolean;
metadata?: IMetadata;
metadata: IMetadata;
/**
* Shipping information associated with the customer.
+17 -14
View File
@@ -1,6 +1,7 @@
// Type definitions for styled-components 3.0
// Project: https://github.com/styled-components/styled-components
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Ihor Chulinda <https://github.com/Igmat>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -104,19 +105,20 @@ export interface ThemedBaseStyledInterface<T>
component: React.ComponentType<P>,
): ThemedStyledFunction<P, T, WithOptionalTheme<P, T>>;
}
export type BaseStyledInterface = ThemedBaseStyledInterface<any>;
export type ThemedStyledInterface<T> = ThemedBaseStyledInterface<T>;
export type StyledInterface = ThemedStyledInterface<any>;
export type ThemedStyledInterface<T> = ThemedBaseStyledInterface<Extract<keyof T, string> extends never ? any : T>;
export type StyledInterface = ThemedStyledInterface<DefaultTheme>;
// tslint:disable-next-line:no-empty-interface
export interface DefaultTheme {}
export interface ThemeProviderProps<T> {
theme?: T | ((theme: T) => T);
}
export type ThemeProviderComponent<T> = React.ComponentClass<
export type BaseThemeProviderComponent<T> = React.ComponentClass<
ThemeProviderProps<T>
>;
export interface ThemedCssFunction<T> {
>;
export type ThemeProviderComponent<T> = BaseThemeProviderComponent<Extract<keyof T, string> extends never ? any : T>;
export interface BaseThemedCssFunction<T> {
(
strings: TemplateStringsArray,
...interpolations: SimpleInterpolation[]
@@ -126,6 +128,7 @@ export interface ThemedCssFunction<T> {
...interpolations: Array<Interpolation<ThemedStyledProps<P, T>>>
): Array<FlattenInterpolation<ThemedStyledProps<P, T>>>;
}
export type ThemedCssFunction<T> = BaseThemedCssFunction<Extract<keyof T, string> extends never ? any : T>;
// Helper type operators
type KeyofBase = keyof any;
@@ -150,20 +153,20 @@ export interface ThemedStyledComponentsModule<T> {
strings: TemplateStringsArray,
...interpolations: SimpleInterpolation[]
): void;
withTheme<P extends { theme?: T }>(
component: React.ComponentType<P>,
): React.ComponentClass<WithOptionalTheme<P, T>>;
withTheme: WithThemeFnInterface<T>;
ThemeProvider: ThemeProviderComponent<T>;
}
declare const styled: StyledInterface;
export const css: ThemedCssFunction<any>;
export const css: ThemedCssFunction<DefaultTheme>;
export function withTheme<P extends { theme?: T }, T>(
component: React.ComponentType<P>,
): React.ComponentClass<WithOptionalTheme<P, T>>;
export type BaseWithThemeFnInterface<T> = <P extends { theme?: T }>(
component: React.ComponentType<P>,
) => React.ComponentClass<WithOptionalTheme<P, T>>;
export type WithThemeFnInterface<T> = BaseWithThemeFnInterface<Extract<keyof T, string> extends never ? any : T>;
export const withTheme: WithThemeFnInterface<DefaultTheme>;
export function keyframes(
strings: TemplateStringsArray,
+522
View File
@@ -0,0 +1,522 @@
// Type definitions for twilio-video 2.0
// Project: https://twilio.com/video
// Definitions by: MindDoc <https://github.com/minddocdev>, Darío Blanco <https://github.com/darioblanco>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { EventEmitter } from 'events';
/**
* Classes
*/
export class AccessTokenExpiredError extends TwilioError {
code: 20104;
message: 'Access Token expired or expiration date invalid';
}
export class AccessTokenGrantsInvalidError extends TwilioError {
code: 20106;
message: 'Invalid Access Token grants';
}
export class AccessTokenHeaderInvalidError extends TwilioError {
code: 20102;
message: 'Invalid Access Token header';
}
export class AccessTokenIssuerInvalidError extends TwilioError {
code: 20103;
message: 'Invalid Access Token issuer/subject';
}
export class AccessTokenNotYetValidError extends TwilioError {
code: 20105;
message: 'Access Token not yet valid';
}
export class AccessTokenSignatureInvalidError extends TwilioError {
code: 20107;
message: 'Invalid Access Token signature';
}
export class AudioTrack extends Track {
isStarted: boolean;
isEnabled: boolean;
kind: 'audio';
mediaStreamTrack: MediaStreamTrack;
attach(element?: HTMLMediaElement | string): HTMLMediaElement;
detach(element?: HTMLMediaElement | string): HTMLMediaElement[];
}
export class ConfigurationAcquireFailedError extends TwilioError {
code: 53500;
message: 'Unable to acquire configuration';
}
export class ConfigurationAcquireTurnFailedError extends TwilioError {
code: 53501;
message: 'Unable to acquire TURN credentials';
}
export class LocalAudioTrack extends AudioTrack {
constructor(mediaStreamTrack: MediaStreamTrack, options?: LocalTrackOptions);
id: Track.ID;
isStopped: boolean;
disable(): LocalAudioTrack;
enable(enabled?: boolean): LocalAudioTrack;
stop(): LocalAudioTrack;
}
export class LocalAudioTrackPublication extends LocalTrackPublication {
kind: 'audio';
track: LocalAudioTrack;
unpublish(): LocalAudioTrackPublication;
}
export class LocalAudioTrackStats extends LocalTrackStats {
audioLevel: AudioLevel | null;
jitter: number | null;
}
export class LocalDataTrack extends Track {
constructor(options?: LocalDataTrackOptions);
id: Track.ID;
kind: 'data';
maxPacketLifeTime: number | null;
maxRetransmits: number | null;
ordered: boolean;
reliable: boolean;
send(data: string | Blob | ArrayBuffer | ArrayBufferView): void;
}
export class LocalDataTrackPublication extends LocalTrackPublication {
kind: 'data';
track: LocalDataTrack;
unpublish(): LocalDataTrackPublication;
}
export class LocalParticipant extends Participant {
audioTracks: Map<Track.SID, LocalAudioTrackPublication>;
dataTracks: Map<Track.SID, LocalDataTrackPublication>;
tracks: Map<Track.SID, LocalTrackPublication>;
videoTracks: Map<Track.SID, LocalVideoTrackPublication>;
publishTrack(localTrack: LocalTrack): Promise<LocalTrackPublication>;
publishTrack(
mediaStreamTrack: MediaStreamTrack, options?: LocalTrackOptions,
): Promise<LocalTrackPublication>;
publishTracks(
tracks: LocalTrack[] | MediaStreamTrack[],
): Promise<LocalTrackPublication[]>;
setParameters(encodingParameters?: EncodingParameters | null): LocalParticipant;
}
export class LocalTrackPublication extends TrackPublication {
isTrackEnabled: boolean;
kind: Track.Kind;
track: LocalTrack;
unpublish(): LocalTrackPublication;
}
export class LocalTrackStats extends TrackStats {
bytesSent: number | null;
packetsSent: number | null;
roundTripTime: number | null;
}
export class LocalVideoTrack extends VideoTrack {
constructor(mediaStreamTrack: MediaStreamTrack, options?: LocalTrackOptions);
id: Track.ID;
isStopped: boolean;
disable(): LocalVideoTrack;
enable(enabled?: boolean): LocalVideoTrack;
stop(): LocalVideoTrack;
}
export class LocalVideoTrackPublication extends LocalTrackPublication {
kind: 'video';
track: LocalVideoTrack;
unpublish(): LocalVideoTrackPublication;
}
export class LocalVideoTrackStats extends LocalTrackStats {
captureDimensions: VideoTrack.Dimensions | null;
dimensions: VideoTrack.Dimensions | null;
captureFrameRate: number | null;
frameRate: number | null;
}
export class MediaClientLocalDescFailedError extends TwilioError {
code: 53400;
message: 'Client is unable to create or apply a local media description';
}
export class MediaClientRemoteDescFailedError extends TwilioError {
code: 53402;
message: 'Client is unable to apply a remote media description';
}
export class MediaConnectionError extends TwilioError {
code: 53405;
message: 'Media connection failed';
}
export class MediaNoSupportedCodecError extends TwilioError {
code: 53404;
message: 'No supported codec';
}
export class MediaServerLocalDescFailedError extends TwilioError {
code: 53401;
message: 'Server is unable to create or apply a local media description';
}
export class MediaServerRemoteDescFailedError extends TwilioError {
code: 53403;
message: 'Server is unable to apply a remote media description';
}
export namespace Participant {
type Identity = string;
type SID = string;
}
export class Participant extends EventEmitter {
audioTracks: Map<Track.SID, AudioTrackPublication>;
dataTracks: Map<Track.SID, DataTrackPublication>;
identity: Participant.Identity;
networkQualityLEvel: NetworkQualityLevel | null;
sid: Participant.SID;
state: string;
tracks: Map<Track.SID, TrackPublication>;
videoTracks: Map<Track.SID, VideoTrackPublication>;
}
export class ParticipantDuplicateIdentityError extends TwilioError {
code: 53205;
message: 'Participant disconnected because of duplicate identity';
}
export class ParticipantIdentityCharsInvalidError extends TwilioError {
code: 53202;
message: 'Participant identity contains invalid characters';
}
export class ParticipantIdentityInvalidError extends TwilioError {
code: 53200;
message: 'Participant identity is invalid';
}
export class ParticipantIdentityTooLongError extends TwilioError {
code: 53201;
message: 'Participant identity is too long';
}
export class ParticipantMaxTracksExceededError extends TwilioError {
code: 53203;
message: 'Participant has too many Tracks';
}
export class ParticipantNotFoundError extends TwilioError {
code: 53204;
message: 'Participant not found';
}
export class RemoteAudioTrack extends AudioTrack {
sid: Track.SID;
}
export class RemoteAudioTrackPublication extends RemoteTrackPublication {
kind: 'audio';
track: RemoteAudioTrack | null;
}
export class RemoteAudioTrackStats extends RemoteTrackStats {
audioLevel: AudioLevel | null;
jitter: number | null;
}
export class RemoteDataTrack extends Track {
isEnabled: boolean;
isSubscribed: boolean;
kind: 'data';
maxPacketLifeTime: number | null;
maxRetransmits: number | null;
ordered: boolean;
reliable: boolean;
sid: Track.SID;
}
export class RemoteDataTrackPublication extends RemoteTrackPublication {
kind: 'data';
track: RemoteDataTrack | null;
}
export class RemoteParticipant extends Participant {
audioTracks: Map<Track.SID, RemoteAudioTrackPublication>;
dataTracks: Map<Track.SID, RemoteDataTrackPublication>;
tracks: Map<Track.SID, RemoteTrackPublication>;
videoTracks: Map<Track.SID, RemoteVideoTrackPublication>;
}
export class RemoteTrackPublication extends TrackPublication {
isSubscribed: boolean;
isTrackEnabled: boolean;
kind: Track.Kind;
track: RemoteTrack | null;
}
export class RemoteTrackStats {
bytesReceived: number | null;
packetsReceived: number | null;
}
export class RemoteVideoTrack extends VideoTrack {
sid: Track.SID;
}
export class RemoteVideoTrackPublication extends RemoteTrackPublication {
kind: 'video';
track: RemoteVideoTrack | null;
}
export class RemoteVideoTrackStats extends RemoteTrackStats {
dimensions: VideoTrack.Dimensions | null;
frameRate: number | null;
}
export namespace Room {
type SID = string;
}
export class Room extends EventEmitter {
dominantSpeaker: RemoteParticipant | null;
isRecording: boolean;
localParticipant: LocalParticipant;
name: string;
participants: Map<Participant.SID, RemoteParticipant>;
sid: Room.SID;
state: string;
disconnect(): Room;
getStats(): Promise<StatsReport[]>;
}
export class RoomCompletedError extends TwilioError {
code: 53118;
message: 'Room completed';
}
export class RoomConnectFailedError extends TwilioError {
code: 53104;
message: 'Unable to connect to Room';
}
export class RoomCreateFailedError extends TwilioError {
code: 53103;
message: 'Unable to create Room';
}
export class RoomInvalidParametersError extends TwilioError {
code: 53114;
message: 'Room creation parameter(s) incompatible with the Room type';
}
export class RoomMaxParticipantsExceededError extends TwilioError {
code: 53105;
message: 'Room contains too many Participants';
}
export class RoomMaxParticipantsOutOfRangeError extends TwilioError {
code: 53107;
message: 'MaxParticipants is out of range';
}
export class RoomMediaRegionInvalidError extends TwilioError {
code: 53115;
message: 'MediaRegion is invalid';
}
export class RoomMediaRegionUnavailableError extends TwilioError {
code: 53116;
message: 'There are no media servers available in the MediaRegion';
}
export class RoomNameCharsInvalidError extends TwilioError {
code: 53102;
message: 'Room name contains invalid characters';
}
export class RoomNameInvalidError extends TwilioError {
code: 53100;
message: 'Room name is invalid';
}
export class RoomNameTooLongError extends TwilioError {
code: 53101;
message: 'Room name is too long';
}
export class RoomNotFoundError extends TwilioError {
code: 53106;
message: 'Room not found';
}
export class RoomRoomExistsError extends TwilioError {
code: 53113;
message: 'Room exists';
}
export class RoomStatusCallbackInvalidError extends TwilioError {
code: 53111;
message: 'StatusCallback is invalid';
}
export class RoomStatusCallbackMethodInvalidError extends TwilioError {
code: 53110;
message: 'StatusCallbackMethod is invalid';
}
export class RoomStatusInvalidError extends TwilioError {
code: 53112;
message: 'Status is invalid';
}
export class RoomSubscriptionOperationNotSupportedError extends TwilioError {
code: 53117;
message: 'The subscription operation requested is not supported for the Room type';
}
export class RoomTimeoutOutOfRangeError extends TwilioError {
code: 53109;
message: 'Timeout is out of range';
}
export class RoomTypeInvalidError extends TwilioError {
code: 53108;
message: 'RoomType is not valid';
}
export class SignalingConnectionDisconnectedError extends TwilioError {
code: 53001;
message: 'Signaling connection disconnected';
}
export class SignalingConnectionError extends TwilioError {
code: 53000;
message: 'Signaling connection error';
}
export class SignalingConnectionTimeoutError extends TwilioError {
code: 53002;
message: 'Signaling connection timed out';
}
export class SignalingIncomingMessageInvalidError extends TwilioError {
code: 53003;
message: 'Client received an invalid signaling message';
}
export class SignalingOutgoingMessageInvalidError extends TwilioError {
code: 53004;
message: 'Client sent an invalid signaling message';
}
export class StatsReport {
peerConnectionId: string;
localAudioTrackStats: LocalAudioTrackStats[];
localVideoTrackStats: LocalVideoTrackStats[];
remoteAudioTrackStats: RemoteAudioTrackStats[];
remoteVideoTrackStats: RemoteVideoTrackStats[];
}
export namespace Track {
type Kind = 'audio' | 'video' | 'data';
type ID = string;
type SID = string;
}
export class Track extends EventEmitter {
kind: Track.Kind;
name: string;
}
export class TrackInvalidError extends TwilioError {
code: 53300;
message: 'Track is invalid';
}
export class TrackNameCharsInvalidError extends TwilioError {
code: 53303;
message: 'Track name contains invalid characters';
}
export class TrackNameInvalidError extends TwilioError {
code: 53301;
message: 'Track name is invalid';
}
export class TrackNameIsDuplicatedError extends TwilioError {
code: 53304;
message: 'Track name is duplicated';
}
export class TrackNameTooLongError extends TwilioError {
code: 53302;
message: 'Track name is too long';
}
export class TrackPublication {
trackName: string;
trackSid: Track.SID;
}
export class TrackServerTrackCapacityReachedError extends TwilioError {
code: 53305;
message: 'The server has reached capacity and cannot fulfill this request.';
}
export class TrackStats {
trackId: Track.ID;
trackSid: Track.SID;
timestamp: number;
ssrc: string;
packetsLost: number | null;
codec: string | null;
}
export class TwilioError extends Error {
code: number;
toString(): string;
}
export namespace VideoTrack {
interface Dimensions {
width: number | null;
height: number | null;
}
}
export class VideoTrack extends Track {
isStarted: boolean;
isEnabled: boolean;
dimensions: VideoTrack.Dimensions;
kind: 'video';
mediaStreamTrack: MediaStreamTrack;
attach(element?: HTMLMediaElement | string): HTMLVideoElement;
detach(element?: HTMLMediaElement | string): HTMLMediaElement[];
}
/**
* Global (https://media.twiliocdn.com/sdk/js/video/releases/2.0.0-beta1/docs/global.html)
*/
export const version: string;
/** Members */
export type AudioCodec = 'isac' | 'opus' | 'PCMA' | 'PCMU';
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'off';
export type VideoCodec = 'H264' | 'VP8' | 'VP9';
/** Methods */
export function connect(token: string, options?: ConnectOptions): Promise<Room>;
export function createLocalAudioTrack(options?: CreateLocalTrackOptions): Promise<LocalAudioTrack>;
export function createLocalTracks(options?: CreateLocalTracksOptions): Promise<LocalTrack[]>;
export function createLocalVideoTrack(options?: CreateLocalTrackOptions): Promise<LocalVideoTrack>;
export function isSupported(): boolean;
export function rewriteLocalTrackIds(room: Room, trackStats: LocalTrackStats[]): LocalTrackStats[];
/** Type Definitions */
export type AudioLevel = number;
export type AudioTrackPublication = LocalAudioTrackPublication | RemoteAudioTrackPublication;
export interface ConnectOptions {
abortOnIceServersTimeout?: boolean;
audio?: boolean | CreateLocalTrackOptions;
iceServers?: RTCIceServer[];
iceServersTimeout?: number;
iceTransportPolicy?: RTCIceTransportPolicy;
insights?: boolean;
maxAudioBitRate?: number | null;
maxVideoBitRate?: number | null;
name?: string | null;
preferredAudioCodecs?: AudioCodec[];
preferredVideoCodecs?: VideoCodec[] | VideoCodecSettings[];
logLevel?: LogLevel | LogLevels;
tracks?: LocalTrack[] | MediaStreamTrack[];
video?: boolean | CreateLocalTrackOptions;
}
export interface CreateLocalTrackOptions {
logLevel: LogLevel | LogLevels;
name?: string;
workaroundWebKitBug180748?: boolean; // Lol
}
export interface CreateLocalTracksOptions {
audio?: boolean | CreateLocalTrackOptions;
logLevel?: LogLevel | LogLevels;
video?: boolean | CreateLocalTrackOptions;
}
export type DataTrack = LocalDataTrack | RemoteDataTrack;
export type DataTrackPublication = LocalDataTrackPublication | RemoteDataTrackPublication;
export interface EncodingParameters {
maxAudioBitrate?: number | null;
maxVideoBitrate?: number | null;
}
export interface LocalDataTrackOptions {
maxPacketLifeTime?: number | null;
maxRetransmits?: number | null;
ordered?: boolean;
}
export type LocalTrack = LocalAudioTrack | LocalVideoTrack | LocalDataTrack;
export interface LocalTrackOptions {
logLevel: LogLevel | LogLevels;
name?: string;
}
export interface LogLevels {
default: LogLevel;
media: LogLevel;
signaling: LogLevel;
webrtc: LogLevel;
}
export type NetworkQualityLevel = number;
export type RemoteTrack = RemoteAudioTrack | RemoteVideoTrack | RemoteDataTrack;
export interface RemoteTrackPublicationOptions {
logLevel: LogLevel | LogLevels;
}
export interface TrackPublicationOptions {
logLevel: LogLevel | LogLevels;
}
export interface VideoCodecSettings {
codec: VideoCodec;
}
export type VideoTrackPublication = LocalVideoTrackPublication | RemoteVideoTrackPublication;
export interface VP8CodecSettings {
name: VideoCodec;
simulcast?: boolean;
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6", "dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"twilio-video-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+45
View File
@@ -0,0 +1,45 @@
import * as Video from 'twilio-video';
// Examples taken from https://twilio.github.io/twilio-video/ (v2.x)
Video.connect('$TOKEN', { name: 'room-name' }).then(room => {
room.participants.forEach(participantConnected);
room.on('participantConnected', participantConnected);
room.on('participantDisconnected', participantDisconnected);
room.once('disconnected', error => room.participants.forEach(participantDisconnected));
});
function participantConnected(participant: Video.Participant) {
participant.on('trackSubscribed', trackSubscribed);
participant.on('trackUnsubscribed', trackUnsubscribed);
participant.tracks.forEach(publication => {
const remotePublication = publication as Video.RemoteTrackPublication;
if (remotePublication.isSubscribed) {
trackSubscribed(remotePublication.track as Video.VideoTrack | Video.AudioTrack);
}
});
}
function participantDisconnected(participant: Video.Participant) {
participant.tracks.forEach((publication) => {
const remotePublication = publication as Video.RemoteTrackPublication;
if (remotePublication.isSubscribed) {
const { track } = remotePublication;
if (track) trackUnsubscribed(track as Video.AudioTrack | Video.VideoTrack);
}
});
}
function trackSubscribed(track: Video.VideoTrack | Video.AudioTrack) {
const media = track.attach();
insertDomElement(media);
}
function trackUnsubscribed(track: Video.VideoTrack | Video.AudioTrack) {
track.detach().forEach(element => element.remove());
}
function insertDomElement(element: any) {
// Do something with the dom element
}
+8 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for twitch-ext 1.14
// Type definitions for twitch-ext 1.15
// Project: https://dev.twitch.tv/docs/extensions/reference/#javascript-helper
// Definitions by: Benedict Etzel <https://github.com/beheh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -137,6 +137,13 @@ interface TwitchExtActions {
*/
followChannel(channelName: string): void;
/**
* This function causes your video-component or video-overlay extension to be minimized.
*
* @see https://dev.twitch.tv/docs/extensions/reference/#minimize
*/
minimize(): void;
/**
* This function registers a callback that is invoked whenever a user completes an interaction prompted by the followChannel action.
*
+1
View File
@@ -32,6 +32,7 @@ window.Twitch.ext.actions.onFollow((didFollow, channelName) => {
console.log(`You followed ${channelName}`);
}
});
window.Twitch.ext.actions.minimize();
window.Twitch.ext.actions.followChannel("hearthsim");
window.Twitch.ext.actions.requestIdShare();
+60
View File
@@ -0,0 +1,60 @@
// Type definitions for typography 0.16
// Project: https://github.com/KyleAMathews/typography.js
// Definitions by: Boye <https://github.com/boyeborg>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
interface BaseLine {
fontSize: string;
lineHeight: string;
}
export interface VerticalRhythm {
rhythm: (value: number) => string;
scale: (value: number) => object;
adjustFontSizeTo: (value?: number | string) => object;
linesForFontSize: (fontSize: number) => number;
establishBaseline: () => BaseLine;
}
export interface GoogleFont {
name: string;
styles: string[];
}
export interface TypographyOptions {
baseFontSize?: string;
baseLineHeight?: number;
scaleRatio?: number;
googleFonts?: GoogleFont[];
headerFontFamily?: string[];
bodyFontFamily?: string[];
headerColor?: string;
bodyColor?: string;
headerWeight?: number | string;
bodyWeight?: number | string;
boldWeight?: number | string;
blockMarginBottom?: number;
includeNormalize?: boolean;
overrideStyles?: (
VerticalRhythm: VerticalRhythm,
options: TypographyOptions,
styles: any
) => object;
overrideThemeStyles?: (
VerticalRhythm: VerticalRhythm,
options: TypographyOptions,
styles: any
) => object;
plugins?: any[];
}
declare class Typography {
constructor(opts: TypographyOptions);
options: TypographyOptions;
createStyles(): string;
toJSON(): object;
injectStyles(): void;
}
export default Typography;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"typography-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+12
View File
@@ -0,0 +1,12 @@
import Typography from 'typography';
const typography = new Typography({
baseFontSize: '18px',
baseLineHeight: 1.45,
headerFontFamily: ['Avenir Next', 'Helvetica Neue', 'Segoe UI', 'Helvetica', 'Arial', 'sans-serif'],
bodyFontFamily: ['Georgia', 'serif']
});
typography.createStyles(); // $ExpectType string
typography.toJSON(); // $ExpectType object
typography.options; // $ExpectType TypographyOptions
+14
View File
@@ -4395,6 +4395,20 @@ declare namespace videojs {
*/
reset(): void;
/**
* Returns whether or not the player is in the "seeking" state.
*
* @return boolean True if the player is in the seeking state, false if not.
*/
seeking(): boolean;
/**
* Returns the TimeRanges of the media that are currently available for seeking to.
*
* @return TimeRanges Returns the TimeRanges of the media that are currently available for seeking to.
*/
seekable(): TimeRanges;
/**
* Select source based on tech-order or source-order
* Uses source-order selection if `options.sourceOrder` is truthy. Otherwise,
+1 -1
View File
@@ -43,7 +43,7 @@ declare class Web3 {
bzz: Bzz;
currentProvider: Provider;
eth: Eth;
ssh: Shh;
shh: Shh;
givenProvider: Provider;
providers: Providers;
setProvider(provider: Provider): void;
+7
View File
@@ -0,0 +1,7 @@
{
"private": true,
"dependencies": {
"bignumber.js": "^4.0.0",
"underscore": "^1.8.3"
}
}
+8 -1
View File
@@ -81,5 +81,12 @@ export interface Subscribe<T> {
on(type: "error", handler: (data: Error) => void): void;
}
export class Shh {} // TODO: Type
export interface Shh {
generateSymKeyFromPassword(password: string): Promise<string>;
generateSymKeyFromPassword(
password: string,
callback: Callback<string>
): void;
// TODO: type every method
}
export class Bzz {} // TODO: Type
+3
View File
@@ -21,9 +21,12 @@ myContract.options.gas = 5000000;
const weiStr: string = web3.utils.toWei("100", "gwei");
const weiBn: BigNumber = web3.utils.toWei(web3.utils.toBN("1"));
const rndHex: string = Web3.utils.randomHex(10);
const shhPromise: Promise<string> = web3.shh.generateSymKeyFromPassword("xyz");
web3.eth.personal.unlockAccount(
web3.eth.defaultAccount,
"passphrase",
600
);
+14 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for webpack-bundle-analyzer 2.9
// Type definitions for webpack-bundle-analyzer 2.13
// Project: https://github.com/th0r/webpack-bundle-analyzer
// Definitions by: Michael Strobel <https://github.com/kryops>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -7,6 +7,9 @@
import * as webpack from 'webpack';
export namespace BundleAnalyzerPlugin {
type ExcludeAssetsPatternFn = (assetName: string) => boolean;
type ExcludeAssetsPattern = string | RegExp | ExcludeAssetsPatternFn;
interface Options {
/**
* Can be "server", "static" or "disabled".
@@ -68,6 +71,16 @@ export namespace BundleAnalyzerPlugin {
*/
statsOptions?: null | webpack.Stats.ToJsonOptionsObject;
/**
* Default: `null`.
* Patterns that will be used to match against asset names to exclude them from the report.
* If pattern is a string it will be converted to RegExp via `new RegExp(str)`.
* If pattern is a function it should have the following signature `(assetName: string) => boolean`
* and should return true to exclude matching asset.
* If multiple patterns are provided asset should match at least one of them to be excluded.
*/
excludeAssets?: null | ExcludeAssetsPattern | ExcludeAssetsPattern[];
/**
* Log level. Can be "info", "warn", "error" or "silent".
* Defaults to "info"
@@ -19,6 +19,11 @@ const config: webpack.Configuration = {
statsOptions: {
source: false
},
excludeAssets: [
'foo',
/foo/,
assetName => assetName.indexOf('foo') !== -1
],
logLevel: 'info'
})
]

Some files were not shown because too many files have changed in this diff Show More