Skip to content

Commit

Permalink
Map Date type to JS.Date
Browse files Browse the repository at this point in the history
Fix #48
  • Loading branch information
MangelMaxime committed Mar 24, 2024
1 parent a2320ae commit 2742f30
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

* Replace `Boolean` with `bool`
* Map `Date` type to `JS.Date` ([GH-48](https://github.com/glutinum-org/cli/issues/48))

## 0.4.0 - 2024-01-08

Expand Down
2 changes: 1 addition & 1 deletion src/Glutinum.Converter/Utils/Naming.fs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let escapeName (name: string) : string =

let mapTypeNameToFableCoreAwareName (name: string) : string =
match name with
| "Date" -> "DateTime"
| "Date" -> "JS.Date"
| "Promise" -> "JS.Promise"
| "Uint8Array" -> "JS.Uint8Array"
| name -> name
Expand Down
6 changes: 3 additions & 3 deletions tests/specs/references/replacements/date.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ open System
[<Erase>]
type Exports =
[<Import("date", "module")>]
static member date: DateTime = nativeOnly
static member date: JS.Date = nativeOnly

[<AllowNullLiteral>]
type MyDate =
abstract member toDate: unit -> DateTime
abstract member toDate: unit -> JS.Date

type MyDateUnion =
U2<string, DateTime>
U2<string, JS.Date>

(***)
#r "nuget: Fable.Core"
Expand Down

0 comments on commit 2742f30

Please sign in to comment.