feat(physical-cpu-count): new type definition (#44216)

- definition file
- test

https://www.npmjs.com/package/physical-cpu-count

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-04-27 13:58:51 +02:00 committed by GitHub
parent f23e0e67cb
commit ca14596212
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 0 deletions

14
types/physical-cpu-count/index.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
// Type definitions for physical-cpu-count 2.0
// Project: https://www.npmjs.com/package/physical-cpu-count
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Returns the number of physical CPU cores.
*
* @see {@link https://www.npmjs.com/package/physical-cpu-count#use-case|Use Case}
* @see {@link https://www.npmjs.com/package/physical-cpu-count#known-limitations|Known Limitations}
*/
declare const amount: number;
export = amount;

View File

@ -0,0 +1,8 @@
/// <reference types="node" />
import physicalCpuCount = require('physical-cpu-count');
import { cpus } from 'os';
const logicalCpuCount = cpus().length;
physicalCpuCount; // $ExpectType number
logicalCpuCount; // $ExpectType number

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"physical-cpu-count-tests.ts"
]
}

View File

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