Open joprice opened 2 weeks ago
I don't think we have an equivalent in F#, do we?
I don't think so. It's basically a function that is capturing a compile time proof that it can be called with new
. Scalajs uses an implicit ConstructorTag
trait along with a a helper function, where the trait can be used as a type bound similar to what can be done with SRTP:
Perhaps jsConstructor
or a similar intrinsic could be designed to enable a comparable typesafe pattern, but as it currently stands, the example above new(config?: string | pg.ClientConfig) => T;
would just have to be a function that doesn't track that it's source is a constructor.
Issue created from Glutinum Tool
Glutinum version - 0.11.0-preview
TypeScript
FSharp (with warnings/errors)
Problem description
When
new
appears in a type alias, it fails to get handled and results in the fsharp typeobj
. The above is taken frompg-pool
. A simpler version that triggers this is: