unbuild icon indicating copy to clipboard operation
unbuild copied to clipboard

`untyped` does not works as expected

Open Barbapapazes opened this issue 2 years ago • 1 comments

Environment

node v18.18.0 unbuild v2.0.0

Reproduction

Create a new project with this config:

import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
  entries: [
    'src/index.ts',
    {
      builder: 'untyped',
      input: 'src/index.ts',
      outDir: 'docs',
      name: 'examples',
    }
  ],
  declaration: true,
  rollup: {
    emitCJS: true,
  }
})

and this simple file src/index.ts

export function main(data: string): string {
  return `Hello ${data}!`
}

Describe the bug

The markdown and the .d.ts file generated by untyped are

# `main`
- **Type**: `function`
- **Default**: `undefined`

```ts
() => any
export interface ExamplesSchema {
 main: () => any,
}

But I expect more something like this

export interface Untyped {
 main: (data: string) => string,
}
# `main`
- **Type**: `function`

```ts
(data: string) => string

https://untyped.unjs.io/#eyJlZGl0b3JUYWIiOiJyZWZlcmVuY2UiLCJvdXRwdXRUYWIiOiJ0eXBlcyIsInJlZiI6ImV4cG9ydCBmdW5jdGlvbiBtYWluKGRhdGE6IHN0cmluZyk6IHN0cmluZyB7XG4gIHJldHVybiBgSGVsbG8gJHtkYXRhfSFgXG59XG4iLCJpbnB1dCI6ImV4cG9ydCBjb25zdCBjb25maWcgPSB7XG4gICAgbmFtZTogJ2ZvbycsXG4gICAgZGltZW5zaW9uczoge1xuICAgICAgICBoZWlnaHQ6IDI1XG4gICAgfSxcbiAgICB0YWdzOiBbJ2N1c3RvbSddXG59In0=

Additional context

No response

Logs

No response

Barbapapazes avatar Nov 05 '23 21:11 Barbapapazes

Upstream issue: https://github.com/unjs/untyped/issues/159

kricsleo avatar Feb 14 '25 06:02 kricsleo