diff --git a/types/pg-connection-string/index.d.ts b/types/pg-connection-string/index.d.ts new file mode 100644 index 0000000000..bc2f8bafa5 --- /dev/null +++ b/types/pg-connection-string/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for pg-connection-string 0.1 +// Project: https://github.com/iceddev/pg-connection-string +// Definitions by: Bradley Ayers +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export function parse(connectionString: string): { + host: string; + database: string; + port: string; + application_name?: string; + client_encoding?: string; + fallback_application_name?: string; + user?: string; + password?: string; + ssl?: boolean; +}; diff --git a/types/pg-connection-string/pg-connection-string-tests.ts b/types/pg-connection-string/pg-connection-string-tests.ts new file mode 100644 index 0000000000..bf9698a7b9 --- /dev/null +++ b/types/pg-connection-string/pg-connection-string-tests.ts @@ -0,0 +1,13 @@ +import { parse } from 'pg-connection-string'; + +const parts = parse('postgres://user:password@host:port/dbname'); + +parts.application_name; +parts.client_encoding; +parts.database; +parts.fallback_application_name; +parts.host; +parts.password; +parts.port; +parts.ssl; +parts.user; diff --git a/types/pg-connection-string/tsconfig.json b/types/pg-connection-string/tsconfig.json new file mode 100644 index 0000000000..780089a760 --- /dev/null +++ b/types/pg-connection-string/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-connection-string-tests.ts" + ] +} diff --git a/types/pg-connection-string/tslint.json b/types/pg-connection-string/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pg-connection-string/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }