mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #31497 from BendingBender/open-editor
Add types for open-editor
This commit is contained in:
Vendored
+25
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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' }
|
||||
);
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user