Skip to content

Commit

Permalink
converted type declaration to module (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhaufe authored Apr 23, 2021
1 parent 72f8d90 commit b796f76
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.20.0",
"description": "Code Contracts for TypeScript and ECMAScript classes",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"prebuild": "npm run clean && npm run lint",
"build": "webpack",
Expand Down
2 changes: 1 addition & 1 deletion src/Contracted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @see <https://spdx.org/licenses/AGPL-3.0-only.html>
*/

import { ClassRegistration, CLASS_REGISTRY, Feature, takeWhile, assertInvariants } from './lib';
import { ClassRegistration, CLASS_REGISTRY, Constructor, Feature, takeWhile, assertInvariants } from './lib';
import { assert, checkedMode, Contract } from './';
import { MSG_NO_PROPERTIES, MSG_SINGLE_CONTRACT } from './Messages';

Expand Down
1 change: 1 addition & 0 deletions src/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import AssertionError from './AssertionError';
import { ASSERTION_FAILED } from './Messages';
import { Constructor } from './lib';

/**
* An assertion is an expression of a property that must be true at a particular
Expand Down
2 changes: 1 addition & 1 deletion src/lib/CLASS_REGISTRY.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @see <https://spdx.org/licenses/AGPL-3.0-only.html>
*/

import ClassRegistration from './ClassRegistration';
import {ClassRegistration, Constructor} from './';

/**
* A WeakMap that tracks class registrations.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ClassRegistration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { MSG_SINGLE_RETRY } from '../Messages';
import { assert, checkedMode, Contract } from '../';
import { assertInvariants, assertDemands, CLASS_REGISTRY, Feature, unChecked } from './';
import { assertInvariants, assertDemands, CLASS_REGISTRY, Constructor, Feature, unChecked } from './';
import assertEnsures from './assertEnsures';

/**
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Constructor.d.ts → src/lib/Constructor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @see <https://spdx.org/licenses/AGPL-3.0-only.html>
*/

/**
/**
* Constructs a type representing a constructor
*/
type Constructor<T> = new(...args: any[]) => T;
export type Constructor<T> = new(...args: any[]) => T;
2 changes: 2 additions & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import assertEnsures from './assertEnsures';
import assertInvariants from './assertInvariants';
import CLASS_REGISTRY from './CLASS_REGISTRY';
import ClassRegistration from './ClassRegistration';
import {Constructor} from './Constructor';
import deepFreeze from './deepFreeze';
import Feature from './Feature';
import takeWhile from './takeWhile';
Expand All @@ -23,6 +24,7 @@ export {
assertInvariants,
CLASS_REGISTRY,
ClassRegistration,
Constructor,
deepFreeze,
Feature,
fnTrue,
Expand Down

0 comments on commit b796f76

Please sign in to comment.