diff --git a/src/lib/converter/converter.ts b/src/lib/converter/converter.ts index fb7a8dcb1..75159f1f8 100644 --- a/src/lib/converter/converter.ts +++ b/src/lib/converter/converter.ts @@ -157,12 +157,18 @@ export class Converter extends ChildableComponent< return project; } + /** @internal */ + convertSymbol(context: Context, symbol: ts.Symbol) { + convertSymbol(context, symbol); + } + /** * Convert the given TypeScript type into its TypeDoc type reflection. * * @param context The context object describing the current state the converter is in. * @param referenceTarget The target to be used to attempt to resolve reference types * @returns The TypeDoc type reflection representing the given node and type. + * @internal */ convertType( context: Context, @@ -171,6 +177,7 @@ export class Converter extends ChildableComponent< return convertType(context, node); } + /** @internal */ getNodesForSymbol(symbol: ts.Symbol, kind: ReflectionKind) { const wantedKinds: ts.SyntaxKind[] = { [ReflectionKind.Project]: [ts.SyntaxKind.SourceFile], @@ -187,11 +194,15 @@ export class Converter extends ChildableComponent< ts.SyntaxKind.VariableDeclaration, ], [ReflectionKind.Class]: [ts.SyntaxKind.ClassDeclaration], - [ReflectionKind.Interface]: [ts.SyntaxKind.InterfaceDeclaration], + [ReflectionKind.Interface]: [ + ts.SyntaxKind.InterfaceDeclaration, + ts.SyntaxKind.JSDocTypedefTag, + ], [ReflectionKind.Constructor]: [ts.SyntaxKind.Constructor], [ReflectionKind.Property]: [ ts.SyntaxKind.PropertyDeclaration, ts.SyntaxKind.PropertySignature, + ts.SyntaxKind.JSDocPropertyTag, ], [ReflectionKind.Method]: [ ts.SyntaxKind.MethodDeclaration, @@ -223,7 +234,10 @@ export class Converter extends ChildableComponent< [ReflectionKind.ObjectLiteral]: [ ts.SyntaxKind.ObjectLiteralExpression, ], - [ReflectionKind.TypeAlias]: [ts.SyntaxKind.TypeAliasDeclaration], + [ReflectionKind.TypeAlias]: [ + ts.SyntaxKind.TypeAliasDeclaration, + ts.SyntaxKind.JSDocTypedefTag, + ], [ReflectionKind.Event]: [], /// this needs to go away [ReflectionKind.Reference]: [ ts.SyntaxKind.NamespaceExport, diff --git a/src/lib/converter/factories/comment.ts b/src/lib/converter/factories/comment.ts index cf272d78b..c36baeaad 100644 --- a/src/lib/converter/factories/comment.ts +++ b/src/lib/converter/factories/comment.ts @@ -95,6 +95,19 @@ function getJSDocCommentRanges(node: ts.Node, text: string): ts.CommentRange[] { * @returns The raw comment string or undefined if no comment could be found. */ export function getRawComment(node: ts.Node): string | undefined { + // This happens if we are converting a JS project that has @typedef "interfaces" + // with an @property tag, a @typedef type alias, a callback with parameters, etc. + if ( + ts.isJSDocTypedefTag(node) || + ts.isJSDocPropertyTag(node) || + ts.isJSDocParameterTag(node) || + ts.isJSDocCallbackTag(node) + ) { + // Also strip off leading dashes: + // @property {string} name - docs + return node.comment?.replace(/^\s*-\s*/, ""); + } + if ( node.parent && node.parent.kind === ts.SyntaxKind.VariableDeclarationList diff --git a/src/lib/converter/factories/signature.ts b/src/lib/converter/factories/signature.ts index 1bff3b81d..56bb13eaf 100644 --- a/src/lib/converter/factories/signature.ts +++ b/src/lib/converter/factories/signature.ts @@ -89,26 +89,44 @@ function convertParameters( ) { return parameters.map((param, i) => { const declaration = param.valueDeclaration; - assert(declaration && ts.isParameter(declaration)); + assert( + declaration && + (ts.isParameter(declaration) || + ts.isJSDocParameterTag(declaration)) + ); const paramRefl = new ParameterReflection( /__\d+/.test(param.name) ? "__namedParameters" : param.name, ReflectionKind.Parameter, sigRef ); context.registerReflection(paramRefl, param); + context.trigger( + ConverterEvents.CREATE_PARAMETER, + paramRefl, + declaration + ); paramRefl.type = context.converter.convertType( context.withScope(paramRefl), context.checker.getTypeOfSymbolAtLocation(param, declaration) ); - if (declaration.questionToken) { + const isOptional = ts.isParameter(declaration) + ? !!declaration.questionToken + : declaration.isBracketed; + if (isOptional) { paramRefl.type = removeUndefined(paramRefl.type); } paramRefl.defaultValue = convertDefaultValue(parameterNodes?.[i]); - paramRefl.setFlag(ReflectionFlag.Optional, !!declaration.questionToken); - paramRefl.setFlag(ReflectionFlag.Rest, !!declaration.dotDotDotToken); + paramRefl.setFlag(ReflectionFlag.Optional, isOptional); + paramRefl.setFlag( + ReflectionFlag.Rest, + ts.isParameter(declaration) + ? !!declaration.dotDotDotToken + : !!declaration.typeExpression && + ts.isJSDocVariadicType(declaration.typeExpression.type) + ); return paramRefl; }); } @@ -116,7 +134,7 @@ function convertParameters( export function convertParameterNodes( context: Context, sigRef: SignatureReflection, - parameters: readonly ts.ParameterDeclaration[] + parameters: readonly (ts.JSDocParameterTag | ts.ParameterDeclaration)[] ) { return parameters.map((param) => { const paramRefl = new ParameterReflection( @@ -133,16 +151,25 @@ export function convertParameterNodes( paramRefl.type = context.converter.convertType( context.withScope(paramRefl), - param.type + ts.isParameter(param) ? param.type : param.typeExpression?.type ); - if (param.questionToken) { + const isOptional = ts.isParameter(param) + ? !!param.questionToken + : param.isBracketed; + if (isOptional) { paramRefl.type = removeUndefined(paramRefl.type); } paramRefl.defaultValue = convertDefaultValue(param); - paramRefl.setFlag(ReflectionFlag.Optional, !!param.questionToken); - paramRefl.setFlag(ReflectionFlag.Rest, !!param.dotDotDotToken); + paramRefl.setFlag(ReflectionFlag.Optional, isOptional); + paramRefl.setFlag( + ReflectionFlag.Rest, + ts.isParameter(param) + ? !!param.dotDotDotToken + : !!param.typeExpression && + ts.isJSDocVariadicType(param.typeExpression.type) + ); return paramRefl; }); } @@ -177,7 +204,6 @@ function convertTypeParameters( export function convertTypeParameterNodes( context: Context, - parent: Reflection, parameters: readonly ts.TypeParameterDeclaration[] | undefined ) { return parameters?.map((param) => { @@ -191,10 +217,14 @@ export function convertTypeParameterNodes( param.name.text, constraint, defaultType, - parent + context.scope ); context.registerReflection(paramRefl, undefined); - context.trigger(ConverterEvents.CREATE_TYPE_PARAMETER, paramRefl); + context.trigger( + ConverterEvents.CREATE_TYPE_PARAMETER, + paramRefl, + param + ); return paramRefl; }); diff --git a/src/lib/converter/jsdoc.ts b/src/lib/converter/jsdoc.ts new file mode 100644 index 000000000..a7705c5ee --- /dev/null +++ b/src/lib/converter/jsdoc.ts @@ -0,0 +1,146 @@ +// Converter functions for JSDoc defined types +// @typedef +// @callback + +import { ok } from "assert"; +import * as ts from "typescript"; +import { + DeclarationReflection, + IntrinsicType, + ReflectionKind, + ReflectionType, + SignatureReflection, +} from "../models"; +import { flatMap } from "../utils/array"; +import { Context } from "./context"; +import { ConverterEvents } from "./converter-events"; +import { + convertParameterNodes, + convertTypeParameterNodes, +} from "./factories/signature"; + +export function convertJsDocTypedef( + context: Context, + symbol: ts.Symbol, + declaration: ts.JSDocTypedefTag, + nameOverride?: string +) { + if ( + declaration.typeExpression && + ts.isJSDocTypeLiteral(declaration.typeExpression) + ) { + convertJsDocInterface(context, declaration, symbol, nameOverride); + return; + } + + const reflection = context.createDeclarationReflection( + ReflectionKind.TypeAlias, + symbol, + nameOverride + ); + + reflection.type = context.converter.convertType( + context.withScope(reflection), + declaration.typeExpression?.type + ); + + convertTemplateParameters( + context.withScope(reflection), + declaration.parent + ); +} + +export function convertJsDocCallback( + context: Context, + symbol: ts.Symbol, + declaration: ts.JSDocCallbackTag, + nameOverride?: string +) { + const alias = context.createDeclarationReflection( + ReflectionKind.TypeAlias, + symbol, + nameOverride + ); + const ac = context.withScope(alias); + + alias.type = convertJsDocSignature(ac, declaration.typeExpression); + convertTemplateParameters(ac, declaration.parent); +} + +function convertJsDocInterface( + context: Context, + declaration: ts.JSDocTypedefTag, + symbol: ts.Symbol, + nameOverride?: string +) { + const reflection = context.createDeclarationReflection( + ReflectionKind.Interface, + symbol, + nameOverride + ); + const rc = context.withScope(reflection); + + const type = context.checker.getDeclaredTypeOfSymbol(symbol); + for (const s of type.getProperties()) { + context.converter.convertSymbol(rc, s); + } + + convertTemplateParameters(rc, declaration.parent); +} + +function convertJsDocSignature(context: Context, node: ts.JSDocSignature) { + const symbol = context.getSymbolAtLocation(node) ?? node.symbol; + const type = context.getTypeAtLocation(node); + if (!symbol || !type) { + return new IntrinsicType("Function"); + } + + const reflection = new DeclarationReflection( + "__type", + ReflectionKind.TypeLiteral, + context.scope + ); + context.registerReflection(reflection, symbol); + context.trigger(ConverterEvents.CREATE_DECLARATION, reflection, node); + + const signature = new SignatureReflection( + "__type", + ReflectionKind.CallSignature, + reflection + ); + context.registerReflection(signature, void 0); + const signatureCtx = context.withScope(signature); + + reflection.signatures = [signature]; + signature.type = context.converter.convertType( + signatureCtx, + node.type?.typeExpression?.type + ); + signature.parameters = convertParameterNodes( + signatureCtx, + signature, + node.parameters + ); + signature.typeParameters = convertTemplateParameterNodes( + context.withScope(reflection), + node.typeParameters + ); + + return new ReflectionType(reflection); +} + +function convertTemplateParameters(context: Context, node: ts.JSDoc) { + ok(context.scope instanceof DeclarationReflection); + context.scope.typeParameters = convertTemplateParameterNodes( + context, + node.tags?.filter(ts.isJSDocTemplateTag) + ); +} + +function convertTemplateParameterNodes( + context: Context, + nodes: readonly ts.JSDocTemplateTag[] | undefined +) { + const params = flatMap(nodes ?? [], (tag) => tag.typeParameters); + return convertTypeParameterNodes(context, params); +} diff --git a/src/lib/converter/plugins/CommentPlugin.ts b/src/lib/converter/plugins/CommentPlugin.ts index bd100a681..670f5363e 100644 --- a/src/lib/converter/plugins/CommentPlugin.ts +++ b/src/lib/converter/plugins/CommentPlugin.ts @@ -174,8 +174,14 @@ export class CommentPlugin extends ConverterComponent { private onCreateTypeParameter( _context: Context, reflection: TypeParameterReflection, - _node?: ts.Node + node?: ts.Node ) { + if (node && ts.isJSDocTemplateTag(node.parent)) { + if (node.parent.comment) { + reflection.comment = new Comment(node.parent.comment); + } + } + const comment = reflection.parent && reflection.parent.comment; if (comment) { let tag = comment.getTag("typeparam", reflection.name); diff --git a/src/lib/converter/symbols.ts b/src/lib/converter/symbols.ts index bdd2d8f49..3d0c1dad5 100644 --- a/src/lib/converter/symbols.ts +++ b/src/lib/converter/symbols.ts @@ -15,6 +15,7 @@ import { convertDefaultValue } from "./convert-expression"; import { ConverterEvents } from "./converter-events"; import { convertIndexSignature } from "./factories/index-signature"; import { createSignature } from "./factories/signature"; +import { convertJsDocCallback, convertJsDocTypedef } from "./jsdoc"; function getSymbolExportsWithFlag(symbol: ts.Symbol, flag: ts.SymbolFlags) { const childSymbols: ts.Symbol[] = []; @@ -176,21 +177,41 @@ function convertTypeAlias( symbol: ts.Symbol, nameOverride?: string ) { - const reflection = context.createDeclarationReflection( - ReflectionKind.TypeAlias, - symbol, - nameOverride - ); - const declaration = symbol ?.getDeclarations() - ?.find(ts.isTypeAliasDeclaration); + ?.find( + ( + d + ): d is + | ts.TypeAliasDeclaration + | ts.JSDocTypedefTag + | ts.JSDocCallbackTag => + ts.isTypeAliasDeclaration(d) || + ts.isJSDocTypedefTag(d) || + ts.isJSDocCallbackTag(d) + ); assert(declaration); - reflection.type = context.converter.convertType(context, declaration.type); - reflection.typeParameters = declaration.typeParameters?.map((param) => - createTypeParamReflection(param, context.withScope(reflection)) - ); + if (ts.isTypeAliasDeclaration(declaration)) { + const reflection = context.createDeclarationReflection( + ReflectionKind.TypeAlias, + symbol, + nameOverride + ); + + reflection.type = context.converter.convertType( + context, + declaration.type + ); + + reflection.typeParameters = declaration.typeParameters?.map((param) => + createTypeParamReflection(param, context.withScope(reflection)) + ); + } else if (ts.isJSDocTypedefTag(declaration)) { + convertJsDocTypedef(context, symbol, declaration, nameOverride); + } else { + convertJsDocCallback(context, symbol, declaration, nameOverride); + } } function createTypeParamReflection( diff --git a/src/lib/converter/types.ts b/src/lib/converter/types.ts index b56d80cff..2941a4aea 100644 --- a/src/lib/converter/types.ts +++ b/src/lib/converter/types.ts @@ -61,6 +61,7 @@ export function loadConverters() { indexedAccessConverter, inferredConverter, intersectionConverter, + jsDocVariadicTypeConverter, keywordConverter, parensConverter, predicateConverter, @@ -108,12 +109,7 @@ export function convertType( if (converter) { return converter.convert(context, typeOrNode); } - context.logger.warn( - `Missing type node converter for kind ${typeOrNode.kind} (${ - ts.SyntaxKind[typeOrNode.kind] - })` - ); - return new UnknownType(typeOrNode.getText()); + return requestBugReport(context, typeOrNode); } // IgnoreErrors is important, without it, we can't assert that we will get a node. @@ -146,12 +142,7 @@ export function convertType( return result; } - context.logger.warn( - `Missing type converter for type: ${context.checker.typeToString( - typeOrNode - )} with kind ${ts.SyntaxKind[node.kind]} (${node.kind})` - ); - return new UnknownType(context.checker.typeToString(typeOrNode)); + return requestBugReport(context, typeOrNode); } const arrayConverter: TypeConverter = { @@ -224,8 +215,7 @@ const constructorConverter: TypeConverter = { node.parameters ); signature.typeParameters = convertTypeParameterNodes( - signatureCtx, - reflection, + context.withScope(reflection), node.typeParameters ); @@ -316,8 +306,7 @@ const functionTypeConverter: TypeConverter = { node.parameters ); signature.typeParameters = convertTypeParameterNodes( - signatureCtx, - reflection, + context.withScope(reflection), node.typeParameters ); @@ -394,6 +383,15 @@ const intersectionConverter: TypeConverter< }, }; +const jsDocVariadicTypeConverter: TypeConverter = { + kind: [ts.SyntaxKind.JSDocVariadicType], + convert(context, node) { + return new ArrayType(convertType(context, node.type)); + }, + // Should just be an ArrayType + convertType: requestBugReport, +}; + const keywordNames = { [ts.SyntaxKind.AnyKeyword]: "any", [ts.SyntaxKind.BigIntKeyword]: "bigint", diff --git a/src/test/converter/js/index.js b/src/test/converter/js/index.js new file mode 100644 index 000000000..73418b74c --- /dev/null +++ b/src/test/converter/js/index.js @@ -0,0 +1,53 @@ +/** + * not included anywhere + * @typedef {Object} InterfaceIsh + * @property {string} foo docs for property + * more docs for property + */ + +/** + * @typedef {object} AlsoInterfaceIsh docs for interface + * @property {string} foo docs for property + * @prop {string} bar can also use prop tag + */ + +/** + * @typedef {Object} ObjectAlias type alias since it doesn't have a property tag + */ + +/** + * @typedef {string | number} UnionType docs for alias + * @typedef {{ x: string } & { y: number }} IntersectionType docs for alias + */ + +/** + * @callback NoReturnTag even though in the same comment block + * @callback HasReturnTag + * @returns {string} + */ + +/** + * @template T + * @callback IdentityFn + * @param {T} data + * @return {T} the data + */ + +/** + * @callback OptionalArg + * @param {string} [data] an optional argument + */ + +/** + * @template T comment on template + * @typedef {T} Identity comment on alias + */ + +/** + * @callback Foo + * @param {...string} args + * @returns {number} + */ + +/** @type {Foo} */ +export const usedFoo = () => 1; diff --git a/src/test/converter/js/specs.json b/src/test/converter/js/specs.json new file mode 100644 index 000000000..4d89c722f --- /dev/null +++ b/src/test/converter/js/specs.json @@ -0,0 +1,511 @@ +{ + "id": 0, + "name": "typedoc", + "kind": 0, + "kindString": "Project", + "flags": {}, + "children": [ + { + "id": 6, + "name": "AlsoInterfaceIsh", + "kind": 256, + "kindString": "Interface", + "flags": {}, + "comment": { + "shortText": "docs for interface" + }, + "children": [ + { + "id": 8, + "name": "bar", + "kind": 1024, + "kindString": "Property", + "flags": {}, + "comment": { + "shortText": "can also use prop tag" + }, + "type": { + "type": "intrinsic", + "name": "string" + } + }, + { + "id": 7, + "name": "foo", + "kind": 1024, + "kindString": "Property", + "flags": {}, + "comment": { + "shortText": "docs for property" + }, + "type": { + "type": "intrinsic", + "name": "string" + } + } + ], + "groups": [ + { + "title": "Properties", + "kind": 1024, + "children": [ + 8, + 7 + ] + } + ] + }, + { + "id": 4, + "name": "InterfaceIsh", + "kind": 256, + "kindString": "Interface", + "flags": {}, + "children": [ + { + "id": 5, + "name": "foo", + "kind": 1024, + "kindString": "Property", + "flags": {}, + "comment": { + "shortText": "docs for property\nmore docs for property" + }, + "type": { + "type": "intrinsic", + "name": "string" + } + } + ], + "groups": [ + { + "title": "Properties", + "kind": 1024, + "children": [ + 5 + ] + } + ] + }, + { + "id": 33, + "name": "Foo", + "kind": 4194304, + "kindString": "Type alias", + "flags": {}, + "type": { + "type": "reflection", + "declaration": { + "id": 34, + "name": "__type", + "kind": 65536, + "kindString": "Type literal", + "flags": {}, + "signatures": [ + { + "id": 35, + "name": "__type", + "kind": 4096, + "kindString": "Call signature", + "flags": {}, + "parameters": [ + { + "id": 36, + "name": "args", + "kind": 32768, + "kindString": "Parameter", + "flags": { + "isRest": true + }, + "type": { + "type": "array", + "elementType": { + "type": "intrinsic", + "name": "string" + } + } + } + ], + "type": { + "type": "intrinsic", + "name": "number" + } + } + ] + } + } + }, + { + "id": 19, + "name": "HasReturnTag", + "kind": 4194304, + "kindString": "Type alias", + "flags": {}, + "type": { + "type": "reflection", + "declaration": { + "id": 20, + "name": "__type", + "kind": 65536, + "kindString": "Type literal", + "flags": {}, + "signatures": [ + { + "id": 21, + "name": "__type", + "kind": 4096, + "kindString": "Call signature", + "flags": {}, + "type": { + "type": "intrinsic", + "name": "string" + } + } + ] + } + } + }, + { + "id": 31, + "name": "Identity", + "kind": 4194304, + "kindString": "Type alias", + "flags": {}, + "comment": { + "shortText": "comment on alias" + }, + "typeParameter": [ + { + "id": 32, + "name": "T", + "kind": 131072, + "kindString": "Type parameter", + "flags": {}, + "comment": { + "shortText": "comment on template" + } + } + ], + "type": { + "type": "reference", + "name": "T" + } + }, + { + "id": 22, + "name": "IdentityFn", + "kind": 4194304, + "kindString": "Type alias", + "flags": {}, + "typeParameter": [ + { + "id": 26, + "name": "T", + "kind": 131072, + "kindString": "Type parameter", + "flags": {} + } + ], + "type": { + "type": "reflection", + "declaration": { + "id": 23, + "name": "__type", + "kind": 65536, + "kindString": "Type literal", + "flags": {}, + "signatures": [ + { + "id": 24, + "name": "__type", + "kind": 4096, + "kindString": "Call signature", + "flags": {}, + "parameters": [ + { + "id": 25, + "name": "data", + "kind": 32768, + "kindString": "Parameter", + "flags": {}, + "type": { + "type": "reference", + "name": "T" + } + } + ], + "type": { + "type": "reference", + "name": "T" + } + } + ] + } + } + }, + { + "id": 11, + "name": "IntersectionType", + "kind": 4194304, + "kindString": "Type alias", + "flags": {}, + "comment": { + "shortText": "docs for alias" + }, + "type": { + "type": "intersection", + "types": [ + { + "type": "reflection", + "declaration": { + "id": 12, + "name": "__type", + "kind": 65536, + "kindString": "Type literal", + "flags": {}, + "children": [ + { + "id": 13, + "name": "x", + "kind": 1024, + "kindString": "Property", + "flags": {}, + "type": { + "type": "intrinsic", + "name": "string" + } + } + ], + "groups": [ + { + "title": "Properties", + "kind": 1024, + "children": [ + 13 + ] + } + ] + } + }, + { + "type": "reflection", + "declaration": { + "id": 14, + "name": "__type", + "kind": 65536, + "kindString": "Type literal", + "flags": {}, + "children": [ + { + "id": 15, + "name": "y", + "kind": 1024, + "kindString": "Property", + "flags": {}, + "type": { + "type": "intrinsic", + "name": "number" + } + } + ], + "groups": [ + { + "title": "Properties", + "kind": 1024, + "children": [ + 15 + ] + } + ] + } + } + ] + } + }, + { + "id": 16, + "name": "NoReturnTag", + "kind": 4194304, + "kindString": "Type alias", + "flags": {}, + "type": { + "type": "reflection", + "declaration": { + "id": 17, + "name": "__type", + "kind": 65536, + "kindString": "Type literal", + "flags": {}, + "signatures": [ + { + "id": 18, + "name": "__type", + "kind": 4096, + "kindString": "Call signature", + "flags": {}, + "type": { + "type": "intrinsic", + "name": "any" + } + } + ] + } + } + }, + { + "id": 9, + "name": "ObjectAlias", + "kind": 4194304, + "kindString": "Type alias", + "flags": {}, + "comment": { + "shortText": "type alias since it doesn't have a property tag" + }, + "type": { + "type": "reference", + "name": "Object" + } + }, + { + "id": 27, + "name": "OptionalArg", + "kind": 4194304, + "kindString": "Type alias", + "flags": {}, + "type": { + "type": "reflection", + "declaration": { + "id": 28, + "name": "__type", + "kind": 65536, + "kindString": "Type literal", + "flags": {}, + "signatures": [ + { + "id": 29, + "name": "__type", + "kind": 4096, + "kindString": "Call signature", + "flags": {}, + "parameters": [ + { + "id": 30, + "name": "data", + "kind": 32768, + "kindString": "Parameter", + "flags": { + "isOptional": true + }, + "type": { + "type": "intrinsic", + "name": "string" + } + } + ], + "type": { + "type": "intrinsic", + "name": "any" + } + } + ] + } + } + }, + { + "id": 10, + "name": "UnionType", + "kind": 4194304, + "kindString": "Type alias", + "flags": {}, + "comment": { + "shortText": "docs for alias" + }, + "type": { + "type": "union", + "types": [ + { + "type": "intrinsic", + "name": "string" + }, + { + "type": "intrinsic", + "name": "number" + } + ] + } + }, + { + "id": 1, + "name": "usedFoo", + "kind": 64, + "kindString": "Function", + "flags": { + "isConst": true + }, + "signatures": [ + { + "id": 2, + "name": "usedFoo", + "kind": 4096, + "kindString": "Call signature", + "flags": {}, + "comment": {}, + "parameters": [ + { + "id": 3, + "name": "args", + "kind": 32768, + "kindString": "Parameter", + "flags": { + "isRest": true + }, + "type": { + "type": "array", + "elementType": { + "type": "intrinsic", + "name": "string" + } + } + } + ], + "type": { + "type": "intrinsic", + "name": "number" + } + } + ] + } + ], + "groups": [ + { + "title": "Interfaces", + "kind": 256, + "children": [ + 6, + 4 + ] + }, + { + "title": "Type aliases", + "kind": 4194304, + "children": [ + 33, + 19, + 31, + 22, + 11, + 16, + 9, + 27, + 10 + ] + }, + { + "title": "Functions", + "kind": 64, + "children": [ + 1 + ] + } + ] +} \ No newline at end of file diff --git a/src/test/converter/tsconfig.json b/src/test/converter/tsconfig.json index c1f9e592a..527e884e8 100644 --- a/src/test/converter/tsconfig.json +++ b/src/test/converter/tsconfig.json @@ -6,7 +6,10 @@ "experimentalDecorators": true, "resolveJsonModule": true, "rootDir": ".", - "strictNullChecks": true + "strictNullChecks": true, + "allowJs": true, + "noEmit": true, + "outDir": "dist" }, "include": ["."] }