Skip to content

Commit

Permalink
Merge pull request #177 from goswinr/patch-1
Browse files Browse the repository at this point in the history
add documentation found in issue
  • Loading branch information
MangelMaxime authored Oct 23, 2023
2 parents 24a5d4f + 5c03eed commit ee9e870
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/docs/javascript/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,31 @@ The resulting printed list of pseudo-random numbers does not work in Fable:

* When accurate low-order bit arithmetic is needed and overflow can result in numbers larger than 2^53 use `int64`, `uint64`, which use exact 64 bits, instead of `int32`, `uint32`.
* Alternately, truncate all arithmetic with `>>> 0` or `>>> 0u` as appropriate before numbers can get larger than 2^53: `let rng (s:int32) = 10001*s + 12345 >>> 0`

## Unsupported Attributes and Types

If your F# code contains attributes (or other types) that are not supported by Fable you will get a Compiler error similar to:
` error FSHARP: The type 'DataContract' is not defined. (code 39)`
for
```fsharp
open System.Runtime.Serialization
[<DataContract>]
type Person = {
[<DataMember(IsRequired = true)>] FullName: string
[<DataMember(IsRequired = true)>] TimeOfBirth: DateTimeOffset
}
```

If you just want the attribute (or types) to be ignored in Fable you can redefine it as an empty type:

```fsharp
#if FABLE_COMPILER
namespace System.Runtime.Serialization
open System
type DataContract() = inherit Attribute()
type DataMember(IsRequired: bool) = inherit Attribute()
#endif
```



0 comments on commit ee9e870

Please sign in to comment.