Skip to content

Commit

Permalink
feat(js-core): add Constructor type to support the mixin pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
ersimont committed Nov 27, 2020
1 parent a2c4280 commit f39a6b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions projects/integration/src/app/api-tests/js-core.spec.ts
@@ -1,6 +1,7 @@
import * as jsCore from '@s-libs/js-core';
import {
assert,
Constructor,
convertTime,
createBuilder,
Debouncer,
Expand Down Expand Up @@ -30,6 +31,11 @@ import { keys } from '@s-libs/micro-dash';

describe('js-core', () => {
describe('public API', () => {
it('has Constructor', () => {
const constructor: Constructor<Date> = Date;
expect(constructor).toBeDefined();
});

it('has TimeUnit', () => {
expect(TimeUnit).toBeDefined();
});
Expand Down
4 changes: 4 additions & 0 deletions projects/js-core/src/lib/objects/constructor.ts
@@ -0,0 +1,4 @@
/**
* Taken from the [typescript docs for mixins](https://www.typescriptlang.org/docs/handbook/mixins.html).
*/
export type Constructor<T = {}> = new (...args: any[]) => T;
1 change: 1 addition & 0 deletions projects/js-core/src/lib/objects/index.ts
@@ -1,3 +1,4 @@
export { Constructor } from './constructor';
export { createBuilder } from './create-builder';
export { isEqualAtDepth } from './is-equal-at-depth';
export { mapAsKeys } from './map-as-keys';
Expand Down

0 comments on commit f39a6b9

Please sign in to comment.