diff --git a/types/pg-escape/index.d.ts b/types/pg-escape/index.d.ts new file mode 100644 index 0000000000..4b995c3fde --- /dev/null +++ b/types/pg-escape/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for pg-escape 0.2 +// Project: https://github.com/segmentio/pg-escape +// Definitions by: Cameron Yan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export = escape; + +declare function escape(fmt: string, ...args: any[]): string; + +declare namespace escape { + function string(val: string): string; + function dollarQuotedString(val: string): string; + function ident(val: string): string; + function literal(val: string): string; +} diff --git a/types/pg-escape/pg-escape-tests.ts b/types/pg-escape/pg-escape-tests.ts new file mode 100644 index 0000000000..36636cf0c2 --- /dev/null +++ b/types/pg-escape/pg-escape-tests.ts @@ -0,0 +1,7 @@ +import * as escape from 'pg-escape'; + +escape('INSERT INTO %I VALUES(%L)', 'books', "O'Reilly"); +escape.string("ab'cd"); +escape.dollarQuotedString("ab'cd"); +escape.ident('1234'); +escape.literal('1234'); diff --git a/types/pg-escape/tsconfig.json b/types/pg-escape/tsconfig.json new file mode 100644 index 0000000000..ad675e0892 --- /dev/null +++ b/types/pg-escape/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", + "pg-escape-tests.ts" + ] +} diff --git a/types/pg-escape/tslint.json b/types/pg-escape/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/pg-escape/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}