Merge pull request #31497 from BendingBender/open-editor

Add types for open-editor
This commit is contained in:
Nathan Shively-Sanders
2018-12-18 08:56:46 -08:00
committed by GitHub
4 changed files with 92 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
// Type definitions for open-editor 1.2
// Project: https://github.com/sindresorhus/open-editor#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { PathSpec } from 'line-column-path';
export = openEditor;
declare function openEditor(files: PathSpec[], options?: openEditor.Options): void;
declare namespace openEditor {
function make(files: PathSpec[], options?: Options): EditorRunConfig;
interface Options {
editor?: string;
}
interface EditorRunConfig {
bin: string;
args: string[];
isTerminalEditor: boolean;
}
}
+43
View File
@@ -0,0 +1,43 @@
import openEditor = require('open-editor');
openEditor([
'unicorn.js:5:3',
{
file: 'readme.md',
line: 10,
column: 2,
},
]);
openEditor(
[
'unicorn.js:5:3',
{
file: 'readme.md',
line: 10,
column: 2,
},
],
{ editor: 'vi' }
);
// $ExpectType EditorRunConfig
openEditor.make([
'unicorn.js:5:3',
{
file: 'readme.md',
line: 10,
column: 2,
},
]);
// $ExpectType EditorRunConfig
openEditor.make(
[
'unicorn.js:5:3',
{
file: 'readme.md',
line: 10,
column: 2,
},
],
{ editor: 'vi' }
);
+23
View File
@@ -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",
"open-editor-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }