ts-runtime
Advanced tools
Comparing version 0.1.22 to 0.1.23
@@ -160,3 +160,3 @@ #!/usr/bin/env node | ||
console.log(' $ tsr src/entry1 bin/entry2 lib/entry3'); | ||
console.log(' $ tsr -c tsconfig.json'); | ||
console.log(' $ tsr entry.ts -c tsconfig.json'); | ||
console.log(); | ||
@@ -163,0 +163,0 @@ }); |
@@ -278,9 +278,7 @@ "use strict"; | ||
let ref = ts.createIdentifier(text); | ||
let call = 'typeOf'; | ||
if (typeInfo.isTsrDeclaration()) { | ||
text = util.getHashedDeclarationName(text, typeInfo.sourceFile.fileName); | ||
ref = ts.createLiteral(text); | ||
call = 'ref'; | ||
ref = [ts.createLiteral(text), ts.createTrue()]; | ||
} | ||
return this.libCall(call, ref); | ||
return this.libCall('typeOf', ref); | ||
} | ||
@@ -287,0 +285,0 @@ typeLiteralReflection(node) { |
@@ -6,2 +6,3 @@ "use strict"; | ||
const voidType = t.void; | ||
const typeOf = t.typeOf; | ||
// const intersect = t.intersect; | ||
@@ -62,2 +63,14 @@ // const declare = t.declare; | ||
}; | ||
t.typeOf = (input, declaration = false) => { | ||
if (declaration && typeof input === 'string') { | ||
input = t.get(input); | ||
if (input) { | ||
if (input.typeName === 'ClassDeclaration') { | ||
return t.Class(input); | ||
} | ||
return input; | ||
} | ||
} | ||
return typeOf.bind(t)(input); | ||
}; | ||
exports.default = t; |
{ | ||
"name": "ts-runtime", | ||
"version": "0.1.22", | ||
"version": "0.1.23", | ||
"description": "Runtime type checks for TypeScript", | ||
@@ -17,3 +17,3 @@ "main": "index.js", | ||
"build": "./node_modules/.bin/tsc --rootDir src --outDir dist --module CommonJS --target es6 --skipLibCheck && cp package.json dist/package.json && cp README.md dist/README.md && cp LICENSE dist/LICENSE", | ||
"build:docs": "node_modules/.bin/rimraf docs/*worker.js* && node_modules/.bin/webpack", | ||
"build:docs": "node_modules/.bin/rimraf docs/*worker*.js* && node_modules/.bin/webpack", | ||
"build:tsr": "ts-node ./src/bin/index src/index src/lib/index src/bin/index src/bin/process --moduleAlias --compilerOptions '{\"outDir\": \"dist-tsr\", \"strictNullChecks\": false, \"moduleResolution\": \"Node\", \"module\": \"commonjs\", \"target\": \"ES2015\", \"lib\": [\"ESNext\"]}'", | ||
@@ -27,3 +27,3 @@ "build:tsr:fast": "ts-node ./src/bin/index src/index src/lib/index src/bin/index src/bin/process --fast --moduleAlias --compilerOptions '{\"outDir\": \"dist-tsr\", \"strictNullChecks\": false, \"moduleResolution\": \"Node\", \"module\": \"commonjs\", \"target\": \"ES2015\", \"lib\": [\"ESNext\"]}'" | ||
"docs": { | ||
"version": "0.1.22-0" | ||
"version": "0.1.23-0" | ||
} | ||
@@ -30,0 +30,0 @@ }, |
@@ -617,3 +617,2 @@ # ts-runtime | ||
-F, --fast no fancy status for the command line, but faster processing. defaults to false | ||
-k, --keepTemp keep temporary files. defaults to false | ||
-l, --libIdentifier <name> lib import name. defaults to "t" | ||
@@ -625,3 +624,2 @@ -L, --libDeclarations reflect declarations from global libs (e.g. DOM). defaults to false | ||
-s, --stackTraceOutput <limit> output a specified number of lines of the stack trace. defaults to 3 | ||
-t, --tempFolderName <name> set folder name for temporary files. defaults to ".tsr" | ||
@@ -632,3 +630,3 @@ Examples: | ||
$ tsr src/entry1 bin/entry2 lib/entry3 | ||
$ tsr -c tsconfig.json | ||
$ tsr entry.ts -c tsconfig.json | ||
``` | ||
@@ -635,0 +633,0 @@ |
470201
10733
638