unjs / consola

🐨 Elegant Console Logger for Node.js and Browser
Other
5.93k stars 175 forks source link

typescript: prompt could return Symbol('clack:cancel') #234

Open Jannchie opened 11 months ago

Jannchie commented 11 months ago

Environment

v3.2.3

Reproduction

const res = await consola.prompt('Enter somethings', {type: 'text'}) 

When executing the above code, if you press ctrl + c to cancel, the value of res is Symbol('clack:cancel')

Describe the bug

However, res is annotated as string.

I'm not sure if we should set the return value type to string | symbol or make it output an empty string or undefined.

Is this an upstream issue (in @clack/core)?

Additional context

No response

Logs

No response

samuelstroschein commented 10 months ago

See https://github.com/unjs/consola/issues/251#issue-1952779657