mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-06 06:19:58 +08:00
[getos] add typings (#18733)
This commit is contained in:
committed by
Mohamed Hegazy
parent
d17782cacf
commit
f340893290
18
types/getos/getos-tests.ts
Normal file
18
types/getos/getos-tests.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import getos = require('getos');
|
||||
|
||||
getos((e, os) => {
|
||||
if (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
const thisOs: getos.Os = os;
|
||||
|
||||
if (os.os === 'linux') {
|
||||
let str: string;
|
||||
let strn: string | undefined;
|
||||
|
||||
str = os.dist;
|
||||
str = os.release;
|
||||
strn = os.codename;
|
||||
}
|
||||
});
|
||||
30
types/getos/index.d.ts
vendored
Normal file
30
types/getos/index.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Type definitions for getos 3.0
|
||||
// Project: https://github.com/retrohacker/getos
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = getos;
|
||||
|
||||
declare function getos(cb: (error: Error | null, os: getos.Os) => void): string;
|
||||
|
||||
declare namespace getos {
|
||||
type Os = OtherOs | LinuxOs;
|
||||
|
||||
interface OtherOs {
|
||||
os: 'aix'
|
||||
| 'android'
|
||||
| 'darwin'
|
||||
| 'freebsd'
|
||||
| 'openbsd'
|
||||
| 'sunos'
|
||||
| 'win32'
|
||||
| 'cygwin';
|
||||
}
|
||||
|
||||
interface LinuxOs {
|
||||
os: 'linux';
|
||||
dist: string;
|
||||
release: string;
|
||||
codename?: string;
|
||||
}
|
||||
}
|
||||
22
types/getos/tsconfig.json
Normal file
22
types/getos/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"getos-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/getos/tslint.json
Normal file
1
types/getos/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user