From 253d42273d6d5d1bbf35c020f7dc05d1ce6cdd0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alu=C3=ADsio=20Augusto=20Silva=20Gon=C3=A7alves?= Date: Fri, 10 Mar 2017 20:18:53 -0300 Subject: [PATCH] Add type definitions for 'printf' (#14821) * Add definitions for 'printf' * Add "lib" to tsconfig.json * Fix link --- printf/index.d.ts | 10 ++++++++++ printf/printf-tests.ts | 9 +++++++++ printf/tsconfig.json | 22 ++++++++++++++++++++++ printf/tslint.json | 1 + 4 files changed, 42 insertions(+) create mode 100644 printf/index.d.ts create mode 100644 printf/printf-tests.ts create mode 100644 printf/tsconfig.json create mode 100644 printf/tslint.json diff --git a/printf/index.d.ts b/printf/index.d.ts new file mode 100644 index 0000000000..e136eed929 --- /dev/null +++ b/printf/index.d.ts @@ -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 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export = printf; +declare function printf(format: string, ...args: any[]): string; +declare function printf(writeStream: NodeJS.WritableStream, format: string, ...args: any[]): void; diff --git a/printf/printf-tests.ts b/printf/printf-tests.ts new file mode 100644 index 0000000000..d116d45f76 --- /dev/null +++ b/printf/printf-tests.ts @@ -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'); diff --git a/printf/tsconfig.json b/printf/tsconfig.json new file mode 100644 index 0000000000..e937977428 --- /dev/null +++ b/printf/tsconfig.json @@ -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" + ] +} diff --git a/printf/tslint.json b/printf/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/printf/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" }