Skip to content

Commit

Permalink
Changes approach to optional fields
Browse files Browse the repository at this point in the history
  • Loading branch information
GambolingPangolin committed Jan 5, 2021
1 parent c313bfe commit ce7da79
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Changelog for aeson-typescript

## Unreleased changes

## 0.3.0.0

Represents optional fields (according to the Haskell model) as required fields
with type `A | null` rather than optional fields.
2 changes: 1 addition & 1 deletion aeson-typescript.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cabal-version: 1.12
-- hash: e1e74b37dded848299e515c32291f9f35f71998ce4f89f9a5622d634b197109d

name: aeson-typescript
version: 0.2.0.0
version: 0.3.0.0
synopsis: Generate TypeScript definition files from your ADTs
description: Please see the README on Github at <https://github.com/codedownio/aeson-typescript#readme>
category: Text, Web, JSON
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Aeson/TypeScript/Formatting.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ formatTSDeclarations' :: FormattingOptions -> [TSDeclaration] -> String
formatTSDeclarations' options declarations = T.unpack $ T.intercalate "\n\n" (fmap (T.pack . formatTSDeclaration options) declarations)

formatTSField :: TSField -> String
formatTSField (TSField optional name typ) = [i|#{name}#{if optional then "?" else ""}: #{typ}|]
formatTSField (TSField optional name typ) = [i|#{name}: #{typ}#{if optional then "| null" else ""}|]

getGenericBrackets :: [String] -> String
getGenericBrackets [] = ""
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

resolver: lts-14.21
resolver: lts-16.20

packages:
- .
8 changes: 4 additions & 4 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
packages: []
snapshots:
- completed:
size: 524162
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/21.yaml
sha256: 9a55dd75853718f2bbbe951872b36a3b7802fcd71796e0f25b8664f24e34c666
original: lts-14.21
size: 532177
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/20.yaml
sha256: 0e14ba5603f01e8496e8984fd84b545a012ca723f51a098c6c9d3694e404dc6d
original: lts-16.20

0 comments on commit ce7da79

Please sign in to comment.