Add some packages and update 1 repo url (#35953)

Add
1. all-the-package-names
2. date-range-array
3. download-file-sync
4. node-wget-promise
5. random
6. stats-lite
This commit is contained in:
Nathan Shively-Sanders 2019-06-04 13:54:22 -07:00 committed by GitHub
parent e830c9b573
commit d9fd6571d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 302 additions and 1 deletions

View File

@ -0,0 +1,5 @@
import names = require('all-the-package-names');
// $ExpectType string[]
names.slice(0, 5);
// $ExpectType number
names.indexOf('superagent');

View File

@ -0,0 +1,6 @@
// Type definitions for all-the-package-names 1.3744
// Project: https://github.com/zeke/all-the-package-names
// Definitions by: Nathan Shively-Sanders <https://github.com/sandersn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare const names: string[];
export = names;

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",
"all-the-package-names-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -0,0 +1,4 @@
import dra = require('date-range-array');
const dates = dra('2015-02-27', '2015-03-02');
// $ExpectType string[]
dates;

6
types/date-range-array/index.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
// Type definitions for date-range-array 2.1
// Project: https://github.com/davidguttman/date-range-array
// Definitions by: Nathan Shively-Sanders <https://github.com/sandersn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function f(start: string, end: string): string[];
export = f;

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",
"date-range-array-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -0,0 +1,3 @@
import downloadFileSync = require('download-file-sync');
// $ExpectType string
const content = downloadFileSync('https://github.com/vjeux/download-file-sync');

6
types/download-file-sync/index.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
// Type definitions for download-file-sync 1.0
// Project: https://github.com/vjeux/download-file-sync
// Definitions by: Nathan Shively-Sanders <https://github.com/sandersn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function f(url: string): string;
export = f;

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",
"download-file-sync-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -1,5 +1,5 @@
// Type definitions for geodesy 1.2
// Project: https://github.com/chrisveness/geodesy, http://www.movable-type.co.uk/scripts/latlong.html
// Project: https://github.com/chrisveness/geodesy, http://www.movable-type.co.uk/scripts/geodesy-library.html
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
// Gilbert Handy <https://github.com/HandyG52>
// Harry Nicholls <https://github.com/excelulous>

6
types/node-wget-promise/index.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
// Type definitions for date-range-array 0.1
// Project: https://github.com/ajhsu/node-wget-promise
// Definitions by: Nathan Shively-Sanders <https://github.com/sandersn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function download(source: string, options?: { verbose?: boolean, output?: string, onStart?: any, onProgress?: any}): Promise<void>;
export = download;

View File

@ -0,0 +1,3 @@
import wget = require('node-wget-promise');
wget('https://node.js.org/images/logo.svg');
wget('https://node.js.org/images/logo.svg', { output: '~/Pictures/logo.svg', verbose: false });

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",
"node-wget-promise-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

30
types/random/index.d.ts vendored Normal file
View File

@ -0,0 +1,30 @@
// Type definitions for random 2.1
// Project: https://github.com/transitive-bullshit/random
// Definitions by: Nathan Shively-Sanders <https://github.com/sandersn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function float(min?: number, max?: number): number;
export function int(min?: number, max?: number): number;
export function boolean(): boolean;
export function uniform(min: number, max: number): () => number;
export function uniformInt(min: number, max: number): () => number;
export function uniformBoolean(): () => boolean;
export function normal(mu: number, sigma: number): () => number;
export function logNormal(mu: number, sigma: number): () => number;
export function bernoulli(p: number): () => number;
export function binomial(n: number, p: number): () => number;
export function geometric(p: number): () => number;
export function poisson(lambda: number): () => number;
export function exponential(lambda: number): () => number;
export function irwinHall(n: number): () => number;
export function bates(n: number): () => number;
export function pareto(alpha: number): () => number;
export function use(n: number): void;
export function patch(): void;
export function unpatch(): void;

View File

@ -0,0 +1,53 @@
import * as random from 'random';
let min = 0;
let max = 0;
let mu = 0;
let sigma = 0;
let lambda = 0;
let p = 0;
let n = 0;
// quick uniform shortcuts
// $ExpectType number
random.float(min = 0, max = 1); // uniform float in [ min, max )
// $ExpectType number
random.int(min = 0, max = 1); // uniform integer in [ min, max ]
// $ExpectType boolean
random.boolean(); // true or false
// uniform
// $ExpectType () => number
random.uniform(min = 0, max = 1); // () => [ min, max )
// $ExpectType () => number
random.uniformInt(min = 0, max = 1); // () => [ min, max ]
// $ExpectType () => boolean
random.uniformBoolean(); // () => [ false, true ]
// normal
// $ExpectType () => number
random.normal(mu = 0, sigma = 1);
// $ExpectType () => number
random.logNormal(mu = 0, sigma = 1);
// bernoulli
// $ExpectType () => number
random.bernoulli(p = 0.5);
// $ExpectType () => number
random.binomial(n = 1, p = 0.5);
// $ExpectType () => number
random.geometric(p = 0.5);
// poisson
// $ExpectType () => number
random.poisson(lambda = 1);
// $ExpectType () => number
random.exponential(lambda = 1);
// misc
// $ExpectType () => number
random.irwinHall(n);
// $ExpectType () => number
random.bates(n);
const alpha = 0;
// $ExpectType () => number
random.pareto(alpha);

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",
"random-tests.ts"
]
}

1
types/random/tslint.json Normal file
View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

14
types/stats-lite/index.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
// Type definitions for stats-lite 2.2
// Project: https://github.com/brycebaril/node-stats-lite
// Definitions by: Nathan Shively-Sanders <https://github.com/sandersn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function sum(ns: number[]): number;
export function mean(ns: number[]): number;
export function median(ns: number[]): number;
export function mode(ns: number[]): number;
export function variance(ns: number[]): number;
export function stdev(ns: number[]): number;
export function sampleStdev(ns: number[]): number;
export function percentile(ns: number[], percentile: number): number;
export function histogram(ns: number[], percentile: number): number;

View File

@ -0,0 +1,21 @@
import * as stats from "stats-lite";
const rolls: number[] = [];
// $ExpectType number
stats.sum(rolls);
// $ExpectType number
stats.mean(rolls);
// $ExpectType number
stats.median(rolls);
// $ExpectType number
stats.mode(rolls);
// $ExpectType number
stats.variance(rolls);
// $ExpectType number
stats.stdev(rolls);
// $ExpectType number
stats.sampleStdev(rolls);
// $ExpectType number
stats.percentile(rolls, 0.85);
// $ExpectType number
stats.histogram(rolls, 10);

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",
"stats-lite-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }