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

No longer generate references to js.Promise and js.Thenable. Instead provide toPromise and toFuture extension methods #410

Merged
merged 2 commits into from
Sep 30, 2022

Conversation

fdietze
Copy link
Contributor

@fdietze fdietze commented Jan 27, 2022

I wasn't able to minimize further than this.

fixes #404

fdietze and others added 2 commits September 30, 2022 02:34
…e`. Instead provide `toPromise` and `toFuture` operations implicitly.

It's just too complicated and it currently breaks a bunch of libs. This fixes ScalablyTyped#404, see that for some details
@oyvindberg oyvindberg marked this pull request as ready for review September 30, 2022 00:35
@oyvindberg oyvindberg changed the title Add minimized failing prisma example No longer generate references to js.Promise and js.Thenable. Instead provide toPromise and toFuture extension methods Sep 30, 2022
@oyvindberg
Copy link
Collaborator

Ok, I'm making the problem go away now. It's slightly worse for users, but now at least things work.

@oyvindberg
Copy link
Collaborator

package typings.std

import scala.concurrent.Future
import org.scalablytyped.runtime.StObject
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}

trait Promise[T] extends StObject
object Promise {
  
  extension [T](promise: Promise[T]) {
    
    def toFuture: Future[T] = toPromise.toFuture
    
    def toPromise: js.Promise[T] = promise.asInstanceOf[js.Promise[T]]
  }
}

@oyvindberg oyvindberg merged commit f514ce0 into ScalablyTyped:master Sep 30, 2022
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

Successfully merging this pull request may close these issues.

Unspecified value parameter executor
2 participants