Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

untyped does not works as expected #333

Open
Barbapapazes opened this issue Nov 5, 2023 · 0 comments
Open

untyped does not works as expected #333

Barbapapazes opened this issue Nov 5, 2023 · 0 comments

Comments

@Barbapapazes
Copy link
Member

Barbapapazes commented Nov 5, 2023

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 Barbapapazes mentioned this issue Nov 5, 2023
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant