@inquirer/type
Advanced tools
Comparing version
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CancelablePromise = void 0; | ||
class CancelablePromise extends Promise { | ||
constructor() { | ||
super(...arguments); | ||
Object.defineProperty(this, "cancel", { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: () => { } | ||
}); | ||
} | ||
} | ||
exports.CancelablePromise = CancelablePromise; | ||
__exportStar(require('./inquirer.js'), exports); | ||
__exportStar(require('./utils.js'), exports); |
@@ -1,40 +0,2 @@ | ||
import * as readline from 'node:readline'; | ||
import MuteStream from 'mute-stream'; | ||
export type InquirerReadline = readline.ReadLine & { | ||
output: MuteStream; | ||
input: NodeJS.ReadableStream; | ||
clearLine: (dir: 0 | 1 | -1) => void; | ||
}; | ||
export declare class CancelablePromise<T> extends Promise<T> { | ||
cancel: () => void; | ||
} | ||
export type Prettify<T> = { | ||
[K in keyof T]: T[K]; | ||
} & {}; | ||
export type PartialDeep<T> = T extends object ? { | ||
[P in keyof T]?: PartialDeep<T[P]>; | ||
} : T; | ||
export type Context = { | ||
input?: NodeJS.ReadableStream; | ||
output?: NodeJS.WritableStream; | ||
clearPromptOnDone?: boolean; | ||
}; | ||
export type Prompt<Value, Config> = (config: Config, context?: Context) => CancelablePromise<Value>; | ||
/** | ||
* Utility types used for writing tests | ||
* | ||
* Equal<A, B> checks that A and B are the same type, and returns | ||
* either `true` or `false`. | ||
* | ||
* You can use it in combination with `Expect` to write type | ||
* inference unit tests: | ||
* | ||
* ```ts | ||
* type t = Expect< | ||
* Equal<Partial<{ a: string }>, { a?: string }> | ||
* > | ||
* ``` | ||
*/ | ||
export type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false; | ||
export type Expect<T extends true> = T; | ||
export type Not<T extends boolean> = T extends true ? false : true; | ||
export * from './inquirer.js'; | ||
export * from './utils.js'; |
{ | ||
"name": "@inquirer/type", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Inquirer core TS types", | ||
@@ -64,3 +64,3 @@ "main": "./dist/cjs/index.js", | ||
"tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs", | ||
"dev": "tsc -p ./tsconfig.json --watch", | ||
"tsc:watch": "tsc -p ./tsconfig.json --watch", | ||
"attw": "attw --pack" | ||
@@ -84,3 +84,3 @@ }, | ||
"sideEffects": false, | ||
"gitHead": "fc27d575bceb96466cb8da8524c26d4eb2a77df0" | ||
"gitHead": "eb7a658ca58d8cc5863efb9289ae1b42e818bdd0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
9007
55%15
150%132
127.59%