diff --git a/types/ember__object/test/observable.ts b/types/ember__object/test/observable.ts index baa8e3d09a..aa41889d24 100644 --- a/types/ember__object/test/observable.ts +++ b/types/ember__object/test/observable.ts @@ -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 } } diff --git a/types/nedb/index.d.ts b/types/nedb/index.d.ts index 02ed81be4f..dd3035dd72 100644 --- a/types/nedb/index.d.ts +++ b/types/nedb/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/louischatriot/nedb // Definitions by: Stefan Steinhart // Anthony Nichols +// Alejandro Fernandez Haro // 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 { diff --git a/types/nedb/nedb-tests.ts b/types/nedb/nedb-tests.ts index c1ba5459cd..0df7168cf1 100644 --- a/types/nedb/nedb-tests.ts +++ b/types/nedb/nedb-tests.ts @@ -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 diff --git a/types/node/index.d.ts b/types/node/index.d.ts index d0ebd2124f..c1974ef350 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -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; + } + export function pipeline(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException) => void): T; export function pipeline(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException) => void): T; export function pipeline(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: NodeJS.ReadWriteStream, stream4: T, callback?: (err: NodeJS.ErrnoException) => void): T; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index b9a02f8dbd..3feb7a4a86 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -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 /// //////////////////////////////////////////////////////// diff --git a/types/pino/index.d.ts b/types/pino/index.d.ts index 42d7a4d1f6..71cb957643 100644 --- a/types/pino/index.d.ts +++ b/types/pino/index.d.ts @@ -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 // 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. */ diff --git a/types/prosemirror-dropcursor/index.d.ts b/types/prosemirror-dropcursor/index.d.ts new file mode 100644 index 0000000000..548834b6df --- /dev/null +++ b/types/prosemirror-dropcursor/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for prosemirror-dropcursor 1.0 +// Project: https://github.com/ProseMirror/prosemirror-dropcursor +// Definitions by: Bradley Ayers +// David Hahn +// Daniil Dotsev +// 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; diff --git a/types/prosemirror-dropcursor/prosemirror-dropcursor-tests.ts b/types/prosemirror-dropcursor/prosemirror-dropcursor-tests.ts new file mode 100644 index 0000000000..f6341817ea --- /dev/null +++ b/types/prosemirror-dropcursor/prosemirror-dropcursor-tests.ts @@ -0,0 +1,4 @@ +import { dropCursor } from 'prosemirror-dropcursor'; +import { Plugin } from 'prosemirror-state'; + +const dropCursorPlugin: Plugin = dropCursor(); diff --git a/types/prosemirror-dropcursor/tsconfig.json b/types/prosemirror-dropcursor/tsconfig.json new file mode 100644 index 0000000000..706e5b2d16 --- /dev/null +++ b/types/prosemirror-dropcursor/tsconfig.json @@ -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" + ] +} \ No newline at end of file diff --git a/types/prosemirror-dropcursor/tslint.json b/types/prosemirror-dropcursor/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/prosemirror-dropcursor/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/react-native/Devtools.d.ts b/types/react-native/Devtools.d.ts new file mode 100644 index 0000000000..18f17540b9 --- /dev/null +++ b/types/react-native/Devtools.d.ts @@ -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 + ): Promise; +} diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 98f6c92c3f..048e34b872 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -30,6 +30,7 @@ /// /// /// +/// import * as PropTypes from 'prop-types'; import * as React from 'react'; @@ -5217,6 +5218,20 @@ export namespace StyleSheet { export function flatten(style?: StyleProp): ImageStyle; export function flatten(style?: StyleProp): 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. diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index b2b66ee2da..a16d6f3e4d 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -153,6 +153,8 @@ const stylesAlt = StyleSheet.create({ }, }); +StyleSheet.setStyleAttributePreprocessor('fontFamily', (family: string) => family); + const welcomeFontSize = StyleSheet.flatten(styles.welcome).fontSize; const viewStyle: StyleProp = { diff --git a/types/resize-img/index.d.ts b/types/resize-img/index.d.ts new file mode 100644 index 0000000000..b071488ac5 --- /dev/null +++ b/types/resize-img/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for resize-img 1.1 +// Project: https://github.com/kevva/resize-img#readme +// Definitions by: Yusuke Higuchi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export = ResizeImg; + +declare function ResizeImg( + input: Buffer, + options: ResizeImg.ResizeImgOptions): Promise; + +declare namespace ResizeImg { + interface ResizeImgOptions { + width?: number; + height?: number; + } +} diff --git a/types/resize-img/resize-img-tests.ts b/types/resize-img/resize-img-tests.ts new file mode 100644 index 0000000000..b9fad114ea --- /dev/null +++ b/types/resize-img/resize-img-tests.ts @@ -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); +}); diff --git a/types/resize-img/tsconfig.json b/types/resize-img/tsconfig.json new file mode 100644 index 0000000000..10f4aba357 --- /dev/null +++ b/types/resize-img/tsconfig.json @@ -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" + ] +} diff --git a/types/resize-img/tslint.json b/types/resize-img/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/resize-img/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index fcb008c07b..33bc44b0ee 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -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;