mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
feat: Add array.from (#39055)
* feat: Add `array.from` * docs(array.from): Add TSDoc comments * docs(array.from): Improve TSDoc
This commit is contained in:
parent
a66be93748
commit
192a1b5b5b
3
types/array.from/.editorconfig
Normal file
3
types/array.from/.editorconfig
Normal file
@ -0,0 +1,3 @@
|
||||
# This package uses tabs
|
||||
[*]
|
||||
indent_style = tab
|
||||
12
types/array.from/array.from-tests.ts
Normal file
12
types/array.from/array.from-tests.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import ArrayFrom = require('array.from');
|
||||
|
||||
/**
|
||||
* The `expectType` function from https://www.npmjs.com/package/tsd,
|
||||
* except instead of returning `void`, it returns `T`.
|
||||
*/
|
||||
declare function expectType<T>(t: T): T;
|
||||
|
||||
expectType<typeof Array.from>(ArrayFrom);
|
||||
expectType<typeof Array.from>(ArrayFrom.implementation);
|
||||
expectType<() => typeof Array.from>(ArrayFrom.getPolyfill);
|
||||
expectType<() => typeof Array.from>(ArrayFrom.shim);
|
||||
8
types/array.from/implementation.d.ts
vendored
Normal file
8
types/array.from/implementation.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param iterable An array-like or iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of `this` used to invoke the mapfn.
|
||||
*/
|
||||
declare const ArrayFrom: typeof Array.from;
|
||||
export = ArrayFrom;
|
||||
31
types/array.from/index.d.ts
vendored
Normal file
31
types/array.from/index.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Type definitions for array.from 1.0
|
||||
// Project: https://mths.be/array-from
|
||||
// Definitions by: ExE Boss <https://github.com/ExE-Boss>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import implementation = require('./implementation');
|
||||
import getPolyfill = require('./polyfill');
|
||||
import shim = require('./shim');
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param iterable An iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of `this` used to invoke the mapfn.
|
||||
*/
|
||||
declare const ArrayFrom: typeof implementation & {
|
||||
/**
|
||||
* Gets the optimal `Array.from` implementation to use.
|
||||
*/
|
||||
readonly getPolyfill: typeof getPolyfill;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like or iterable object.
|
||||
* @param iterable An iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of `this` used to invoke the mapfn.
|
||||
*/
|
||||
readonly implementation: typeof implementation;
|
||||
readonly shim: typeof shim;
|
||||
};
|
||||
export = ArrayFrom;
|
||||
7
types/array.from/polyfill.d.ts
vendored
Normal file
7
types/array.from/polyfill.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import ArrayFrom = require('./implementation');
|
||||
|
||||
/**
|
||||
* Gets the optimal `Array.from` implementation to use.
|
||||
*/
|
||||
declare function getPolyfill(): typeof ArrayFrom;
|
||||
export = getPolyfill;
|
||||
4
types/array.from/shim.d.ts
vendored
Normal file
4
types/array.from/shim.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import ArrayFrom = require('./implementation');
|
||||
|
||||
declare function shimArrayFrom(): typeof ArrayFrom;
|
||||
export = shimArrayFrom;
|
||||
22
types/array.from/tsconfig.json
Normal file
22
types/array.from/tsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es2015"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"implementation.d.ts",
|
||||
"index.d.ts",
|
||||
"polyfill.d.ts",
|
||||
"shim.d.ts",
|
||||
"array.from-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/array.from/tslint.json
Normal file
1
types/array.from/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user