[detect-indent] add typings for v5, lintint & strict null checks (#18859)

This commit is contained in:
Dimitri Benin
2017-08-11 09:02:39 -07:00
committed by Mohamed Hegazy
parent e3c0aa0357
commit e09f8c00cd
8 changed files with 62 additions and 12 deletions
+7 -5
View File
@@ -1,7 +1,9 @@
import detectIndent = require('detect-indent');
import di = require('detect-indent');
const indent = detectIndent('').indent || ' ';
var str: string;
str = di(str);
str = di(str, str);
const indentInfo = detectIndent('');
indentInfo; // $ExpectType IndentInfo
const num: number = indentInfo.amount;
const str: string = indentInfo.indent;
const type: 'space' | 'tab' | null = indentInfo.type;
+11 -5
View File
@@ -1,11 +1,17 @@
// Type definitions for detect-indent 0.1.3
// Type definitions for detect-indent 5.0
// Project: https://github.com/sindresorhus/detect-indent
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = detectIndent;
interface DetectIndent {
(dir: string, alt?: string): string;
declare function detectIndent(str: string): detectIndent.IndentInfo;
declare namespace detectIndent {
interface IndentInfo {
amount: number;
type: 'tab' | 'space' | null;
indent: string;
}
}
declare var _: DetectIndent;
export = _;
+2 -2
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -19,4 +19,4 @@
"index.d.ts",
"detect-indent-tests.ts"
]
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,6 @@
import di = require('detect-indent');
let str: string = '';
str = di(str);
str = di(str, str);
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for detect-indent 0.1
// Project: https://github.com/sindresorhus/detect-indent
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type DetectIndent = (dir: string, alt?: string) => string;
declare const _: DetectIndent;
export = _;
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"detect-indent": ["detect-indent/v0"]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"detect-indent-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }