mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Add write-file-atomically types. (#25064)
This commit is contained in:
14
types/write-file-atomically/index.d.ts
vendored
Normal file
14
types/write-file-atomically/index.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// Type definitions for write-file-atomically 2.0
|
||||
// Project: https://github.com/shinnn/write-file-atomically#readme
|
||||
// Definitions by: Aankhen <https://github.com/Aankhen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import writeFileAtomic = require("write-file-atomic");
|
||||
|
||||
export = WriteFileAtomically;
|
||||
|
||||
declare function WriteFileAtomically(path: string, data: WriteFileAtomically.Data, options?: writeFileAtomic.Options): Promise<void>;
|
||||
|
||||
declare namespace WriteFileAtomically {
|
||||
type Data = string | Buffer | Uint8Array;
|
||||
}
|
||||
23
types/write-file-atomically/tsconfig.json
Normal file
23
types/write-file-atomically/tsconfig.json
Normal 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",
|
||||
"write-file-atomically-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/write-file-atomically/tslint.json
Normal file
1
types/write-file-atomically/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
10
types/write-file-atomically/write-file-atomically-tests.ts
Normal file
10
types/write-file-atomically/write-file-atomically-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import writeFileAtomically = require('write-file-atomically');
|
||||
|
||||
writeFileAtomically(1, '_'); // $ExpectError
|
||||
|
||||
import { readFileSync } from 'fs';
|
||||
|
||||
(() => {
|
||||
writeFileAtomically('file.txt', 'Hi!');
|
||||
readFileSync('file.txt', 'utf8');
|
||||
})();
|
||||
Reference in New Issue
Block a user