Skip to content

Commit

Permalink
Merge branch 'master' of github.com:moshegottlieb/ts-json-object
Browse files Browse the repository at this point in the history
  • Loading branch information
moshegottlieb committed Jun 16, 2020
2 parents 6c84405 + c3b71c8 commit 11c58ef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,14 @@ Let me know.

## Notes

* **Known issues**
* It looks like there's an [issue](../../issues/2) with **react** apps built with something like `npx create-react-app my-app --typescript`

* **Important**
Properties that were not annonated will _not_ be loaded.
* The annonation code runs when your module is loaded, and the runtime checks run when your object constructor is running
* Doesn't work on interfaces because typescript decorators don't work on interfaces, classes are required, and must subclass `JSONObject`.
* Properties that were not annonated will _not_ be loaded.
* If you plan to use `--strictPropertyInitialization` or set it in your `tsconfig.json` file, make sure you add the ts linter annonations: `// @ts-ignore` to your properties, as typescript does not know how your properties are initialized - otherwise you'd see the compilation error:
`Property 'propertyNameHere' has no initializer and is not definitely assigned in the constructor. TS2564`
Typescript doesn't have built in support for this.
This is similar to **swift**'s built in codable support - which doesn't exist in typescript, unfortunately.
* The annonation code runs when your module is loaded, and the runtime checks run when your object constructor is running
* Doesn't work on interfaces because typescript decorators don't work on interfaces, classes are required, and must subclass `JSONObject`.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-minimal

0 comments on commit 11c58ef

Please sign in to comment.