diff --git a/packages/compress-stringify/typescript/src/compress-stringify-node.ts b/packages/compress-stringify/typescript/src/compress-stringify-node.ts index cca702055..32f132131 100644 --- a/packages/compress-stringify/typescript/src/compress-stringify-node.ts +++ b/packages/compress-stringify/typescript/src/compress-stringify-node.ts @@ -1,6 +1,7 @@ import { BinaryStream, InterfaceTypes, + PipelineOutput, PipelineInput, runPipelineNode } from 'itk-wasm' @@ -23,10 +24,10 @@ async function compressStringifyNode( options: CompressStringifyOptions = {} ) : Promise { - const desiredOutputs = [ + const desiredOutputs: Array = [ { type: InterfaceTypes.BinaryStream }, ] - const inputs: [ PipelineInput ] = [ + const inputs: Array = [ { type: InterfaceTypes.BinaryStream, data: { data: input } }, ] diff --git a/packages/compress-stringify/typescript/src/compress-stringify.ts b/packages/compress-stringify/typescript/src/compress-stringify.ts index 75aa1fba9..9b9530f9b 100644 --- a/packages/compress-stringify/typescript/src/compress-stringify.ts +++ b/packages/compress-stringify/typescript/src/compress-stringify.ts @@ -1,6 +1,7 @@ import { BinaryStream, InterfaceTypes, + PipelineOutput, PipelineInput, runPipeline } from 'itk-wasm' @@ -27,10 +28,10 @@ async function compressStringify( options: CompressStringifyOptions = {} ) : Promise { - const desiredOutputs = [ + const desiredOutputs: Array = [ { type: InterfaceTypes.BinaryStream }, ] - const inputs: [ PipelineInput ] = [ + const inputs: Array = [ { type: InterfaceTypes.BinaryStream, data: { data: input } }, ] diff --git a/packages/compress-stringify/typescript/src/parse-string-decompress-node.ts b/packages/compress-stringify/typescript/src/parse-string-decompress-node.ts index 897fd24b7..63c59a588 100644 --- a/packages/compress-stringify/typescript/src/parse-string-decompress-node.ts +++ b/packages/compress-stringify/typescript/src/parse-string-decompress-node.ts @@ -1,6 +1,7 @@ import { BinaryStream, InterfaceTypes, + PipelineOutput, PipelineInput, runPipelineNode } from 'itk-wasm' @@ -23,10 +24,10 @@ async function parseStringDecompressNode( options: ParseStringDecompressOptions = {} ) : Promise { - const desiredOutputs = [ + const desiredOutputs: Array = [ { type: InterfaceTypes.BinaryStream }, ] - const inputs: [ PipelineInput ] = [ + const inputs: Array = [ { type: InterfaceTypes.BinaryStream, data: { data: input } }, ] diff --git a/packages/compress-stringify/typescript/src/parse-string-decompress.ts b/packages/compress-stringify/typescript/src/parse-string-decompress.ts index 5c7d4e6a7..ca75101eb 100644 --- a/packages/compress-stringify/typescript/src/parse-string-decompress.ts +++ b/packages/compress-stringify/typescript/src/parse-string-decompress.ts @@ -1,6 +1,7 @@ import { BinaryStream, InterfaceTypes, + PipelineOutput, PipelineInput, runPipeline } from 'itk-wasm' @@ -27,10 +28,10 @@ async function parseStringDecompress( options: ParseStringDecompressOptions = {} ) : Promise { - const desiredOutputs = [ + const desiredOutputs: Array = [ { type: InterfaceTypes.BinaryStream }, ] - const inputs: [ PipelineInput ] = [ + const inputs: Array = [ { type: InterfaceTypes.BinaryStream, data: { data: input } }, ] diff --git a/packages/dicom/typescript/src/apply-presentation-state-to-image-node.ts b/packages/dicom/typescript/src/apply-presentation-state-to-image-node.ts index ceab1b4a7..1b74cb97d 100644 --- a/packages/dicom/typescript/src/apply-presentation-state-to-image-node.ts +++ b/packages/dicom/typescript/src/apply-presentation-state-to-image-node.ts @@ -2,6 +2,7 @@ import { JsonObject, Image, InterfaceTypes, + PipelineOutput, PipelineInput, runPipelineNode } from 'itk-wasm' @@ -24,11 +25,11 @@ async function applyPresentationStateToImageNode( options: ApplyPresentationStateToImageOptions = {} ) : Promise { - const desiredOutputs = [ + const desiredOutputs: Array = [ { type: InterfaceTypes.JsonObject }, { type: InterfaceTypes.Image }, ] - const inputs: [ PipelineInput ] = [ + const inputs: Array = [ { type: InterfaceTypes.BinaryFile, data: { data: imageIn, path: "file0" } }, ] diff --git a/packages/dicom/typescript/src/apply-presentation-state-to-image.ts b/packages/dicom/typescript/src/apply-presentation-state-to-image.ts index c82804814..edeebdaa2 100644 --- a/packages/dicom/typescript/src/apply-presentation-state-to-image.ts +++ b/packages/dicom/typescript/src/apply-presentation-state-to-image.ts @@ -2,6 +2,7 @@ import { JsonObject, Image, InterfaceTypes, + PipelineOutput, PipelineInput, runPipeline } from 'itk-wasm' @@ -28,11 +29,11 @@ async function applyPresentationStateToImage( options: ApplyPresentationStateToImageOptions = {} ) : Promise { - const desiredOutputs = [ + const desiredOutputs: Array = [ { type: InterfaceTypes.JsonObject }, { type: InterfaceTypes.Image }, ] - const inputs: [ PipelineInput ] = [ + const inputs: Array = [ { type: InterfaceTypes.BinaryFile, data: { data: imageIn, path: "file0" } }, ] diff --git a/packages/dicom/typescript/src/read-dicom-encapsulated-pdf-node.ts b/packages/dicom/typescript/src/read-dicom-encapsulated-pdf-node.ts index f712800a5..dffa9e393 100644 --- a/packages/dicom/typescript/src/read-dicom-encapsulated-pdf-node.ts +++ b/packages/dicom/typescript/src/read-dicom-encapsulated-pdf-node.ts @@ -1,6 +1,7 @@ import { BinaryStream, InterfaceTypes, + PipelineOutput, PipelineInput, runPipelineNode } from 'itk-wasm' @@ -23,10 +24,10 @@ async function readDicomEncapsulatedPdfNode( options: ReadDicomEncapsulatedPdfOptions = {} ) : Promise { - const desiredOutputs = [ + const desiredOutputs: Array = [ { type: InterfaceTypes.BinaryStream }, ] - const inputs: [ PipelineInput ] = [ + const inputs: Array = [ { type: InterfaceTypes.BinaryFile, data: { data: dicomFile, path: "file0" } }, ] diff --git a/packages/dicom/typescript/src/read-dicom-encapsulated-pdf.ts b/packages/dicom/typescript/src/read-dicom-encapsulated-pdf.ts index 898d83b25..8a5b397a4 100644 --- a/packages/dicom/typescript/src/read-dicom-encapsulated-pdf.ts +++ b/packages/dicom/typescript/src/read-dicom-encapsulated-pdf.ts @@ -1,6 +1,7 @@ import { BinaryStream, InterfaceTypes, + PipelineOutput, PipelineInput, runPipeline } from 'itk-wasm' @@ -27,10 +28,10 @@ async function readDicomEncapsulatedPdf( options: ReadDicomEncapsulatedPdfOptions = {} ) : Promise { - const desiredOutputs = [ + const desiredOutputs: Array = [ { type: InterfaceTypes.BinaryStream }, ] - const inputs: [ PipelineInput ] = [ + const inputs: Array = [ { type: InterfaceTypes.BinaryFile, data: { data: dicomFile, path: "file0" } }, ] diff --git a/packages/dicom/typescript/src/structured-report-to-html-node.ts b/packages/dicom/typescript/src/structured-report-to-html-node.ts index fa6050f6a..6319a1acf 100644 --- a/packages/dicom/typescript/src/structured-report-to-html-node.ts +++ b/packages/dicom/typescript/src/structured-report-to-html-node.ts @@ -1,6 +1,7 @@ import { TextStream, InterfaceTypes, + PipelineOutput, PipelineInput, runPipelineNode } from 'itk-wasm' @@ -23,10 +24,10 @@ async function structuredReportToHtmlNode( options: StructuredReportToHtmlOptions = {} ) : Promise { - const desiredOutputs = [ + const desiredOutputs: Array = [ { type: InterfaceTypes.TextStream }, ] - const inputs: [ PipelineInput ] = [ + const inputs: Array = [ { type: InterfaceTypes.BinaryFile, data: { data: dicomFile, path: "file0" } }, ] diff --git a/packages/dicom/typescript/src/structured-report-to-html.ts b/packages/dicom/typescript/src/structured-report-to-html.ts index 761ba4494..7c6177c76 100644 --- a/packages/dicom/typescript/src/structured-report-to-html.ts +++ b/packages/dicom/typescript/src/structured-report-to-html.ts @@ -1,6 +1,7 @@ import { TextStream, InterfaceTypes, + PipelineOutput, PipelineInput, runPipeline } from 'itk-wasm' @@ -27,10 +28,10 @@ async function structuredReportToHtml( options: StructuredReportToHtmlOptions = {} ) : Promise { - const desiredOutputs = [ + const desiredOutputs: Array = [ { type: InterfaceTypes.TextStream }, ] - const inputs: [ PipelineInput ] = [ + const inputs: Array = [ { type: InterfaceTypes.BinaryFile, data: { data: dicomFile, path: "file0" } }, ] diff --git a/packages/dicom/typescript/src/structured-report-to-text-node.ts b/packages/dicom/typescript/src/structured-report-to-text-node.ts index 0a546fcd9..fd8548a46 100644 --- a/packages/dicom/typescript/src/structured-report-to-text-node.ts +++ b/packages/dicom/typescript/src/structured-report-to-text-node.ts @@ -1,6 +1,7 @@ import { TextStream, InterfaceTypes, + PipelineOutput, PipelineInput, runPipelineNode } from 'itk-wasm' @@ -23,10 +24,10 @@ async function structuredReportToTextNode( options: StructuredReportToTextOptions = {} ) : Promise { - const desiredOutputs = [ + const desiredOutputs: Array = [ { type: InterfaceTypes.TextStream }, ] - const inputs: [ PipelineInput ] = [ + const inputs: Array = [ { type: InterfaceTypes.BinaryFile, data: { data: dicomFile, path: "file0" } }, ] diff --git a/packages/dicom/typescript/src/structured-report-to-text.ts b/packages/dicom/typescript/src/structured-report-to-text.ts index f9c3f28ed..f1c4bd3ad 100644 --- a/packages/dicom/typescript/src/structured-report-to-text.ts +++ b/packages/dicom/typescript/src/structured-report-to-text.ts @@ -1,6 +1,7 @@ import { TextStream, InterfaceTypes, + PipelineOutput, PipelineInput, runPipeline } from 'itk-wasm' @@ -27,10 +28,10 @@ async function structuredReportToText( options: StructuredReportToTextOptions = {} ) : Promise { - const desiredOutputs = [ + const desiredOutputs: Array = [ { type: InterfaceTypes.TextStream }, ] - const inputs: [ PipelineInput ] = [ + const inputs: Array = [ { type: InterfaceTypes.BinaryFile, data: { data: dicomFile, path: "file0" } }, ] diff --git a/src/bindgen/typescript.js b/src/bindgen/typescript.js index ee2fc9014..b9e42cba5 100644 --- a/src/bindgen/typescript.js +++ b/src/bindgen/typescript.js @@ -243,7 +243,8 @@ function typescriptBindings(outputDir, buildDir, wasmBinaries, options, forNode= resultsImportTypes.add(outputType) } resultContent += ` ${camelCase(output.name)}: ${outputType}\n\n` - readmeResultTable.push([`\`${camelCase(output.name)}\``, `*${outputType}*`, output.description]) + const readmeOutputArray = output.itemsExpectedMax > 1 ? "[]" : "" + readmeResultTable.push([`\`${camelCase(output.name)}\``, `*${outputType}${readmeOutputArray}*`, output.description]) }) readmeResult += markdownTable(readmeResultTable, { align: ['c', 'c', 'l'] }) + '\n' @@ -285,7 +286,8 @@ function typescriptBindings(outputDir, buildDir, wasmBinaries, options, forNode= optionsImportTypes.add(parameterType) } optionsInterfaceContent += ` ${camelCase(parameter.name)}?: ${parameterType}\n\n` - readmeOptionsTable.push([`\`${camelCase(parameter.name)}\``, `*${parameterType}*`, parameter.description]) + const readmeParameterArray = parameter.itemsExpectedMax > 1 ? "[]" : "" + readmeOptionsTable.push([`\`${camelCase(parameter.name)}\``, `*${parameterType}${readmeParameterArray}*`, parameter.description]) }) // Insert the import statement in the beginning for the file. if(optionsImportTypes.size !== 0) @@ -348,7 +350,8 @@ function typescriptBindings(outputDir, buildDir, wasmBinaries, options, forNode= } const typescriptType = interfaceJsonTypeToTypeScriptType.get(input.type) functionContent += ` * @param {${typescriptType}} ${camelCase(input.name)} - ${input.description}\n` - readmeParametersTable.push([`\`${camelCase(input.name)}\``, `*${typescriptType}*`, input.description]) + const readmeParameterArray = input.itemsExpectedMax > 1 ? "[]" : "" + readmeParametersTable.push([`\`${camelCase(input.name)}\``, `*${typescriptType}${readmeParameterArray}*`, input.description]) }) functionContent += ` *\n * @returns {Promise<${modulePascalCase}${nodeTextCamel}Result>} - result object\n` functionContent += ` */\n`