Merge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped into jquery/promise-compatibility

This commit is contained in:
Leonard Thieu
2018-09-17 13:50:26 -04:00
18 changed files with 191 additions and 3 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ class MyComponent extends EmberObject {
removeObserver(this, 'foo', lambda);
}
fooDidChange(sender: this, key: keyof this) {
fooDidChange(sender: this, key: string) {
// your code
}
}
+2
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/louischatriot/nedb
// Definitions by: Stefan Steinhart <https://github.com/reppners>
// Anthony Nichols <https://github.com/anthonynichols>
// Alejandro Fernandez Haro <https://github.com/afharo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = Nedb;
@@ -215,6 +216,7 @@ declare namespace Nedb {
fieldName: string;
unique?: boolean;
sparse?: boolean;
expireAfterSeconds?: number;
}
interface Persistence {
+5
View File
@@ -496,6 +496,11 @@ db.ensureIndex({ fieldName: 'somefield', unique: true }, (err: Error) => {
db.ensureIndex({ fieldName: 'somefield', unique: true, sparse: true }, (err: Error) => {
});
// Example of using expireAfterSeconds to remove documents 1 hour
// after their creation (db's timestampData option is true here)
db.ensureIndex({ fieldName: 'somefield', expireAfterSeconds: 3600 }, (err: Error) => {
});
// Format of the error message when the unique constraint is not met
db.insert({ somefield: 'nedb' }, (err: Error) => {
// err is null
+5
View File
@@ -6415,6 +6415,11 @@ declare module "stream" {
export class PassThrough extends Transform { }
export function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException) => void): () => void;
export namespace finished {
export function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream): Promise<void>;
}
export function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException) => void): T;
export function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException) => void): T;
export function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.ReadWriteStream, stream4: T, callback?: (err: NodeJS.ErrnoException) => void): T;
+15
View File
@@ -1123,6 +1123,21 @@ function simplified_stream_ctor_test() {
});
}
function streamPipelineFinished() {
const cancel = stream.finished(process.stdin, (err?: Error) => {});
cancel();
stream.pipeline(process.stdin, process.stdout, (err?: Error) => {});
}
async function asyncStreamPipelineFinished() {
const finished = util.promisify(stream.finished);
await finished(process.stdin);
const pipeline = util.promisify(stream.pipeline);
await pipeline(process.stdin, process.stdout);
}
////////////////////////////////////////////////////////
/// Crypto tests : http://nodejs.org/api/crypto.html ///
////////////////////////////////////////////////////////
+20 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for pino 5.20
// Type definitions for pino 5.6
// Project: https://github.com/pinojs/pino.git
// Definitions by: Peter Snider <https://github.com/psnider>
// BendingBender <https://github.com/BendingBender>
@@ -150,6 +150,17 @@ declare namespace P {
* Outputs the level as a string instead of integer. Default: `false`.
*/
useLevelLabels?: boolean;
/**
* Use this option to define additional logging levels.
* The keys of the object correspond the namespace of the log level, and the values should be the numerical value of the level.
*/
customLevels?: { [key: string]: number };
/**
* Use this option to only use defined `customLevels` and omit Pino's levels.
* Logger's default `level` must be changed to a value in `customLevels` in order to use `useOnlyCustomLevels`
* Warning: this option may not be supported by downstream transports.
*/
useOnlyCustomLevels?: boolean;
/**
* When defining a custom log level via level, set to an integer value to define the new level. Default: `undefined`.
*/
@@ -277,6 +288,14 @@ declare namespace P {
* Outputs the level as a string instead of integer.
*/
useLevelLabels: boolean;
/**
* Define additional logging levels.
*/
customLevels: { [key: string]: number };
/**
* Use only defined `customLevels` and omit Pino's levels.
*/
useOnlyCustomLevels: boolean;
/**
* Returns the integer value for the logger instance's logging level.
*/
+20
View File
@@ -0,0 +1,20 @@
// Type definitions for prosemirror-dropcursor 1.0
// Project: https://github.com/ProseMirror/prosemirror-dropcursor
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
// David Hahn <https://github.com/davidka>
// Daniil Dotsev <https://github.com/dddotsev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Plugin } from 'prosemirror-state';
/**
* Create a plugin that, when added to a ProseMirror instance,
* causes a decoration to show up at the drop position when something
* is dragged over the editor.
*
* @param options These options are supported:
* @param options.color The color of the cursor. Defaults to `black`.
* @param options.width The precise width of the cursor in pixels. Defaults to 1.
*/
export function dropCursor(options?: { color?: string | null, width?: number | null }): Plugin;
@@ -0,0 +1,4 @@
import { dropCursor } from 'prosemirror-dropcursor';
import { Plugin } from 'prosemirror-state';
const dropCursorPlugin: Plugin = dropCursor();
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"prosemirror-dropcursor-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+22
View File
@@ -0,0 +1,22 @@
declare module 'react-native/Libraries/Core/Devtools/parseErrorStack' {
export type StackFrame = {
file: string;
methodName: string;
lineNumber: number;
column: number | null;
};
export interface ExtendedError extends Error {
framesToPop?: number;
}
export default function parseErrorStack(error: ExtendedError): StackFrame[];
}
declare module 'react-native/Libraries/Core/Devtools/symbolicateStackTrace' {
import { StackFrame } from 'react-native/Libraries/Core/Devtools/parseErrorStack';
export default function symbolicateStackTrace(
stack: ReadonlyArray<StackFrame>
): Promise<StackFrame[]>;
}
+15
View File
@@ -30,6 +30,7 @@
/// <reference path="globals.d.ts" />
/// <reference path="legacy-properties.d.ts" />
/// <reference path="BatchedBridge.d.ts" />
/// <reference path="Devtools.d.ts" />
import * as PropTypes from 'prop-types';
import * as React from 'react';
@@ -5217,6 +5218,20 @@ export namespace StyleSheet {
export function flatten(style?: StyleProp<ImageStyle>): ImageStyle;
export function flatten(style?: StyleProp<ViewStyle>): ViewStyle;
/**
* WARNING: EXPERIMENTAL. Breaking changes will probably happen a lot and will
* not be reliably announced. The whole thing might be deleted, who knows? Use
* at your own risk.
*
* Sets a function to use to pre-process a style property value. This is used
* internally to process color and transform values. You should not use this
* unless you really know what you are doing and have exhausted other options.
*/
export function setStyleAttributePreprocessor(
property: string,
process: (nextProp: any) => any
): void;
/**
* This is defined as the width of a thin line on the platform. It can be
* used as the thickness of a border or division between two elements.
+2
View File
@@ -153,6 +153,8 @@ const stylesAlt = StyleSheet.create({
},
});
StyleSheet.setStyleAttributePreprocessor('fontFamily', (family: string) => family);
const welcomeFontSize = StyleSheet.flatten(styles.welcome).fontSize;
const viewStyle: StyleProp<ViewStyle> = {
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for resize-img 1.1
// Project: https://github.com/kevva/resize-img#readme
// Definitions by: Yusuke Higuchi <https://github.com/higuri>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export = ResizeImg;
declare function ResizeImg(
input: Buffer,
options: ResizeImg.ResizeImgOptions): Promise<Buffer>;
declare namespace ResizeImg {
interface ResizeImgOptions {
width?: number;
height?: number;
}
}
+9
View File
@@ -0,0 +1,9 @@
import * as fs from "fs";
import resizeImg = require("resize-img");
resizeImg(fs.readFileSync("images/dog.jpg"), {
width: 128,
height: 128,
}).then((buf) => {
fs.writeFileSync("resized.jpg", buf);
});
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"resize-img-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -4585,7 +4585,7 @@ declare namespace Stripe {
* If the subscription has ended (either because it was canceled or because the customer was switched to a subscription
* to a new plan), the date the subscription ended
*/
ended_at: number;
ended_at: number | null;
metadata: IMetadata;