Comparing version 2.0.4 to 2.0.5
@@ -258,2 +258,14 @@ "use strict"; | ||
} | ||
else if (upperName === 'CLASS') { | ||
let valType = parent.types[0]; | ||
if (!valType) { | ||
logger_1.warn('Unable to resolve array value type, defaulting to \`any\`.', parent); | ||
valType = anyGeneric; | ||
} | ||
if (!valType.resolved) { | ||
logger_1.warn('Unable to resolve array value type, defaulting to \`any\`.', parent); | ||
valType.resolved = anyTypeNode; | ||
} | ||
lastType = parent.resolved = ts.createTypeQueryNode(ts.createIdentifier(valType.name)); | ||
} | ||
else { | ||
@@ -311,5 +323,8 @@ const typeNodes = []; | ||
const node = tree.roots[i]; | ||
const type = node.children.length ? createTypeLiteral(node.children) : resolveType(node.prop.type); | ||
const opt = resolveOptional(node.prop); | ||
const dots = resolveVariable(node.prop); | ||
let type = node.children.length ? createTypeLiteral(node.children) : resolveType(node.prop.type); | ||
if (dots) { | ||
type = ts.createArrayTypeNode(type); | ||
} | ||
params.push(ts.createParameter(undefined, undefined, dots, node.name, opt, type, undefined)); | ||
@@ -316,0 +331,0 @@ } |
{ | ||
"name": "tsd-jsdoc", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Compiles JSDoc annotated javascript into a Typescript Declaration File (.d.ts).", | ||
@@ -5,0 +5,0 @@ "main": "dist/publish.js", |
@@ -99,1 +99,8 @@ # tsd-jsdoc | ||
- [`@template`](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#template-t) - For generics | ||
## Extended support for TS features | ||
JSDoc doesn't have a way to express all the features of typescript so we treat some syntax as special case to | ||
create better Typescript. | ||
- `Class<T>` - If we encounter a type that is `Class<T>` we will treat it as `typeof T`. See [jsdoc3/jsdoc#1349](https://github.com/jsdoc3/jsdoc/issues/1349) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76712
863
106