Add type definitions for 'printf' (#14821)

* Add definitions for 'printf'

* Add "lib" to tsconfig.json

* Fix link
This commit is contained in:
Aluísio Augusto Silva Gonçalves
2017-03-10 15:18:53 -08:00
committed by Mohamed Hegazy
parent a43da75444
commit 253d42273d
4 changed files with 42 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for printf 0.2
// Project: https://github.com/adaltas/node-printf
// Definitions by: Aluísio Augusto Silva Gonçalves <https://github.com/AluisioASG>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export = printf;
declare function printf(format: string, ...args: any[]): string;
declare function printf(writeStream: NodeJS.WritableStream, format: string, ...args: any[]): void;
+9
View File
@@ -0,0 +1,9 @@
import printf = require("printf");
printf('%c', 0x7f).charCodeAt(0);
printf('%2$s: %1$O', {hello: 'Node'}, 'Test');
printf('%(temperature)s %(crevace)ss', {
temperature: 'Hot',
crevace: 'Pocket',
});
printf(process.stdout, '%2$s: %1$O', {hello: 'Node'}, 'Test');
+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",
"printf-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }