Comparing version 0.1.18 to 0.1.19
@@ -0,1 +1,3 @@ | ||
import {Constructor} from './types'; | ||
export * from './assertion'; | ||
@@ -6,1 +8,13 @@ export * from './comparison'; | ||
export * from './mutation'; | ||
/** | ||
* https://www.typescriptlang.org/docs/handbook/mixins.html | ||
* @param targetConstructor Target constructor of which the prototype will be | ||
* applied with properties from other constructors. | ||
* @param constructors Constructors of which the properties will be applied to | ||
* the target constructor. | ||
*/ | ||
export function mixin( | ||
targetConstructor: Constructor, | ||
...constructors: Constructor[] | ||
): void; |
@@ -1,1 +0,24 @@ | ||
// fake library entry | ||
/* eslint-disable @magicspace/scoped-modules */ | ||
// @ts-check | ||
/** | ||
* @typedef {import('./types').Constructor} Constructor | ||
*/ | ||
/** | ||
* @param targetConstructor {Constructor} | ||
* @param constructors {Constructor[]} | ||
*/ | ||
exports.mixin = function mixin(targetConstructor, ...constructors) { | ||
let targetPrototype = targetConstructor.prototype; | ||
for (let constructor of constructors) { | ||
let prototype = constructor.prototype; | ||
Object.defineProperties( | ||
targetPrototype, | ||
Object.getOwnPropertyDescriptors(prototype), | ||
); | ||
} | ||
}; |
@@ -272,3 +272,3 @@ import {IsEqual} from './comparison'; | ||
T[K] | ||
> | ||
>; | ||
} & | ||
@@ -279,3 +279,3 @@ { | ||
undefined | ||
>]: OptionalizeUndefinedDeep<T[K]> | ||
>]: OptionalizeUndefinedDeep<T[K]>; | ||
} | ||
@@ -297,4 +297,4 @@ : T; | ||
export type Intersection<TUnion> = (TUnion extends any | ||
? (_: TUnion) => void | ||
: never) extends ((_: infer T) => void) | ||
? (_: TUnion) => void | ||
: never) extends (_: infer T) => void | ||
? T | ||
@@ -319,3 +319,3 @@ : never; | ||
: never | ||
: never | ||
: never; | ||
}; | ||
@@ -325,2 +325,2 @@ | ||
| __FlattenObject<Extract<TUnion, object>> | ||
| (Exclude<TUnion, object>); | ||
| Exclude<TUnion, object>; |
@@ -1,3 +0,1 @@ | ||
// tslint:disable: interface-over-type-literal | ||
import {Primitive} from './types'; | ||
@@ -7,2 +5,3 @@ | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions | ||
type __Type<T> = { | ||
@@ -9,0 +8,0 @@ [__type]: T; |
{ | ||
"name": "tslang", | ||
"version": "0.1.18", | ||
"version": "0.1.19", | ||
"description": "TypeScript Language Type Utilities.", | ||
@@ -9,3 +9,6 @@ "license": "MIT", | ||
"scripts": { | ||
"lint": "yarn tslint -p library && yarn tslint -p test", | ||
"lint:library": "eslint library --ext .ts,.tsx --max-warnings 0", | ||
"lint:test": "eslint test --ext .ts,.tsx --max-warnings 0", | ||
"lint-prettier": "prettier --list-different \"**/*.{ts,tsx,js,jsx,json,md}\"", | ||
"lint": "yarn lint-prettier && yarn lint:library && yarn lint:test", | ||
"test": "yarn tsc -p library && yarn tsc -p test" | ||
@@ -18,8 +21,9 @@ }, | ||
"devDependencies": { | ||
"@magicspace/configs": "^0.1.49", | ||
"prettier": "^1.17.1", | ||
"tslint": "^5.17.0", | ||
"typescript": "^3.5.1", | ||
"typescript-tslint-plugin": "^0.4.0" | ||
"@magicspace/configs": "^0.2.3", | ||
"@magicspace/eslint-plugin": "^0.1.15", | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"prettier": "^1.19.1", | ||
"typescript": "^3.7.5" | ||
} | ||
} |
11909
342
6