jsii-diff 1.117.0 → 1.118.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BREAKING_CHANGES.md +27 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +2 -2
- package/package.json +5 -5
package/BREAKING_CHANGES.md
CHANGED
|
@@ -49,7 +49,9 @@ const d = new Dog({ name: 'Fido' });
|
|
|
49
49
|
console.log(d.name.toLowerCase());
|
|
50
50
|
|
|
51
51
|
// Not valid anymore after the type of `d.name` has changed into `string | undefined`.
|
|
52
|
-
// 'd.name' can be undefined, and
|
|
52
|
+
// 'd.name' can be undefined, and calling `undefined.toLowerCase()` would throw an error.
|
|
53
|
+
// The user will have to account for that with an `if`, which means changing their code,
|
|
54
|
+
// which means a breaking change.
|
|
53
55
|
```
|
|
54
56
|
|
|
55
57
|
### Optional properties: how to solve
|
|
@@ -83,6 +85,30 @@ This doesn't break any existing users: all their Dogs will have names, so they w
|
|
|
83
85
|
|
|
84
86
|
For new users that fail to give their Dog a name, presumably they will be aware that their Dog doesn't have a name, so they can avoid trying to read it. If you want to give them a way to avoid the exception, add a `public get hasName(): boolean` field so they can test for the existence of the name before accessing it.
|
|
85
87
|
|
|
88
|
+
### Optional properties: what about structs?
|
|
89
|
+
|
|
90
|
+
In the above example, we said that `DogOptions#name` was an *input* and `Dog#name` was an *output*. Does that mean it's
|
|
91
|
+
always okay to change struct (data interface) fields to optional?
|
|
92
|
+
|
|
93
|
+
Not necessarily! It depends on how the struct is used. If the struct is used as the return value of a method or the
|
|
94
|
+
type of a class proeprty somewhere, it is in *output position* and all of its fields are as well. So if you have the following
|
|
95
|
+
class:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
class Dog {
|
|
99
|
+
public readonly options: DogOptions; // DogOptions is an OUTPUT
|
|
100
|
+
|
|
101
|
+
constructor(options: DogOptions) { // DogOptions is an INPUT
|
|
102
|
+
this.options = options;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Then `DogOptions` is now both in input as well as output position, and you're not allowed to make anything optional anymore!
|
|
108
|
+
|
|
109
|
+
(That's why using the same struct name to represent both input and output data is best avoided, because it limits
|
|
110
|
+
evolvability).
|
|
111
|
+
|
|
86
112
|
## Changing types to superclass/subclass
|
|
87
113
|
|
|
88
114
|
When changing types involved in an operation, you run into a similar issue as with changing the optionality of a property:
|
package/lib/version.d.ts
CHANGED
package/lib/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Generated at 2025-10-
|
|
2
|
+
// Generated at 2025-10-29T09:49:48Z by generate.sh
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.VERSION = void 0;
|
|
5
5
|
/** The qualified version number for this JSII compiler. */
|
|
6
|
-
exports.VERSION = '1.
|
|
6
|
+
exports.VERSION = '1.118.0 (build 02eec31)';
|
|
7
7
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsii-diff",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.118.0",
|
|
4
4
|
"description": "Assembly comparison for jsii",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"package": "package-js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@jsii/check-node": "1.
|
|
37
|
-
"@jsii/spec": "1.
|
|
36
|
+
"@jsii/check-node": "1.118.0",
|
|
37
|
+
"@jsii/spec": "1.118.0",
|
|
38
38
|
"fs-extra": "^10.1.0",
|
|
39
|
-
"jsii-reflect": "^1.
|
|
39
|
+
"jsii-reflect": "^1.118.0",
|
|
40
40
|
"log4js": "^6.9.1",
|
|
41
41
|
"yargs": "^17.7.2"
|
|
42
42
|
},
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
"@types/yargs": "^17.0.33",
|
|
47
47
|
"jest-expect-message": "^1.1.3",
|
|
48
48
|
"jsii": "^5.9.10",
|
|
49
|
-
"jsii-build-tools": "^1.
|
|
49
|
+
"jsii-build-tools": "^1.118.0"
|
|
50
50
|
}
|
|
51
51
|
}
|