mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
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:
parent
f23e0e67cb
commit
ca14596212
14
types/physical-cpu-count/index.d.ts
vendored
Normal file
14
types/physical-cpu-count/index.d.ts
vendored
Normal 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;
|
||||
8
types/physical-cpu-count/physical-cpu-count-tests.ts
Normal file
8
types/physical-cpu-count/physical-cpu-count-tests.ts
Normal 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
|
||||
23
types/physical-cpu-count/tsconfig.json
Normal file
23
types/physical-cpu-count/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
1
types/physical-cpu-count/tslint.json
Normal file
1
types/physical-cpu-count/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user