mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
temp typings import themselves; use import "." instead (#20190)
* Refer to ourselves as '.' * Adhere to dtslint
This commit is contained in:
parent
af382ee072
commit
eb450d9bf7
31
types/temp/index.d.ts
vendored
31
types/temp/index.d.ts
vendored
@ -1,11 +1,11 @@
|
||||
// Type definitions for temp 0.8.3
|
||||
// Type definitions for temp 0.8
|
||||
// Project: https://www.npmjs.com/package/temp, https://github.com/bruce/node-temp
|
||||
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as temp from "temp";
|
||||
import * as temp from ".";
|
||||
import * as fs from "fs";
|
||||
|
||||
export interface OpenFile {
|
||||
@ -24,29 +24,22 @@ export interface AffixOptions {
|
||||
dir?: string;
|
||||
}
|
||||
|
||||
export declare var dir: string;
|
||||
export let dir: string;
|
||||
|
||||
export declare function track(value?: boolean): typeof temp;
|
||||
export function track(value?: boolean): typeof temp;
|
||||
|
||||
export declare function mkdir(affixes?: string, callback?: (err: any, dirPath: string) => void): void;
|
||||
export declare function mkdir(affixes?: AffixOptions, callback?: (err: any, dirPath: string) => void): void;
|
||||
export function mkdir(affixes?: string | AffixOptions, callback?: (err: any, dirPath: string) => void): void;
|
||||
|
||||
export declare function mkdirSync(affixes?: string): string;
|
||||
export declare function mkdirSync(affixes?: AffixOptions): string;
|
||||
export function mkdirSync(affixes?: string | AffixOptions): string;
|
||||
|
||||
export declare function open(affixes?: string, callback?: (err: any, result: OpenFile) => void): void;
|
||||
export declare function open(affixes?: AffixOptions, callback?: (err: any, result: OpenFile) => void): void;
|
||||
export function open(affixes?: string | AffixOptions, callback?: (err: any, result: OpenFile) => void): void;
|
||||
|
||||
export declare function openSync(affixes?: string): OpenFile;
|
||||
export declare function openSync(affixes?: AffixOptions): OpenFile;
|
||||
export function openSync(affixes?: string | AffixOptions): OpenFile;
|
||||
|
||||
export declare function path(affixes?: string, defaultPrefix?: string): string;
|
||||
export declare function path(affixes?: AffixOptions, defaultPrefix?: string): string;
|
||||
export function path(affixes?: string | AffixOptions, defaultPrefix?: string): string;
|
||||
|
||||
export declare function cleanup(callback?: (result: boolean | Stats) => void): void;
|
||||
export function cleanup(callback?: (result: boolean | Stats) => void): void;
|
||||
|
||||
export declare function cleanupSync(): boolean | Stats;
|
||||
|
||||
export declare function createWriteStream(affixes?: string): fs.WriteStream;
|
||||
export declare function createWriteStream(affixes?: AffixOptions): fs.WriteStream;
|
||||
export function cleanupSync(): boolean | Stats;
|
||||
|
||||
export function createWriteStream(affixes?: string | AffixOptions): fs.WriteStream;
|
||||
|
||||
@ -5,9 +5,8 @@ import * as temp from "temp";
|
||||
function testCleanup() {
|
||||
temp.cleanup(result => {
|
||||
if (typeof result === "boolean") {
|
||||
const x = result === true;
|
||||
}
|
||||
else {
|
||||
const x = result;
|
||||
} else {
|
||||
const { files, dirs } = result;
|
||||
files.toPrecision(4);
|
||||
files.toPrecision(4);
|
||||
@ -16,12 +15,11 @@ function testCleanup() {
|
||||
}
|
||||
|
||||
function testCleanupSync() {
|
||||
const cleanupResult: boolean | temp.Stats = temp.cleanupSync()
|
||||
const cleanupResult: boolean | temp.Stats = temp.cleanupSync();
|
||||
if (typeof cleanupResult === "boolean") {
|
||||
const x = cleanupResult === true;
|
||||
}
|
||||
else {
|
||||
const { dirs, files } = cleanupResult
|
||||
const x = cleanupResult;
|
||||
} else {
|
||||
const { dirs, files } = cleanupResult;
|
||||
dirs.toPrecision(4);
|
||||
files.toPrecision(4);
|
||||
}
|
||||
|
||||
5
types/temp/tslint.json
Normal file
5
types/temp/tslint.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user