Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync from Source Repo and Upgrade to GHC 9.6.4 #2

Merged
merged 211 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
211 commits
Select commit Hold shift + click to select a range
d124044
Add TSRawDeclaration
thomasjm Dec 20, 2020
41e5b2b
LookupTypes.hs turned out to be a bad idea
thomasjm Dec 20, 2020
35e7207
Simplifying to try to address higher kind issues
thomasjm Jan 14, 2021
bfc9329
Code cleanups in preparation for working on higher kinded types
thomasjm Jan 14, 2021
574bf6e
Higher kinded type progress -- not actually correct, but works for Be…
thomasjm Jan 14, 2021
eb49abe
Ability to generate HIE files for weeder
thomasjm Jan 14, 2021
a37385d
Expose poly kinded constructors for trying this out
thomasjm Jan 14, 2021
d3366bb
Expose a few more constructors for testing this
thomasjm Jan 16, 2021
ac6fb39
Various test files for experimenting with HKT scenarios
thomasjm Jan 14, 2021
417f51b
More experimentation
thomasjm Jan 17, 2021
206fe10
Using more quasiquoters in TH.hs
thomasjm Jan 17, 2021
761c150
Tests pass if we add ConstraintKinds
thomasjm Jan 17, 2021
0ffc9c2
Changing up how constraints work
thomasjm Jan 17, 2021
048178e
Working on generic vars
thomasjm Jan 17, 2021
d704d6d
More cleaning in TH.hs
thomasjm Jan 17, 2021
bcdaf7f
Make handleConstructor run in Q
thomasjm Jan 17, 2021
d3aed88
More Q stuff in T.hs
thomasjm Jan 17, 2021
3aec961
More Q-ification
thomasjm Jan 17, 2021
bf24666
Progress, still need to fix higher kind tests
thomasjm Jan 17, 2021
4b956b0
More quasiquoting
thomasjm Jan 18, 2021
0c972b1
Another tidying
thomasjm Jan 18, 2021
e6d85ec
Write deriveTypeScriptLookupType
thomasjm Jan 18, 2021
d08848d
Move lookup derivation to its own file
thomasjm Jan 18, 2021
983eac3
Simplifying so we can get to WriterT
thomasjm Jan 18, 2021
e73122d
WriterT switch looks good
thomasjm Jan 18, 2021
cc9cd55
Make getTSFields be able to WriterT
thomasjm Jan 18, 2021
b1ba500
Working on gathering type variables
thomasjm Jan 18, 2021
e1a26ff
Adding options for type family mapping
thomasjm Jan 18, 2021
7e7db65
More refactoring to expose namesAndTypes
thomasjm Jan 18, 2021
12ea5d4
First steps toward unifying constraints
thomasjm Jan 18, 2021
532d738
Progress on type variables
thomasjm Jan 18, 2021
fd3e63f
All tests passing!
thomasjm Jan 18, 2021
daa5c14
Include constraint suffixes
thomasjm Jan 18, 2021
a281cf1
Q-ify a couple more helpers
thomasjm Jan 18, 2021
8bc4944
Making progress, need to change the order things happen
thomasjm Jan 18, 2021
d8d1e34
Remove some unnecessary variables
thomasjm Jan 18, 2021
10a130e
About to try adding the needed constraint
thomasjm Jan 19, 2021
4d8391d
Type family thing is working
thomasjm Jan 19, 2021
6c6e9c8
Fix all warnings
thomasjm Jan 19, 2021
02302de
Remove beam dependencies that were added for testing
thomasjm Jan 19, 2021
2319778
Don't add constraints for constructor types that don't have free type…
thomasjm Jan 19, 2021
7279dac
Remove unnecessary dollar signs
thomasjm Jan 19, 2021
edf9249
Fix illegal tuple constraint issue hopefully
thomasjm Jan 19, 2021
06c9d8a
Export ExtraTypeScriptOptions
thomasjm Jan 19, 2021
52fb711
Actually export ExtraTypeScriptOptions
thomasjm Jan 19, 2021
0e9273d
Add parent types to type family things
thomasjm Jan 19, 2021
54ffe06
Improve error messages when type family equation not recognized
thomasjm Jan 19, 2021
8da9b5d
Add some test of type families
thomasjm Jan 19, 2021
70bfd32
Add deriveJSONAndTypeScript'
thomasjm Jan 19, 2021
5c1957d
Always emit generics
thomasjm Jan 19, 2021
d38346b
Try fixing parent types expression
thomasjm Jan 19, 2021
4cc50a9
Try adding even more constructor preds
thomasjm Jan 19, 2021
6bd3304
Add WIP Basic.hs test file
thomasjm Jan 19, 2021
17908ce
Fix a redundant case expression warning
thomasjm Jan 20, 2021
f86258e
Fix type families tests
thomasjm Jan 20, 2021
74eb21e
Update th-abstraction dependency version to <0.5
ghais Feb 3, 2021
4409bd8
Merge pull request #21 from ghais/master
thomasjm Feb 5, 2021
e0b5304
Improve changelog
thomasjm Feb 5, 2021
c327925
Try using github workflow
thomasjm Feb 5, 2021
abba73a
Set fail-fast: false
thomasjm Feb 5, 2021
fa61a11
Try bumping setup-haskell
thomasjm Feb 5, 2021
c9d263e
Remove old references to sandwich
thomasjm Feb 5, 2021
c496c07
Add badge
thomasjm Feb 5, 2021
1116dd4
Fix on GHC 8.6
thomasjm Feb 5, 2021
9d174cd
Try adding TSC install step
thomasjm Feb 5, 2021
53555f6
tsc -> typescript
thomasjm Feb 5, 2021
8fd3a71
Allow to export types easily (#22)
Mar 15, 2021
8023174
Add Data.Aeson.TypeScript.Internal module
thomasjm Mar 25, 2021
97d1166
Merge mauriciofierrom/format-sum-types
thomasjm Mar 25, 2021
baa74a1
Change some names
thomasjm Mar 25, 2021
f31170c
Fix weird indentation
thomasjm Mar 25, 2021
6dcc8c8
Update GHC version in CI (8.10.1->8.10.4)
thomasjm Mar 25, 2021
50ad3d4
Export ExportMode(..) (#23)
rimmington May 13, 2021
cb6c492
Getting ready to upload new major version
thomasjm May 13, 2021
5b20f36
Fix CHANGELOG.md path
thomasjm May 13, 2021
2eedb09
Update cabal file and add GHC 8.10.4 to stack build matrix
thomasjm May 13, 2021
32d063f
Update CI
thomasjm May 28, 2021
e4700fc
Update docs to include type parameter
thomasjm May 28, 2021
2c8bb13
Switch to string-interpolate and fix build on GHC 9.0.1
thomasjm May 28, 2021
87afdde
Bump version to 0.3.0.1
thomasjm May 28, 2021
ee1a87f
Dedup predicates
thomasjm Aug 4, 2021
005609f
More reducing redundant constraints
thomasjm Aug 5, 2021
70de71d
Add some more basic instances
thomasjm Aug 5, 2021
b6137d9
Export TSField in internal module
thomasjm Aug 5, 2021
85ec32e
Add Map and HashSet instances
thomasjm Aug 5, 2021
7e363e1
Fix warning
thomasjm Aug 5, 2021
ee4d858
Merge branch 'master' of github.com:codedownio/aeson-typescript
thomasjm Aug 5, 2021
ccf9d57
include immediate parents for containers...
bitonic Apr 8, 2020
64c03f3
use mapped types to represent maps
bitonic Apr 8, 2020
3fb5d50
Support open type families
thomasjm Aug 11, 2021
bfd68ab
Add CPP for another TH breaking change
thomasjm Aug 11, 2021
d6b3b10
Try handling promoted types
thomasjm Aug 11, 2021
2196c84
Last few changes
thomasjm Aug 11, 2021
9982503
Move dev files
thomasjm Aug 11, 2021
5752824
Add failing test for generic instance in interface
thomasjm Aug 11, 2021
5cb8c25
Bump copyright years
thomasjm Aug 11, 2021
ff7ce98
Propagate T variables in declarations correctly
thomasjm Aug 11, 2021
0819fbe
Switch resolver to 18.3
thomasjm Aug 11, 2021
8c75c94
Add notes to CHANGELOG under 0.4.0.0
thomasjm Aug 11, 2021
18e7e0d
Check in .dir-locals.el
thomasjm Aug 13, 2021
9b8a373
Trying to fix another generic case
thomasjm Aug 13, 2021
3fe26a1
More generic cases working
thomasjm Aug 13, 2021
906decc
More improvement to mapType + another generic case
thomasjm Aug 13, 2021
473cd88
Comment some currently errored live stuff
thomasjm Aug 13, 2021
2223f2c
Tidy where a constraint is added
thomasjm Aug 14, 2021
56344a2
Crazy refactor that seems to actually work
thomasjm Aug 14, 2021
eb8a0e5
Refactoring
thomasjm Aug 14, 2021
29e2271
More refactoring
thomasjm Aug 14, 2021
c1ab39c
A bit more code golf
thomasjm Aug 14, 2021
2a16112
Final code golf for now
thomasjm Aug 14, 2021
1224ab7
Considering separate key types
thomasjm Aug 13, 2021
b651e53
Be able to set key type
thomasjm Aug 14, 2021
1db89b9
Fix up exports for ExtraTypeScriptOptions
thomasjm Aug 14, 2021
cbfa1e1
Add changelog entry
thomasjm Aug 15, 2021
f9c3d80
Fix deriveTypeScript' calls
thomasjm Aug 22, 2021
29db9bf
Add failing test for unwrapUnaryRecords
thomasjm Aug 22, 2021
7e4c7b1
Working on unwrapUnaryRecords
thomasjm Aug 22, 2021
5cea178
Add recursivelyDeriveMissingTypeScriptInstancesFor etc.
thomasjm Sep 13, 2021
8985dcf
Bump version number in preparation for next release
thomasjm Sep 13, 2021
16d6c2a
Export `defaultFormattingOptions`.
nh2 Oct 4, 2021
305cd58
Sort type family interface keys so they're deterministic
thomasjm Feb 8, 2022
c0cd122
Prepare for 0.4.0.0 release
thomasjm Mar 18, 2022
6bff8f9
Add TypeScript Int16
thomasjm Apr 25, 2022
1066fb8
Add TypeScript (A.KeyMap a) instance for aeson 2
thomasjm May 21, 2022
2f0d7a8
Update CHANGELOG
thomasjm Oct 17, 2022
d4ff690
README: fix getTypeScriptDeclarations name
tanyabouman Oct 19, 2022
1214f1c
Test GHC 9.2.4 in CI
thomasjm Oct 19, 2022
477a883
Remove accidentally checked in dev folder
thomasjm Oct 19, 2022
85200a0
Bump Stackage in stack.yaml
thomasjm Oct 19, 2022
8311cdf
Add failing test for bad type of Aeson map
thomasjm Oct 19, 2022
a70a8c3
Fix Typescript instance for KeyMap
tanyabouman Oct 19, 2022
3c7f78b
Fix TestBoilerplate
thomasjm Oct 19, 2022
c4958f9
Also remove dev as a source dir
thomasjm Oct 19, 2022
c982c7c
Update CHANGELOG for 0.4.2.0
thomasjm Oct 29, 2022
5f71db9
Release 0.4.2.0
thomasjm Nov 11, 2022
ba5d998
check for illegal characters
parsonsmatt Oct 27, 2022
cc1545e
Formatting and tweaks following pull #35
thomasjm Dec 23, 2022
a30807d
Bump stack.yaml to lts-20.12
thomasjm Mar 1, 2023
5d10208
Piping through haddocks using getDoc
thomasjm Mar 1, 2023
8a5bb23
Recover from getDoc failure
thomasjm Mar 1, 2023
5bfb857
Add getDoc tests and fix Basic tests
thomasjm Mar 1, 2023
b284178
Use the actual getDoc result; not working yet
thomasjm Mar 1, 2023
b773b8c
Small tweaks
thomasjm Mar 1, 2023
cbc7595
GetDoc.hs test passing + start to clean up test extensions
thomasjm Mar 1, 2023
332ff83
Update github CI
thomasjm Mar 1, 2023
ba10af7
Run CI on all branches
thomasjm Mar 1, 2023
68c56ea
Cleaning up test extensions
thomasjm Mar 1, 2023
d17d457
Bump haskell setup actions
thomasjm Mar 1, 2023
724db4d
More test extension cleanup
thomasjm Mar 1, 2023
c7175f8
Always do checkout
thomasjm Mar 1, 2023
bf1f582
More extension cleanup
thomasjm Mar 1, 2023
3117bfc
More CI fixups
thomasjm Mar 1, 2023
0bb53c0
More extension cleanup
thomasjm Mar 1, 2023
85c11ec
More extension cleanup
thomasjm Mar 1, 2023
62882d0
More extension cleanup
thomasjm Mar 1, 2023
d0aa202
More extension cleanup
thomasjm Mar 1, 2023
91b7205
Fix getDoc call to use actual name, not transformed one
thomasjm Mar 1, 2023
40b5750
Add docstring example to README.md
thomasjm Mar 1, 2023
02da0c6
Improve docstring formatting
thomasjm Mar 1, 2023
32f5672
Don't try to run GetDoc tests when not supported
thomasjm Mar 1, 2023
431d854
Get docs on interface names
thomasjm Mar 1, 2023
8563700
Update tests to use docs on interface names
thomasjm Mar 1, 2023
01ec42f
Fix warning in test/Util.hs
thomasjm Mar 1, 2023
8cba467
Add haddockModifier to ExtraTypeScriptOptions
thomasjm Mar 1, 2023
68be59f
Working on TSTypeAlternatives docs and cleaning up extensions
thomasjm Mar 1, 2023
e75d17a
Consolidate extensions and update TSTypeAlternatives in tests
thomasjm Mar 1, 2023
b814988
Change default haddockModifier to stripStart on each line
thomasjm Mar 1, 2023
bab4047
Format haddocks with // comments always
thomasjm Mar 1, 2023
4c58775
Implement @no-emit-typescript annotation address #31
thomasjm Mar 1, 2023
d6a3add
Check for compatible template-haskell when testing @no-emit-typescript
thomasjm Mar 1, 2023
6c4cbc9
GHC 9.2.6 -> 9.2.7 in CI
thomasjm Mar 23, 2023
6f5803a
See if we can test GHC 9.6.1 Cabal in CI
thomasjm Mar 23, 2023
5ae6687
Enable building with mtl-2.3
9999years Mar 22, 2023
1ddb9d5
Add instances for more types from base
langston-barrett Aug 3, 2022
0043bb7
Bump dev stack resolver
thomasjm Mar 23, 2023
5ef8e55
Release 0.5.0.0
thomasjm Mar 23, 2023
c8c94fd
Try fixing up new instances and add test of the new number ones
thomasjm Mar 23, 2023
7a7fd49
Fix numbers boilerplate
thomasjm Mar 23, 2023
ba24350
One more boilerplate fix
thomasjm Mar 23, 2023
aed83ab
Fix up package.yaml tested-with
thomasjm Mar 23, 2023
afbf921
Bump CI setup-node version (v2 -> v3) and node (v12 -> v16)
thomasjm Mar 23, 2023
55ed89b
More FancyFunctors fields
thomasjm Mar 23, 2023
671347e
Release 0.6.0.0
thomasjm Apr 28, 2023
903774c
ci: try specifying stack resolver properly
thomasjm Jun 23, 2023
0f4b0d3
Modernize CI by using explicit stack.yaml files
thomasjm Jun 28, 2023
968a95b
Fix Aeson CPP
thomasjm Jun 28, 2023
870982a
Fix a yaml path
thomasjm Jun 28, 2023
a80b62c
Another Util/Aeson.hs fix
thomasjm Jun 28, 2023
c8e64b6
Improve output when TSC check fails
thomasjm Jun 28, 2023
d7deffa
Try fixing cabal tests in CI
thomasjm Jun 28, 2023
40674f9
Update README.md
thomasjm Oct 13, 2023
0d0f4b2
Update README.md
thomasjm Oct 13, 2023
0c62a92
Apply typeNameModifier to fields within interfaces
thomasjm Nov 14, 2023
9465d8d
Update stack.yaml files/GHC versions
thomasjm Nov 14, 2023
7cd5183
Undo 0c62a92
thomasjm Nov 14, 2023
70af53a
Remove changelog entry until we fix this for real
thomasjm Nov 14, 2023
1afccfe
Add more enum formatting tests
thomasjm Dec 1, 2023
a7d273e
Get rid of validateFormattingOptions
thomasjm Dec 1, 2023
07bc492
Comment Unit test for now
thomasjm Dec 1, 2023
5afd164
Fix bug in getDeclarationName
thomasjm Dec 1, 2023
7933c64
Fix a couple warnings
thomasjm Dec 1, 2023
2e5c123
Add a better check for enum mode
thomasjm Dec 1, 2023
e39ae7c
Add CHANGELOG entry
thomasjm Dec 1, 2023
007e161
Always include string in enums to match aeson
thomasjm Dec 6, 2023
78bbf42
Release 0.6.1.0
thomasjm Dec 6, 2023
5802281
export type variables 4 through 10
jjkv Jan 9, 2024
02b2795
Update CHANGELOG
thomasjm Jan 10, 2024
b834e60
Bump version to 0.6.2.0
thomasjm Jan 10, 2024
9a07b61
Changes approach to optional fields
GambolingPangolin Jan 5, 2021
5e18c74
Merge branch 'master' into ghc-9.6.4
bradsherman Jan 22, 2024
987b8eb
Remove OmitNothingFields test
bradsherman Jan 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dir-locals.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
((haskell-mode
. (
(haskell-process-args-stack-ghci . ("--ghci-options=-ferror-spans" "--no-build" "--no-load"
"aeson-typescript:lib"
"aeson-typescript:aeson-typescript-tests"
))
)))
105 changes: 105 additions & 0 deletions .github/workflows/aeson-typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: aeson-typescript

on:
pull_request:
push:

jobs:
cabal:
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
ghc:
- "8.10.7"
- "9.0.2"
- "9.2.8"
- "9.4.7"
- "9.6.3"

steps:
- uses: actions/checkout@v2

- uses: haskell/actions/setup@v2
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: "latest"

- name: Freeze
run: |
cabal freeze

- uses: actions/cache@v3
name: Cache ~/.cabal/store
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}

- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install TSC
run: |
npm install -g typescript

- name: Build
run: |
cabal configure --enable-tests --enable-benchmarks --test-show-details=direct
cabal build all

- name: Test
run: |
cabal test all

stack:
name: stack / ghc ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ghc: "8.10.7"
yaml: "stack-8.10.7.yaml"
- ghc: "9.0.2"
yaml: "stack-9.0.2.yaml"
- ghc: "9.2.8"
yaml: "stack-9.2.8.yaml"
- ghc: "9.4.7"
yaml: "stack-9.4.7.yaml"
- ghc: "9.6.3"
yaml: "stack.yaml"

steps:
- uses: actions/checkout@v3

- uses: haskell/actions/setup@v2
name: Setup Haskell Stack
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: "latest"

- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.yaml }}

- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install TSC
run: |
npm install -g typescript

- name: Build
run: |
stack build --stack-yaml ${{matrix.yaml}} --system-ghc --test --bench --no-run-tests --no-run-benchmarks

- name: Test
run: |
stack test --stack-yaml ${{matrix.yaml}} --system-ghc
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.stack-work/
*~
.dir-locals.el
dist-newstyle
dist-newstyle
*.hie
dev/
69 changes: 69 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################

# This file contains a template configuration file, which is typically
# placed as .hlint.yaml in the root of your project


# Warnings currently triggered by your code
- ignore: {name: "Redundant bracket"}
- ignore: {name: "Redundant do"}
- ignore: {name: "Use if"}
- ignore: {name: "Move brackets to avoid $"}
- ignore: {name: "Use <$>"}
- ignore: {name: "Reduce duplication"}
- ignore: {name: "Redundant multi-way if"}

# Specify additional command line arguments
#
# - arguments: [--color, -XQuasiQuotes]


# Control which extensions/flags/modules/functions can be used
#
# - extensions:
# - default: false # all extension are banned by default
# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used
# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module
#
# - flags:
# - {name: -w, within: []} # -w is allowed nowhere
#
# - modules:
# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
#
# - functions:
# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules


# Add custom hints for this project
#
# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}


