mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #31381 from BendingBender/line-column-path
Add types for line-column-path
This commit is contained in:
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// Type definitions for line-column-path 1.0
|
||||
// Project: https://github.com/sindresorhus/line-column-path#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
export function parse(input: PathSpec): ParsedPath;
|
||||
export function stringify(input: PathDescriptor, options?: StringifyOptions): string;
|
||||
|
||||
export type PathSpec = string | PathDescriptor;
|
||||
|
||||
export interface PathDescriptor {
|
||||
file: string;
|
||||
line?: number;
|
||||
column?: number;
|
||||
}
|
||||
|
||||
export type ParsedPath = Required<PathDescriptor>;
|
||||
|
||||
export interface StringifyOptions {
|
||||
file?: boolean;
|
||||
column?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import lineColumnPath = require('line-column-path');
|
||||
|
||||
const parsed = lineColumnPath.parse('unicorn.js:8:14');
|
||||
// $ExpectType Required<PathDescriptor>
|
||||
parsed;
|
||||
// $ExpectType Required<PathDescriptor>
|
||||
lineColumnPath.parse({ file: 'unicorn.js' });
|
||||
// $ExpectType Required<PathDescriptor>
|
||||
lineColumnPath.parse({ file: 'unicorn.js', line: 1 });
|
||||
// $ExpectType Required<PathDescriptor>
|
||||
lineColumnPath.parse({ file: 'unicorn.js', column: 1 });
|
||||
|
||||
// $ExpectType string
|
||||
lineColumnPath.stringify(parsed);
|
||||
// $ExpectType string
|
||||
lineColumnPath.stringify({ file: 'unicorn.js' });
|
||||
// $ExpectType string
|
||||
lineColumnPath.stringify({ file: 'unicorn.js', line: 1 });
|
||||
// $ExpectType string
|
||||
lineColumnPath.stringify({ file: 'unicorn.js', column: 1 });
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"line-column-path-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user