tinspector
Advanced tools
Comparing version 3.0.5 to 3.0.6
@@ -116,8 +116,6 @@ "use strict"; | ||
const Type = (() => { | ||
class DynamicType { | ||
class DynamicType extends parent { | ||
} | ||
return DynamicType; | ||
})(); | ||
Object.setPrototypeOf(Type.prototype, parent.prototype); | ||
Object.setPrototypeOf(Type, parent); | ||
Reflect.decorate([generic.type(...params)], Type); | ||
@@ -124,0 +122,0 @@ return Type; |
@@ -0,4 +1,5 @@ | ||
import { Class } from "./types"; | ||
declare function useCache<K, P extends any[], R>(cache: Map<K, R>, fn: (...args: P) => R, getKey: (...args: P) => K): (...args: P) => R; | ||
declare namespace metadata { | ||
function isPrimitive(type: any): boolean; | ||
function isCallback(type: Function): type is ((x: any) => Class[] | Class | string | string[]); | ||
function isConstructor(value: any): boolean; | ||
@@ -5,0 +6,0 @@ function isCustomClass(type: Function | Function[]): boolean; |
@@ -23,19 +23,8 @@ "use strict"; | ||
(function (metadata) { | ||
function isPrimitive(type) { | ||
switch (type) { | ||
case Boolean: | ||
case String: | ||
case Array: | ||
case Number: | ||
case Object: | ||
case Date: | ||
case Promise: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
function isCallback(type) { | ||
return typeof type === "function" && !type.prototype; | ||
} | ||
metadata.isPrimitive = isPrimitive; | ||
metadata.isCallback = isCallback; | ||
function isConstructor(value) { | ||
return isPrimitive(value) || ("" + value).indexOf("class") == 0; | ||
return ("" + value).indexOf("class") == 0; | ||
} | ||
@@ -42,0 +31,0 @@ metadata.isConstructor = isConstructor; |
@@ -211,3 +211,3 @@ "use strict"; | ||
const result = Array.isArray(override.type) || typeof override.type === "string" ? override.type : | ||
helpers_1.metadata.isConstructor(override.type) ? override.type : override.type(); | ||
helpers_1.metadata.isCallback(override.type) ? override.type({}) : override.type; | ||
return { type: result, target: override.target }; | ||
@@ -214,0 +214,0 @@ } |
{ | ||
"name": "tinspector", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "TypeScript type inspector", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
59635
1018