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

[TypeScript] Async type signature always returns any #3864

Closed
leononame opened this issue Jul 9, 2024 · 1 comment
Closed

[TypeScript] Async type signature always returns any #3864

leononame opened this issue Jul 9, 2024 · 1 comment

Comments

@leononame
Copy link

Description

Async does not generate correct type signature.

Repro code

REPL

Expected and actual results

It should have some type signature like export const doAsync: Async<string> instead of any, and ideally should be awaitable as well from typescript without giving errors.

Related information

  • Fable version: dotnet fable --version
  • Operating system
@leononame leononame changed the title [TypeScript] [TypeScript] Async type signature always returns any Jul 9, 2024
@MangelMaxime
Copy link
Member

and ideally should be awaitable as well from typescript without giving errors.

I am not sure if this will be possible because in Fable when you use async we generate a custom async type which have the same behaviour as in .NET.

If you want asynchronous code to be await-able from TypeScrip you should use promise (coming from Fable.Promise) because in this case you will have a real promise.

Regarding the we could indeed type it to:

// Implemented just for type references
export class Async<_T> { }

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

2 participants