Open baronfel opened 5 years ago
Hello
* The missing react dependency/namespace is easy to fix with a simple `open Fable.Import` so that `React.xxxxx` is valid.
This is "normal", because ts2fable generate codes that he can understand. So if all the libraries were generated using ts2fable and if this tool was perfect then the important would work. But this is not the case, and in general we use ts2fable to do all the heavy work and then fix/improve manually the binding.
* the module `TableCellRenderer` has a few functions that convert to/from U2 cases, and the names are of the form `isCASENAME`, `ofCASENAME`, `asCASENAME`, and for the second case (`React.ReactNode`), the full name of `React.ReactNode` is used giving `ofReact.ReactNode`. Do the generated names need to be normalized here?
All these codes can be deleted because it doesn't work anymore with Fable 2. More info here
* the `TableProps<'D, 'ResolvedData>` type inherits from some partial types in the typescript: Partial, Partial, Partial, Partial, Partial, Partial`, but in the generated code each of these is represented by `inherit obj`, leading to repeated instances of `inherit obj` in the type definition:
This is probably something not yet supported by ts2fable. You will have to go the manual way for this type.
the
noDataText
property ofTextProps
's second case is aReact.ComponentType
which is unknown to methe
ReactTable<'D>
type inherits fromReact.Component<obj>
which expects two type parameters.
We could say ts2fable is generated code that ts2fable understand. So it generated code for React as it would have generated react bindings. Source
Fable.React
has been manually reworked in order to be easier to use with F# this why you don't know these types. You can take a look at the source code I linked and find/guess the equivalent in Fable.React
(and people do use Fable.React
and not the generated React.fs
:) ).
Thanks for the pointers @MangelMaxime, I'll take a look and see if I can make those modifications and more importantly understand the reasoning behind them 👍
Hi, I ran into a few issues when trying to generate bindings for
react-table
from DefinitelyTyped using the online ts2fable.From the above link I generate the following F# source:
F# autogen code for react-table
```fsharp module Fable.Import.React.Table2 // ts2fable 0.6.1 open System open Fable.Core open Fable.Import.JS type [open Fable.Import
so thatReact.xxxxx
is valid.TableCellRenderer
has a few functions that convert to/from U2 cases, and the names are of the formisCASENAME
,ofCASENAME
,asCASENAME
, and for the second case (React.ReactNode
), the full name ofReact.ReactNode
is used givingofReact.ReactNode
. Do the generated names need to be normalized here?TableProps<'D, 'ResolvedData>
type inherits from some partial types in the typescript: Partial, but in the generated code each of these is represented by
inherit obj, leading to repeated instances of
inherit obj` in the type definition:noDataText
property ofTextProps
's second case is aReact.ComponentType
which is unknown to meReactTable<'D>
type inherits fromReact.Component<obj>
which expects two type parameters.I'm not really sure where to begin to investigate each of these issues, but I'd love to help triage or dig further.