mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
pg-types: Remove "moment" dependency (#20525)
This commit is contained in:
parent
a06c2aaba6
commit
fbdaba3edc
12
types/pg-types/index.d.ts
vendored
12
types/pg-types/index.d.ts
vendored
@ -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[] };
|
||||
}
|
||||
|
||||
@ -3,4 +3,4 @@
|
||||
"dependencies": {
|
||||
"moment": ">=2.14.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
|
||||
1
types/pg-types/tslint.json
Normal file
1
types/pg-types/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user