mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 06:40:35 +08:00
[detect-newline] add typings (#18861)
This commit is contained in:
committed by
Mohamed Hegazy
parent
9f1b796ade
commit
d77e701618
7
types/detect-newline/detect-newline-tests.ts
Normal file
7
types/detect-newline/detect-newline-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import detectNewline = require('detect-newline');
|
||||
|
||||
const res1 = detectNewline('foo\nbar\nbaz\r\n');
|
||||
res1; // $ExpectType "\r\n" | "\n" | null
|
||||
|
||||
const res2 = detectNewline.graceful('foo\nbar\nbaz\r\n');
|
||||
res2; // $ExpectType "\r\n" | "\n"
|
||||
12
types/detect-newline/index.d.ts
vendored
Normal file
12
types/detect-newline/index.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Type definitions for detect-newline 2.1
|
||||
// Project: https://github.com/sindresorhus/detect-newline#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = detectNewline;
|
||||
|
||||
declare function detectNewline(str: string): '\r\n' | '\n' | null;
|
||||
|
||||
declare namespace detectNewline {
|
||||
function graceful(str: string): '\r\n' | '\n';
|
||||
}
|
||||
22
types/detect-newline/tsconfig.json
Normal file
22
types/detect-newline/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",
|
||||
"detect-newline-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/detect-newline/tslint.json
Normal file
1
types/detect-newline/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user