# Turn on hints that are off by default
#
# Ban "module X(module X) where", to require a real export list
# - warn: {name: Use explicit module export list}
#
# Replace a $ b $ c with a . b $ c
# - group: {name: dollar, enabled: true}
#
# Generalise map to fmap, ++ to <>
# - group: {name: generalise, enabled: true}


# Ignore some builtin hints
# - ignore: {name: Use let}
# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules


# Define some custom infix operators
# - fixity: infixr 3 ~^#^~


# To generate a suitable file for HLint do:
# $ hlint --default > .hlint.yaml
72 changes: 72 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Change log

## Unreleased

## 0.7.0.0

Represents optional fields (according to the Haskell model) as required fields
with type `A | null` rather than optional fields.

## 0.6.2.0

* Expose generic type constructors `T4` through `T10`. (We only exposed `T`, `T1`, `T2`, and `T3` before.)

## 0.6.1.0

* Fix a bug which caused enum formatting mode to turn off when multiple declarations were provided (#41)
* Fix some mismatch issues where an enum value doesn't match the desired string.

## 0.6.0.0

* New word instances: Word, Word16, Word32, Word64
* New instances from Data.Functor: Compose, Const, Identity, Product

## 0.5.0.0

* [#35](https://github.com/codedownio/aeson-typescript/pull/35)
* Add `Data.Aeson.TypeScript.LegalName` module for checking whether a name is a legal JavaScript name or not.
* The `defaultFormatter` will `error` if the name contains illegal characters.
* Be able to transfer Haddock comments to emitted TypeScript (requires GHC >= 9.2 and `-haddock` flag)
* Add support for @no-emit-typescript in Haddocks for constructors and record fields (requires GHC >= 9.2 and `-haddock` flag)
* Support GHC 9.6.1

## 0.4.2.0

* Fix TypeScript (A.KeyMap a) instance

## 0.4.1.0

* Add TypeScript Int16
* Add TypeScript (A.KeyMap a) instance for aeson 2

## 0.4.0.0

* Add new built-in instances (Word8, Int32, Int64, Map, HashSet)
* Export TSField in the Internal module
* Avoid producing redundant constraints (for fewer warnings when using -Wredundant-constraints)
* Encode maps as mapped types (allows you to have unions as keys)
* Support mapping open type families to lookup types (+ progress on handling promoted types)
* Improve propagation of T variables in declarations
* Add support for "key types", in case you have custom implementations of FromJSONKey/ToJSONKey
* Add ability to recursively derive missing instances (fragile)

## 0.3.0.1

* Support GHC 9.0.1

## 0.3.0.0

* Update th-abstraction dependency to < 0.5 to support working with newer Stack LTS.
* Major refactors to improve TH quality.
* Tracking of parent types to allow recursive deriving
* The `getParentTypes` function was added to the main typeclass.
* The new `Data.Aeson.TypeScript.Recursive` module for working with recursive definitions.
* New support for mapping Haskell closed type families to TypeScript lookup types.

## 0.2.0.0

* New formatting option `interfaceNameModifier`.

## 0.1.0.0

* Initial release.
8 changes: 0 additions & 8 deletions ChangeLog.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright Tom McLaughlin (c) 2017
Copyright Tom McLaughlin (c) 2022

All rights reserved.

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Welcome to `aeson-typescript` [![Hackage](https://img.shields.io/hackage/v/aeson-typescript.svg)](https://hackage.haskell.org/package/aeson-typescript) [![Build Status](https://travis-ci.org/codedownio/aeson-typescript.svg)](https://travis-ci.org/codedownio/aeson-typescript)
# Welcome to `aeson-typescript` [![Hackage](https://img.shields.io/hackage/v/aeson-typescript.svg)](https://hackage.haskell.org/package/aeson-typescript) ![aeson-typescript](https://github.com/codedownio/aeson-typescript/workflows/aeson-typescript/badge.svg)

This library provides a way to generate TypeScript `.d.ts` files that match your existing Aeson `ToJSON` instances.
If you already use Aeson's Template Haskell support to derive your instances, then deriving TypeScript is as simple as
Expand All @@ -16,6 +16,7 @@ data D a = Nullary
| Product String Char a
| Record { testOne :: Double
, testTwo :: Bool
-- | This docstring will go into the generated TypeScript!
, testThree :: D a
} deriving Eq
```
Expand All @@ -29,7 +30,7 @@ $(deriveTypeScript (defaultOptions {fieldLabelModifier = drop 4, constructorTagM
Now we can use the newly created instances.

```haskell
>>> putStrLn $ formatTSDeclarations $ getTypeScriptDeclaration (Proxy :: Proxy D)
>>> putStrLn $ formatTSDeclarations $ getTypeScriptDeclarations (Proxy :: Proxy (D T))

type D<T> = "nullary" | IUnary<T> | IProduct<T> | IRecord<T>;

Expand All @@ -41,6 +42,7 @@ interface IRecord<T> {
tag: "record";
One: number;
Two: boolean;
// This docstring will go into the generated TypeScript!
Three: D<T>;
}
```
Expand Down Expand Up @@ -112,6 +114,6 @@ Now you can generate the types by running `stack runhaskell tsdef/Main.hs > type

# See also

If you want a much more opinionated web framework for generating APIs, check out [servant](http://haskell-servant.readthedocs.io/en/stable/). (Although it doesn't seem to support TypeScript client generation at the moment.)
If you want a more opinionated web framework for generating APIs, check out [servant](http://haskell-servant.readthedocs.io/en/stable/). If you use Servant, you may enjoy [servant-typescript](https://github.com/codedownio/servant-typescript), which is based on `aeson-typescript`! This companion package also has the advantage of magically collecting all the types used in your API, so you don't have to list them out manually.

For another very powerful framework that can generate TypeScript client code based on an API specification, see [Swagger/OpenAPI](https://github.com/swagger-api/swagger-codegen).
Loading
Loading