From 83d959c9698839bba2a6bef2350bc124a5d781b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=B0=E6=96=87?= Date: Mon, 9 Oct 2017 11:49:48 +0800 Subject: [PATCH] chore: add default export, more friendly to typescript --- objectid.d.ts | 2 +- objectid.js | 1 + typing-tests/objectid-tests.ts | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/objectid.d.ts b/objectid.d.ts index dc89bb7..af2f341 100644 --- a/objectid.d.ts +++ b/objectid.d.ts @@ -2,7 +2,7 @@ // Project: bson-objectid // Definitions by: Marcel Ernst -export = ObjectID; +export default ObjectID; declare class ObjectID { static createFromTime(time: number): ObjectID; diff --git a/objectid.js b/objectid.js index 46dabc2..15c6bab 100644 --- a/objectid.js +++ b/objectid.js @@ -56,6 +56,7 @@ function ObjectID(arg) { } module.exports = ObjectID; ObjectID.generate = generate; +ObjectID.default = ObjectID; /** * Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. diff --git a/typing-tests/objectid-tests.ts b/typing-tests/objectid-tests.ts index d34a7d6..1654149 100644 --- a/typing-tests/objectid-tests.ts +++ b/typing-tests/objectid-tests.ts @@ -1,5 +1,5 @@ /// -import ObjectID = require('../objectid'); +import ObjectID from '../objectid'; // ---------------------------------------------------------------------------- // setup test data @@ -12,7 +12,7 @@ const idString:string = "TIZÙL“G!íçm"; // ---------------------------------------------------------------------------- // should construct with no arguments -let oid:ObjectID = new ObjectID(); +let oid = new ObjectID(); // ---------------------------------------------------------------------------- // should have an `id` property