Skip to content

Commit 2384982

Browse files
Fixed bug with class inheritance
1 parent f3895de commit 2384982

19 files changed

+179
-431
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
# v1.0.x (2017-07-31)
1+
# v1.0.3 (2017-09-10)
2+
3+
## Bug Fixes
4+
5+
* Fixed issue with class properties when extending another class, closes [#22](https://github.com/dhlab-basel/json2typescript/issues/22)
6+
7+
## Features
8+
9+
* Allow `json2typescript` to work with `noImplicitAny`, closes [#23](https://github.com/dhlab-basel/json2typescript/issues/23)
10+
11+
# v1.0.2 (2017-07-31)
212

313
## Bug Fixes
414

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,15 @@ export class User {
519519
520520
---
521521
522-
# Authors
522+
# Contributors
523523
524-
This NPM package was originally created by the **Digital Humanities Lab** of **University of Basel** in 2016.
525-
We make use of it in our new website of http://www.salsah.org.
524+
This NPM package was originally created by **Andreas Aeschlimann**, scientific researcher of the **Digital Humanities Lab** (DHlab) of **University of Basel** in 2016.
526525
527-
More information on http://dhlab.unibas.ch
526+
The Digital Humanities Lab makes use of `json2typescript` in several Angular web applications, for example in the new website of http://www.salsah.org. You may find more information about us on http://dhlab.unibas.ch
527+
528+
## Special thanks
529+
530+
Thanks for the input and pull requests by:
531+
- @gempain for fixing several issues and adding karma tests.
532+
- @mrwogu for fixing the `noImplicitAny` issue.
533+
- @bblommers for the support of multiple decorators.

index.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json2typescript",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "Provides TypeScript methods to map a JSON object to a JavaScript object on runtime",
55
"keywords": [
66
"convert",
@@ -28,8 +28,7 @@
2828
"typescript": {
2929
"definition": "dist/index.d.ts"
3030
},
31-
"dependencies": {
32-
},
31+
"dependencies": {},
3332
"devDependencies": {
3433
"@types/jasmine": "^2.5.52",
3534
"jasmine": "2.6.0",

src/json2typescript/json-convert-decorators.js

Lines changed: 4 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/json2typescript/json-convert-decorators.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/json2typescript/json-convert-decorators.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export function JsonProperty(jsonPropertyName?: string, conversionOption?: any,
4444
target[Settings.MAPPING_PROPERTY] = [];
4545
}
4646

47+
const className = target.constructor.name;
48+
4749
if (typeof(jsonPropertyName) === "undefined") {
4850
jsonPropertyName = classPropertyName;
4951
}
@@ -52,12 +54,6 @@ export function JsonProperty(jsonPropertyName?: string, conversionOption?: any,
5254
isOptional = false;
5355
}
5456

55-
if (classPropertyName === "version") {
56-
//console.error(target.hasOwnProperty(classPropertyName));
57-
//target[classPropertyName] = "null";
58-
//console.error(target[classPropertyName]);
59-
}
60-
6157
let jsonPropertyMappingOptions = new MappingOptions();
6258
jsonPropertyMappingOptions.classPropertyName = classPropertyName;
6359
jsonPropertyMappingOptions.jsonPropertyName = jsonPropertyName;
@@ -71,7 +67,7 @@ export function JsonProperty(jsonPropertyName?: string, conversionOption?: any,
7167
}
7268

7369
// Save the mapping info
74-
target[Settings.MAPPING_PROPERTY][classPropertyName] = jsonPropertyMappingOptions;
70+
target[Settings.MAPPING_PROPERTY][className + "." + classPropertyName] = jsonPropertyMappingOptions;
7571

7672
}
7773

src/json2typescript/json-convert-enums.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use strict";
2-
exports.__esModule = true;
2+
Object.defineProperty(exports, "__esModule", { value: true });
33
/**
44
* Enum for the operation mode of a JsonConvert instance.
55
*

src/json2typescript/json-convert-options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use strict";
2-
exports.__esModule = true;
2+
Object.defineProperty(exports, "__esModule", { value: true });
33
/**
44
* Internal constants.
55
*/

src/json2typescript/json-convert-options.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)