[temp-write] add typings (#18853)

This commit is contained in:
Dimitri Benin
2017-08-10 16:54:57 -07:00
committed by Mohamed Hegazy
parent f6d01af1e6
commit fb18e56681
4 changed files with 48 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for temp-write 3.3
// Project: https://github.com/sindresorhus/temp-write#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export = tempWrite;
declare function tempWrite(input: string | Buffer | NodeJS.ReadableStream, filepath?: string): Promise<string>;
declare namespace tempWrite {
function sync(input: string | Buffer, filepath?: string): string;
}
+12
View File
@@ -0,0 +1,12 @@
import tempWrite = require('temp-write');
tempWrite('unicorn').then(path => {
path; // $ExpectType string
});
tempWrite('unicorn', 'pony.png'); // $ExpectType Promise<string>
tempWrite(process.stdin, 'pony.png');
tempWrite(new Buffer('pony'), 'pony.png');
tempWrite.sync('unicorn'); // $ExpectType string
tempWrite.sync(new Buffer('unicorn'));
tempWrite.sync('unicorn', 'pony.png');
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"temp-write-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }