@runtime-type-inspector/transpiler 3.2.7 → 3.3.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/index.cjs +17 -12
- package/index.mjs +19 -14
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -3423,20 +3423,25 @@
|
|
|
3423
3423
|
if (node.type === 'BlockStatement') {
|
|
3424
3424
|
node = this.parent;
|
|
3425
3425
|
}
|
|
3426
|
-
if (node.type === 'ClassMethod'
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
this.warn("getJSDoc> setters require exactly one argument");
|
|
3430
|
-
}
|
|
3431
|
-
var setterType = parseJSDocSetter(comment, this.expandType);
|
|
3432
|
-
if (!setterType) {
|
|
3426
|
+
if (node.type === 'ClassMethod') {
|
|
3427
|
+
if (node.kind === 'get') {
|
|
3428
|
+
// JSDoc on a getter is just some documentation.
|
|
3433
3429
|
return;
|
|
3430
|
+
} else if (node.kind === 'set') {
|
|
3431
|
+
if (node.params.length !== 1) {
|
|
3432
|
+
this.warn("getJSDoc> setters require exactly one argument");
|
|
3433
|
+
}
|
|
3434
|
+
var setterType = parseJSDocSetter(comment, this.expandType);
|
|
3435
|
+
if (!setterType) {
|
|
3436
|
+
return;
|
|
3437
|
+
}
|
|
3438
|
+
var paramName = this.getNameOfParam(node.params[0]);
|
|
3439
|
+
var _params = _defineProperty({}, paramName, setterType);
|
|
3440
|
+
return {
|
|
3441
|
+
templates: undefined,
|
|
3442
|
+
params: _params
|
|
3443
|
+
};
|
|
3434
3444
|
}
|
|
3435
|
-
var _params = _defineProperty({}, paramName, setterType);
|
|
3436
|
-
return {
|
|
3437
|
-
templates: undefined,
|
|
3438
|
-
params: _params
|
|
3439
|
-
};
|
|
3440
3445
|
}
|
|
3441
3446
|
var templates = parseJSDocTemplates(comment);
|
|
3442
3447
|
var params = parseJSDoc(comment, this.expandType);
|
package/index.mjs
CHANGED
|
@@ -3108,22 +3108,27 @@ class Asserter extends Stringifier {
|
|
|
3108
3108
|
if (node.type === 'BlockStatement') {
|
|
3109
3109
|
node = this.parent;
|
|
3110
3110
|
}
|
|
3111
|
-
if (node.type === 'ClassMethod'
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
this.warn("getJSDoc> setters require exactly one argument");
|
|
3115
|
-
}
|
|
3116
|
-
const setterType = parseJSDocSetter(comment, this.expandType);
|
|
3117
|
-
if (!setterType) {
|
|
3111
|
+
if (node.type === 'ClassMethod') {
|
|
3112
|
+
if (node.kind === 'get') {
|
|
3113
|
+
// JSDoc on a getter is just some documentation.
|
|
3118
3114
|
return;
|
|
3115
|
+
} else if (node.kind === 'set') {
|
|
3116
|
+
if (node.params.length !== 1) {
|
|
3117
|
+
this.warn("getJSDoc> setters require exactly one argument");
|
|
3118
|
+
}
|
|
3119
|
+
const setterType = parseJSDocSetter(comment, this.expandType);
|
|
3120
|
+
if (!setterType) {
|
|
3121
|
+
return;
|
|
3122
|
+
}
|
|
3123
|
+
const paramName = this.getNameOfParam(node.params[0]);
|
|
3124
|
+
const _params = {
|
|
3125
|
+
[paramName]: setterType
|
|
3126
|
+
};
|
|
3127
|
+
return {
|
|
3128
|
+
templates: undefined,
|
|
3129
|
+
params: _params
|
|
3130
|
+
};
|
|
3119
3131
|
}
|
|
3120
|
-
const _params = {
|
|
3121
|
-
[paramName]: setterType
|
|
3122
|
-
};
|
|
3123
|
-
return {
|
|
3124
|
-
templates: undefined,
|
|
3125
|
-
params: _params
|
|
3126
|
-
};
|
|
3127
3132
|
}
|
|
3128
3133
|
const templates = parseJSDocTemplates(comment);
|
|
3129
3134
|
const params = parseJSDoc(comment, this.expandType);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bin": "bin.js",
|
|
3
3
|
"name": "@runtime-type-inspector/transpiler",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.0",
|
|
5
5
|
"description": "Validating JSDoc types at runtime for high-quality types - Trust is good, control is better.",
|
|
6
6
|
"main": "index.cjs",
|
|
7
7
|
"module": "index.mjs",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"homepage": "https://github.com/kungfooman/RuntimeTypeInspector.js#readme",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@babel/parser": "^7.23.0",
|
|
22
|
-
"@runtime-type-inspector/runtime": "^3.
|
|
22
|
+
"@runtime-type-inspector/runtime": "^3.3.0",
|
|
23
23
|
"typescript": "^5.1.6"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|