mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
[os-locale] add typings for v2, add strict null checks & linting (#18732)
This commit is contained in:
committed by
Mohamed Hegazy
parent
f340893290
commit
734ea84afc
Vendored
+11
-7
@@ -1,13 +1,17 @@
|
||||
// Type definitions for os-locale 1.4.0
|
||||
// Type definitions for os-locale 2.1
|
||||
// Project: https://github.com/sindresorhus/os-locale
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = osLocale;
|
||||
|
||||
declare function osLocale(options: { spawn?: boolean }, cb: (err: any, locale: string) => void): void;
|
||||
declare function osLocale(cb: (err: any, locale: string) => void): void;
|
||||
declare function osLocaleSync(): string;
|
||||
declare function osLocaleSync(options: { spawn?: boolean }): string;
|
||||
declare function osLocale(options?: osLocale.Options): Promise<string>;
|
||||
|
||||
export { osLocaleSync as sync };
|
||||
export default osLocale;
|
||||
declare namespace osLocale {
|
||||
function sync(options?: Options): string;
|
||||
|
||||
interface Options {
|
||||
spawn?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import osLocale = require('os-locale');
|
||||
|
||||
import osLocale, { sync } from 'os-locale';
|
||||
|
||||
osLocale((err: any, locale: string) => {
|
||||
osLocale().then(locale => {
|
||||
const str: string = locale;
|
||||
});
|
||||
osLocale({spawn: false}).then(locale => {
|
||||
const str: string = locale;
|
||||
});
|
||||
|
||||
osLocale({spawn: false}, (err: any, locale: string) => {
|
||||
});
|
||||
|
||||
var locale1: string = sync();
|
||||
var locale2: string = sync({spawn: false});
|
||||
const locale1: string = osLocale.sync();
|
||||
const locale2: string = osLocale.sync({spawn: false});
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -19,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"os-locale-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Type definitions for os-locale 1.4
|
||||
// Project: https://github.com/sindresorhus/os-locale
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = osLocale;
|
||||
|
||||
declare function osLocale(options: { spawn?: boolean }, cb: (err: any, locale: string) => void): void;
|
||||
declare function osLocale(cb: (err: any, locale: string) => void): void;
|
||||
|
||||
declare namespace osLocale {
|
||||
function sync(options?: { spawn?: boolean }): string;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import osLocale = require('os-locale');
|
||||
|
||||
osLocale((err: any, locale: string) => {
|
||||
});
|
||||
|
||||
osLocale({spawn: false}, (err: any, locale: string) => {
|
||||
});
|
||||
|
||||
const locale1: string = osLocale.sync();
|
||||
const locale2: string = osLocale.sync({spawn: false});
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"os-locale": ["os-locale/v1"]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"os-locale-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user