pg-types: Remove "moment" dependency (#20525)

This commit is contained in:
Andy 2017-10-12 13:47:52 -07:00 committed by Wesley Wigham
parent a06c2aaba6
commit fbdaba3edc
5 changed files with 11 additions and 19 deletions

View File

@ -1,11 +1,9 @@
// Type definitions for pg-types 1.11.0
// Type definitions for pg-types 1.11
// Project: https://github.com/brianc/node-pg-types
// Definitions by: James Bracy <https://github.com/waratuman>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface TypeParser {
(value: any): any;
}
export type TypeParser = (value: any) => any;
export function getTypeParser(oid: number, format: string): TypeParser;
@ -13,7 +11,5 @@ export function setTypeParser(oid: number, format: string, parseFn: TypeParser):
export function setTypeParser(oid: number, parseFn: TypeParser): void;
export namespace arrayParser {
export function create(source: any, transform: TypeParser): { parse: () => any[] };
}
function create(source: any, transform: TypeParser): { parse(): any[] };
}

View File

@ -3,4 +3,4 @@
"dependencies": {
"moment": ">=2.14.0"
}
}
}

View File

@ -1,6 +1,4 @@
/// <reference types="moment" />
import * as types from "pg-types";
import * as moment from "moment";
types.getTypeParser(1184, 'text');
@ -9,10 +7,7 @@ types.setTypeParser(1186, 'text', (value) => value === null ? null : value);
types.setTypeParser(1186, 'binary', (value) => value.toISOString());
types.setTypeParser(1185, (value) => types.arrayParser.create(value, (x) => x).parse());
var TIMESTAMPTZ_OID = 1184
var TIMESTAMP_OID = 1114
var parseFn = function(val: any) {
return val === null ? null : moment(val)
}
types.setTypeParser(TIMESTAMPTZ_OID, parseFn)
types.setTypeParser(TIMESTAMP_OID, parseFn)
const TIMESTAMPTZ_OID = 1184;
const TIMESTAMP_OID = 1114;
types.setTypeParser(TIMESTAMPTZ_OID, parseInt);
types.setTypeParser(TIMESTAMP_OID, parseInt);

View File

@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }