sveld 0.16.1 → 0.17.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/CHANGELOG.md CHANGED
@@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
  - add isAccessor field to API
11
11
  - update Markdown writer to generate a separate table for accessors -->
12
12
 
13
+ ## [0.17.0](https://github.com/carbon-design-system/sveld/releases/tag/v0.17.0) - 2022-05-21
14
+
15
+ - remove `@required` tag; directly infer if a prop is required
16
+
13
17
  ## [0.16.1](https://github.com/carbon-design-system/sveld/releases/tag/v0.16.1) - 2022-05-20
14
18
 
15
19
  - `additional_tags` can be `undefined`
package/README.md CHANGED
@@ -115,7 +115,6 @@ export default class Button extends SvelteComponentTyped<
115
115
  - [API Reference](#api-reference)
116
116
  - [@type](#type)
117
117
  - [@typedef](#typedef)
118
- - [@required](#required)
119
118
  - [@slot](#slot)
120
119
  - [@event](#event)
121
120
  - [@restProps](#restprops)
@@ -351,36 +350,6 @@ export let author = {};
351
350
  export let authors = [];
352
351
  ```
353
352
 
354
- ### `@required`
355
-
356
- By default, all props are typed as optional.
357
-
358
- Use the `@required` tag to denote a component prop as required.
359
-
360
- Example:
361
-
362
- ```js
363
- /**
364
- * This prop is required
365
- * @required
366
- */
367
- export let isRequired = true;
368
- ```
369
-
370
- TypeScript output:
371
-
372
- ```ts
373
- export interface ComponentProps {
374
- /**
375
- * This prop is required
376
- * @default true
377
- */
378
- isRequired: boolean;
379
- }
380
- ```
381
-
382
- Because `@required` is non-standard JSDoc tag, it is omitted from the prop comment in the TypeScript definitions.
383
-
384
353
  ### `@slot`
385
354
 
386
355
  Use the `@slot` tag for typing component slots. Note that `@slot` is a non-standard JSDoc tag.
@@ -349,7 +349,7 @@ var ComponentParser = /** @class */ (function () {
349
349
  var description_1 = undefined;
350
350
  var isFunction = false;
351
351
  var isFunctionDeclaration = false;
352
- var isRequired_1 = false;
352
+ var isRequired = kind === "let" && init == null;
353
353
  if (init != null) {
354
354
  if (init.type === "ObjectExpression" ||
355
355
  init.type === "BinaryExpression" ||
@@ -396,10 +396,7 @@ var ComponentParser = /** @class */ (function () {
396
396
  description_1 = "";
397
397
  }
398
398
  additional_tags.forEach(function (tag) {
399
- isRequired_1 = tag.tag === "required";
400
- if (!isRequired_1) {
401
- description_1 += "".concat(description_1 ? "\n" : "", "@").concat(tag.tag, " ").concat(tag.name).concat(tag.description ? " ".concat(tag.description) : "");
402
- }
399
+ description_1 += "".concat(description_1 ? "\n" : "", "@").concat(tag.tag, " ").concat(tag.name).concat(tag.description ? " ".concat(tag.description) : "");
403
400
  });
404
401
  }
405
402
  if (!description_1 && _this.typedefs.has(type)) {
@@ -413,7 +410,7 @@ var ComponentParser = /** @class */ (function () {
413
410
  value: value,
414
411
  isFunction: isFunction,
415
412
  isFunctionDeclaration: isFunctionDeclaration,
416
- isRequired: isRequired_1,
413
+ isRequired: isRequired,
417
414
  constant: kind === "const",
418
415
  reactive: _this.reactive_vars.has(prop_name)
419
416
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveld",
3
- "version": "0.16.1",
3
+ "version": "0.17.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Generate TypeScript definitions for your Svelte components.",
6
6
  "main": "./lib/index.js",