mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
merge from master
This commit is contained in:
commit
4e4141faab
@ -726,6 +726,12 @@
|
||||
"sourceRepoURL": "https://github.com/prettymuchbryce/node-http-status",
|
||||
"asOfVersion": "1.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "i18next-browser-languagedetector",
|
||||
"typingsPackageName": "i18next-browser-languagedetector",
|
||||
"sourceRepoURL": "https://github.com/i18next/i18next-browser-languagedetector",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "i18next-xhr-backend",
|
||||
"typingsPackageName": "i18next-xhr-backend",
|
||||
@ -1116,6 +1122,12 @@
|
||||
"sourceRepoURL": "http://onsen.io",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-throttle",
|
||||
"typingsPackageName": "p-throttle",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-throttle",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "param-case",
|
||||
"typingsPackageName": "param-case",
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
"lint": "dtslint types"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dtslint": "github:Microsoft/dtslint#production",
|
||||
"dtslint": "latest",
|
||||
"types-publisher": "github:Microsoft/types-publisher#production"
|
||||
},
|
||||
"dependencies": {}
|
||||
|
||||
@ -97,6 +97,7 @@ let _algoliaIndexSettings: IndexSettings = {
|
||||
minProximity: 0,
|
||||
placeholders: { '': [''] },
|
||||
camelCaseAttributes: [''],
|
||||
sortFacetValuesBy: 'count',
|
||||
};
|
||||
|
||||
let _algoliaQueryParameters: QueryParameters = {
|
||||
@ -150,6 +151,7 @@ let _algoliaQueryParameters: QueryParameters = {
|
||||
synonyms: true,
|
||||
replaceSynonymsInHighlight: false,
|
||||
minProximity: 0,
|
||||
sortFacetValuesBy: 'alpha',
|
||||
};
|
||||
|
||||
let client: Client = algoliasearch('', '');
|
||||
|
||||
30
types/algoliasearch/index.d.ts
vendored
30
types/algoliasearch/index.d.ts
vendored
@ -5,6 +5,7 @@
|
||||
// Aurélien Hervé <https://github.com/aherve>
|
||||
// Samuel Vaillant <https://github.com/samouss>
|
||||
// Kai Eichinger <https://github.com/keichinger>
|
||||
// Nery Ortez <https://github.com/neryortez>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@ -24,25 +25,25 @@ declare namespace algoliasearch {
|
||||
* Query on multiple index
|
||||
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
|
||||
*/
|
||||
search(
|
||||
search<T=any>(
|
||||
queries: {
|
||||
indexName: string;
|
||||
query: string;
|
||||
params: QueryParameters;
|
||||
}[],
|
||||
cb: (err: Error, res: MultiResponse) => void
|
||||
cb: (err: Error, res: MultiResponse<T>) => void
|
||||
): void;
|
||||
/**
|
||||
* Query on multiple index
|
||||
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
|
||||
*/
|
||||
search(
|
||||
search<T=any>(
|
||||
queries: {
|
||||
indexName: string;
|
||||
query: string;
|
||||
params: QueryParameters;
|
||||
}[]
|
||||
): Promise<MultiResponse>;
|
||||
): Promise<MultiResponse<T>>;
|
||||
/**
|
||||
* Query for facet values of a specific facet
|
||||
*/
|
||||
@ -590,14 +591,14 @@ declare namespace algoliasearch {
|
||||
* Search in an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
|
||||
*/
|
||||
search(params: QueryParameters): Promise<Response>;
|
||||
search<T=any>(params: QueryParameters): Promise<Response<T>>;
|
||||
/**
|
||||
* Search in an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
|
||||
*/
|
||||
search(
|
||||
search<T=any>(
|
||||
params: QueryParameters,
|
||||
cb: (err: Error, res: Response) => void
|
||||
cb: (err: Error, res: Response<T>) => void
|
||||
): void;
|
||||
/**
|
||||
* Search in an index
|
||||
@ -1451,6 +1452,11 @@ declare namespace algoliasearch {
|
||||
|
||||
nbShards?: number;
|
||||
userData?: string | object;
|
||||
|
||||
/**
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/
|
||||
*/
|
||||
sortFacetValuesBy?: 'count' | 'alpha';
|
||||
}
|
||||
|
||||
namespace SearchForFacetValues {
|
||||
@ -1776,14 +1782,16 @@ declare namespace algoliasearch {
|
||||
https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/
|
||||
*/
|
||||
camelCaseAttributes?: string[];
|
||||
|
||||
sortFacetValuesBy?: 'count' | 'alpha';
|
||||
}
|
||||
|
||||
interface Response {
|
||||
interface Response<T=any> {
|
||||
/**
|
||||
* Contains all the hits matching the query
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
hits: any[];
|
||||
hits: T[];
|
||||
/**
|
||||
* Current page
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
@ -1842,8 +1850,8 @@ declare namespace algoliasearch {
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
interface MultiResponse {
|
||||
results: Response[];
|
||||
interface MultiResponse<T=any> {
|
||||
results: Response<T>[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
28
types/algoliasearch/lite/index.d.ts
vendored
28
types/algoliasearch/lite/index.d.ts
vendored
@ -6,6 +6,7 @@
|
||||
// Samuel Vaillant <https://github.com/samouss>
|
||||
// Claas Brüggemann <https://github.com/ClaasBrueggemann>
|
||||
// Kai Eichinger <https://github.com/keichinger>
|
||||
// Nery Ortez <https://github.com/neryortez>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@ -25,25 +26,25 @@ declare namespace algoliasearch {
|
||||
* Query on multiple index
|
||||
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
|
||||
*/
|
||||
search(
|
||||
search<T=any>(
|
||||
queries: {
|
||||
indexName: string;
|
||||
query: string;
|
||||
params: QueryParameters;
|
||||
}[],
|
||||
cb: (err: Error, res: MultiResponse) => void
|
||||
cb: (err: Error, res: MultiResponse<T>) => void
|
||||
): void;
|
||||
/**
|
||||
* Query on multiple index
|
||||
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
|
||||
*/
|
||||
search(
|
||||
search<T=any>(
|
||||
queries: {
|
||||
indexName: string;
|
||||
query: string;
|
||||
params: QueryParameters;
|
||||
}[]
|
||||
): Promise<MultiResponse>;
|
||||
): Promise<MultiResponse<T>>;
|
||||
/**
|
||||
* Query for facet values of a specific facet
|
||||
*/
|
||||
@ -109,15 +110,15 @@ declare namespace algoliasearch {
|
||||
* Search in an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
|
||||
*/
|
||||
search(
|
||||
search<T=any>(
|
||||
params: QueryParameters,
|
||||
cb: (err: Error, res: Response) => void
|
||||
cb: (err: Error, res: Response<T>) => void
|
||||
): void;
|
||||
/**
|
||||
* Search in an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
|
||||
*/
|
||||
search(params: QueryParameters): Promise<Response>;
|
||||
search<T=any>(params: QueryParameters): Promise<Response<T>>;
|
||||
/**
|
||||
* Search in an index
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/
|
||||
@ -531,6 +532,11 @@ declare namespace algoliasearch {
|
||||
|
||||
nbShards?: number;
|
||||
userData?: string | object;
|
||||
|
||||
/**
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/
|
||||
*/
|
||||
sortFacetValuesBy?: 'count' | 'alpha';
|
||||
}
|
||||
|
||||
namespace SearchForFacetValues {
|
||||
@ -552,12 +558,12 @@ declare namespace algoliasearch {
|
||||
}
|
||||
}
|
||||
|
||||
interface Response {
|
||||
interface Response<T=any> {
|
||||
/**
|
||||
* Contains all the hits matching the query
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
hits: any[];
|
||||
hits: T[];
|
||||
/**
|
||||
* Current page
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
@ -616,8 +622,8 @@ declare namespace algoliasearch {
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
interface MultiResponse {
|
||||
results: Response[];
|
||||
interface MultiResponse<T=any> {
|
||||
results: Response<T>[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
types/angular-material/index.d.ts
vendored
2
types/angular-material/index.d.ts
vendored
@ -346,7 +346,7 @@ declare module 'angular' {
|
||||
interface IMenuService {
|
||||
close(): void;
|
||||
hide(response?: any, options?: any): IPromise<any>;
|
||||
open(event?: MouseEvent): void;
|
||||
open(event?: MouseEvent | JQueryEventObject): void;
|
||||
}
|
||||
|
||||
interface IColorPalette {
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
// near copy of each of the tests from https://github.com/nodeca/argparse/tree/master/examples
|
||||
|
||||
import { ArgumentParser, RawDescriptionHelpFormatter } from 'argparse';
|
||||
import {
|
||||
ArgumentParser,
|
||||
RawDescriptionHelpFormatter,
|
||||
Action,
|
||||
ActionConstructorOptions,
|
||||
Namespace,
|
||||
} from 'argparse';
|
||||
let args: any;
|
||||
|
||||
const simpleExample = new ArgumentParser({
|
||||
@ -276,3 +282,26 @@ group.addArgument(['--bar'], {
|
||||
help: 'bar help'
|
||||
});
|
||||
formatterExample.printHelp();
|
||||
|
||||
class CustomAction1 extends Action {
|
||||
constructor(options: ActionConstructorOptions) {
|
||||
super(options);
|
||||
}
|
||||
call(parser: ArgumentParser, namespace: Namespace, values: string | string[], optionString: string | null) {
|
||||
console.log('custom action 1');
|
||||
}
|
||||
}
|
||||
|
||||
class CustomAction2 extends Action {
|
||||
call(parser: ArgumentParser, namespace: Namespace, values: string | string[], optionString: string | null) {
|
||||
console.log('custom action 2');
|
||||
}
|
||||
}
|
||||
|
||||
const customActionExample = new ArgumentParser({ addHelp: false });
|
||||
customActionExample.addArgument('--abc', {
|
||||
action: CustomAction1,
|
||||
});
|
||||
customActionExample.addArgument('--def', {
|
||||
action: CustomAction2,
|
||||
});
|
||||
|
||||
14
types/argparse/index.d.ts
vendored
14
types/argparse/index.d.ts
vendored
@ -3,6 +3,7 @@
|
||||
// Definitions by: Andrew Schurman <https://github.com/arcticwaters>
|
||||
// Tomasz Łaziuk <https://github.com/tlaziuk>
|
||||
// Sebastian Silbermann <https://github.com/eps1lon>
|
||||
// Kannan Goundan <https://github.com/cakoose>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@ -79,13 +80,24 @@ export interface ArgumentGroupOptions {
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export abstract class Action {
|
||||
protected dest: string;
|
||||
constructor(options: ActionConstructorOptions);
|
||||
abstract call(parser: ArgumentParser, namespace: Namespace, values: string | string[], optionString: string | null): void;
|
||||
}
|
||||
|
||||
// Passed to the Action constructor. Subclasses are just expected to relay this to
|
||||
// the super() constructor, so using an "opaque type" pattern is probably fine.
|
||||
// Someone may want to fill this out in the future.
|
||||
export type ActionConstructorOptions = number & {_: 'ActionConstructorOptions'};
|
||||
|
||||
export class HelpFormatter { }
|
||||
export class ArgumentDefaultsHelpFormatter { }
|
||||
export class RawDescriptionHelpFormatter { }
|
||||
export class RawTextHelpFormatter { }
|
||||
|
||||
export interface ArgumentOptions {
|
||||
action?: string;
|
||||
action?: string | { new(options: ActionConstructorOptions): Action };
|
||||
optionStrings?: string[];
|
||||
dest?: string;
|
||||
nargs?: string | number;
|
||||
|
||||
@ -21,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"argparse-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,3 +39,59 @@ babel.transformFromAstAsync(parsedAst!, sourceCode, options).then(transformFromA
|
||||
const { code, map, ast } = transformFromAstAsyncResult!;
|
||||
const { body } = ast!.program;
|
||||
});
|
||||
|
||||
function checkOptions(_options: babel.TransformOptions) {}
|
||||
function checkConfigFunction(_config: babel.ConfigFunction) {}
|
||||
|
||||
checkOptions({ envName: 'banana' });
|
||||
// babel uses object destructuring default to provide the envName fallback so null is not allowed
|
||||
// $ExpectError
|
||||
checkOptions({ envName: null });
|
||||
checkOptions({ caller: { name: '@babel/register' } });
|
||||
checkOptions({ caller: { name: 'babel-jest', supportsStaticESM: false } });
|
||||
// don't add an index signature; users should augment the interface instead if they need to
|
||||
// $ExpectError
|
||||
checkOptions({ caller: { name: '', tomato: true } });
|
||||
checkOptions({ rootMode: 'upward-optional' });
|
||||
// $ExpectError
|
||||
checkOptions({ rootMode: 'potato' });
|
||||
|
||||
// $ExpectError
|
||||
checkConfigFunction(() => {});
|
||||
// you technically can do that though you probably shouldn't
|
||||
checkConfigFunction(() => ({}));
|
||||
checkConfigFunction(api => {
|
||||
api.assertVersion(7);
|
||||
api.assertVersion("^7.2");
|
||||
|
||||
api.cache.forever();
|
||||
api.cache.never();
|
||||
api.cache.using(() => true);
|
||||
api.cache.using(() => 1);
|
||||
api.cache.using(() => '1');
|
||||
api.cache.using(() => null);
|
||||
api.cache.using(() => undefined);
|
||||
// $ExpectError
|
||||
api.cache.using(() => ({}));
|
||||
api.cache.invalidate(() => 2);
|
||||
|
||||
// $ExpectType string
|
||||
api.env();
|
||||
|
||||
api.env('development');
|
||||
api.env(['production', 'test']);
|
||||
// $ExpectType 42
|
||||
api.env(name => 42);
|
||||
|
||||
// $ExpectType string
|
||||
api.version;
|
||||
|
||||
return {
|
||||
shouldPrintComment(comment) {
|
||||
// $ExpectType string
|
||||
comment;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
155
types/babel__core/index.d.ts
vendored
155
types/babel__core/index.d.ts
vendored
@ -1,8 +1,9 @@
|
||||
// Type definitions for @babel/core 7.0
|
||||
// Type definitions for @babel/core 7.1
|
||||
// Project: https://github.com/babel/babel/tree/master/packages/babel-core, https://babeljs.io
|
||||
// Definitions by: Troy Gerwien <https://github.com/yortus>
|
||||
// Marvin Hagemeister <https://github.com/marvinhagemeister>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Jessica Franco <https://github.com/Jessidhia>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
@ -54,6 +55,15 @@ export interface TransformOptions {
|
||||
*/
|
||||
root?: string | null;
|
||||
|
||||
/**
|
||||
* This option, combined with the "root" value, defines how Babel chooses its project root.
|
||||
* The different modes define different ways that Babel can process the "root" value to get
|
||||
* the final project root.
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/options#rootmode
|
||||
*/
|
||||
rootMode?: 'root' | 'upward' | 'upward-optional';
|
||||
|
||||
/**
|
||||
* The config file to load Babel's config from. Defaults to searching for "babel.config.js" inside the "root" folder. `false` will disable searching for config files.
|
||||
*
|
||||
@ -82,7 +92,7 @@ export interface TransformOptions {
|
||||
*
|
||||
* Default: env vars
|
||||
*/
|
||||
envName?: string | null;
|
||||
envName?: string;
|
||||
|
||||
/**
|
||||
* Enable code generation
|
||||
@ -112,6 +122,14 @@ export interface TransformOptions {
|
||||
*/
|
||||
cwd?: string | null;
|
||||
|
||||
/**
|
||||
* Utilities may pass a caller object to identify themselves to Babel and
|
||||
* pass capability-related flags for use by configs, presets and plugins.
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/options#caller
|
||||
*/
|
||||
caller?: TransformCaller;
|
||||
|
||||
/**
|
||||
* This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { \/* specific options *\/ } } }`
|
||||
* which will use those options when the `envName` is `production`
|
||||
@ -284,6 +302,14 @@ export interface TransformOptions {
|
||||
wrapPluginVisitorMethod?: ((pluginAlias: string, visitorType: "enter" | "exit", callback: (path: NodePath, state: any) => void) => (path: NodePath, state: any) => void) | null;
|
||||
}
|
||||
|
||||
export interface TransformCaller {
|
||||
// the only required property
|
||||
name: string;
|
||||
// e.g. set to true by `babel-loader` and false by `babel-jest`
|
||||
supportsStaticESM?: boolean;
|
||||
// augment this with a "declare module '@babel/core' { ... }" if you need more keys
|
||||
}
|
||||
|
||||
export type FileResultCallback = (err: Error | null, result: BabelFileResult | null) => any;
|
||||
|
||||
/**
|
||||
@ -528,4 +554,129 @@ export interface CreateConfigItemOptions {
|
||||
*/
|
||||
export function createConfigItem(value: PluginTarget | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined], options?: CreateConfigItemOptions): ConfigItem;
|
||||
|
||||
// NOTE: the documentation says the ConfigAPI also exposes @babel/core's exports, but it actually doesn't
|
||||
/**
|
||||
* @see https://babeljs.io/docs/en/next/config-files#config-function-api
|
||||
*/
|
||||
export interface ConfigAPI {
|
||||
/**
|
||||
* The version string for the Babel version that is loading the config file.
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apiversion
|
||||
*/
|
||||
version: string;
|
||||
/**
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apicache
|
||||
*/
|
||||
cache: SimpleCacheConfigurator;
|
||||
/**
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apienv
|
||||
*/
|
||||
env: EnvFunction;
|
||||
// undocumented; currently hardcoded to return 'false'
|
||||
// async(): boolean
|
||||
/**
|
||||
* This API is used as a way to access the `caller` data that has been passed to Babel.
|
||||
* Since many instances of Babel may be running in the same process with different `caller` values,
|
||||
* this API is designed to automatically configure `api.cache`, the same way `api.env()` does.
|
||||
*
|
||||
* The `caller` value is available as the first parameter of the callback function.
|
||||
* It is best used with something like this to toggle configuration behavior
|
||||
* based on a specific environment:
|
||||
*
|
||||
* @example
|
||||
* function isBabelRegister(caller?: { name: string }) {
|
||||
* return !!(caller && caller.name === "@babel/register")
|
||||
* }
|
||||
* api.caller(isBabelRegister)
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apicallercb
|
||||
*/
|
||||
caller<T extends SimpleCacheKey>(callerCallback: (caller: TransformOptions['caller']) => T): T;
|
||||
/**
|
||||
* While `api.version` can be useful in general, it's sometimes nice to just declare your version.
|
||||
* This API exposes a simple way to do that with:
|
||||
*
|
||||
* @example
|
||||
* api.assertVersion(7) // major version only
|
||||
* api.assertVersion("^7.2")
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apiassertversionrange
|
||||
*/
|
||||
assertVersion(versionRange: number | string): boolean;
|
||||
// NOTE: this is an undocumented reexport from "@babel/parser" but it's missing from its types
|
||||
// tokTypes: typeof tokTypes
|
||||
}
|
||||
|
||||
/**
|
||||
* JS configs are great because they can compute a config on the fly,
|
||||
* but the downside there is that it makes caching harder.
|
||||
* Babel wants to avoid re-executing the config function every time a file is compiled,
|
||||
* because then it would also need to re-execute any plugin and preset functions
|
||||
* referenced in that config.
|
||||
*
|
||||
* To avoid this, Babel expects users of config functions to tell it how to manage caching
|
||||
* within a config file.
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apicache
|
||||
*/
|
||||
export interface SimpleCacheConfigurator {
|
||||
// there is an undocumented call signature that is a shorthand for forever()/never()/using().
|
||||
// (ever: boolean): void
|
||||
// <T extends SimpleCacheKey>(callback: CacheCallback<T>): T
|
||||
/**
|
||||
* Permacache the computed config and never call the function again.
|
||||
*/
|
||||
forever(): void;
|
||||
/**
|
||||
* Do not cache this config, and re-execute the function every time.
|
||||
*/
|
||||
never(): void;
|
||||
/**
|
||||
* Any time the using callback returns a value other than the one that was expected,
|
||||
* the overall config function will be called again and a new entry will be added to the cache.
|
||||
*
|
||||
* @example
|
||||
* api.cache.using(() => process.env.NODE_ENV)
|
||||
*/
|
||||
using<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): T;
|
||||
/**
|
||||
* Any time the using callback returns a value other than the one that was expected,
|
||||
* the overall config function will be called again and all entries in the cache will
|
||||
* be replaced with the result.
|
||||
*
|
||||
* @example
|
||||
* api.cache.invalidate(() => process.env.NODE_ENV)
|
||||
*/
|
||||
invalidate<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): T;
|
||||
}
|
||||
|
||||
// https://github.com/babel/babel/blob/v7.3.3/packages/babel-core/src/config/caching.js#L231
|
||||
export type SimpleCacheKey = string | boolean | number | null | undefined;
|
||||
export type SimpleCacheCallback<T extends SimpleCacheKey> = () => T;
|
||||
|
||||
/**
|
||||
* Since `NODE_ENV` is a fairly common way to toggle behavior, Babel also includes an API function
|
||||
* meant specifically for that. This API is used as a quick way to check the `"envName"` that Babel
|
||||
* was loaded with, which takes `NODE_ENV` into account if no other overriding environment is set.
|
||||
*
|
||||
* @see https://babeljs.io/docs/en/next/config-files#apienv
|
||||
*/
|
||||
export interface EnvFunction {
|
||||
/**
|
||||
* @returns the current `envName` string
|
||||
*/
|
||||
(): string;
|
||||
/**
|
||||
* @returns `true` if the `envName` is `===` any of the given strings
|
||||
*/
|
||||
(envName: string | ReadonlyArray<string>): boolean;
|
||||
// the official documentation is misleading for this one...
|
||||
// this just passes the callback to `cache.using` but with an additional argument.
|
||||
// it returns its result instead of necessarily returning a boolean.
|
||||
<T extends SimpleCacheKey>(envCallback: (envName: NonNullable<TransformOptions['envName']>) => T): T;
|
||||
}
|
||||
|
||||
export type ConfigFunction = (api: ConfigAPI) => TransformOptions;
|
||||
|
||||
export as namespace babel;
|
||||
|
||||
2
types/baidu-app/index.d.ts
vendored
2
types/baidu-app/index.d.ts
vendored
@ -4287,7 +4287,7 @@ declare namespace swan {
|
||||
Methods,
|
||||
Props
|
||||
> = object &
|
||||
ComponentOptions<V, Data | ((this: V) => Data), Methods, Props> &
|
||||
ComponentOptions<V, Data, Methods, Props> &
|
||||
ThisType<CombinedInstance<V, Data, Methods, Readonly<Props>>>;
|
||||
|
||||
interface ComponentRelation<D = any, P = any> {
|
||||
|
||||
23
types/bit-twiddle/bit-twiddle-tests.ts
Normal file
23
types/bit-twiddle/bit-twiddle-tests.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import * as bitTwiddle from "bit-twiddle";
|
||||
|
||||
bitTwiddle.INT_BITS;
|
||||
bitTwiddle.INT_MAX;
|
||||
bitTwiddle.INT_MIN;
|
||||
|
||||
bitTwiddle.sign(5);
|
||||
bitTwiddle.abs(-5);
|
||||
bitTwiddle.min(1, 6);
|
||||
bitTwiddle.max(6, 1);
|
||||
bitTwiddle.isPow2(3);
|
||||
bitTwiddle.log2(3);
|
||||
bitTwiddle.log10(3);
|
||||
bitTwiddle.popCount(4);
|
||||
bitTwiddle.countTrailingZeros(3.0000003);
|
||||
bitTwiddle.nextPow2(31.315);
|
||||
bitTwiddle.prevPow2(31.315);
|
||||
bitTwiddle.parity(123);
|
||||
bitTwiddle.interleave2(12, 24);
|
||||
bitTwiddle.deinterleave2(24, 12);
|
||||
bitTwiddle.interleave3(24, 12, 6);
|
||||
bitTwiddle.deinterleave3(24, 12);
|
||||
bitTwiddle.nextCombination(41.935);
|
||||
101
types/bit-twiddle/index.d.ts
vendored
Normal file
101
types/bit-twiddle/index.d.ts
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
// Type definitions for bit-twiddle 1.0
|
||||
// Project: https://github.com/mikolalysenko/bit-twiddle
|
||||
// Definitions by: Adam Zerella <https://github.com/adamzerella>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.3
|
||||
|
||||
export const INT_BITS: number;
|
||||
export const INT_MAX: number;
|
||||
export const INT_MIN: number;
|
||||
|
||||
/**
|
||||
* Computes the sign of the integer.
|
||||
*/
|
||||
export function sign(value: number): number;
|
||||
|
||||
/**
|
||||
* Returns the absolute value of the integer.
|
||||
*/
|
||||
export function abs(value: number): number;
|
||||
|
||||
/**
|
||||
* Computes the minimum of integers x and y.
|
||||
*/
|
||||
export function min(x: number, y: number): number;
|
||||
|
||||
/**
|
||||
* Computes the maximum of integers x and y.
|
||||
*/
|
||||
export function max(x: number, y: number): number;
|
||||
|
||||
/**
|
||||
* Returns true if value is a power of 2, otherwise false.
|
||||
*/
|
||||
export function isPow2(value: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns an integer approximation of the log-base 2 of value.
|
||||
*/
|
||||
export function log2(value: number): number;
|
||||
|
||||
/**
|
||||
* Returns an integer approximation of the log-base 10 of value.
|
||||
*/
|
||||
export function log10(value: number): number;
|
||||
|
||||
/**
|
||||
* Counts the number of bits set in value.
|
||||
*/
|
||||
export function popCount(value: number): number;
|
||||
|
||||
/**
|
||||
* Counts the number of trailing zeros.
|
||||
*/
|
||||
export function countTrailingZeros(value: number): number;
|
||||
|
||||
/**
|
||||
* Rounds value up to the next power of 2.
|
||||
*/
|
||||
export function nextPow2(value: number): number;
|
||||
|
||||
/**
|
||||
* Rounds value down to the previous power of 2.
|
||||
*/
|
||||
export function prevPow2(value: number): number;
|
||||
|
||||
/**
|
||||
* Computes the parity of the bits in value.
|
||||
*/
|
||||
export function parity(value: number): number;
|
||||
|
||||
/**
|
||||
* Reverses the bits of value.
|
||||
*/
|
||||
export function reverse(value: number): number;
|
||||
|
||||
/**
|
||||
* Interleaves a pair of 16 bit integers. Useful for fast quadtree style indexing.
|
||||
* @see http://en.wikipedia.org/wiki/Z-order_curve
|
||||
*/
|
||||
export function interleave2(x: number, y: number): number;
|
||||
|
||||
/**
|
||||
* Deinterleaves the bits of value, returns the nth part.
|
||||
* If both x and y are 16 bit.
|
||||
*/
|
||||
export function deinterleave2(x: number, y: number): number;
|
||||
|
||||
/**
|
||||
* Interleaves a triple of 10 bit integers. Useful for fast octree indexing.
|
||||
*/
|
||||
export function interleave3(x: number, y: number, z: number): number;
|
||||
|
||||
/**
|
||||
* Same deal as deinterleave2, only for triples instead of pairs.
|
||||
*/
|
||||
export function deinterleave3(x: number, y: number): number;
|
||||
|
||||
/**
|
||||
* Returns next combination ordered colexicographically.
|
||||
*/
|
||||
export function nextCombination(x: number): number;
|
||||
25
types/bit-twiddle/tsconfig.json
Normal file
25
types/bit-twiddle/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [
|
||||
|
||||
],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bit-twiddle-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/bit-twiddle/tslint.json
Normal file
3
types/bit-twiddle/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@ -143,6 +143,8 @@ pdfQueue
|
||||
.on('drained', () => undefined)
|
||||
.on('removed', (job: Queue.Job) => undefined);
|
||||
|
||||
pdfQueue.setMaxListeners(42);
|
||||
|
||||
// test different process methods
|
||||
|
||||
const profileQueue = new Queue('profile');
|
||||
|
||||
3
types/bull/index.d.ts
vendored
3
types/bull/index.d.ts
vendored
@ -17,6 +17,7 @@
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as Redis from "ioredis";
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
/**
|
||||
* This is the Queue constructor.
|
||||
@ -384,7 +385,7 @@ declare namespace Bull {
|
||||
next: number;
|
||||
}
|
||||
|
||||
interface Queue<T = any> {
|
||||
interface Queue<T = any> extends EventEmitter {
|
||||
/**
|
||||
* The name of the queue
|
||||
*/
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
|
||||
import CamlBuilder from 'camljs'
|
||||
|
||||
var caml = new CamlBuilder().Where()
|
||||
.Any(
|
||||
@ -53,3 +53,37 @@ caml = CamlBuilder.Expression()
|
||||
.ToString();
|
||||
|
||||
caml = new CamlBuilder().Where().DateTimeField("Created").GreaterThan(new Date(Date.UTC(2013,0,1))).ToString();
|
||||
|
||||
// Aggregations and extended syntax of GroupBy
|
||||
var query = new CamlBuilder()
|
||||
.View(["Category", { count: "ID" }, { sum: "Amount" }])
|
||||
.Query()
|
||||
.GroupBy("Category", true, 100)
|
||||
.ToString();
|
||||
|
||||
// ContentTypeId field
|
||||
var query = new CamlBuilder()
|
||||
.Where()
|
||||
.TextField("Title").EqualTo("Document")
|
||||
.And()
|
||||
.ContentTypeIdField().BeginsWith("0x101")
|
||||
.ToString();
|
||||
|
||||
// joins
|
||||
var query = new CamlBuilder()
|
||||
.View(["Title", "Country", "Population"])
|
||||
.LeftJoin("Country", "Country").Select("y4r6", "Population")
|
||||
.Query()
|
||||
.Where()
|
||||
.NumberField("Population").LessThan(10)
|
||||
.ToString();
|
||||
|
||||
// RowLimit & Scope
|
||||
var camlBuilder1 = new CamlBuilder()
|
||||
.View(["ID", "Created"])
|
||||
.RowLimit(20, true)
|
||||
.Scope(CamlBuilder.ViewScope.RecursiveAll)
|
||||
.Query()
|
||||
.Where()
|
||||
.TextField("Title").BeginsWith("A")
|
||||
.ToString();
|
||||
|
||||
77
types/camljs/index.d.ts
vendored
77
types/camljs/index.d.ts
vendored
@ -1,8 +1,8 @@
|
||||
// Type definitions for camljs
|
||||
// Project: http://camljs.codeplex.com
|
||||
// Definitions by: Andrey Markeev <http://markeev.com>
|
||||
// Project: https://github.com/andrei-markeev/camljs
|
||||
// Definitions by: Andrey Markeev <https://github.com/andrei-markeev>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
declare class CamlBuilder {
|
||||
constructor();
|
||||
@ -10,25 +10,43 @@ declare class CamlBuilder {
|
||||
Where(): CamlBuilder.IFieldExpression;
|
||||
/** Generate <View> tag for SP.CamlQuery
|
||||
@param viewFields If omitted, default view fields are requested; otherwise, only values for the fields with the specified internal names are returned.
|
||||
Specifying view fields is a good practice, as it decreases traffic between server and client. */
|
||||
View(viewFields?: string[]): CamlBuilder.IView;
|
||||
Specifying view fields is a good practice, as it decreases traffic between server and client.
|
||||
Additionally you can specify aggregated fields, e.g. { count: "<field name>" }, { sum: "<field name>" }, etc.. */
|
||||
View(viewFields?: CamlBuilder.ViewField[]): CamlBuilder.IView;
|
||||
/** Generate <ViewFields> tag for SPServices */
|
||||
ViewFields(viewFields: string[]): CamlBuilder.IFinalizableToString;
|
||||
/** Use for:
|
||||
1. SPServices CAMLQuery attribute
|
||||
2. Creating partial expressions
|
||||
3. In conjunction with Any & All clauses
|
||||
*/
|
||||
*/
|
||||
static Expression(): CamlBuilder.IFieldExpression;
|
||||
static FromXml(xml: string): CamlBuilder.IRawQuery;
|
||||
}
|
||||
declare namespace CamlBuilder {
|
||||
interface IView extends IJoinable, IFinalizable {
|
||||
declare module CamlBuilder {
|
||||
type Aggregation = {
|
||||
count: string;
|
||||
} | {
|
||||
sum: string;
|
||||
} | {
|
||||
avg: string;
|
||||
} | {
|
||||
max: string;
|
||||
} | {
|
||||
min: string;
|
||||
} | {
|
||||
stdev: string;
|
||||
} | {
|
||||
var: string;
|
||||
};
|
||||
type ViewField = string | Aggregation;
|
||||
interface IView extends IFinalizable {
|
||||
/** Define query */
|
||||
Query(): IQuery;
|
||||
/** Define maximum amount of returned records */
|
||||
RowLimit(limit: number, paged?: boolean): IView;
|
||||
/** Define view scope */
|
||||
Scope(scope: ViewScope): IView;
|
||||
}
|
||||
interface IJoinable {
|
||||
/** Join the list you're querying with another list.
|
||||
Joins are only allowed through a lookup field relation.
|
||||
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
|
||||
@ -40,22 +58,39 @@ declare namespace CamlBuilder {
|
||||
@alias alias for the joined list */
|
||||
LeftJoin(lookupFieldInternalName: string, alias: string): IJoin;
|
||||
}
|
||||
interface IJoinable {
|
||||
/** Join the list you're querying with another list.
|
||||
Joins are only allowed through a lookup field relation.
|
||||
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
|
||||
@param alias Alias for the joined list
|
||||
@param fromList (optional) List where the lookup column resides - use it only for nested joins */
|
||||
InnerJoin(lookupFieldInternalName: string, alias: string, fromList?: string): IJoin;
|
||||
/** Join the list you're querying with another list.
|
||||
Joins are only allowed through a lookup field relation.
|
||||
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
|
||||
@param alias Alias for the joined list
|
||||
@param fromList (optional) List where the lookup column resides - use it only for nested joins */
|
||||
LeftJoin(lookupFieldInternalName: string, alias: string, fromList?: string): IJoin;
|
||||
}
|
||||
interface IJoin extends IJoinable {
|
||||
/** Select projected field for using in the main Query body
|
||||
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
|
||||
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
|
||||
}
|
||||
interface IProjectableView extends IView {
|
||||
interface IProjectableView extends IJoinable {
|
||||
/** Define query */
|
||||
Query(): IQuery;
|
||||
/** Define maximum amount of returned records */
|
||||
RowLimit(limit: number, paged?: boolean): IView;
|
||||
/** Define view scope */
|
||||
Scope(scope: ViewScope): IView;
|
||||
/** Select projected field for using in the main Query body
|
||||
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
|
||||
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
|
||||
}
|
||||
enum ViewScope {
|
||||
/** */
|
||||
Recursive = 0,
|
||||
/** */
|
||||
RecursiveAll = 1,
|
||||
/** */
|
||||
FilesOnly = 2,
|
||||
}
|
||||
interface IQuery extends IGroupable {
|
||||
@ -85,8 +120,9 @@ declare namespace CamlBuilder {
|
||||
}
|
||||
interface IGroupable extends ISortable {
|
||||
/** Adds GroupBy clause to the query.
|
||||
@param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved. */
|
||||
GroupBy(fieldInternalName: any): IGroupedQuery;
|
||||
@param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved.
|
||||
@param groupLimit Return only first N groups */
|
||||
GroupBy(fieldInternalName: any, collapse?: boolean, groupLimit?: number): IGroupedQuery;
|
||||
}
|
||||
interface IExpression extends IGroupable {
|
||||
/** Adds And clause to the query. */
|
||||
@ -113,6 +149,12 @@ declare namespace CamlBuilder {
|
||||
Any(conditions: IExpression[]): IExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Text */
|
||||
TextField(internalName: string): ITextFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is ContentTypeId */
|
||||
ContentTypeIdField(internalName?: string): ITextFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Choice */
|
||||
ChoiceField(internalName: string): ITextFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Computed */
|
||||
ComputedField(internalName: string): ITextFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Boolean */
|
||||
BooleanField(internalName: string): IBooleanFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is URL */
|
||||
@ -360,7 +402,7 @@ declare namespace CamlBuilder {
|
||||
Year = 4,
|
||||
}
|
||||
class Internal {
|
||||
static createView(viewFields?: string[]): IView;
|
||||
static createView(viewFields?: ViewField[]): IView;
|
||||
static createViewFields(viewFields: string[]): IFinalizableToString;
|
||||
static createWhere(): IFieldExpression;
|
||||
static createExpression(): IFieldExpression;
|
||||
@ -401,3 +443,4 @@ declare namespace CamlBuilder {
|
||||
};
|
||||
}
|
||||
}
|
||||
export = CamlBuilder;
|
||||
|
||||
@ -14,7 +14,8 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
@ -18,6 +18,9 @@ const Memory: EnginePrototypeOrObject = {
|
||||
|
||||
const client = new Client<string>(Memory, { partition: 'cache' });
|
||||
|
||||
client.start().then(() => {});
|
||||
client.stop().then(() => {});
|
||||
|
||||
const cache = new Policy({
|
||||
expiresIn: 5000,
|
||||
}, client, 'cache');
|
||||
|
||||
2
types/catbox/index.d.ts
vendored
2
types/catbox/index.d.ts
vendored
@ -23,7 +23,7 @@ export class Client<T> implements ClientApi<T> {
|
||||
/** start() - creates a connection to the cache server. Must be called before any other method is available. */
|
||||
start(): Promise<void>;
|
||||
/** stop() - terminates the connection to the cache server. */
|
||||
stop(): void;
|
||||
stop(): Promise<void>;
|
||||
/**
|
||||
* get(key, callback) - retrieve an item from the cache engine if found where:
|
||||
* * key - a cache key object (see [ICacheKey]).
|
||||
|
||||
2
types/chrome/index.d.ts
vendored
2
types/chrome/index.d.ts
vendored
@ -5246,7 +5246,7 @@ declare namespace chrome.runtime {
|
||||
|
||||
export interface PortMessageEvent extends chrome.events.Event<(message: any, port: Port) => void> { }
|
||||
|
||||
export interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response: any) => void) => void> { }
|
||||
export interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void> { }
|
||||
|
||||
export interface ExtensionConnectEvent extends chrome.events.Event<(port: Port) => void> { }
|
||||
|
||||
|
||||
2
types/cordova-sqlite-storage/index.d.ts
vendored
2
types/cordova-sqlite-storage/index.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
// Type definitions for cordova-sqlite-storage 1.5
|
||||
// Project: https://github.com/litehelpers/Cordova-sqlite-storage
|
||||
// Project: https://github.com/xpbrew/cordova-sqlite-storage
|
||||
// Definitions by: rafw87 <https://github.com/rafw87>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
23
types/cytoscape/index.d.ts
vendored
23
types/cytoscape/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for Cytoscape.js 3.2
|
||||
// Type definitions for Cytoscape.js 3.3
|
||||
// Project: http://js.cytoscape.org/
|
||||
// Definitions by: Fabian Schmidt and Fred Eisele <https://github.com/phreed>
|
||||
// Shenghan Gao <https://github.com/wy193777>
|
||||
@ -464,6 +464,27 @@ declare namespace cytoscape {
|
||||
*/
|
||||
endBatch(): void;
|
||||
|
||||
/**
|
||||
* Attaches the instance to the specified container for visualisation.
|
||||
* http://js.cytoscape.org/#cy.mount
|
||||
*
|
||||
* If the core instance is headless prior to calling cy.mount(), then
|
||||
* the instance will no longer be headless and the visualisation will
|
||||
* be shown in the specified container. If the core instance is
|
||||
* non-headless prior to calling cy.mount(), then the visualisation
|
||||
* is swapped from the prior container to the specified container.
|
||||
*/
|
||||
mount(element: Element): void;
|
||||
|
||||
/**
|
||||
* Remove the instance from its current container.
|
||||
* http://js.cytoscape.org/#cy.unmount
|
||||
*
|
||||
* This function sets the instance to be headless after unmounting from
|
||||
* the current container.
|
||||
*/
|
||||
unmount(): void;
|
||||
|
||||
/**
|
||||
* A convenience function to explicitly destroy the Core.
|
||||
* http://js.cytoscape.org/#cy.destroy
|
||||
|
||||
@ -608,7 +608,8 @@ const testObject = {
|
||||
};
|
||||
|
||||
const p1: Array<number | string | Date | number[]> = d3Array.permute(testObject, ['name', 'val', 'when', 'more']);
|
||||
const p2: Array<Date | number[]> = d3Array.permute(testObject, ['when', 'more']);
|
||||
// $ExpectType: Array<Date | number[]>
|
||||
const p2 = d3Array.permute(testObject, ['when', 'more']);
|
||||
// $ExpectError
|
||||
const p3 = d3Array.permute(testObject, ['when', 'unknown']);
|
||||
|
||||
|
||||
2
types/debug/index.d.ts
vendored
2
types/debug/index.d.ts
vendored
@ -38,7 +38,7 @@ declare namespace debug {
|
||||
(formatter: any, ...args: any[]): void;
|
||||
|
||||
enabled: boolean;
|
||||
log: (v: any) => string;
|
||||
log: (...args: any[]) => any;
|
||||
namespace: string;
|
||||
extend: (namespace: string, delimiter?: string) => Debugger;
|
||||
}
|
||||
|
||||
4
types/ej.web.all/index.d.ts
vendored
4
types/ej.web.all/index.d.ts
vendored
@ -8,8 +8,8 @@
|
||||
|
||||
/*!
|
||||
* filename: ej.web.all.d.ts
|
||||
* version : 16.4.0.42
|
||||
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved.
|
||||
* version : 16.4.0.52
|
||||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved.
|
||||
* Use of this code is subject to the terms of our license.
|
||||
* A copy of the current license can be obtained at any time by e-mailing
|
||||
* licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
|
||||
2
types/elliptic/index.d.ts
vendored
2
types/elliptic/index.d.ts
vendored
@ -187,7 +187,7 @@ export class ec {
|
||||
|
||||
export namespace ec {
|
||||
interface GenKeyPairOptions {
|
||||
pers: any;
|
||||
pers?: any;
|
||||
entropy: any;
|
||||
persEnc?: string;
|
||||
entropyEnc?: string;
|
||||
|
||||
2
types/emojione/index.d.ts
vendored
2
types/emojione/index.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
// Type definitions for emojione 2.2
|
||||
// Project: https://github.com/Ranks/emojione, http://www.emojione.com
|
||||
// Project: https://github.com/Ranks/emojione, https://www.emojione.com
|
||||
// Definitions by: Danilo Bargen <https://github.com/dbrgn>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
@ -412,6 +412,7 @@ async () => {
|
||||
{ resize: { width: 300 } },
|
||||
{ resize: { height: 300 } },
|
||||
{ resize: { height: 300, width: 300 } },
|
||||
{ crop: { originX: 0, originY: 0, height: 300, width: 300 } }
|
||||
], {
|
||||
compress: 0.75
|
||||
});
|
||||
|
||||
12
types/expo/index.d.ts
vendored
12
types/expo/index.d.ts
vendored
@ -1952,14 +1952,16 @@ export namespace ImageManipulator {
|
||||
}
|
||||
|
||||
interface Flip {
|
||||
flip?: { vertical?: boolean; horizontal?: boolean };
|
||||
flip: { vertical?: boolean; horizontal?: boolean };
|
||||
}
|
||||
|
||||
interface Crop {
|
||||
originX: number;
|
||||
originY: number;
|
||||
width: number;
|
||||
height: number;
|
||||
crop: {
|
||||
originX: number;
|
||||
originY: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface ImageResult {
|
||||
|
||||
22
types/express-urlrewrite/express-urlrewrite-tests.ts
Normal file
22
types/express-urlrewrite/express-urlrewrite-tests.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import * as express from "express";
|
||||
|
||||
import rewrite = require("express-urlrewrite");
|
||||
|
||||
declare const app: express.Application;
|
||||
|
||||
app.use(rewrite(/^\/i(\w+)/, "/items/$1"));
|
||||
|
||||
app.use(rewrite("/:src..:dst", "/commits/$1/to/$2"));
|
||||
app.use(rewrite("/:src..:dst", "/commits/:src/to/:dst"));
|
||||
|
||||
app.use(rewrite("/js/*", "/public/assets/js/$1"));
|
||||
|
||||
app.use(rewrite("/file\\?param=:param", "/file/:param"));
|
||||
|
||||
app.use(rewrite("/path", "/anotherpath?param=some"));
|
||||
|
||||
app.get("/route/:var", rewrite("/rewritten/:var"));
|
||||
|
||||
declare const someMw: express.Handler;
|
||||
|
||||
app.get("/rewritten/:var", someMw);
|
||||
12
types/express-urlrewrite/index.d.ts
vendored
Normal file
12
types/express-urlrewrite/index.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
// Type definitions for express-urlrewrite 1.2
|
||||
// Project: https://github.com/kapouer/express-urlrewrite
|
||||
// Definitions by: Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import * as express from "express";
|
||||
|
||||
declare function rewrite(s: string): express.Handler;
|
||||
declare function rewrite(s: string | RegExp, t: string): express.Handler;
|
||||
|
||||
export = rewrite;
|
||||
@ -6,23 +6,18 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"i18next-browser-languagedetector": [
|
||||
"i18next-browser-languagedetector/v0"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"i18next-browser-languagedetector-tests.ts"
|
||||
"express-urlrewrite-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
12
types/favicons/index.d.ts
vendored
12
types/favicons/index.d.ts
vendored
@ -9,7 +9,7 @@
|
||||
import { Duplex } from "stream";
|
||||
|
||||
declare namespace favicons {
|
||||
interface Configuration {
|
||||
interface Configuration {
|
||||
/** Path for overriding default icons path @default "/" */
|
||||
path: string;
|
||||
/** Your application's name @default null */
|
||||
@ -38,6 +38,8 @@ declare namespace favicons {
|
||||
version: string;
|
||||
/** Print logs to console? @default false */
|
||||
logging: boolean;
|
||||
/** Use nearest neighbor resampling to preserve hard edges on pixel art @default false */
|
||||
pixel_art: boolean;
|
||||
/**
|
||||
* Platform Options:
|
||||
* - offset - offset in percentage
|
||||
@ -66,18 +68,18 @@ declare namespace favicons {
|
||||
}>;
|
||||
}
|
||||
|
||||
interface FavIconResponse {
|
||||
interface FavIconResponse {
|
||||
images: Array<{ name: string; contents: Buffer }>;
|
||||
files: Array<{ name: string; contents: Buffer }>;
|
||||
html: string[];
|
||||
}
|
||||
|
||||
type Callback = (error: Error | null, response: FavIconResponse) => void;
|
||||
type Callback = (error: Error | null, response: FavIconResponse) => void;
|
||||
|
||||
/** You can programmatically access Favicons configuration (icon filenames, HTML, manifest files, etc) with this export */
|
||||
const config: Configuration;
|
||||
const config: Configuration;
|
||||
|
||||
function stream(configuration?: Configuration): Duplex;
|
||||
function stream(configuration?: Configuration): Duplex;
|
||||
}
|
||||
/**
|
||||
* Generate favicons
|
||||
|
||||
2
types/firefox-webext-browser/index.d.ts
vendored
2
types/firefox-webext-browser/index.d.ts
vendored
@ -3188,7 +3188,7 @@ declare namespace browser.storage {
|
||||
* @param changes Object mapping each key that changed to its corresponding `storage.StorageChange` for that item.
|
||||
* @param areaName The name of the storage area (`"sync"`, `"local"` or `"managed"`) the changes are for.
|
||||
*/
|
||||
const onChanged: WebExtEvent<(changes: StorageChange, areaName: string) => void>;
|
||||
const onChanged: WebExtEvent<(changes: {[key: string]: StorageChange}, areaName: string) => void>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
6
types/hexo/package.json
Normal file
6
types/hexo/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"moment": "^2.19.4"
|
||||
}
|
||||
}
|
||||
@ -1,61 +0,0 @@
|
||||
import * as i18next from "i18next";
|
||||
import * as LngDetector from "i18next-browser-languagedetector";
|
||||
|
||||
const options: LngDetector.DetectorOptions = {
|
||||
// order and from where user language should be detected
|
||||
order: ["querystring", "cookie", "localStorage", "navigator", "htmlTag"],
|
||||
|
||||
// keys or params to lookup language from
|
||||
lookupQuerystring: "lng",
|
||||
lookupCookie: "i18next",
|
||||
lookupLocalStorage: "i18nextLng",
|
||||
|
||||
// cache user language on
|
||||
caches: ["localStorage", "cookie"],
|
||||
excludeCacheFor: ["cimode"], // languages to not persist (cookie, localStorage)
|
||||
|
||||
// optional expire and domain for set cookie
|
||||
cookieMinutes: 10,
|
||||
cookieDomain: "myDomain",
|
||||
|
||||
// optional htmlTag with lang attribute, the default is:
|
||||
htmlTag: document.documentElement
|
||||
};
|
||||
|
||||
i18next.use(LngDetector).init({
|
||||
detection: options
|
||||
});
|
||||
|
||||
const customDetector: LngDetector.CustomDetector = {
|
||||
name: "myDetectorsName",
|
||||
|
||||
lookup(options: LngDetector.DetectorOptions) {
|
||||
// options -> are passed in options
|
||||
return "en";
|
||||
},
|
||||
|
||||
cacheUserLanguage(lng: string, options: LngDetector.DetectorOptions) {
|
||||
// options -> are passed in options
|
||||
// lng -> current language, will be called after init and on changeLanguage
|
||||
|
||||
// store it
|
||||
}
|
||||
};
|
||||
|
||||
const customDetector2: LngDetector.CustomDetector = {
|
||||
name: "myDetectorsName",
|
||||
lookup(options: LngDetector.DetectorOptions) {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
const lngDetector = new LngDetector(null, options);
|
||||
|
||||
lngDetector.init(options);
|
||||
lngDetector.addDetector(customDetector);
|
||||
|
||||
i18next
|
||||
.use(lngDetector)
|
||||
.init({
|
||||
detection: options
|
||||
});
|
||||
@ -1,65 +0,0 @@
|
||||
// Type definitions for i18next-browser-languagedetector 2.0
|
||||
// Project: http://i18next.com/, https://github.com/i18next/i18next-browser-languagedetector
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>, Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
declare namespace i18nextBrowserLanguageDetector {
|
||||
interface DetectorOptions {
|
||||
/**
|
||||
* order and from where user language should be detected
|
||||
*/
|
||||
order?: Array<"querystring" | "cookie" | "localStorage" | "navigator" | "htmlTag" | string>;
|
||||
|
||||
/**
|
||||
* keys or params to lookup language from
|
||||
*/
|
||||
lookupQuerystring?: string;
|
||||
lookupCookie?: string;
|
||||
lookupLocalStorage?: string;
|
||||
|
||||
/**
|
||||
* cache user language on
|
||||
*/
|
||||
caches?: string[];
|
||||
|
||||
/**
|
||||
* languages to not persist (cookie, localStorage)
|
||||
*/
|
||||
excludeCacheFor?: string[];
|
||||
|
||||
/**
|
||||
* optional expire and domain for set cookie
|
||||
* @default 10
|
||||
*/
|
||||
cookieMinutes?: number;
|
||||
cookieDomain?: string;
|
||||
|
||||
/**
|
||||
* optional htmlTag with lang attribute
|
||||
* @default document.documentElement
|
||||
*/
|
||||
htmlTag?: HTMLElement;
|
||||
}
|
||||
|
||||
interface CustomDetector {
|
||||
name: string;
|
||||
cacheUserLanguage?(lng: string, options: DetectorOptions): void;
|
||||
lookup(options: DetectorOptions): string | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
declare class i18nextBrowserLanguageDetector {
|
||||
constructor(services?: any, options?: i18nextBrowserLanguageDetector.DetectorOptions);
|
||||
/**
|
||||
* Adds detector.
|
||||
*/
|
||||
addDetector(detector: i18nextBrowserLanguageDetector.CustomDetector): i18nextBrowserLanguageDetector;
|
||||
|
||||
/**
|
||||
* Initializes detector.
|
||||
*/
|
||||
init(options?: i18nextBrowserLanguageDetector.DetectorOptions): void;
|
||||
}
|
||||
|
||||
export = i18nextBrowserLanguageDetector;
|
||||
@ -1,42 +0,0 @@
|
||||
import * as i18next from 'i18next';
|
||||
import LngDetector from 'i18next-browser-languagedetector';
|
||||
|
||||
const options = {
|
||||
// order and from where user language should be detected
|
||||
order: ['querystring', 'cookie', 'localStorage', 'navigator'],
|
||||
|
||||
// keys or params to lookup language from
|
||||
lookupQuerystring: 'lng',
|
||||
lookupCookie: 'i18next',
|
||||
lookupLocalStorage: 'i18nextLng',
|
||||
|
||||
// cache user language on
|
||||
caches: ['localStorage', 'cookie'],
|
||||
|
||||
// optional expire and domain for set cookie
|
||||
cookieMinutes: 10,
|
||||
cookieDomain: 'myDomain'
|
||||
};
|
||||
const myDetector = {
|
||||
name: 'myDetectorsName',
|
||||
|
||||
lookup(options: {}) {
|
||||
// options -> are passed in options
|
||||
return 'en';
|
||||
},
|
||||
|
||||
cacheUserLanguage(lng: string, options: {}) {
|
||||
// options -> are passed in options
|
||||
// lng -> current language, will be called after init and on changeLanguage
|
||||
|
||||
// store it
|
||||
}
|
||||
};
|
||||
|
||||
i18next.use(LngDetector).init({
|
||||
detection: options
|
||||
});
|
||||
|
||||
const lngDetector = new LngDetector(null, options);
|
||||
lngDetector.init(options);
|
||||
lngDetector.addDetector(myDetector);
|
||||
@ -1,58 +0,0 @@
|
||||
// Type definitions for i18next-browser-languagedetector 0.0
|
||||
// Project: http://i18next.com/
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>, Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as i18next from "i18next";
|
||||
|
||||
declare namespace I18next {
|
||||
interface I18nextStatic extends i18nextBrowserLanguageDetector.I18nextStatic { }
|
||||
interface I18nextOptions extends i18nextBrowserLanguageDetector.I18nextOptions { }
|
||||
}
|
||||
|
||||
declare namespace i18nextBrowserLanguageDetector {
|
||||
/** Interface for Language detector options. */
|
||||
interface LanguageDetectorOptions {
|
||||
caches?: string[] | boolean;
|
||||
cookieDomain?: string;
|
||||
cookieExpirationDate?: Date;
|
||||
lookupCookie?: string;
|
||||
lookupFromPathIndex?: number;
|
||||
lookupQuerystring?: string;
|
||||
lookupSession?: string;
|
||||
order?: string[];
|
||||
}
|
||||
|
||||
/** Interface for custom detector. */
|
||||
interface CustomDetector {
|
||||
name: string;
|
||||
|
||||
// todo: Checks parameters type.
|
||||
cacheUserLanguage(lng: string, options: {}): void;
|
||||
lookup(options: {}): string;
|
||||
}
|
||||
|
||||
/** i18next options. */
|
||||
interface I18nextOptions {
|
||||
detection?: LanguageDetectorOptions;
|
||||
}
|
||||
|
||||
/** i18next interface. */
|
||||
interface I18nextStatic {
|
||||
use(module: LngDetector): I18nextStatic;
|
||||
}
|
||||
|
||||
/** i18next language detection. */
|
||||
class LngDetector {
|
||||
constructor(services?: any, options?: LanguageDetectorOptions);
|
||||
|
||||
/** Adds detector. */
|
||||
addDetector(detector: CustomDetector): LngDetector;
|
||||
|
||||
/** Initializes detector. */
|
||||
init(options?: LanguageDetectorOptions): void;
|
||||
}
|
||||
}
|
||||
|
||||
export default i18nextBrowserLanguageDetector.LngDetector;
|
||||
@ -1,11 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"interface-name": [
|
||||
false
|
||||
],
|
||||
"no-empty-interface": [
|
||||
false
|
||||
]
|
||||
}
|
||||
}
|
||||
9
types/indefinite/indefinite-tests.ts
Normal file
9
types/indefinite/indefinite-tests.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { indefinite } from "indefinite";
|
||||
|
||||
const anApple = indefinite("apple"); // "an apple"
|
||||
const aBanana = indefinite('banana'); // "a banana"
|
||||
const AnApple = indefinite('apple', { capitalize: true }); // "An apple"
|
||||
const anEight = indefinite("8"); // "an 8"
|
||||
const anEightAsNumber = indefinite(8); // "an 8"
|
||||
const a1892 = indefinite("1892"); // "a 1892" -> read "a one thousand eight hundred ninety-two"
|
||||
const a1892AsColloquial = indefinite("1892", { numbers: "colloquial" }); // "an 1892" -> read "an eighteen ninety-two"
|
||||
11
types/indefinite/index.d.ts
vendored
Normal file
11
types/indefinite/index.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
// Type definitions for indefinite 2.2
|
||||
// Project: https://github.com/tandrewnichols/indefinite
|
||||
// Definitions by: omaishar <https://github.com/omaishr>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface Options {
|
||||
capitalize?: boolean;
|
||||
caseInsensitive?: boolean;
|
||||
numbers?: "colloquial";
|
||||
}
|
||||
export function indefinite(word: string | number, opts?: Options): string;
|
||||
23
types/indefinite/tsconfig.json
Normal file
23
types/indefinite/tsconfig.json
Normal 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",
|
||||
"indefinite-tests.ts"
|
||||
]
|
||||
}
|
||||
39
types/ink-spinner/index.d.ts
vendored
Normal file
39
types/ink-spinner/index.d.ts
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
// Type definitions for ink-spinner 2.0
|
||||
// Project: https://github.com/vadimdemedes/ink-spinner#readme
|
||||
// Definitions by: Łukasz Ostrowski <https://github.com/lukostry>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { Chalk } from 'chalk';
|
||||
import * as cliSpinners from 'cli-spinners';
|
||||
import { Component } from 'ink';
|
||||
|
||||
type StringifyPartial<T> = {
|
||||
[P in keyof T]?: string;
|
||||
};
|
||||
|
||||
type BooleansPartial<T> = {
|
||||
[P in keyof T]?: boolean;
|
||||
};
|
||||
|
||||
type TupleOfNumbersPartial<T> = {
|
||||
[P in keyof T]?: [number, number, number];
|
||||
};
|
||||
// Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html
|
||||
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
type ChalkColorModels = Pick<Chalk, 'rgb' | 'hsl' | 'hsv' | 'hwb' | 'bgRgb' | 'bgHsl' | 'bgHsv' | 'bgHwb'>;
|
||||
type ChalkKeywordsAndHexes = Pick<Chalk, 'keyword' | 'hex' | 'bgKeyword' | 'bgHex'>;
|
||||
type ChalkCommons = Omit<Chalk, keyof ChalkColorModels | keyof ChalkKeywordsAndHexes | 'constructor' | 'level' | 'enabled'>;
|
||||
|
||||
interface SpinnerProps {
|
||||
type?: cliSpinners.SpinnerName;
|
||||
}
|
||||
|
||||
type ChalkProps = BooleansPartial<ChalkCommons>
|
||||
& StringifyPartial<ChalkKeywordsAndHexes>
|
||||
& TupleOfNumbersPartial<ChalkColorModels>;
|
||||
|
||||
declare class Spinner extends Component<SpinnerProps & ChalkProps> { }
|
||||
|
||||
export = Spinner;
|
||||
10
types/ink-spinner/ink-spinner-tests.tsx
Normal file
10
types/ink-spinner/ink-spinner-tests.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
/** @jsx h */
|
||||
import { h } from 'ink';
|
||||
import Spinner from 'ink-spinner';
|
||||
// NOTE: `import Spinner = require('ink-spinner');` will work as well.
|
||||
// If importing using ES6 default import as above,
|
||||
// `allowSyntheticDefaultImports` flag in compiler options needs to be set to `true`
|
||||
|
||||
const Demo = () => {
|
||||
return <Spinner type="line" rgb={[255, 255, 255]} />;
|
||||
};
|
||||
25
types/ink-spinner/tsconfig.json
Normal file
25
types/ink-spinner/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"jsx": "react",
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ink-spinner-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/ink-spinner/tslint.json
Normal file
1
types/ink-spinner/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
15
types/iobroker/index.d.ts
vendored
15
types/iobroker/index.d.ts
vendored
@ -900,7 +900,7 @@ declare global {
|
||||
q?: boolean;
|
||||
addID?: boolean;
|
||||
limit?: number;
|
||||
ignoreNull: boolean;
|
||||
ignoreNull?: boolean;
|
||||
sessionId?: any;
|
||||
aggregate?: "minmax" | "min" | "max" | "average" | "total" | "count" | "none";
|
||||
}
|
||||
@ -1627,11 +1627,11 @@ declare global {
|
||||
removeAllListeners(event?: "ready" | "unload" | "stateChange" | "objectChange" | "message"): this;
|
||||
} // end interface Adapter
|
||||
|
||||
type ReadyHandler = () => void;
|
||||
type ObjectChangeHandler = (id: string, obj: ioBroker.Object | null | undefined) => void;
|
||||
type StateChangeHandler = (id: string, obj: State | null | undefined) => void;
|
||||
type MessageHandler = (obj: Message) => void;
|
||||
type UnloadHandler = (callback: EmptyCallback) => void;
|
||||
type ReadyHandler = () => void | Promise<void>;
|
||||
type ObjectChangeHandler = (id: string, obj: ioBroker.Object | null | undefined) => void | Promise<void>;
|
||||
type StateChangeHandler = (id: string, obj: State | null | undefined) => void | Promise<void>;
|
||||
type MessageHandler = (obj: Message) => void | Promise<void>;
|
||||
type UnloadHandler = (callback: EmptyCallback) => void | Promise<void>;
|
||||
|
||||
type EmptyCallback = () => void;
|
||||
type ErrorCallback = (err?: string) => void;
|
||||
@ -1682,7 +1682,8 @@ declare global {
|
||||
type SetStateCallback = (err: string | null, id?: string) => void;
|
||||
type SetStateChangedCallback = (err: string | null, id: string, notChanged: boolean) => void;
|
||||
type DeleteStateCallback = (err: string | null, id?: string) => void;
|
||||
type GetHistoryCallback = (err: string | null, result: Array<(State & { id?: string })>, step: number, sessionId?: string) => void;
|
||||
type GetHistoryResult = Array<(State & { id?: string })>;
|
||||
type GetHistoryCallback = (err: string | null, result: GetHistoryResult, step: number, sessionId?: string) => void;
|
||||
|
||||
/** Contains the return values of readDir */
|
||||
interface ReadDirResult {
|
||||
|
||||
@ -20,6 +20,16 @@ adapter
|
||||
;
|
||||
adapter.removeAllListeners();
|
||||
|
||||
// Test adapter constructor options
|
||||
let adapterOptions: ioBroker.AdapterOptions = {
|
||||
name: "foo",
|
||||
ready: readyHandler,
|
||||
stateChange: stateChangeHandler,
|
||||
objectChange: objectChangeHandler,
|
||||
message: messageHandler,
|
||||
unload: unloadHandler,
|
||||
};
|
||||
|
||||
function readyHandler() { }
|
||||
|
||||
function stateChangeHandler(id: string, state: ioBroker.State | null | undefined) {
|
||||
@ -260,6 +270,8 @@ adapter.subscribeForeignStatesAsync("*").catch(handleError);
|
||||
adapter.unsubscribeStatesAsync("*").catch(handleError);
|
||||
adapter.unsubscribeForeignStatesAsync("*").catch(handleError);
|
||||
|
||||
adapter.getHistory("state.id", {}, (err, result: ioBroker.GetHistoryResult) => {});
|
||||
|
||||
// Repro from https://github.com/ioBroker/adapter-core/issues/3
|
||||
const repro1: ioBroker.ObjectChangeHandler = (id, obj) => {
|
||||
if (!obj || !obj.common) return;
|
||||
|
||||
20
types/ioredis/index.d.ts
vendored
20
types/ioredis/index.d.ts
vendored
@ -272,7 +272,7 @@ declare namespace IORedis {
|
||||
hgetBuffer(key: KeyType, field: string, callback: (err: Error, res: Buffer) => void): void;
|
||||
hgetBuffer(key: KeyType, field: string): Promise<Buffer>;
|
||||
|
||||
hmset(key: KeyType, field: string, value: any, ...args: string[]): Promise<0 | 1>;
|
||||
hmset(key: KeyType, ...args: any[]): Promise<0 | 1>;
|
||||
hmset(key: KeyType, data: any, callback: (err: Error, res: 0 | 1) => void): void;
|
||||
hmset(key: KeyType, data: any): Promise<0 | 1>;
|
||||
|
||||
@ -313,9 +313,13 @@ declare namespace IORedis {
|
||||
getset(key: KeyType, value: any, callback: (err: Error, res: string | null) => void): void;
|
||||
getset(key: KeyType, value: any): Promise<string | null>;
|
||||
|
||||
mset(key: KeyType, value: any, ...args: string[]): any;
|
||||
mset(...args: any[]): any;
|
||||
mset(data: any, callback: (err: Error, res: string) => void): void;
|
||||
mset(data: any): Promise<string>;
|
||||
|
||||
msetnx(key: KeyType, value: any, ...args: string[]): any;
|
||||
msetnx(...args: any[]): any;
|
||||
msetnx(data: any, callback: (err: Error, res: 0 | 1) => void): void;
|
||||
msetnx(data: any): Promise<0 | 1>;
|
||||
|
||||
randomkey(callback: (err: Error, res: string) => void): void;
|
||||
randomkey(): Promise<string>;
|
||||
@ -489,6 +493,8 @@ declare namespace IORedis {
|
||||
xack(key: KeyType, group: string, ...ids: string[]): any;
|
||||
|
||||
xadd(key: KeyType, id: string, ...args: string[]): any;
|
||||
xadd(key: KeyType, maxLenOption: 'MAXLEN' | 'maxlen', count: number, ...args: string[]): any;
|
||||
xadd(key: KeyType, maxLenOption: 'MAXLEN' | 'maxlen', approximate: '~', count: number, ...args: string[]): any;
|
||||
|
||||
xclaim(key: KeyType, group: string, consumer: string, minIdleTime: number, ...args: any[]): any;
|
||||
|
||||
@ -673,7 +679,7 @@ declare namespace IORedis {
|
||||
hget(key: KeyType, field: string, callback?: (err: Error, res: string | string) => void): Pipeline;
|
||||
hgetBuffer(key: KeyType, field: string, callback?: (err: Error, res: Buffer) => void): Pipeline;
|
||||
|
||||
hmset(key: KeyType, field: string, value: any, ...args: string[]): Pipeline;
|
||||
hmset(key: KeyType, ...args: any[]): Pipeline;
|
||||
hmset(key: KeyType, data: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline;
|
||||
|
||||
hmget(key: KeyType, ...fields: string[]): Pipeline;
|
||||
@ -702,9 +708,11 @@ declare namespace IORedis {
|
||||
|
||||
getset(key: KeyType, value: any, callback?: (err: Error, res: string) => void): Pipeline;
|
||||
|
||||
mset(key: KeyType, value: any, ...args: string[]): Pipeline;
|
||||
mset(...args: any[]): Pipeline;
|
||||
mset(data: any, callback?: (err: Error, res: string) => void): Pipeline;
|
||||
|
||||
msetnx(key: KeyType, value: any, ...args: string[]): Pipeline;
|
||||
msetnx(...args: any[]): Pipeline;
|
||||
msetnx(data: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline;
|
||||
|
||||
randomkey(callback?: (err: Error, res: string) => void): Pipeline;
|
||||
|
||||
|
||||
@ -154,6 +154,9 @@ redis.multi([
|
||||
const keys = ['foo', 'bar'];
|
||||
redis.mget(...keys);
|
||||
|
||||
redis.mset(...['foo', 'bar']);
|
||||
redis.mset({ foo: 'bar' });
|
||||
|
||||
new Redis.Cluster([
|
||||
'localhost'
|
||||
]);
|
||||
@ -177,6 +180,8 @@ new Redis.Cluster([{
|
||||
|
||||
redis.xack('streamName', 'groupName', 'id');
|
||||
redis.xadd('streamName', '*', 'field', 'name');
|
||||
redis.xadd('streamName', 'MAXLEN', 100, '*', 'field', 'name');
|
||||
redis.xadd('streamName', 'MAXLEN', '~', 100, '*', 'field', 'name');
|
||||
redis.xclaim('streamName', 'groupName', 'consumerName', 3600000, 'id');
|
||||
redis.xdel('streamName', 'id');
|
||||
redis.xgroup('CREATE', 'streamName', 'groupName', '$');
|
||||
|
||||
7
types/is-blank/index.d.ts
vendored
Normal file
7
types/is-blank/index.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
// Type definitions for is-blank 2.1
|
||||
// Project: https://github.com/johnotander/is-blank#readme
|
||||
// Definitions by: Christian Gambardella <https://github.com/heygambo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function isBlank(input: any): boolean;
|
||||
export = isBlank;
|
||||
17
types/is-blank/is-blank-tests.ts
Normal file
17
types/is-blank/is-blank-tests.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import isBlank = require('is-blank');
|
||||
|
||||
isBlank([]); // => true
|
||||
isBlank({}); // => true
|
||||
isBlank(0); // => true
|
||||
isBlank(() => {}); // => true
|
||||
isBlank(null); // => true
|
||||
isBlank(undefined); // => true
|
||||
isBlank(''); // => true
|
||||
isBlank(' '); // => true
|
||||
isBlank('\r\t\n '); // => true
|
||||
|
||||
isBlank(['a', 'b']); // => false
|
||||
isBlank({ a: 'b' }); // => false
|
||||
isBlank('string'); // => false
|
||||
isBlank(42); // => false
|
||||
isBlank((a: number, b: number) => a + b);
|
||||
@ -18,6 +18,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"p-throttle-tests.ts"
|
||||
"is-blank-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
1
types/is-blank/tslint.json
Normal file
1
types/is-blank/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
2
types/jasmine-data_driven_tests/index.d.ts
vendored
2
types/jasmine-data_driven_tests/index.d.ts
vendored
@ -34,6 +34,6 @@ interface JasmineDataDrivenTest {
|
||||
assertion: (arg0: T, arg1: U, done: () => void) => void): void;
|
||||
<T>(
|
||||
description: string,
|
||||
dataset: T[],
|
||||
dataset: T[] | Array<[T]>,
|
||||
assertion: (value: T, done: () => void) => void): void;
|
||||
}
|
||||
|
||||
@ -37,6 +37,13 @@ xall("A data driven test can be pending",
|
||||
}
|
||||
);
|
||||
|
||||
all("A data set must consist of array-wrapped arrays, if test expects single array input",
|
||||
[[[1, 2]], [[3, 4]], [[5, 6]]],
|
||||
(numberArray: number[]) => {
|
||||
expect(numberArray.length).toBe(2);
|
||||
}
|
||||
);
|
||||
|
||||
describe("A suite", () => {
|
||||
let a: number;
|
||||
|
||||
|
||||
2
types/jenkins/index.d.ts
vendored
2
types/jenkins/index.d.ts
vendored
@ -15,7 +15,7 @@ declare namespace create {
|
||||
log(name: string, n: number, start: number, callback: (err: Error, data: any) => void): void;
|
||||
log(name: string, n: number, start: number, type: 'text' | 'html', callback: (err: Error, data: any) => void): void;
|
||||
log(name: string, n: number, start: number, type: 'text' | 'html', meta: boolean, callback: (err: Error, data: any) => void): void;
|
||||
logStream(name: string, n: number, type?: 'text' | 'html', delay?: number): NodeJS.ReadableStream;
|
||||
logStream(name: string, n: number, options?: { type?: 'text' | 'html', delay?: number }): NodeJS.ReadableStream;
|
||||
stop(name: string, n: number, callback: (err: Error) => void): void;
|
||||
term(name: string, n: number, callback: (err: Error) => void): void;
|
||||
};
|
||||
|
||||
@ -34,6 +34,20 @@ log.on('end', () => {
|
||||
console.log('end');
|
||||
});
|
||||
|
||||
const log2 = jenkins.build.logStream('example', 1, { type: 'html', delay: 2 * 1000 });
|
||||
|
||||
log2.on('data', (text: string) => {
|
||||
process.stdout.write(text);
|
||||
});
|
||||
|
||||
log2.on('error', (err: Error) => {
|
||||
console.log('error', err);
|
||||
});
|
||||
|
||||
log2.on('end', () => {
|
||||
console.log('end');
|
||||
});
|
||||
|
||||
jenkins.build.stop('example', 1, (err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
|
||||
3
types/joi/index.d.ts
vendored
3
types/joi/index.d.ts
vendored
@ -15,6 +15,7 @@
|
||||
// Peter Thorson <https://github.com/zaphoyd>
|
||||
// Will Garcia <https://github.com/thewillg>
|
||||
// Simon Schick <https://github.com/SimonSchick>
|
||||
// Alejandro Fernandez Haro <https://github.com/afharo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@ -704,7 +705,7 @@ export interface ArraySchema extends AnySchema {
|
||||
* `schema` - the validation rules required to satisfy the assertion. If the `schema` includes references, they are resolved against
|
||||
* the array item being tested, not the value of the `ref` target.
|
||||
*/
|
||||
assertItem(schema: SchemaLike): this;
|
||||
has(schema: SchemaLike): this;
|
||||
/**
|
||||
* Allow this array to be sparse.
|
||||
* enabled can be used with a falsy value to go back to the default behavior.
|
||||
|
||||
@ -312,7 +312,7 @@ anySchema = Joi.any();
|
||||
|
||||
arrSchema = Joi.array();
|
||||
|
||||
arrSchema = arrSchema.assertItem(Joi.any());
|
||||
arrSchema = arrSchema.has(Joi.any());
|
||||
arrSchema = arrSchema.sparse();
|
||||
arrSchema = arrSchema.sparse(bool);
|
||||
arrSchema = arrSchema.single();
|
||||
|
||||
177
types/jsoneditor/index.d.ts
vendored
177
types/jsoneditor/index.d.ts
vendored
@ -1,54 +1,199 @@
|
||||
// Type definitions for jsoneditor v5.19.0
|
||||
// Type definitions for jsoneditor v5.28.2
|
||||
// Project: https://github.com/josdejong/jsoneditor
|
||||
// Definitions by: Alejandro Sánchez <https://github.com/alejo90>
|
||||
// Errietta Kostala <https://github.com/errietta>
|
||||
// Adam Vigneaux <https://github.com/adamvig>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="ace" />
|
||||
|
||||
import { Ajv } from "ajv";
|
||||
|
||||
declare module 'jsoneditor' {
|
||||
export interface JSONEditorNode {
|
||||
type JSONPath = (string|number)[];
|
||||
|
||||
export interface Node {
|
||||
field: string;
|
||||
value: string;
|
||||
path: Array<string>;
|
||||
value?: string;
|
||||
path: JSONPath;
|
||||
}
|
||||
|
||||
export type JSONEditorMode = 'tree' | 'view' | 'form' | 'code' | 'text';
|
||||
|
||||
export interface NodeName {
|
||||
path: string;
|
||||
type: 'object'|'array';
|
||||
size: number;
|
||||
}
|
||||
|
||||
export interface ValidationError {
|
||||
path: JSONPath;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface Template {
|
||||
text: string;
|
||||
title: string;
|
||||
className?: string;
|
||||
field: string;
|
||||
value: any;
|
||||
}
|
||||
|
||||
export type AutoCompleteCompletion = null|string[]|{startFrom: number, options: string[]};
|
||||
|
||||
export type AutoCompleteOptionsGetter = (
|
||||
text: string, path: JSONPath, input: string, editor: JSONEditor,
|
||||
) => AutoCompleteCompletion|Promise<AutoCompleteCompletion>;
|
||||
|
||||
export interface AutoCompleteOptions {
|
||||
/**
|
||||
* @default [39, 35, 9]
|
||||
*/
|
||||
confirmKeys?: number[];
|
||||
caseSensitive?: boolean;
|
||||
getOptions?: AutoCompleteOptionsGetter;
|
||||
}
|
||||
|
||||
export interface SelectionPosition {
|
||||
row: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
export interface SerializableNode {
|
||||
value: any;
|
||||
path: JSONPath;
|
||||
}
|
||||
|
||||
// Based on the API of https://github.com/Sphinxxxx/vanilla-picker
|
||||
export interface Color {
|
||||
rgba: Array<number>;
|
||||
hsla: Array<number>;
|
||||
rgbString: string;
|
||||
rgbaString: string;
|
||||
hslString: string;
|
||||
hslaString: string;
|
||||
hex: string;
|
||||
}
|
||||
|
||||
export interface JSONEditorOptions {
|
||||
ace?: AceAjax.Ace;
|
||||
ajv?: any; // Any for now, since ajv typings aren't A-Ok
|
||||
ajv?: Ajv;
|
||||
onChange?: () => void;
|
||||
onEditable?: (node: JSONEditorNode) => boolean | {field: boolean, value: boolean};
|
||||
onChangeJSON?: (json: any) => void;
|
||||
onChangeText?: (jsonString: string) => void;
|
||||
onEditable?: (node: Node) => boolean|{field: boolean, value: boolean};
|
||||
onError?: (error: Error) => void;
|
||||
onModeChange?: (newMode: JSONEditorMode, oldMode: JSONEditorMode) => void;
|
||||
onNodeName?: (nodeName: NodeName) => string|undefined;
|
||||
onValidate?: (json: any) => ValidationError[]|Promise<ValidationError[]>;
|
||||
/**
|
||||
* @default false
|
||||
*/
|
||||
escapeUnicode?: boolean;
|
||||
/**
|
||||
* @default false
|
||||
*/
|
||||
sortObjectKeys?: boolean;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
history?: boolean;
|
||||
/**
|
||||
* @default 'tree'
|
||||
*/
|
||||
mode?: JSONEditorMode;
|
||||
modes?: Array<JSONEditorMode>;
|
||||
modes?: JSONEditorMode[];
|
||||
/**
|
||||
* @default undefined
|
||||
*/
|
||||
name?: string;
|
||||
schema?: Object;
|
||||
schemaRefs?: Object;
|
||||
schema?: object;
|
||||
schemaRefs?: object;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
search?: boolean;
|
||||
/**
|
||||
* @default 2
|
||||
*/
|
||||
indentation?: number;
|
||||
theme?: string;
|
||||
templates?: Template[];
|
||||
autocomplete?: AutoCompleteOptions;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
mainMenuBar?: boolean;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
navigationBar?: boolean;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
statusBar?: boolean;
|
||||
onTextSelectionChange?: (start: SelectionPosition, end: SelectionPosition, text: string) => void;
|
||||
onSelectionChange?: (start: SerializableNode, end: SerializableNode) => void;
|
||||
onEvent?: (node: Node, event: string) => void;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
colorPicker?: boolean;
|
||||
onColorPicker?: (parent: HTMLElement, color: string, onChange: (color: Color) => void) => void;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
timestampTag?: boolean;
|
||||
language?: string;
|
||||
languages?: {
|
||||
[lang: string]: {
|
||||
[key: string]: string;
|
||||
};
|
||||
};
|
||||
modalAnchor?: HTMLElement;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
enableSort?: boolean;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
enableTransform?: boolean;
|
||||
/**
|
||||
* @default 100
|
||||
*/
|
||||
maxVisibleChilds?: number;
|
||||
|
||||
}
|
||||
|
||||
export default class JSONEditor {
|
||||
constructor(container: HTMLElement, options?: JSONEditorOptions, json?: Object);
|
||||
constructor(container: HTMLElement, options?: JSONEditorOptions, json?: any);
|
||||
collapseAll(): void;
|
||||
destroy(): void;
|
||||
expandAll(): void;
|
||||
focus(): void;
|
||||
set(json: Object): void;
|
||||
setMode(mode: JSONEditorMode): void;
|
||||
setName(name?: string): void;
|
||||
setSchema(schema: Object): void;
|
||||
setText(jsonString: string): void;
|
||||
get(): any;
|
||||
getMode(): JSONEditorMode;
|
||||
getName(): string;
|
||||
getName(): string|undefined;
|
||||
getNodesByRange(start: {path: JSONPath}, end: {path: JSONPath}): Array<SerializableNode>;
|
||||
getSelection(): {start: SerializableNode, end: SerializableNode};
|
||||
getText(): string;
|
||||
getTextSelection(): {start: SelectionPosition, end: SelectionPosition, text: string};
|
||||
refresh(): void;
|
||||
set(json: any): void;
|
||||
setMode(mode: JSONEditorMode): void;
|
||||
setName(name?: string): void;
|
||||
setSchema(schema: object, schemaRefs?: object): void;
|
||||
setSelection(start: {path: JSONPath}, end: {path: JSONPath}): void;
|
||||
setText(jsonString: string): void;
|
||||
setTextSelection(start: SelectionPosition, end: SelectionPosition): void;
|
||||
update(json: any): void;
|
||||
updateText(jsonString: string): void;
|
||||
|
||||
static VALID_OPTIONS: Array<string>;
|
||||
static ace: AceAjax.Ace;
|
||||
static Ajv: Ajv;
|
||||
static VanillaPicker: any;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
import JSONEditor, {JSONEditorMode, JSONEditorNode, JSONEditorOptions } from 'jsoneditor';
|
||||
import * as Ajv from 'ajv';
|
||||
import JSONEditor, {JSONEditorMode, Node, JSONEditorOptions } from 'jsoneditor';
|
||||
|
||||
let options: JSONEditorOptions;
|
||||
options = {};
|
||||
options = {
|
||||
ace: ace,
|
||||
//ajv: Ajv({allErrors: true, verbose: true})
|
||||
ajv: new Ajv({allErrors: true, verbose: true}),
|
||||
onChange() {},
|
||||
onEditable(node: JSONEditorNode) {
|
||||
onEditable(node: Node) {
|
||||
return true;
|
||||
},
|
||||
onError(error: Error) {},
|
||||
@ -23,7 +25,7 @@ options = {
|
||||
theme: 'default'
|
||||
};
|
||||
options = {
|
||||
onEditable(node: JSONEditorNode) {
|
||||
onEditable(node: Node) {
|
||||
return {field: true, value: false};
|
||||
}
|
||||
};
|
||||
|
||||
6
types/jsoneditor/package.json
Normal file
6
types/jsoneditor/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"ajv": "*"
|
||||
}
|
||||
}
|
||||
4
types/klaw/index.d.ts
vendored
4
types/klaw/index.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
// Type definitions for klaw v2.1.1
|
||||
// Type definitions for klaw v3.0.0
|
||||
// Project: https://github.com/jprichardson/node-klaw
|
||||
// Definitions by: Matthew McEachen <https://github.com/mceachen>
|
||||
// Pascal Sthamer <https://github.com/p4sca1>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@ -26,6 +27,7 @@ declare module "klaw" {
|
||||
fs?: any // fs or mock-fs
|
||||
filter?: (path: string) => boolean
|
||||
depthLimit?: number
|
||||
preserveSymlinks?: boolean
|
||||
}
|
||||
|
||||
type Event = "close" | "data" | "end" | "readable" | "error"
|
||||
|
||||
@ -5,7 +5,7 @@ const path = require('path');
|
||||
|
||||
let items: klaw.Item[] = [] // files, directories, symlinks, etc
|
||||
|
||||
klaw('/some/dir')
|
||||
klaw('/some/dir', { preserveSymlinks: false })
|
||||
.on('data', function(item: klaw.Item) {
|
||||
items.push(item)
|
||||
})
|
||||
|
||||
10
types/leaflet/index.d.ts
vendored
10
types/leaflet/index.d.ts
vendored
@ -626,7 +626,7 @@ export interface PathOptions extends InteractiveLayerOptions {
|
||||
opacity?: number;
|
||||
lineCap?: LineCapShape;
|
||||
lineJoin?: LineJoinShape;
|
||||
dashArray?: string;
|
||||
dashArray?: string | number[];
|
||||
dashOffset?: string;
|
||||
fill?: boolean;
|
||||
fillColor?: string;
|
||||
@ -1134,14 +1134,15 @@ export interface PopupOptions extends DivOverlayOptions {
|
||||
maxWidth?: number;
|
||||
minWidth?: number;
|
||||
maxHeight?: number;
|
||||
keepInView?: boolean;
|
||||
closeButton?: boolean;
|
||||
autoPan?: boolean;
|
||||
autoPanPaddingTopLeft?: PointExpression;
|
||||
autoPanPaddingBottomRight?: PointExpression;
|
||||
autoPanPadding?: PointExpression;
|
||||
keepInView?: boolean;
|
||||
closeButton?: boolean;
|
||||
autoClose?: boolean;
|
||||
closeOnClick?: boolean;
|
||||
closeOnEscapeKey?: boolean;
|
||||
}
|
||||
|
||||
export type Content = string | HTMLElement;
|
||||
@ -1534,6 +1535,9 @@ export interface MarkerOptions extends InteractiveLayerOptions {
|
||||
opacity?: number;
|
||||
riseOnHover?: boolean;
|
||||
riseOffset?: number;
|
||||
autoPan?: boolean;
|
||||
autoPanSpeed?: number;
|
||||
autoPanPadding?: PointExpression;
|
||||
}
|
||||
|
||||
export class Marker<P = any> extends Layer {
|
||||
|
||||
@ -506,7 +506,10 @@ export class MyNewControl extends L.Control {
|
||||
L.marker([1, 2], {
|
||||
icon: L.icon({
|
||||
iconUrl: 'my-icon.png'
|
||||
})
|
||||
}),
|
||||
autoPan: true,
|
||||
autoPanPadding: [10, 20],
|
||||
autoPanSpeed: 5,
|
||||
}).bindPopup('<p>Hi</p>');
|
||||
|
||||
L.marker([1, 2], {
|
||||
|
||||
2
types/luxon/index.d.ts
vendored
2
types/luxon/index.d.ts
vendored
@ -426,7 +426,7 @@ export class Interval {
|
||||
engulfs(other: Interval): boolean;
|
||||
equals(other: Interval): boolean;
|
||||
hasSame(unit: DurationUnit): boolean;
|
||||
intersection(other: Interval): Interval;
|
||||
intersection(other: Interval): Interval | null;
|
||||
isAfter(dateTime: DateTime): boolean;
|
||||
isBefore(dateTime: DateTime): boolean;
|
||||
isEmpty(): boolean;
|
||||
|
||||
@ -140,6 +140,7 @@ i.length('years'); // $ExpectType number
|
||||
i.contains(DateTime.local(2019)); // $ExpectType boolean
|
||||
i.set({end: DateTime.local(2020)}); // $ExpectType Interval
|
||||
i.mapEndpoints((d) => d); // $ExpectType Interval
|
||||
i.intersection(i); // $ExpectType Interval | null
|
||||
|
||||
i.toISO(); // $ExpectType string
|
||||
i.toString(); // $ExpectType string
|
||||
|
||||
188
types/mongoose/index.d.ts
vendored
188
types/mongoose/index.d.ts
vendored
@ -337,7 +337,7 @@ declare module "mongoose" {
|
||||
/** Use ssl connection (needs to have a mongod server with ssl support) (default: true) */
|
||||
ssl?: boolean;
|
||||
/** Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher) */
|
||||
sslValidate?: object;
|
||||
sslValidate?: boolean;
|
||||
/** Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons. */
|
||||
poolSize?: number;
|
||||
/** Reconnect on error (default: true) */
|
||||
@ -1722,6 +1722,9 @@ declare module "mongoose" {
|
||||
* If later in the query chain a method returns Query<T>, we will need to know type T.
|
||||
* So we save this type as the second type parameter in DocumentQuery. Since people have
|
||||
* been using Query<T>, we set it as an alias of DocumentQuery.
|
||||
*
|
||||
* Furthermore, Query<T> is used for function that has an option { rawResult: true }.
|
||||
* for instance findOneAndUpdate.
|
||||
*/
|
||||
class Query<T> extends DocumentQuery<T, any> { }
|
||||
class DocumentQuery<T, DocType extends Document, QueryHelpers = {}> extends mquery {
|
||||
@ -1864,7 +1867,7 @@ declare module "mongoose" {
|
||||
equals<T>(val: T): this;
|
||||
|
||||
/** Executes the query */
|
||||
exec(callback?: (err: any, res: T) => void): Promise<T>;
|
||||
exec(callback?: (err: NativeError, res: T) => void): Promise<T>;
|
||||
exec(operation: string | Function, callback?: (err: any, res: T) => void): Promise<T>;
|
||||
|
||||
/** Specifies an $exists condition */
|
||||
@ -1895,10 +1898,16 @@ declare module "mongoose" {
|
||||
* Issues a mongodb findAndModify remove command.
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the
|
||||
* callback. Executes immediately if callback is passed.
|
||||
*
|
||||
* If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify().
|
||||
* https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set
|
||||
*/
|
||||
findOneAndRemove(callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any,
|
||||
callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any, options: { rawResult: true } & QueryFindOneAndRemoveOptions,
|
||||
callback?: (error: any, doc: mongodb.FindAndModifyWriteOpResultObject<DocType | null>, result: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<DocType | null>> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any, options: QueryFindOneAndRemoveOptions,
|
||||
callback?: (error: any, doc: DocType | null, result: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
|
||||
@ -1906,6 +1915,9 @@ declare module "mongoose" {
|
||||
* Issues a mongodb findAndModify update command.
|
||||
* Finds a matching document, updates it according to the update arg, passing any options, and returns
|
||||
* the found document (if any) to the callback. The query executes immediately if callback is passed.
|
||||
*
|
||||
* If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify().
|
||||
* https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set
|
||||
*/
|
||||
findOneAndUpdate(callback?: (err: any, doc: DocType | null) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndUpdate(update: any,
|
||||
@ -1913,8 +1925,15 @@ declare module "mongoose" {
|
||||
findOneAndUpdate(query: any, update: any,
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
findOneAndUpdate(query: any, update: any,
|
||||
options: { upsert: true, new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: DocType, res: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
options: { rawResult: true } & { upsert: true } & { new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<DocType>, res: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<DocType>> & QueryHelpers;
|
||||
findOneAndUpdate(query: any, update: any,
|
||||
options: { upsert: true } & { new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: DocType, res: any) => void): DocumentQuery<DocType, DocType> & QueryHelpers;
|
||||
findOneAndUpdate(query: any, update: any, options: { rawResult: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<DocType | null>, res: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<DocType | null>> & QueryHelpers;
|
||||
findOneAndUpdate(query: any, update: any, options: QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: DocType | null, res: any) => void): DocumentQuery<DocType | null, DocType> & QueryHelpers;
|
||||
|
||||
@ -2238,12 +2257,21 @@ declare module "mongoose" {
|
||||
class mquery { }
|
||||
|
||||
interface QueryFindOneAndRemoveOptions {
|
||||
/** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */
|
||||
/**
|
||||
* if multiple docs are found by the conditions, sets the sort order to choose
|
||||
* which doc to update
|
||||
*/
|
||||
sort?: any;
|
||||
/** puts a time limit on the query - requires mongodb >= 2.6.0 */
|
||||
maxTimeMS?: number;
|
||||
/** if true, passes the raw result from the MongoDB driver as the third callback parameter */
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
/** like select, it determines which fields to return */
|
||||
projection?: any;
|
||||
/** if true, returns the raw result from the MongoDB driver */
|
||||
rawResult?: boolean;
|
||||
/** overwrites the schema's strict mode option for this update */
|
||||
strict?: boolean|string;
|
||||
}
|
||||
|
||||
interface QueryFindOneAndUpdateOptions extends QueryFindOneAndRemoveOptions {
|
||||
@ -2251,8 +2279,6 @@ declare module "mongoose" {
|
||||
new?: boolean;
|
||||
/** creates the object if it doesn't exist. defaults to false. */
|
||||
upsert?: boolean;
|
||||
/** Field selection. Equivalent to .select(fields).findOneAndUpdate() */
|
||||
fields?: any | string;
|
||||
/** if true, runs update validators on this command. Update validators validate the update operation against the model's schema. */
|
||||
runValidators?: boolean;
|
||||
/**
|
||||
@ -2270,6 +2296,8 @@ declare module "mongoose" {
|
||||
* Turn on this option to aggregate all the cast errors.
|
||||
*/
|
||||
multipleCastError?: boolean;
|
||||
/** Field selection. Equivalent to .select(fields).findOneAndUpdate() */
|
||||
fields?: any | string;
|
||||
}
|
||||
|
||||
interface QueryUpdateOptions extends ModelUpdateOptions {
|
||||
@ -2998,17 +3026,21 @@ declare module "mongoose" {
|
||||
* findByIdAndRemove(id, ...) is equivalent to findOneAndRemove({ _id: id }, ...).
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the callback.
|
||||
* Executes immediately if callback is passed, else a Query object is returned.
|
||||
*
|
||||
* If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify().
|
||||
* https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set
|
||||
*
|
||||
* Note: same signatures as findByIdAndDelete
|
||||
*
|
||||
* @param id value of _id to query by
|
||||
*/
|
||||
findByIdAndRemove(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndRemove(id: any | number | string,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndRemove(id: any | number | string, options: {
|
||||
/** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */
|
||||
sort?: any;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndRemove(id: any | number | string, options: QueryFindOneAndRemoveOptions,
|
||||
callback?: (err: any, res: mongodb.FindAndModifyWriteOpResultObject<T | null>) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
|
||||
findByIdAndRemove(id: any | number | string, options: QueryFindOneAndRemoveOptions, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
|
||||
/**
|
||||
@ -3016,31 +3048,44 @@ declare module "mongoose" {
|
||||
* findByIdAndDelete(id, ...) is equivalent to findByIdAndDelete({ _id: id }, ...).
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the callback.
|
||||
* Executes immediately if callback is passed, else a Query object is returned.
|
||||
*
|
||||
* Note: same signatures as findByIdAndRemove
|
||||
*
|
||||
* @param id value of _id to query by
|
||||
*/
|
||||
findByIdAndDelete(): DocumentQuery<T | null, T>;
|
||||
findByIdAndDelete(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndDelete(id: any | number | string,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndDelete(id: any | number | string, options: {
|
||||
/** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */
|
||||
sort?: any;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndDelete(id: any | number | string, options: QueryFindOneAndRemoveOptions,
|
||||
callback?: (err: any, res: mongodb.FindAndModifyWriteOpResultObject<T | null>) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
|
||||
findByIdAndDelete(id: any | number | string, options: QueryFindOneAndRemoveOptions, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Issues a mongodb findAndModify update command by a document's _id field. findByIdAndUpdate(id, ...)
|
||||
* is equivalent to findOneAndUpdate({ _id: id }, ...).
|
||||
*
|
||||
* If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify().
|
||||
* https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set
|
||||
*
|
||||
* @param id value of _id to query by
|
||||
*/
|
||||
findByIdAndUpdate(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: { upsert: true, new: true } & ModelFindByIdAndUpdateOptions,
|
||||
options: { rawResult: true } & { upsert: true } & { new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, res: T) => void): DocumentQuery<T, T> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: ModelFindByIdAndUpdateOptions,
|
||||
options: { upsert: true, new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, res: mongodb.FindAndModifyWriteOpResultObject<T>) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T>> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: { rawResult : true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, res: mongodb.FindAndModifyWriteOpResultObject<T | null>) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
|
||||
findByIdAndUpdate(id: any | number | string, update: any,
|
||||
options: QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
@ -3059,62 +3104,62 @@ declare module "mongoose" {
|
||||
* Issue a mongodb findAndModify remove command.
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the callback.
|
||||
* Executes immediately if callback is passed else a Query object is returned.
|
||||
*
|
||||
* If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than deprecated findAndModify().
|
||||
* https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set
|
||||
*
|
||||
* Note: same signatures as findOneAndDelete
|
||||
*
|
||||
*/
|
||||
findOneAndRemove(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any, options: {
|
||||
/**
|
||||
* if multiple docs are found by the conditions, sets the sort order to choose
|
||||
* which doc to update
|
||||
*/
|
||||
sort?: any;
|
||||
/** puts a time limit on the query - requires mongodb >= 2.6.0 */
|
||||
maxTimeMS?: number;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any, options: { rawResult: true } & QueryFindOneAndRemoveOptions,
|
||||
callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<T | null>, res: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
|
||||
findOneAndRemove(conditions: any, options: QueryFindOneAndRemoveOptions, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Issues a mongodb findOneAndDelete command.
|
||||
* Finds a matching document, removes it, passing the found document (if any) to the
|
||||
* callback. Executes immediately if callback is passed.
|
||||
*
|
||||
* Note: same signatures as findOneAndRemove
|
||||
*
|
||||
*/
|
||||
findOneAndDelete(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndDelete(conditions: any,
|
||||
callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndDelete(conditions: any, options: {
|
||||
/**
|
||||
* if multiple docs are found by the conditions, sets the sort order to choose
|
||||
* which doc to update
|
||||
*/
|
||||
sort?: any;
|
||||
/** puts a time limit on the query - requires mongodb >= 2.6.0 */
|
||||
maxTimeMS?: number;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
/** like select, it determines which fields to return */
|
||||
projection?: any;
|
||||
/** if true, returns the raw result from the MongoDB driver */
|
||||
rawResult?: boolean;
|
||||
/** overwrites the schema's strict mode option for this update */
|
||||
strict?: boolean|string;
|
||||
}, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndDelete(conditions: any, options: { rawResult: true } & QueryFindOneAndRemoveOptions,
|
||||
callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<T | null>, res: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
|
||||
findOneAndDelete(conditions: any, options: QueryFindOneAndRemoveOptions, callback?: (err: any, res: T | null) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
* Issues a mongodb findAndModify update command.
|
||||
* Finds a matching document, updates it according to the update arg, passing any options,
|
||||
* and returns the found document (if any) to the callback. The query executes immediately
|
||||
* if callback is passed else a Query object is returned.
|
||||
*
|
||||
+ * If mongoose option 'useFindAndModify': set to false it uses native findOneAndUpdate() rather than the deprecated findAndModify().
|
||||
+ * https://mongoosejs.com/docs/api.html#mongoose_Mongoose-set
|
||||
*/
|
||||
findOneAndUpdate(): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: { upsert: true, new: true } & ModelFindOneAndUpdateOptions,
|
||||
options: { rawResult : true } & { upsert: true, new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<T>, res: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T>> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: { upsert: true, new: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: T, res: any) => void): DocumentQuery<T, T> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: ModelFindOneAndUpdateOptions,
|
||||
options: { rawResult: true } & QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<T | null>, res: any) => void)
|
||||
: Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
|
||||
findOneAndUpdate(conditions: any, update: any,
|
||||
options: QueryFindOneAndUpdateOptions,
|
||||
callback?: (err: any, doc: T | null, res: any) => void): DocumentQuery<T | null, T> & QueryHelpers;
|
||||
|
||||
/**
|
||||
@ -3308,43 +3353,6 @@ declare module "mongoose" {
|
||||
session?: ClientSession | null;
|
||||
}
|
||||
|
||||
interface ModelFindByIdAndUpdateOptions extends ModelOptions {
|
||||
/** true to return the modified document rather than the original. defaults to false */
|
||||
new?: boolean;
|
||||
/** creates the object if it doesn't exist. defaults to false. */
|
||||
upsert?: boolean;
|
||||
/**
|
||||
* if true, runs update validators on this command. Update validators validate the
|
||||
* update operation against the model's schema.
|
||||
*/
|
||||
runValidators?: boolean;
|
||||
/**
|
||||
* if this and upsert are true, mongoose will apply the defaults specified in the model's
|
||||
* schema if a new document is created. This option only works on MongoDB >= 2.4 because
|
||||
* it relies on MongoDB's $setOnInsert operator.
|
||||
*/
|
||||
setDefaultsOnInsert?: boolean;
|
||||
/** if multiple docs are found by the conditions, sets the sort order to choose which doc to update */
|
||||
sort?: any;
|
||||
/** sets the document fields to return */
|
||||
select?: any;
|
||||
/** if true, passes the raw result from the MongoDB driver as the third callback parameter */
|
||||
rawResult?: boolean;
|
||||
/** overwrites the schema's strict mode option for this update */
|
||||
strict?: boolean;
|
||||
/** The context option lets you set the value of this in update validators to the underlying query. */
|
||||
context?: string;
|
||||
}
|
||||
|
||||
interface ModelFindOneAndUpdateOptions extends ModelFindByIdAndUpdateOptions {
|
||||
/** Field selection. Equivalent to .select(fields).findOneAndUpdate() */
|
||||
fields?: any | string;
|
||||
/** puts a time limit on the query - requires mongodb >= 2.6.0 */
|
||||
maxTimeMS?: number;
|
||||
/** if true, passes the raw result from the MongoDB driver as the third callback parameter */
|
||||
rawResult?: boolean;
|
||||
}
|
||||
|
||||
interface ModelPopulateOptions {
|
||||
/** space delimited path(s) to populate */
|
||||
path: string;
|
||||
|
||||
@ -1021,7 +1021,7 @@ query.findOne(function (err, res) {
|
||||
query.findOneAndRemove({name: 'aa'}, {
|
||||
rawResult: true
|
||||
}, function (err, doc) {
|
||||
doc.execPopulate();
|
||||
doc.lastErrorObject
|
||||
}).findOneAndRemove();
|
||||
query.findOneAndUpdate({name: 'aa'}, {name: 'bb'}, {
|
||||
|
||||
@ -1911,6 +1911,14 @@ LocModel.findOneAndUpdate().exec().then(function (arg) {
|
||||
arg.openingTimes;
|
||||
}
|
||||
});
|
||||
LocModel.findOneAndUpdate(
|
||||
// find a document with that filter
|
||||
{name: "aa"},
|
||||
// document to insert when nothing was found
|
||||
{ $set: {name: "bb"} },
|
||||
// options
|
||||
{upsert: true, new: true, runValidators: true,
|
||||
rawResult: true, multipleCastError: true });
|
||||
LocModel.geoSearch({}, {
|
||||
near: [1, 2],
|
||||
maxDistance: 22
|
||||
|
||||
7
types/moveto/index.d.ts
vendored
7
types/moveto/index.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
// Type definitions for moveto 1.7
|
||||
// Type definitions for moveto 1.8
|
||||
// Project: https://github.com/hsnaydd/moveTo
|
||||
// Definitions by: Rostislav Shermenyov <https://github.com/shermendev>
|
||||
// pea3nut <https://github.com/pea3nut>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class MoveTo {
|
||||
@ -66,6 +67,10 @@ declare namespace MoveTo {
|
||||
* Ease function name
|
||||
*/
|
||||
easing?: string;
|
||||
/**
|
||||
* The container been computed and scrolled
|
||||
*/
|
||||
container?: Window | HTMLElement;
|
||||
/**
|
||||
* The function to be run after scrolling complete. Target passes as the first argument
|
||||
*/
|
||||
|
||||
@ -2,6 +2,7 @@ const options: MoveTo.MoveToOptions = {
|
||||
tolerance: 70,
|
||||
duration: 300,
|
||||
easing: "easeOutQuart",
|
||||
container: Math.random() > 0.5 ? window : document.createElement('div'),
|
||||
callback: () => {}
|
||||
};
|
||||
|
||||
|
||||
63
types/mumath/index.d.ts
vendored
Normal file
63
types/mumath/index.d.ts
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
// Type definitions for mumath 3.3
|
||||
// Project: https://github.com/dfcreative/mumath
|
||||
// Definitions by: Adam Zerella <https://github.com/adamzerella>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.3
|
||||
|
||||
/**
|
||||
* Detects proper clamp min/max.
|
||||
*/
|
||||
export function clamp(value: number, left: number, right: number): number;
|
||||
|
||||
/**
|
||||
* Get closest value out of a set.
|
||||
*/
|
||||
export function closest(value: number, list: number[]): number;
|
||||
|
||||
/**
|
||||
* Check if one number is multiple of other
|
||||
* Same as a % b === 0, but with precision check.
|
||||
*/
|
||||
export function isMultiple(a: number, b: number, eps?: number): boolean;
|
||||
|
||||
/**
|
||||
* Return quadratic length of a vector.
|
||||
*/
|
||||
export function len(a: number, b: number): number;
|
||||
|
||||
/**
|
||||
* Return value interpolated between x and y.
|
||||
*/
|
||||
export function lerp(x: number, y: number, ratio: number): number;
|
||||
|
||||
/**
|
||||
* An enhanced mod-loop, like fmod — loops value within a frame.
|
||||
*/
|
||||
export function mod(value: number, max: number, min?: number): number;
|
||||
|
||||
/**
|
||||
* Get order of magnitude for a number.
|
||||
*/
|
||||
export function order(value: number): number;
|
||||
|
||||
/**
|
||||
* Get precision from float:
|
||||
*/
|
||||
export function precision(value: number): number;
|
||||
|
||||
/**
|
||||
* Rounds value to optional step.
|
||||
*/
|
||||
export function round(value: number, step?: number): number;
|
||||
|
||||
/**
|
||||
* Get first scale out of a list of basic scales, aligned to the power. E. g.
|
||||
* step(.37, [1, 2, 5]) → .5 step(456, [1, 2]) → 1000
|
||||
* Similar to closest, but takes all possible powers of scales.
|
||||
*/
|
||||
export function scale(value: number, list: number[]): number;
|
||||
|
||||
/**
|
||||
* Whether element is between left & right, including.
|
||||
*/
|
||||
export function within(value: number, left: number, right: number): number;
|
||||
25
types/mumath/mumath-tests.ts
Normal file
25
types/mumath/mumath-tests.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import * as mumath from "mumath";
|
||||
|
||||
mumath.clamp(1, 2, 3);
|
||||
|
||||
mumath.closest(5, [1, 7, 3, 6, 10]);
|
||||
|
||||
mumath.isMultiple(5, 10, 1.000074);
|
||||
mumath.isMultiple(5, 10);
|
||||
|
||||
mumath.len(15, 1.0);
|
||||
|
||||
mumath.lerp(1, 2, 3);
|
||||
|
||||
mumath.mod(1, 2, 3);
|
||||
mumath.mod(1, 2);
|
||||
|
||||
mumath.order(5);
|
||||
|
||||
mumath.precision(5.0000001);
|
||||
|
||||
mumath.round(0.3, 0.5);
|
||||
|
||||
mumath.scale(5.93, [1.0, 35, 10, 7.135]);
|
||||
|
||||
mumath.within(5, 1, 10);
|
||||
25
types/mumath/tsconfig.json
Normal file
25
types/mumath/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [
|
||||
|
||||
],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mumath-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/mumath/tslint.json
Normal file
3
types/mumath/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@ -6,6 +6,8 @@ import randomBrowser = require('nanoid/random-browser');
|
||||
import url = require('nanoid/url');
|
||||
import nanoidAsync = require('nanoid/async');
|
||||
import nanoidAsyncBrowser = require('nanoid/async-browser');
|
||||
import nanoidNonSecure = require('nanoid/non-secure');
|
||||
import generateNonSecure = require('nanoid/non-secure/generate');
|
||||
|
||||
const _random = (size: number) => [1, 2, 3, 4];
|
||||
|
||||
@ -22,5 +24,9 @@ nanoidAsync(null, (error, id) => {
|
||||
});
|
||||
nanoidAsyncBrowser().then((id) => console.log(id));
|
||||
nanoidAsyncBrowser(10).then((id) => console.log(id));
|
||||
nanoidNonSecure();
|
||||
nanoidNonSecure(10);
|
||||
generateNonSecure('0123456789абвгдеё', 5);
|
||||
generateNonSecure('0123456789абвгдеё');
|
||||
|
||||
console.log(url);
|
||||
|
||||
19
types/nanoid/non-secure/generate.d.ts
vendored
Normal file
19
types/nanoid/non-secure/generate.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Generate URL-friendly unique ID. This method use non-secure predictable
|
||||
* random generator.
|
||||
*
|
||||
* By default, ID will have 21 symbols to have a collision probability similar
|
||||
* to UUID v4.
|
||||
*
|
||||
* @param alphabet Symbols to be used in ID.
|
||||
* @param [size=21] The number of symbols in ID.
|
||||
*
|
||||
* @return Random string.
|
||||
*
|
||||
* @example
|
||||
* const nanoid = require('nanoid/non-secure')
|
||||
* model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
|
||||
*/
|
||||
declare function generate(alphabet: string, size?: number): string;
|
||||
|
||||
export = generate;
|
||||
18
types/nanoid/non-secure/index.d.ts
vendored
Normal file
18
types/nanoid/non-secure/index.d.ts
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Generate URL-friendly unique ID. This method use non-secure predictable
|
||||
* random generator.
|
||||
*
|
||||
* By default, ID will have 21 symbols to have a collision probability similar
|
||||
* to UUID v4.
|
||||
*
|
||||
* @param [size=21] The number of symbols in ID.
|
||||
*
|
||||
* @return Random string.
|
||||
*
|
||||
* @example
|
||||
* const nanoid = require('nanoid/non-secure')
|
||||
* model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
|
||||
*/
|
||||
declare function nanoid(size?: number): string;
|
||||
|
||||
export = nanoid;
|
||||
@ -17,6 +17,8 @@
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"non-secure/index.d.ts",
|
||||
"non-secure/generate.d.ts",
|
||||
"async-browser.d.ts",
|
||||
"async.d.ts",
|
||||
"format.d.ts",
|
||||
|
||||
8
types/next-server/dynamic.d.ts
vendored
8
types/next-server/dynamic.d.ts
vendored
@ -7,9 +7,9 @@ import {
|
||||
|
||||
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
type AsyncComponent<P = any> = Promise<React.ComponentType<P>>;
|
||||
type AsyncComponent<P = any> = Promise<React.ComponentType<P> | { default: React.ComponentType<P> }>;
|
||||
type AsyncComponentLoader<P = any> = () => AsyncComponent<P>;
|
||||
type ModuleMapping = Record<string, AsyncComponent>;
|
||||
type ModuleMapping = Record<string, AsyncComponent | AsyncComponentLoader>;
|
||||
type LoadedModuleMapping = Record<string, React.ComponentType>;
|
||||
|
||||
interface NextDynamicOptions<P = {}> extends Omit<LoadableOptions, "loading" | "modules"> {
|
||||
@ -31,10 +31,10 @@ type DynamicComponent<P> = React.ComponentType<P> & LoadableComponent;
|
||||
* https://github.com/zeit/next.js/blob/7.0.0/lib/dynamic.js#L55
|
||||
*/
|
||||
declare function dynamic<P = {}>(
|
||||
options: AsyncComponentLoader<P> | AsyncComponent<P> | NextDynamicOptions<P>
|
||||
asyncModuleOrOptions: AsyncComponentLoader<P> | AsyncComponent<P> | NextDynamicOptions<P>
|
||||
): DynamicComponent<P>;
|
||||
declare function dynamic<P = {}>(
|
||||
asyncModule: AsyncComponent<P>,
|
||||
asyncModule: AsyncComponentLoader<P> | AsyncComponent<P>,
|
||||
options: NextDynamicOptions<P>
|
||||
): DynamicComponent<P>;
|
||||
|
||||
|
||||
7
types/next-server/test/imports/no-default.tsx
Normal file
7
types/next-server/test/imports/no-default.tsx
Normal file
@ -0,0 +1,7 @@
|
||||
import * as React from "react";
|
||||
|
||||
interface Props {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
export const MyComponent: React.SFC<Props> = ({ foo: text }) => <span>{text}</span>;
|
||||
11
types/next-server/test/imports/with-default.tsx
Normal file
11
types/next-server/test/imports/with-default.tsx
Normal file
@ -0,0 +1,11 @@
|
||||
import * as React from "react";
|
||||
|
||||
interface Props {
|
||||
foo: boolean;
|
||||
}
|
||||
|
||||
export default class MyComponent extends React.Component<Props> {
|
||||
render() {
|
||||
return this.props.foo ? <div/> : null;
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,7 @@
|
||||
import * as React from "react";
|
||||
import dynamic, { LoadingComponentProps } from "next-server/dynamic";
|
||||
|
||||
// You'd typically do this via import('./MyComponent')
|
||||
interface MyComponentProps {
|
||||
foo: string;
|
||||
}
|
||||
const MyComponent: React.StatelessComponent<MyComponentProps> = () => <div>I'm async!</div>;
|
||||
const asyncComponent = Promise.resolve(MyComponent);
|
||||
const asyncComponent = import('./imports/with-default');
|
||||
|
||||
// Examples from
|
||||
// https://github.com/zeit/next.js/#dynamic-import
|
||||
@ -17,30 +12,31 @@ const LoadingComponent: React.StatelessComponent<LoadingComponentProps> = ({
|
||||
}) => <p>loading...</p>;
|
||||
|
||||
// 1. Basic Usage (Also does SSR)
|
||||
const DynamicComponent = dynamic(asyncComponent);
|
||||
const dynamicComponentJSX = <DynamicComponent foo="bar" />;
|
||||
const Test1 = dynamic(asyncComponent);
|
||||
const test1JSX = <Test1 foo />;
|
||||
|
||||
// 1.1 Basic Usage (Loader function)
|
||||
const DynamicComponent2 = dynamic(() => asyncComponent);
|
||||
const dynamicComponent2JSX = <DynamicComponent2 foo="bar" />;
|
||||
const Test1Func = dynamic(() => asyncComponent);
|
||||
const test1FuncJSX = <Test1Func foo />;
|
||||
|
||||
// 2. With Custom Loading Component
|
||||
const DynamicComponentWithCustomLoading = dynamic(asyncComponent, {
|
||||
loading: LoadingComponent
|
||||
});
|
||||
const dynamicComponentWithCustomLoadingJSX = <DynamicComponentWithCustomLoading foo="bar" />;
|
||||
|
||||
// 3. With No SSR
|
||||
const DynamicComponentWithNoSSR = dynamic(asyncComponent, {
|
||||
// 2. With Custom Options
|
||||
const Test2 = dynamic(() => asyncComponent, {
|
||||
loading: LoadingComponent,
|
||||
ssr: false
|
||||
});
|
||||
const test2JSX = <Test2 foo />;
|
||||
|
||||
// 4. With Multiple Modules At Once
|
||||
const HelloBundle = dynamic<MyComponentProps>({
|
||||
// TODO: Mapped components still doesn't infer their props.
|
||||
interface BundleComponentProps {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
const HelloBundle = dynamic<BundleComponentProps>({
|
||||
modules: () => {
|
||||
const components = {
|
||||
Hello1: asyncComponent,
|
||||
Hello2: asyncComponent
|
||||
Hello1: () => asyncComponent,
|
||||
Hello2: () => asyncComponent
|
||||
};
|
||||
|
||||
return components;
|
||||
@ -64,6 +60,6 @@ const LoadableComponent = dynamic({
|
||||
});
|
||||
|
||||
// 6. No loading
|
||||
const DynamicComponentWithNoLoading = dynamic(asyncComponent, {
|
||||
const DynamicComponentWithNoLoading = dynamic(() => asyncComponent, {
|
||||
loading: () => null
|
||||
});
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
"test/next-server-head-tests.tsx",
|
||||
"test/next-server-link-tests.tsx",
|
||||
"test/next-server-dynamic-tests.tsx",
|
||||
"test/next-server-router-tests.tsx"
|
||||
"test/next-server-router-tests.tsx",
|
||||
"test/imports/no-default.tsx",
|
||||
"test/imports/with-default.tsx"
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
import {
|
||||
PHASE_DEVELOPMENT_SERVER,
|
||||
IS_BUNDLED_PAGE_REGEX
|
||||
} from "next/constants";
|
||||
|
||||
const isIndexPage = IS_BUNDLED_PAGE_REGEX.test(
|
||||
"static/CjW0mFnyG80HdP4eSUiy7/pages/index.js"
|
||||
);
|
||||
|
||||
// Example taken from: https://github.com/cyrilwanner/next-compose-plugins/blob/a25b313899638912cc9defc0be072f4fe4a1e855/README.md
|
||||
const config = (nextConfig: any = {}) => {
|
||||
return {
|
||||
...nextConfig,
|
||||
|
||||
// define in which phases this plugin should get applied.
|
||||
// you can also use multiple phases or negate them.
|
||||
// however, users can still overwrite them in their configuration if they really want to.
|
||||
phases: [PHASE_DEVELOPMENT_SERVER],
|
||||
|
||||
webpack(config: any, options: any) {
|
||||
// do something here which only gets applied during development server phase
|
||||
|
||||
if (typeof nextConfig.webpack === "function") {
|
||||
return nextConfig.webpack(config, options);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
};
|
||||
};
|
||||
@ -1,65 +0,0 @@
|
||||
import * as React from "react";
|
||||
import dynamic, { LoadingComponentProps } from "next/dynamic";
|
||||
|
||||
// You'd typically do this via import('./MyComponent')
|
||||
interface MyComponentProps {
|
||||
foo: string;
|
||||
}
|
||||
const MyComponent: React.FunctionComponent<MyComponentProps> = () => <div>I'm async!</div>;
|
||||
const asyncComponent = Promise.resolve(MyComponent);
|
||||
|
||||
// Examples from
|
||||
// https://github.com/zeit/next.js/#dynamic-import
|
||||
|
||||
const LoadingComponent: React.StatelessComponent<LoadingComponentProps> = ({
|
||||
isLoading,
|
||||
error
|
||||
}) => <p>loading...</p>;
|
||||
|
||||
// 1. Basic Usage (Also does SSR)
|
||||
const DynamicComponent = dynamic(asyncComponent);
|
||||
const dynamicComponentJSX = <DynamicComponent foo="bar" />;
|
||||
|
||||
// 2. With Custom Loading Component
|
||||
const DynamicComponentWithCustomLoading = dynamic(asyncComponent, {
|
||||
loading: LoadingComponent
|
||||
});
|
||||
const dynamicComponentWithCustomLoadingJSX = <DynamicComponentWithCustomLoading foo="bar" />;
|
||||
|
||||
// 3. With No SSR
|
||||
const DynamicComponentWithNoSSR = dynamic(asyncComponent, {
|
||||
ssr: false
|
||||
});
|
||||
|
||||
// 4. With Multiple Modules At Once
|
||||
const HelloBundle = dynamic<MyComponentProps>({
|
||||
modules: () => {
|
||||
const components = {
|
||||
Hello1: asyncComponent,
|
||||
Hello2: asyncComponent
|
||||
};
|
||||
|
||||
return components;
|
||||
},
|
||||
render: (props, { Hello1, Hello2 }) => (
|
||||
<div>
|
||||
<h1>{props.foo}</h1>
|
||||
<Hello1 />
|
||||
<Hello2 />
|
||||
</div>
|
||||
)
|
||||
});
|
||||
const helloBundleJSX = <HelloBundle foo="bar" />;
|
||||
|
||||
// 5. With plain Loadable options
|
||||
const LoadableComponent = dynamic({
|
||||
loader: () => asyncComponent,
|
||||
loading: LoadingComponent,
|
||||
delay: 200,
|
||||
timeout: 10000
|
||||
});
|
||||
|
||||
// 6. No loading
|
||||
const DynamicComponentWithNoLoading = dynamic(asyncComponent, {
|
||||
loading: () => null
|
||||
});
|
||||
@ -1,11 +0,0 @@
|
||||
import Head, * as head from "next/head";
|
||||
import * as React from "react";
|
||||
|
||||
const elements: JSX.Element[] = head.defaultHead();
|
||||
const jsx = <Head>{elements}</Head>;
|
||||
|
||||
if (!Head.canUseDOM) {
|
||||
Head.rewind().map(x => [x.key, x.props, x.type]);
|
||||
}
|
||||
|
||||
Head.peek().map(x => [x.key, x.props, x.type]);
|
||||
@ -1,23 +0,0 @@
|
||||
import Link from "next/link";
|
||||
import * as React from "react";
|
||||
|
||||
const links = (
|
||||
<div>
|
||||
<Link
|
||||
as="foo"
|
||||
href="https://www.example.com"
|
||||
onError={(e: any) => {
|
||||
console.log("Handled error!", e);
|
||||
}}
|
||||
prefetch
|
||||
replace
|
||||
scroll
|
||||
shallow
|
||||
>
|
||||
<a>Gotta link to somewhere!</a>
|
||||
</Link>
|
||||
<Link>
|
||||
<a>All props are optional!</a>
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
@ -1,110 +0,0 @@
|
||||
import Router, { withRouter, WithRouterProps } from "next/router";
|
||||
import * as React from "react";
|
||||
import * as qs from "querystring";
|
||||
|
||||
Router.readyCallbacks.push(() => {
|
||||
console.log("I'll get called when the router initializes.");
|
||||
});
|
||||
Router.ready(() => {
|
||||
console.log(
|
||||
"I'll get called immediately if the router initializes, or when it eventually does.",
|
||||
);
|
||||
});
|
||||
|
||||
// Access readonly properties of the router.
|
||||
|
||||
Object.keys(Router.components).forEach(key => {
|
||||
const c = Router.components[key];
|
||||
c.err.isAnAny;
|
||||
|
||||
return <c.Component />;
|
||||
});
|
||||
|
||||
function split(routeLike: string) {
|
||||
routeLike.split("/").forEach(part => {
|
||||
console.log("path part: ", part);
|
||||
});
|
||||
}
|
||||
|
||||
if (Router.asPath) {
|
||||
split(Router.asPath);
|
||||
split(Router.asPath);
|
||||
}
|
||||
|
||||
split(Router.pathname);
|
||||
|
||||
const query = `?${qs.stringify(Router.query)}`;
|
||||
|
||||
// Assign some callback methods.
|
||||
Router.events.on('routeChangeStart', (url: string) => console.log("Route is starting to change.", url));
|
||||
Router.events.on('beforeHistoryChange', (as: string) => console.log("History hasn't changed yet.", as));
|
||||
Router.events.on('routeChangeComplete', (url: string) => console.log("Route change is complete.", url));
|
||||
Router.events.on('routeChangeError', (err: any, url: string) => console.log("Route change errored.", err, url));
|
||||
|
||||
// Call methods on the router itself.
|
||||
Router.reload("/route").then(() => console.log("route was reloaded"));
|
||||
Router.back();
|
||||
Router.beforePopState(({ url }) => !!url);
|
||||
|
||||
Router.push("/route").then((success: boolean) =>
|
||||
console.log("route push success: ", success),
|
||||
);
|
||||
Router.push("/route", "/asRoute").then((success: boolean) =>
|
||||
console.log("route push success: ", success),
|
||||
);
|
||||
Router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) =>
|
||||
console.log("route push success: ", success),
|
||||
);
|
||||
|
||||
Router.replace("/route").then((success: boolean) =>
|
||||
console.log("route replace success: ", success),
|
||||
);
|
||||
Router.replace("/route", "/asRoute").then((success: boolean) =>
|
||||
console.log("route replace success: ", success),
|
||||
);
|
||||
Router.replace("/route", "/asRoute", {
|
||||
shallow: false,
|
||||
}).then((success: boolean) => console.log("route replace success: ", success));
|
||||
|
||||
Router.prefetch("/route").then(Component => {
|
||||
const element = <Component />;
|
||||
});
|
||||
|
||||
interface TestComponentProps {
|
||||
testValue: string;
|
||||
}
|
||||
|
||||
class TestComponent extends React.Component<TestComponentProps & WithRouterProps> {
|
||||
state = { ready: false };
|
||||
|
||||
constructor(props: TestComponentProps & WithRouterProps) {
|
||||
super(props);
|
||||
if (props.router) {
|
||||
props.router.ready(() => {
|
||||
this.setState({ ready: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<h1>{this.state.ready ? 'Ready' : 'Not Ready'}</h1>
|
||||
<h2>Route: {this.props.router ? this.props.router.route : ""}</h2>
|
||||
<p>Another prop: {this.props.testValue}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
withRouter(TestComponent);
|
||||
|
||||
interface TestFCQuery {
|
||||
test?: string;
|
||||
}
|
||||
|
||||
interface TestFCProps extends WithRouterProps<TestFCQuery> { }
|
||||
|
||||
const TestFC: React.FunctionComponent<TestFCProps> = ({ router }) => {
|
||||
return <div>{router && router.query && router.query.test}</div>;
|
||||
};
|
||||
@ -30,14 +30,9 @@
|
||||
"router.d.ts",
|
||||
"config.d.ts",
|
||||
"test/next-tests.ts",
|
||||
"test/next-constants-tests.ts",
|
||||
"test/next-app-tests.tsx",
|
||||
"test/next-error-tests.tsx",
|
||||
"test/next-head-tests.tsx",
|
||||
"test/next-document-tests.tsx",
|
||||
"test/next-link-tests.tsx",
|
||||
"test/next-dynamic-tests.tsx",
|
||||
"test/next-router-tests.tsx",
|
||||
"test/next-component-tests.tsx"
|
||||
]
|
||||
}
|
||||
|
||||
1
types/node-cache/index.d.ts
vendored
1
types/node-cache/index.d.ts
vendored
@ -283,3 +283,4 @@ declare class NodeCache extends events.EventEmitter implements NodeCache.NodeCac
|
||||
}
|
||||
|
||||
export = NodeCache;
|
||||
export as namespace NodeCache;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user