mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Fixed conflicts
This commit is contained in:
+1
-1
@@ -790,7 +790,7 @@ declare module Microsoft.ApplicationInsights {
|
||||
}
|
||||
|
||||
declare module 'applicationinsights-js' {
|
||||
export = appInsights;
|
||||
export let AppInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
}
|
||||
|
||||
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
@@ -284,7 +284,6 @@ app.on('ready', () => {
|
||||
|
||||
app.commandLine.appendSwitch('remote-debugging-port', '8315');
|
||||
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1');
|
||||
app.commandLine.appendSwitch('v', -1);
|
||||
app.commandLine.appendSwitch('vmodule', 'console=0');
|
||||
|
||||
// systemPreferences
|
||||
|
||||
Vendored
+41
-18
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Electron v1.2.8
|
||||
// Type definitions for Electron v1.3.1
|
||||
// Project: http://electron.atom.io/
|
||||
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -401,7 +401,7 @@ declare namespace Electron {
|
||||
* Note: This will not affect process.argv, and is mainly used by developers
|
||||
* to control some low-level Chromium behaviors.
|
||||
*/
|
||||
appendSwitch(_switch: string, value?: string|number): void;
|
||||
appendSwitch(_switch: string, value?: string): void;
|
||||
/**
|
||||
* Append an argument to Chromium's command line. The argument will quoted properly.
|
||||
*
|
||||
@@ -2799,7 +2799,7 @@ declare namespace Electron {
|
||||
/**
|
||||
* Sets the proxy settings.
|
||||
*/
|
||||
setProxy(config: string, callback: Function): void;
|
||||
setProxy(config: ProxyConfig, callback: Function): void;
|
||||
/**
|
||||
* Resolves the proxy information for url.
|
||||
*/
|
||||
@@ -2882,6 +2882,21 @@ declare namespace Electron {
|
||||
quotas?: ('temporary' | 'persistent' | 'syncable')[];
|
||||
}
|
||||
|
||||
interface ProxyConfig {
|
||||
/**
|
||||
* The URL associated with the PAC file.
|
||||
*/
|
||||
pacScript: string;
|
||||
/**
|
||||
* Rules indicating which proxies to use.
|
||||
*/
|
||||
proxyRules: string;
|
||||
/**
|
||||
* Rules indicating which URLs should bypass the proxy settings.
|
||||
*/
|
||||
proxyBypassRules: string;
|
||||
}
|
||||
|
||||
interface NetworkEmulationOptions {
|
||||
/**
|
||||
* Whether to emulate network outage.
|
||||
@@ -3386,10 +3401,10 @@ declare namespace Electron {
|
||||
*/
|
||||
setTitle(title: string): void;
|
||||
/**
|
||||
* Sets whether the tray icon is highlighted when it is clicked.
|
||||
* Sets when the tray's icon background becomes highlighted.
|
||||
* Note: This is only implemented on macOS.
|
||||
*/
|
||||
setHighlightMode(highlight: boolean): void;
|
||||
setHighlightMode(mode: 'selection' | 'always' | 'never'): void;
|
||||
/**
|
||||
* Displays a tray balloon.
|
||||
* Note: This is only implemented on Windows.
|
||||
@@ -3641,6 +3656,10 @@ declare namespace Electron {
|
||||
* passing empty string to callback will cancel the request.
|
||||
*/
|
||||
on(event: 'select-bluetooth-device', listener: (event: Event, deviceList: BluetoothDevice[], callback: (deviceId: string) => void) => void): this;
|
||||
/**
|
||||
* Emitted when a page's view is repainted.
|
||||
*/
|
||||
on(event: 'view-painted', listener: Function): this;
|
||||
on(event: string, listener: Function): this;
|
||||
/**
|
||||
* Loads the url in the window.
|
||||
@@ -3751,47 +3770,51 @@ declare namespace Electron {
|
||||
*/
|
||||
isAudioMuted(): boolean;
|
||||
/**
|
||||
* Executes Edit -> Undo command in page.
|
||||
* Executes the editing command undo in web page.
|
||||
*/
|
||||
undo(): void;
|
||||
/**
|
||||
* Executes Edit -> Redo command in page.
|
||||
* Executes the editing command redo in web page.
|
||||
*/
|
||||
redo(): void;
|
||||
/**
|
||||
* Executes Edit -> Cut command in page.
|
||||
* Executes the editing command cut in web page.
|
||||
*/
|
||||
cut(): void;
|
||||
/**
|
||||
* Executes Edit -> Copy command in page.
|
||||
* Executes the editing command copy in web page.
|
||||
*/
|
||||
copy(): void;
|
||||
/**
|
||||
* Executes Edit -> Paste command in page.
|
||||
* Copy the image at the given position to the clipboard.
|
||||
*/
|
||||
copyImageAt(x: number, y: number): void;
|
||||
/**
|
||||
* Executes the editing command paste in web page.
|
||||
*/
|
||||
paste(): void;
|
||||
/**
|
||||
* Executes Edit -> Paste and Match Style in page.
|
||||
* Executes the editing command pasteAndMatchStyle in web page.
|
||||
*/
|
||||
pasteAndMatchStyle(): void;
|
||||
/**
|
||||
* Executes Edit -> Delete command in page.
|
||||
* Executes the editing command delete in web page.
|
||||
*/
|
||||
delete(): void;
|
||||
/**
|
||||
* Executes Edit -> Select All command in page.
|
||||
* Executes the editing command selectAll in web page.
|
||||
*/
|
||||
selectAll(): void;
|
||||
/**
|
||||
* Executes Edit -> Unselect command in page.
|
||||
* Executes the editing command unselect in web page.
|
||||
*/
|
||||
unselect(): void;
|
||||
/**
|
||||
* Executes Edit -> Replace command in page.
|
||||
* Executes the editing command replace in web page.
|
||||
*/
|
||||
replace(text: string): void;
|
||||
/**
|
||||
* Executes Edit -> Replace Misspelling command in page.
|
||||
* Executes the editing command replaceMisspelling in web page.
|
||||
*/
|
||||
replaceMisspelling(text: string): void;
|
||||
/**
|
||||
@@ -4342,7 +4365,7 @@ declare namespace Electron {
|
||||
wheelTicksY?: number;
|
||||
accelerationRatioX?: number;
|
||||
accelerationRatioY?: number;
|
||||
hasPreciseScrollingDeltas?: number;
|
||||
hasPreciseScrollingDeltas?: boolean;
|
||||
canScroll?: boolean;
|
||||
}
|
||||
|
||||
@@ -4619,7 +4642,7 @@ declare namespace Electron {
|
||||
/**
|
||||
* Navigates to the specified offset from the "current entry".
|
||||
*/
|
||||
goToOffset(offset: boolean): void;
|
||||
goToOffset(offset: number): void;
|
||||
/**
|
||||
* @returns Whether the renderer process has crashed.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
///<reference path="globalize-compiler.d.ts" />
|
||||
|
||||
import globalizeCompiler = require("globalize-compiler");
|
||||
const globalize: GlobalizeStatic = null;
|
||||
|
||||
let extractsArray: GlobalizeCompiler.FormatterOrParserFunction[];
|
||||
|
||||
const templateFunction: (options: GlobalizeCompiler.CompileTemplateOptions) => string =
|
||||
(options: GlobalizeCompiler.CompileTemplateOptions): string => {
|
||||
const deps: string[] = options.dependencies;
|
||||
const code: string = options.code;
|
||||
return `${deps.join(';')}${code}`;
|
||||
};
|
||||
|
||||
let compileOutput: string;
|
||||
compileOutput = globalizeCompiler.compile(extractsArray);
|
||||
compileOutput = globalizeCompiler.compile({ x: () => "test", y: (x: string) => x });
|
||||
compileOutput = globalizeCompiler.compile(extractsArray, { template: templateFunction });
|
||||
compileOutput = globalizeCompiler.compile({ x: () => "test", y: (x: string) => x }, { template: templateFunction });
|
||||
|
||||
let extractOutput: GlobalizeCompiler.ExtractFunction;
|
||||
extractOutput = globalizeCompiler.extract("path");
|
||||
|
||||
const ast: ESTree.Program = undefined;
|
||||
extractOutput = globalizeCompiler.extract(ast);
|
||||
|
||||
extractsArray = extractOutput(globalize);
|
||||
|
||||
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en" });
|
||||
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", messages: {} });
|
||||
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", template: templateFunction });
|
||||
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", messages: {}, template: templateFunction });
|
||||
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", cldr: {} });
|
||||
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", cldr: {}, messages: {} });
|
||||
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", cldr: {}, template: templateFunction });
|
||||
compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", cldr: {}, messages: {}, template: templateFunction });
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
// Type definitions for globalize-compiler v0.2.0
|
||||
// Project: https://github.com/jquery-support/globalize-compiler
|
||||
// Definitions by: Ian Clanton-Thuon <https://github.com/iclanton>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="./../globalize/globalize.d.ts" />
|
||||
/// <reference path="../estree/estree.d.ts" />
|
||||
|
||||
declare namespace GlobalizeCompiler {
|
||||
interface CompileTemplateOptions {
|
||||
/**
|
||||
* the source of the compiled formatters and parsers.
|
||||
*/
|
||||
code: string;
|
||||
|
||||
/**
|
||||
* a list of globalize runtime modules that the compiled code depends on, e.g. globalize-runtime/number.
|
||||
*/
|
||||
dependencies: string[];
|
||||
}
|
||||
|
||||
interface CompileOptions {
|
||||
/**
|
||||
* A function that replaces the default template.
|
||||
*/
|
||||
template?: (options: CompileTemplateOptions) => string;
|
||||
}
|
||||
|
||||
interface FormatterOrParserFunction {
|
||||
(...arguments: any[]): any;
|
||||
}
|
||||
|
||||
interface ExtractFunction {
|
||||
/**
|
||||
* @param {globalize} the globalize object.
|
||||
*
|
||||
* @returns an Array with the formatters and parsers created using the passed Globalize.
|
||||
*/
|
||||
(globalize: GlobalizeStatic): FormatterOrParserFunction[];
|
||||
}
|
||||
|
||||
interface CompileExtractsAttributes extends CompileOptions {
|
||||
/**
|
||||
* an Array of extracts obtained by @see{GlobalizeCompilerStatic.extract}
|
||||
*/
|
||||
extracts: ExtractFunction;
|
||||
|
||||
/**
|
||||
* a locale to be used as Globalize.locale(defaultLocale) when generating the extracted formatters and parsers.
|
||||
*/
|
||||
defaultLocale: string;
|
||||
|
||||
/**
|
||||
* an Object with CLDR data (in the JSON format) or a Function taking one argument: locale, a String; returning
|
||||
* an Object with the CLDR data for the passed locale. Defaults to the entire supplemental data plus the entire
|
||||
* main data for the defaultLocale.
|
||||
*/
|
||||
cldr?: Object | ((locale: string) => Object);
|
||||
|
||||
/**
|
||||
* an Object with messages data (in the JSON format) or a Function taking one argument: locale, a String; returning
|
||||
* an Object with the messages data for the passed locale. Defaults to {}.
|
||||
*/
|
||||
messages?: Object | ((locale: string) => Object);
|
||||
}
|
||||
|
||||
interface GlobalizeCompilerStatic {
|
||||
/**
|
||||
* Generates a JavaScript bundle containing the specified globalize formatters and parsers.
|
||||
*
|
||||
* @param {formattersAndParsers} an Array or an Object containing formatters and/or parsers.
|
||||
* @param {options} compiler options.
|
||||
*
|
||||
* @returns a String with the generated JavaScript bundle (UMD wrapped) including the compiled formatters and
|
||||
* parsers.
|
||||
*/
|
||||
compile(formattersAndParsers: FormatterOrParserFunction[] | { [key: string]: FormatterOrParserFunction },
|
||||
options?: CompileOptions): string;
|
||||
|
||||
/**
|
||||
* Creates an extract function from a source file.
|
||||
*
|
||||
* @param {input} a String with a filename, or a String with the file content, or an AST Object.
|
||||
*
|
||||
* @returns an extract. An extract is a Function taking one argument: Globalize, the Globalize Object;
|
||||
* and returning an Array with the formatters and parsers created using the passed Globalize.
|
||||
*/
|
||||
extract(input: string | ESTree.Program): ExtractFunction;
|
||||
|
||||
/**
|
||||
* Generates a JavaScript bundle containing the specified globalize formatters and parsers.
|
||||
*
|
||||
* @param {options} compiler attributes.
|
||||
*
|
||||
* @returns a String with the generated JavaScript bundle (UMD wrapped) including the compiled formatters and
|
||||
* parsers.
|
||||
*/
|
||||
compileExtracts(attributes: CompileExtractsAttributes): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "globalize-compiler" {
|
||||
var globalizeCompiler: GlobalizeCompiler.GlobalizeCompilerStatic;
|
||||
|
||||
export = globalizeCompiler;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="gulp-help-doc.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require('gulp');
|
||||
import usage = require('gulp-help-doc');
|
||||
|
||||
/**
|
||||
* Demo task
|
||||
*
|
||||
* @task {demo}
|
||||
* @arg {env} environment
|
||||
*/
|
||||
gulp.task('demo', function() {});
|
||||
|
||||
let logger: {
|
||||
output: string,
|
||||
log(msg: string): any
|
||||
} = {
|
||||
output: '',
|
||||
log: msg => logger.output += msg + '\n'
|
||||
};
|
||||
|
||||
usage(gulp, {
|
||||
logger: logger,
|
||||
gulpfile: __filename
|
||||
}).then(() => console.log(logger.output));
|
||||
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
// Type definitions for gulp-help-doc
|
||||
// Project: https://github.com/Mikhus/gulp-help-doc
|
||||
// Definitions by: Mikhus <https://github.com/Mikhus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
declare module "gulp-help-doc" {
|
||||
|
||||
import gulp = require('gulp');
|
||||
|
||||
namespace usage {
|
||||
|
||||
interface UsageOptions {
|
||||
/**
|
||||
* Defines max line width for the printed output lines
|
||||
* (by default is 80 characters long)
|
||||
*/
|
||||
lineWidth?: number,
|
||||
|
||||
/**
|
||||
* Defines max width of the column width tasks or args names
|
||||
* (by default is 20 characters long)
|
||||
*/
|
||||
keysColumnWidth?: number,
|
||||
|
||||
/**
|
||||
* Defines number of empty characters for left-padding of the output
|
||||
*/
|
||||
padding?: number,
|
||||
|
||||
/**
|
||||
* Printing engine (by default is console). Accepted any device
|
||||
* which has log() function defined to do output.
|
||||
*/
|
||||
logger?: { log: Function },
|
||||
|
||||
/**
|
||||
* Path to a gulpfile (default is gulpfile.js)
|
||||
* Normally, there is no need to change this option. It may be used
|
||||
* for some special cases, like mocking gulpfile for testing.
|
||||
*/
|
||||
gulpfile?: string
|
||||
}
|
||||
|
||||
interface Usage {
|
||||
(gulp: gulp.Gulp, options?: UsageOptions): Promise<any>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var usage: usage.Usage;
|
||||
|
||||
export = usage;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/// <reference path="js-priority-queue.d.ts" />
|
||||
|
||||
import * as PriorityQueue from "js-priority-queue";
|
||||
|
||||
{
|
||||
var queue = new PriorityQueue<number>({ comparator: (a, b) => b - a });
|
||||
queue.queue(5);
|
||||
queue.queue(3);
|
||||
queue.queue(2);
|
||||
var lowest = queue.dequeue(); // returns 5
|
||||
}
|
||||
{
|
||||
var compareNumbers = (a: number, b: number) => a - b;
|
||||
new PriorityQueue({ comparator: compareNumbers });
|
||||
}
|
||||
{
|
||||
new PriorityQueue({ initialValues: [1, 2, 3] })
|
||||
}
|
||||
{
|
||||
new PriorityQueue({ strategy: PriorityQueue.ArrayStrategy }); // Array
|
||||
new PriorityQueue({ strategy: PriorityQueue.BinaryHeapStrategy }); // Default
|
||||
new PriorityQueue({ strategy: PriorityQueue.BHeapStrategy }); // Slower
|
||||
}
|
||||
{
|
||||
var a: PriorityQueue.PriorityQueueOptions<number>;
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
// Type definitions for js-priority-queue
|
||||
// Project: https://github.com/adamhooper/js-priority-queue
|
||||
// Definitions by: York Yao <https://github.com/plantain-00/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/* =================== USAGE ===================
|
||||
import * as PriorityQueue from "js-priority-queue";
|
||||
var queue = new PriorityQueue<number>({ comparator: (a, b) => b - a });
|
||||
queue.queue(5);
|
||||
=============================================== */
|
||||
|
||||
declare module "js-priority-queue" {
|
||||
class AbstractPriorityQueue<T> {
|
||||
/**
|
||||
* Returns the number of elements in the queue
|
||||
*/
|
||||
public length: number;
|
||||
/**
|
||||
* Creates a priority queue
|
||||
*/
|
||||
constructor(options?: PriorityQueue.PriorityQueueOptions<T>);
|
||||
/**
|
||||
* Inserts a new value in the queue
|
||||
*/
|
||||
public queue(value: T): void;
|
||||
/**
|
||||
* Returns the smallest item in the queue and leaves the queue unchanged
|
||||
*/
|
||||
public peek(): T;
|
||||
/**
|
||||
* Returns the smallest item in the queue and removes it from the queue
|
||||
*/
|
||||
public dequeue(): T;
|
||||
/**
|
||||
* Removes all values from the queue
|
||||
*/
|
||||
public clear(): void;
|
||||
}
|
||||
namespace PriorityQueue {
|
||||
type PriorityQueueOptions<T> = {
|
||||
/**
|
||||
* This is the argument we would pass to Array.prototype.sort
|
||||
*/
|
||||
comparator?: (a: T, b: T) => number;
|
||||
/**
|
||||
* You can also pass initial values, in any order.
|
||||
* With lots of values, it's faster to load them all at once than one at a time.
|
||||
*/
|
||||
initialValues?: T[];
|
||||
/**
|
||||
* According to JsPerf, the fastest strategy for most cases is BinaryHeapStrategy.
|
||||
* Only use ArrayStrategy only if you're queuing items in a very particular order.
|
||||
* Don't use BHeapStrategy, except as a lesson in how sometimes miracles in one programming language aren't great in other languages.
|
||||
*/
|
||||
strategy?: typeof AbstractPriorityQueue;
|
||||
}
|
||||
class ArrayStrategy<T> extends AbstractPriorityQueue<T>{ }
|
||||
class BinaryHeapStrategy<T> extends AbstractPriorityQueue<T>{ }
|
||||
class BHeapStrategy<T> extends AbstractPriorityQueue<T>{ }
|
||||
|
||||
}
|
||||
class PriorityQueue<T> extends AbstractPriorityQueue<T> { }
|
||||
export = PriorityQueue;
|
||||
}
|
||||
Vendored
+14
@@ -80,6 +80,20 @@ declare module "natural" {
|
||||
static restore(classifier: any, stemmer?: Stemmer): BayesClassifier;
|
||||
}
|
||||
|
||||
interface LogisticRegressionClassifierCallback { (err: any, classifier: any): void }
|
||||
class LogisticRegressionClassifier {
|
||||
events: events.EventEmitter;
|
||||
addDocument(text: string, stem: string): void;
|
||||
addDocument(text: string[], stem: string): void;
|
||||
train(): void;
|
||||
classify(observation: string): string;
|
||||
getClassifications(observation: string): string[];
|
||||
save(filename: string, callback: LogisticRegressionClassifierCallback): void;
|
||||
static load(filename: string, stemmer: Stemmer, callback: LogisticRegressionClassifierCallback): void;
|
||||
static restore(classifier: any, stemmer?: Stemmer): LogisticRegressionClassifier;
|
||||
}
|
||||
|
||||
|
||||
interface Phonetic {
|
||||
compare(stringA: string, stringB: string): boolean;
|
||||
process(token: string, maxLength?: number): string;
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
/// <reference path="./react-relay.d.ts" />
|
||||
|
||||
import * as React from "react"
|
||||
import * as Relay from "react-relay"
|
||||
|
||||
interface Props {
|
||||
text: string
|
||||
userId: string
|
||||
}
|
||||
|
||||
interface Response {
|
||||
}
|
||||
|
||||
export default class AddTweetMutation extends Relay.Mutation<Props, Response> {
|
||||
|
||||
getMutation () {
|
||||
return Relay.QL`mutation{addTweet}`
|
||||
}
|
||||
|
||||
getFatQuery () {
|
||||
return Relay.QL`
|
||||
fragment on AddTweetPayload {
|
||||
tweetEdge
|
||||
user
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
getConfigs () {
|
||||
return [{
|
||||
type: "RANGE_ADD",
|
||||
parentName: "user",
|
||||
parentID: this.props.userId,
|
||||
connectionName: "tweets",
|
||||
edgeName: "tweetEdge",
|
||||
rangeBehaviors: {
|
||||
"": "append",
|
||||
},
|
||||
}]
|
||||
}
|
||||
|
||||
getVariables () {
|
||||
return this.props
|
||||
}
|
||||
}
|
||||
Vendored
+112
@@ -0,0 +1,112 @@
|
||||
// Type definitions for react-relay 0.9.2
|
||||
// Project: https://github.com/facebook/relay
|
||||
// Definitions by: Johannes Schickling <https://github.com/graphcool>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react.d.ts"/>
|
||||
|
||||
declare module "react-relay" {
|
||||
import * as React from "react";
|
||||
|
||||
/** Fragments are a hash of functions */
|
||||
interface Fragments {
|
||||
[query: string]: ((variables?: RelayVariables) => string)
|
||||
}
|
||||
|
||||
interface CreateContainerOpts {
|
||||
initialVariables?: Object
|
||||
fragments: Fragments
|
||||
prepareVariables?(prevVariables: RelayVariables): RelayVariables
|
||||
}
|
||||
|
||||
interface RelayVariables {
|
||||
[name: string]: any
|
||||
}
|
||||
|
||||
/** add static getFragment method to the component constructor */
|
||||
interface RelayContainerClass<T> extends React.ComponentClass<T> {
|
||||
getFragment: ((q: string) => string)
|
||||
}
|
||||
|
||||
interface RelayQueryRequestResolve {
|
||||
response: any
|
||||
}
|
||||
|
||||
interface RelayMutationRequest {
|
||||
getQueryString(): string
|
||||
getVariables(): RelayVariables
|
||||
resolve(result: RelayQueryRequestResolve): any
|
||||
reject(errors: any): any
|
||||
}
|
||||
|
||||
interface RelayQueryRequest {
|
||||
resolve(result: RelayQueryRequestResolve): any
|
||||
reject(errors: any): any
|
||||
|
||||
getQueryString(): string
|
||||
getVariables(): RelayVariables
|
||||
getID(): string
|
||||
getDebugName(): string
|
||||
}
|
||||
|
||||
interface RelayNetworkLayer {
|
||||
supports(...options: string[]): boolean
|
||||
}
|
||||
|
||||
class DefaultNetworkLayer implements RelayNetworkLayer {
|
||||
constructor(host: string, options: any)
|
||||
supports(...options: string[]): boolean
|
||||
}
|
||||
|
||||
function createContainer<T>(component: React.ComponentClass<T>, params?: CreateContainerOpts): RelayContainerClass<any>
|
||||
function injectNetworkLayer(networkLayer: RelayNetworkLayer): any
|
||||
function isContainer(component: React.ComponentClass<any>): boolean
|
||||
function QL(...args: any[]): string
|
||||
|
||||
class Route {
|
||||
constructor(params?: RelayVariables)
|
||||
}
|
||||
|
||||
/**
|
||||
* Relay Mutation class, where T are the props it takes and S is the returned payload from Relay.Store.update.
|
||||
* S is typically dynamic as it depends on the data the app is currently using, but it's possible to always
|
||||
* return some data in the payload using REQUIRED_CHILDREN which is where specifying S is the most useful.
|
||||
*/
|
||||
class Mutation<T,S> {
|
||||
props: T
|
||||
|
||||
constructor(props: T)
|
||||
static getFragment(q: string): string
|
||||
}
|
||||
|
||||
interface Transaction {
|
||||
getError(): Error
|
||||
Status(): number
|
||||
}
|
||||
|
||||
interface StoreUpdateCallbacks<T> {
|
||||
onFailure?(transaction: Transaction): any
|
||||
onSuccess?(response: T): any
|
||||
}
|
||||
|
||||
interface Store {
|
||||
commitUpdate(mutation: Mutation<any,any>, callbacks?: StoreUpdateCallbacks<any>): any
|
||||
}
|
||||
|
||||
var Store: Store
|
||||
|
||||
class RootContainer extends React.Component<RootContainerProps,any> {}
|
||||
|
||||
interface RootContainerProps extends React.Props<RootContainer>{
|
||||
Component: RelayContainerClass<any>
|
||||
route: Route
|
||||
renderLoading?(): JSX.Element
|
||||
renderFetched?(data: any): JSX.Element
|
||||
renderFailure?(error: Error, retry: Function): JSX.Element
|
||||
}
|
||||
|
||||
interface RelayProp {
|
||||
variables: any
|
||||
setVariables(variables: Object): void
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,15 @@ let options: sanitize.IOptions = {
|
||||
},
|
||||
transformTags: {
|
||||
'a': sanitize.simpleTransform('a', { 'rel': 'nofollow' }),
|
||||
'img': 'canvas'
|
||||
'img': (tagName: string, attribs: sanitize.Attributes) => {
|
||||
let img = { tagName, attribs };
|
||||
img.attribs['alt'] = 'transformed' ;
|
||||
return img;
|
||||
}
|
||||
},
|
||||
exclusiveFilter: function(frame: sanitize.IFrame) {
|
||||
return frame.tag === 'a' && !frame.text.trim();
|
||||
}
|
||||
return frame.tag === 'a' && !frame.text.trim();
|
||||
}
|
||||
};
|
||||
|
||||
let unsafe = '<div><script>alert("hello");</script></div>';
|
||||
|
||||
Vendored
+6
-5
@@ -1,4 +1,4 @@
|
||||
// Type definitions for sanitize-html 1.12.0
|
||||
// Type definitions for sanitize-html 1.13.0
|
||||
// Project: https://github.com/punkave/sanitize-html
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>, Afshin Darian <https://github.com/afshin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -11,10 +11,10 @@ declare namespace sanitize {
|
||||
type Attributes = { [attr: string]: string };
|
||||
|
||||
|
||||
type Tag = { tagName: string; attributes: Attributes; };
|
||||
type Tag = { tagName: string; attribs: Attributes; text?: string; };
|
||||
|
||||
|
||||
type Transformer = (tagName: string, attributes: Attributes) => Tag;
|
||||
type Transformer = (tagName: string, attribs: Attributes) => Tag;
|
||||
|
||||
|
||||
interface IDefaults {
|
||||
@@ -28,7 +28,7 @@ declare namespace sanitize {
|
||||
|
||||
interface IFrame {
|
||||
tag: string;
|
||||
attributes: { [index: string]: string };
|
||||
attribs: { [index: string]: string };
|
||||
text: string;
|
||||
tagPosition: number;
|
||||
}
|
||||
@@ -40,6 +40,7 @@ declare namespace sanitize {
|
||||
allowedSchemes?: string[];
|
||||
allowedTags?: string[];
|
||||
exclusiveFilter?: (frame: IFrame) => boolean;
|
||||
nonTextTags?: string[];
|
||||
selfClosing?: string[];
|
||||
transformTags?: { [tagName: string]: string | Transformer };
|
||||
}
|
||||
@@ -48,7 +49,7 @@ declare namespace sanitize {
|
||||
var defaults: IDefaults;
|
||||
|
||||
|
||||
function simpleTransform(tagName: string, attributes: Attributes, merge?: boolean): Transformer;
|
||||
function simpleTransform(tagName: string, attribs: Attributes, merge?: boolean): Transformer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path="utf8.d.ts" />
|
||||
|
||||
import * as utf8 from "utf8";
|
||||
|
||||
function test_encode(): void {
|
||||
utf8.encode("\x49");
|
||||
utf8.encode("\uD800\uDC01");
|
||||
}
|
||||
|
||||
function test_decode(): void {
|
||||
utf8.decode("\xC2\x49");
|
||||
utf8.decode("\xF0\x90\x80\x81");
|
||||
}
|
||||
|
||||
function test_version(): void {
|
||||
if (typeof utf8.version === "string") {
|
||||
console.log(utf8.version);
|
||||
}
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for utf8 v2.1.1
|
||||
// Project: https://github.com/mathiasbynens/utf8.js
|
||||
// Definitions by: Nick Zelei <https://github.com/zelein/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "utf8" {
|
||||
/**
|
||||
* A string representing the semantic version number.
|
||||
*/
|
||||
let version: string;
|
||||
/**
|
||||
* Encodes any given JavaScript string (string) as UTF-8, and returns the UTF-8-encoded version of the string.
|
||||
* It throws an error if the input string contains a non-scalar value, i.e. a lone surrogate.
|
||||
* @param {string} inputString
|
||||
*/
|
||||
function encode(inputString: string): string;
|
||||
|
||||
/**
|
||||
* Decodes any given UTF-8-encoded string (byteString) as UTF-8, and returns the UTF-8-decoded version of the string.
|
||||
* It throws an error when malformed UTF-8 is detected.
|
||||
* @param {string} byteString
|
||||
*/
|
||||
function decode(byteString: string): string;
|
||||
}
|
||||
Reference in New Issue
Block a user